Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply black code formatting #247

Merged
merged 26 commits into from
Dec 18, 2024
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: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: check-json
- id: check-toml
- id: name-tests-test
args: [--pytest-test-first]
- id: check-docstring-first
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.10.0
hooks:
- id: black
exclude: ^docs/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Remove support for python 3.8 and added testing for Python 3.13. @mavaylon1 [#240](https://github.com/hdmf-dev/hdmf-zarr/pull/240)
* Added `NWBZarrIO.read_nwb` convenience method to simplify reading an NWB file. @oruebel [#226](https://github.com/hdmf-dev/hdmf-zarr/pull/226)
* Updated optional dependency groups in `pyproject.toml` and GitHub Actions workflows. @rly, @mavaylon1 [#239](https://github.com/hdmf-dev/hdmf-zarr/pull/239)
* Applied black code formatter. @rly [#247](https://github.com/hdmf-dev/hdmf-zarr/pull/247)

### Bug Fixes
* Fix reading of cached specs and caching of specs during export. @rly [#232](https://github.com/hdmf-dev/hdmf-zarr/pull/232)
Expand Down
4 changes: 0 additions & 4 deletions MANIFEST.in

This file was deleted.

26 changes: 2 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,9 @@ omit = [

[tool.black]
line-length = 120
target-version = ['py38']
target-version = ['py313']
include = '\.pyi?$'
extend-exclude = '''
/(
\.toml
|\.yml
|\.txt
|\.sh
|\.git
|\.ini
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''
force-exclude = '''
/(
/*.txt
/docs
/docs/*
)\
'''
force-exclude = 'docs/*'

[tool.ruff]
lint.select = ["E", "F", "T100", "T201", "T203"]
Expand Down
16 changes: 13 additions & 3 deletions src/hdmf_zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
__version__ = version("hdmf")
del version

__all__ = ["ZarrIO", "ZarrDataIO", "NWBZarrIO"]

# Duecredit definitions
from ._due import due, BibTeX # noqa: E402
due.cite(BibTeX("""

due.cite(
BibTeX(
"""
@INPROCEEDINGS{9005648,
author={A. J. {Tritt} and O. {Rübel} and B. {Dichter} and R. {Ly} and D. {Kang} and E. F. {Chang} and L. M. {Frank} and K. {Bouchard}},
booktitle={2019 IEEE International Conference on Big Data (Big Data)},
Expand All @@ -24,6 +29,11 @@
number={},
pages={165-179},
doi={10.1109/BigData47090.2019.9005648}}
"""), description="HDMF: Hierarchical Data Modeling Framework for Modern Science Data Standards", # noqa: E501
path="hdmf/", version=__version__, cite_module=True)
""" # noqa: E501
),
description="HDMF: Hierarchical Data Modeling Framework for Modern Science Data Standards",
path="hdmf/",
version=__version__,
cite_module=True,
)
del due, BibTeX
37 changes: 22 additions & 15 deletions src/hdmf_zarr/_due.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# emacs: at the end of the file
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### #
from __future__ import annotations

from typing import Any

"""

Stub file for a guaranteed safe import of duecredit constructs: if duecredit
Expand All @@ -24,46 +28,49 @@
License: BSD-2
"""

__version__ = '0.0.9'
__version__ = "0.0.9"


class InactiveDueCreditCollector(object):
class InactiveDueCreditCollector:
"""Just a stub at the Collector which would not do anything"""
def _donothing(self, *args, **kwargs):

def _donothing(self, *_args: Any, **_kwargs: Any) -> None:
"""Perform no good and no bad"""
pass

def dcite(self, *args, **kwargs):
def dcite(self, *_args: Any, **_kwargs: Any):
"""If I could cite I would"""

def nondecorating_decorator(func):
return func

return nondecorating_decorator

active = False
activate = add = cite = dump = load = _donothing

def __repr__(self):
return self.__class__.__name__ + '()'
def __repr__(self) -> str:
return self.__class__.__name__ + "()"


def _donothing_func(*args, **kwargs):
def _donothing_func(*args: Any, **kwargs: Any) -> None:
"""Perform no good and no bad"""
pass


try:
from duecredit import due, BibTeX, Doi, Url, Text # lgtm [py/unused-import]
if 'due' in locals() and not hasattr(due, 'cite'):
raise RuntimeError(
"Imported due lacks .cite. DueCredit is now disabled")
from duecredit import BibTeX, Doi, Text, Url, due # lgtm [py/unused-import]

if "due" in locals() and not hasattr(due, "cite"):
raise RuntimeError("Imported due lacks .cite. DueCredit is now disabled")
except Exception as e:
if not isinstance(e, ImportError):
import logging
logging.getLogger("duecredit").error(
"Failed to import duecredit due to %s" % str(e))

logging.getLogger("duecredit").error("Failed to import duecredit due to %s" % str(e))
# Initiate due stub
due = InactiveDueCreditCollector()
BibTeX = Doi = Url = Text = _donothing_func
due = InactiveDueCreditCollector() # type: ignore
BibTeX = Doi = Url = Text = _donothing_func # type: ignore

# Emacs mode definitions
# Local Variables:
Expand Down
Loading
Loading