File pubmed.py
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Pubmed related utilities
Function add_annotations
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_annotations(pubmed):
"""Add nanopub annotations to pubmed doc
Enhance MESH terms etc as full-fledged nanopub annotations for use by the BEL Nanopub editor
"""
- 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 parse_journal_article_record
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_journal_article_record(doc: dict, root) -> dict:
"""Parse Pubmed Journal Article record"""
doc["title"] = next(iter(root.xpath("//ArticleTitle/text()")), "")
- 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 process_pub_date
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process_pub_date(year, mon, day, medline_date):
"""Create pub_date from what Pubmed provides in Journal PubDate entry"""
if medline_date:
year = "0000"
- 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 parse_book_record
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_book_record(doc: dict, root) -> dict:
"""Parse Pubmed Book entry"""
doc["title"] = next(iter(root.xpath("//BookTitle/text()")))
- 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 get_pubtator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_pubtator(pmid):
"""Get Pubtator Bioconcepts from Pubmed Abstract
Re-configure the denotations into an annotation dictionary format
and collapse duplicate terms so that their spans are in a list.
- 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"