Skip to content

Commit 8c41ea6

Browse files
authored
Merge pull request #25 from CBroz1/main
blackify
2 parents b020ef6 + a5a5e3b commit 8c41ea6

File tree

5 files changed

+41
-32
lines changed

5 files changed

+41
-32
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
44

5+
## [0.1.1] - 2022-05-10
6+
### Added
7+
+ Adopted black formatting into code base
8+
59
## [0.1.0b1] - 2022-01-28
610
### Added
711
+ Added functions to generate dictionaries for NWB export.

element_lab/export/nwb.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def lab_to_nwb_dict(lab_key):
99
"""
1010
lab_info = (lab.Lab & lab_key).fetch1()
1111
return dict(
12-
institution=lab_info.get('institution'),
13-
lab=lab_info.get('lab_name'),
12+
institution=lab_info.get("institution"),
13+
lab=lab_info.get("lab_name"),
1414
)
1515

1616

@@ -23,11 +23,13 @@ def project_to_nwb_dict(project_key):
2323
"""
2424
project_info = (lab.Project & project_key).fetch1()
2525
return dict(
26-
experiment_description=project_info.get('project_description'),
27-
keywords=(lab.ProjectKeywords() & project_key
28-
).fetch('keyword').tolist() or None,
29-
related_publications=(lab.ProjectPublication() & project_key
30-
).fetch('publication').tolist() or None
26+
experiment_description=project_info.get("project_description"),
27+
keywords=(lab.ProjectKeywords() & project_key).fetch("keyword").tolist()
28+
or None,
29+
related_publications=(lab.ProjectPublication() & project_key)
30+
.fetch("publication")
31+
.tolist()
32+
or None,
3133
)
3234

3335

@@ -39,8 +41,8 @@ def protocol_to_nwb_dict(protocol_key):
3941
"""
4042
protocol_info = (lab.Protocol & protocol_key).fetch1()
4143
return dict(
42-
protocol=protocol_info.get('protocol'),
43-
notes=protocol_info.get('protocol_description')
44+
protocol=protocol_info.get("protocol"),
45+
notes=protocol_info.get("protocol_description"),
4446
)
4547

4648

@@ -63,15 +65,17 @@ def element_lab_to_nwb_dict(lab_key=None, project_key=None, protocol_key=None):
6365
:return: dictionary with NWB parameters
6466
"""
6567
# Validate input
66-
assert any([lab_key, project_key, protocol_key]), 'Must specify one key.'
67-
assert lab_key is None or len(lab.Lab & lab_key) == 1, \
68-
'Multiple labs error! The lab_key should specify only one lab.'
69-
assert project_key is None or len(lab.Project & project_key) == 1, \
70-
'Multiple projects error! The project_key should specify only one '\
71-
'project.'
72-
assert protocol_key is None or len(lab.Protocol & protocol_key) == 1, \
73-
'Multiple protocols error! The protocol_key should specify only one '\
74-
'protocol.'
68+
assert any([lab_key, project_key, protocol_key]), "Must specify one key."
69+
assert (
70+
lab_key is None or len(lab.Lab & lab_key) == 1
71+
), "Multiple labs error! The lab_key should specify only one lab."
72+
assert project_key is None or len(lab.Project & project_key) == 1, (
73+
"Multiple projects error! The project_key should specify only one " "project."
74+
)
75+
assert protocol_key is None or len(lab.Protocol & protocol_key) == 1, (
76+
"Multiple protocols error! The protocol_key should specify only one "
77+
"protocol."
78+
)
7579

7680
element_info = dict()
7781
if lab_key:

element_lab/lab.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ def activate(schema_name, create_schema=True, create_tables=True):
1313
:param create_tables: when True (default), create tables in the
1414
database if they do not yet exist.
1515
"""
16-
schema.activate(schema_name, create_schema=create_schema,
17-
create_tables=create_tables)
16+
schema.activate(
17+
schema_name, create_schema=create_schema, create_tables=create_tables
18+
)
1819

1920

2021
@schema

element_lab/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Package metadata."""
2-
__version__ = '0.1.0b1'
2+
__version__ = "0.1.1"

setup.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
from setuptools import setup, find_packages
22
from os import path
33

4-
pkg_name = next(p for p in find_packages() if '.' not in p)
4+
pkg_name = next(p for p in find_packages() if "." not in p)
55
here = path.abspath(path.dirname(__file__))
66

7-
with open(path.join(here, 'README.md'), 'r') as f:
7+
with open(path.join(here, "README.md"), "r") as f:
88
long_description = f.read()
99

10-
with open(path.join(here, 'requirements.txt')) as f:
10+
with open(path.join(here, "requirements.txt")) as f:
1111
requirements = f.read().splitlines()
1212

13-
with open(path.join(here, pkg_name, 'version.py')) as f:
13+
with open(path.join(here, pkg_name, "version.py")) as f:
1414
exec(f.read())
1515

1616
setup(
17-
name=pkg_name.replace('_', '-'),
17+
name=pkg_name.replace("_", "-"),
1818
version=__version__,
1919
description="DataJoint Elements for Lab Management",
2020
long_description=long_description,
21-
long_description_content_type = 'text/markdown',
22-
author='DataJoint',
23-
author_email='[email protected]',
24-
license='MIT',
21+
long_description_content_type="text/markdown",
22+
author="DataJoint",
23+
author_email="[email protected]",
24+
license="MIT",
2525
url=f'https://github.com/datajoint/{pkg_name.replace("_", "-")}',
26-
keywords='neuroscience lab management datajoint',
27-
packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
26+
keywords="neuroscience lab management datajoint",
27+
packages=find_packages(exclude=["contrib", "docs", "tests*"]),
2828
install_requires=requirements,
2929
)

0 commit comments

Comments
 (0)