Skip to content

Commit 9cc6386

Browse files
committed
fixed flake8 errors identified in previous commit
1 parent 4d14c6d commit 9cc6386

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

examples/example2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def convert_rruff():
100100
'name': name,
101101
'formula': formula
102102
}
103-
meta = requests.get(
104-
'https://opsin.ch.cam.ac.uk/opsin/' +
105-
name).json() # get metadata from OPSIN
103+
meta = requests.get('https://opsin.ch.cam.ac.uk/opsin/' + name).json() # get metadata from OPSIN
106104
ignore = ['status', 'message', 'cml', 'inchi']
107105
for key, value in meta.items():
108106
if key not in ignore:

scidatalib/io/jcamp.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def _read_parse_dataset_duplicate_characters(line: str) -> str:
224224
# NOTE: subtract one since we will already have one character from
225225
# the original one we are duplicating from.
226226
nduplicates = DUP_digits[char] - 1
227-
new_line += line[i-1] * nduplicates
227+
new_line += line[i - 1] * nduplicates
228228
else:
229229
new_line += char
230230
return "".join(new_line)
@@ -451,16 +451,16 @@ def _read_post_process_data_xy(
451451
if jcamp_dict.get(_DATA_XY_TYPE_KEY) == _DATA_FORMAT_XYYY:
452452
xstart.append(jcamp_dict['lastx'])
453453
x = np.array([])
454-
for n in range(len(xnum)-1):
455-
dx = (xstart[n+1] - xstart[n]) / xnum[n]
456-
x = np.append(x, xstart[n]+(dx*np.arange(xnum[n])))
454+
for n in range(len(xnum) - 1):
455+
dx = (xstart[n + 1] - xstart[n]) / xnum[n]
456+
x = np.append(x, xstart[n] + (dx * np.arange(xnum[n])))
457457

458458
if xnum[len(xnum) - 1] > 1:
459459
numerator = (jcamp_dict['lastx'] - xstart[len(xnum)-1])
460-
denominator = (xnum[len(xnum)-1] - 1.0)
460+
denominator = (xnum[len(xnum) - 1] - 1.0)
461461
dx = numerator / denominator
462462

463-
xnext = xstart[len(xnum)-1]+(dx*np.arange(xnum[len(xnum)-1]))
463+
xnext = xstart[len(xnum) - 1] + (dx * np.arange(xnum[len(xnum) - 1]))
464464
x = np.append(x, xnext)
465465
else:
466466
x = np.append(x, jcamp_dict['lastx'])
@@ -660,7 +660,7 @@ def _read_get_aspects_section(jcamp_dict: dict) -> dict:
660660
"@id": "measurement/1",
661661
"@type": "sdo:measurement",
662662
"techniqueType": "cao:spectroscopy",
663-
"instrument": f'{jcamp_dict.get("spectrometer/data system")}',
663+
"instrument": f'{jcamp_dict.get("spectrometer/data system")}',
664664
}
665665

666666
settings = []

scidatalib/io/rruff.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ def _read_translate_rruff_to_scidata(rruff_dict: dict) -> dict:
197197

198198
if "url" in rruff_dict:
199199
sources.append({
200-
"@id": f"source/{len(sources) + 1}",
201-
"@type": "dc:source",
202-
"citation": "RRUFF project database entry",
203-
"url": f'https://{rruff_dict.get("url")}',
204-
})
200+
"@id": f"source/{len(sources) + 1}",
201+
"@type": "dc:source",
202+
"citation": "RRUFF project database entry",
203+
"url": f'https://{rruff_dict.get("url")}',
204+
})
205205
scidata.sources(sources)
206206

207207
# Discipline and sub-discipline

scidatalib/scidata.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(self, uid: str):
6666
},
6767
"sources": [], # def sources
6868
"rights": [] # def rights
69-
}
69+
}
7070
}
7171
self.contexts = []
7272
self.nspaces = {}
@@ -457,19 +457,19 @@ def ids(self, ids: [str, list]) -> list:
457457
for idee in ids:
458458
if ':' in idee:
459459
if idee.split(':')[0] not in self.nspaces.keys():
460-
print('Note: Namespace <'
461-
+ idee.split(':')[0]
462-
+ "> not set. A crosswalk "
463-
"url prefix is likely not "
464-
"matched with it's linked namespace")
460+
print('Note: Namespace <' +
461+
idee.split(':')[0] +
462+
"> not set. A crosswalk "
463+
"url prefix is likely not "
464+
"matched with it's linked namespace")
465465
# raise EnvironmentError
466466
curr_ids.append(idee)
467467
elif isinstance(ids, str):
468468
if ':' in ids:
469469
if ids.split(':')[0] not in self.nspaces.keys():
470-
print('Note: Namespace <' + ids.split(':')[0]
471-
+ "> not set. A crosswalk url prefix is "
472-
"likely not matched with it's linked namespace")
470+
print('Note: Namespace <' + ids.split(':')[0] +
471+
"> not set. A crosswalk url prefix is "
472+
"likely not matched with it's linked namespace")
473473
# raise EnvironmentError
474474
curr_ids.append(ids)
475475
self.meta['@graph']['ids'] = sorted(set(curr_ids))

tests/test_scidata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ def test_datagroup_with_datapoints(sd):
454454
"datapoint/3/",
455455
"datapoint/4/"
456456
]
457-
}]
457+
}
458+
]
458459
assert sd.datagroup([datagrp1, datagrp2]) == out
459460

460461

0 commit comments

Comments
 (0)