Skip to content
This repository was archived by the owner on Dec 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

test_patterns = [
'tests/test_*.py'
]

[[analyzers]]
name = 'python'
enabled = true
runtime_version = '2.x.x'
7 changes: 3 additions & 4 deletions eutils/_internal/xmlfacades/entrezgene.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def type(self):

if __name__ == "__main__":
import os
import lxml.etree
from .xmlfacades.entrezgeneset import EntrezgeneSet
data_dir = os.path.join(os.path.dirname(__file__), '..', '..', 'tests', 'data')
data_file = os.path.join(data_dir, 'entrezgeneset.xml.gz')
Expand All @@ -85,13 +84,13 @@ def type(self):

# <LICENSE>
# Copyright 2015 eutils Committers
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
Expand Down
20 changes: 10 additions & 10 deletions eutils/_internal/xmlfacades/gbseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def gene(self):
if not gene:
return None
return gene.qualifiers['gene']

@property
def genes(self):
raise RuntimeError("The genes property is obsolete; use gene instead")
Expand All @@ -62,7 +62,7 @@ def gi(self):
d = {t: l.rstrip('|').split('|')
for t, _, l in [si.partition('|') for si in seqids]}
gis = d['gi']
assert 1 == len(gis), "expected exactly one gi in XML"
assert len(gis) == 1, "expected exactly one gi in XML"
return int(gis[0])

@property
Expand Down Expand Up @@ -118,7 +118,7 @@ class GBFeatureTable(Base):

GBFeatureTable provides an iterator over all features, and returns
GBFeature instances.

In addition, when selecting features for specific types, the
features are instantiated as their type-specific subclasses. This
is the preferred selection mechanism for these feature types.
Expand All @@ -129,13 +129,13 @@ class GBFeatureTable(Base):

def __iter__(self):
return (GBFeature(n) for n in self._xml_root.iterfind('GBFeature'))

@property
def cds(self):
key = 'CDS'
nodes = self._get_nodes_with_key(key)
assert len(nodes) <= 1, "Node has {n=n} {key} features! (expected <= 1)".format(n=len(nodes), key=key)
return None if len(nodes) == 0 else GBFeatureCDS(nodes[0])
return None if not nodes else GBFeatureCDS(nodes[0])

@property
def exons(self):
Expand All @@ -148,7 +148,7 @@ def gene(self):
key = 'gene'
nodes = self._get_nodes_with_key(key)
assert len(nodes) <= 1, "Node has {n=n} {key} features! (expected <= 1)".format(n=len(nodes), key=key)
return None if len(nodes) == 0 else GBFeature(nodes[0])
return None if not nodes else GBFeature(nodes[0])

@property
def source(self):
Expand Down Expand Up @@ -192,7 +192,7 @@ def get_qualifiers(self, name):
def get_qualifier(self, name):
nodes = self.get_qualifiers(name)
assert len(nodes) <= 1, "Node has {n=n} {key} features! (expected <= 1 when using get_qualifier)".format(n=len(nodes), key=name)
if len(nodes)==0:
if not nodes:
return None
return self.get_qualifiers(name)[0]

Expand Down Expand Up @@ -237,13 +237,13 @@ def inference(self):

# <LICENSE>
# Copyright 2015 eutils Committers
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
Expand Down
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
from setuptools import setup, find_packages

package_name = "eutils"
short_description = open("doc/short-description.txt").read()
long_description = open("README.rst").read()

with open("doc/short-description.txt") as short_desc:
short_description = short_desc.read()

with open("README.rst") as long_desc:
long_description = long_desc.read()


setup(
author = package_name + " Committers",
Expand Down Expand Up @@ -62,13 +67,13 @@

# <LICENSE>
# Copyright 2016 Source Code Committers
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
13 changes: 6 additions & 7 deletions tests/test_eutils_queryservice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Performs a query using every form of eutils fcgi that this python
"""Performs a query using every form of eutils fcgi that this python
library should support.

"If you liked it, then you shoulda put a test on it." --Beyonce
Expand All @@ -21,7 +21,7 @@


def assert_in_xml(xml, item):
if six.PY3 and type(xml) == six.binary_type:
if six.PY3 and isinstance(xml, six.binary_type):
xml = xml.decode()
assert item in xml

Expand Down Expand Up @@ -77,18 +77,17 @@ def test_esearch(self):

@vcr.use_cassette
def test_elink(self):
'''Testing elink.fcgi by looking up related pmids in pubmed.'''
'''Testing elink.fcgi by looking up related pmids in pubmed.'''
# Expected response should contain the following information:

# * pubmed (all related links)
# * citedin (papers that cited this paper)
# * five (the "five" that pubmed displays as the top related results)
# * reviews (review papers that cite this paper)
# * combined (?)

expected_keys = ['pubmed', 'citedin', 'five', 'reviews', 'combined']
xmlstr = self.qs.elink( { 'dbfrom': 'pubmed', 'id': 1234567, 'cmd': 'neighbor' } )

xmlstr = self.qs.elink({'dbfrom': 'pubmed', 'id': 1234567, 'cmd': 'neighbor'})

resd = parse_related_pmids_result(xmlstr)
assert 'pubmed' in resd.keys()

Expand Down