Skip to content

Commit

Permalink
Fix issues to improve code quality (#555)
Browse files Browse the repository at this point in the history
- Use list in slots instead of string
   - Add self argument
   - Remove unused module 're'

Also add DeepSource configuration

Signed-off-by: Jai <jai@deepsource.io>
  • Loading branch information
dolftax authored and reece committed Apr 18, 2019
1 parent 5b25b4f commit 3c60c25
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
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/"
]

[[analyzers]]
name = "python"
enabled = true
runtime_version = "3.x.x"
2 changes: 1 addition & 1 deletion hgvs/dataproviders/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def schema_version(self):
pass

@abc.abstractmethod
def get_acs_for_protein_seq(seq):
def get_acs_for_protein_seq(self, seq):
pass

@abc.abstractmethod
Expand Down
1 change: 0 additions & 1 deletion hgvs/dataproviders/seqfetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import logging
import os
import re

import bioutils.seqfetcher

Expand Down
4 changes: 2 additions & 2 deletions hgvs/decorators/lru_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class _HashedSeq(list):
__slots__ = 'hashvalue'
__slots__ = ['hashvalue']

def __init__(self, tup, hash=hash):
self[:] = tup
Expand Down Expand Up @@ -95,7 +95,7 @@ def lru_cache(maxsize=100, typed=False, mode=None, cache=None):
:param mode: cache run mode
None: the default lru cache behaver
LEARN: queries are executed against persistent cache from file "filename";
LEARN: queries are executed against persistent cache from file "filename";
in the event of a miss, the novel query and results would be written to cache, then returned.
RUN: queries are executed against caches; misses result in DataNotLocallyAvailableError
VERIFY: always execute the function; if persistent cache value and returned value are different, raise VerifyFailedError
Expand Down
4 changes: 2 additions & 2 deletions hgvs/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* integers and integer intervals (e.g., NC_012345.6:g.3403243_3403248A>C)
* CDS positions and intervals (e.g., NM_01234.5:c.56+12_56+14delAC)
* CDS stop coordinates (e.g., NM_01234.5:c.*13A>C)
* CDS stop coordinates (e.g., NM_01234.5:c.*13A>C)
Classes:
Expand Down Expand Up @@ -48,7 +48,7 @@ def __repr__(self):
@property
def is_uncertain(self):
"""return True if the position is marked uncertain or undefined"""
return self.uncertain or self.base in None
return self.uncertain or self.base is None

def _set_uncertain(self):
"mark this location as uncertain and return reference to self; this is called during parsing (see hgvs.ometa)"
Expand Down
4 changes: 2 additions & 2 deletions hgvs/normalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ def _get_boundary(self, var):
right = float("inf")

# TODO: #242: implement methods to find tx regions
for i in range(0, len(exon_starts)):
for i, _ in enumerate(exon_starts):
if (var.posedit.pos.start.base - 1 >= exon_starts[i]
and var.posedit.pos.start.base - 1 < exon_ends[i]):
break

for j in range(0, len(exon_starts)):
for j, _ in enumerate(exon_starts):
if (var.posedit.pos.end.base - 1 >= exon_starts[j] and var.posedit.pos.end.base - 1 < exon_ends[j]):
break

Expand Down

0 comments on commit 3c60c25

Please sign in to comment.