Skip to content

Commit ea8c5e5

Browse files
authored
Merge pull request #45 from kipoi/hotfix_string_format
hotfix string formatting
2 parents be07ec4 + 5d3226f commit ea8c5e5

2 files changed

Lines changed: 37 additions & 12 deletions

File tree

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ variables:
1010
name: create env
1111
command: |
1212
conda create -n kipoi-dev python=3.6
13+
create_env_py35: &create_env_py35
14+
run:
15+
name: create env
16+
command: |
17+
conda create -n kipoi-dev python=3.5
1318
install_git_lfs: &install_git_lfs
1419
run:
1520
name: Install git-lfs
@@ -105,6 +110,23 @@ jobs:
105110
- *store_test_results
106111
- *store_test_artifacts
107112

113+
test-py35:
114+
docker:
115+
- image: continuumio/miniconda3:4.5.12
116+
working_directory: ~/repo
117+
steps:
118+
- checkout
119+
- *update_conda
120+
- *create_env_py35
121+
- *update_pytorch
122+
- *install_conda_deps
123+
- *install_kipoi
124+
- *install_kipoiseq
125+
- *kipoi_ls
126+
- *run_tests
127+
- *run_coveralls
128+
- *store_test_results
129+
- *store_test_artifacts
108130

109131

110132
build-deploy-docs:
@@ -145,6 +167,7 @@ workflows:
145167
test:
146168
jobs:
147169
- test-py36
170+
- test-py35
148171
- build-deploy-docs:
149172
requires:
150173
- test-py36

kipoiseq/dataclasses.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def __init__(self,
1818
ref: str,
1919
alt: str,
2020
id: str = '',
21-
qual: float=0,
22-
filter: str='PASS',
23-
info: dict=None,
21+
qual: float = 0,
22+
filter: str = 'PASS',
23+
info: dict = None,
2424
source=None):
2525
"""Variant container.
2626
@@ -109,7 +109,7 @@ def __hash__(self):
109109
return hash((self.chrom, self.pos, self.ref, self.alt))
110110

111111
def __str__(self):
112-
return f"{self.chrom}:{self.pos}:{self.ref}>{self.alt}"
112+
return "{}:{}:{}>{}".format(self.chrom, self.pos, self.ref, self.alt)
113113

114114
@classmethod
115115
def from_str(cls, s):
@@ -118,7 +118,8 @@ def from_str(cls, s):
118118
return cls(chrom=chrom, pos=int(pos), ref=ref, alt=alt)
119119

120120
def __repr__(self):
121-
return f"Variant(chrom='{self.chrom}', pos={self.pos}, ref='{self.ref}', alt='{self.alt}', id='{self.id}',...)"
121+
return ("Variant(chrom='{}', pos={}, ref='{}', alt='{}', id='{}',...)"
122+
.format(self.chrom, self.pos, self.ref, self.alt, self.id))
122123

123124

124125
class Interval:
@@ -141,10 +142,10 @@ def __init__(self,
141142
chrom: str,
142143
start: int, # 0-based
143144
end: int, # 0-based
144-
name: str='',
145-
score: float=0,
146-
strand: str='.',
147-
attrs: dict=None):
145+
name: str = '',
146+
score: float = 0,
147+
strand: str = '.',
148+
attrs: dict = None):
148149
self._chrom = chrom
149150
self._start = start
150151
self._end = end
@@ -218,7 +219,7 @@ def center(self, use_strand=True):
218219
center = (self.end + self.start) // 2
219220
return center + add_offset * delta
220221

221-
def shift(self, x: int, use_strand: bool=True):
222+
def shift(self, x: int, use_strand: bool = True):
222223
"""Shift the interval by x.
223224
224225
Args:
@@ -257,10 +258,11 @@ def __hash__(self):
257258
return hash((self.chrom, self.start, self.end, self.strand))
258259

259260
def __str__(self):
260-
return (f"{self.chrom}:{self.start}-{self.end}:{self.strand}")
261+
return ("{}:{}-{}:{}".format(self.chrom, self.start, self.end, self.strand))
261262

262263
def __repr__(self):
263-
return (f"Interval(chrom='{self.chrom}', start={self.start}, end={self.end}, name='{self.name}', strand='{self.strand}', ...)")
264+
return ("Interval(chrom='{}', start={}, end={}, name='{}', strand='{}', ...)"
265+
.format(self.chrom, self.start, self.end, self.name, self.strand))
264266

265267
@classmethod
266268
def from_str(cls, s):

0 commit comments

Comments
 (0)