File train_neural_net.py
has 549 lines of code (exceeds 250 allowed). Consider refactoring. Open
from glob import glob
import json
import logging
import os
import random
Function train_model
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def train_model(self, filename, queryset=Thesis.objects.all()):
# Don't bother with theses when we know we can't get text from them.
queryset = queryset.filter(unextractable=False)
print('About to extract all text')
for thesis in queryset:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function extract_degree
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_degree(self, metadata, item_sets):
if item_sets:
degree = self.extract_degree_from_sets(item_sets)
if degree:
return degree
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function inner_train_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def inner_train_model(self, window, size, iterator, filename,
Function get_network_files
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_network_files(self, args, start_date=None, end_date=None):
print('Network files!!!!!!')
items = self.get_record_list(DSPACE_OAI_URI, start_date, end_date)
parsed_items = self.parse_record_list(items)
total_items_processed = 0
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return
Function extract_contributors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_contributors(self, metadata):
# Includes advisor and department.
contributors = metadata.findall('.//dc:contributor', METS_NAMESPACE)
advisors = []
departments = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function extract_date
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_date(self, metadata):
# There will be several (representing copyright, accessioning, etc.)
# The copyright date will be a four-digit year. Find the earliest
# year (there may be a substantial difference between copyright year
# and archival processing years).
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"