Skip to content

Commit

Permalink
Apply black to src directory
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Dec 18, 2024
1 parent 802ad39 commit fea4efd
Show file tree
Hide file tree
Showing 9 changed files with 695 additions and 554 deletions.
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/
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)
"""
),
description="HDMF: Hierarchical Data Modeling Framework for Modern Science Data Standards", # noqa: E501
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

0 comments on commit fea4efd

Please sign in to comment.