Skip to content

Commit

Permalink
Merge pull request datalad#7643 from courtois-neuromod/fix/pre-commit…
Browse files Browse the repository at this point in the history
…-all

pre-commit fixes on all files to avoid other PR to contain unrelated changes
  • Loading branch information
yarikoptic authored Oct 14, 2024
2 parents f513885 + 7e7ad48 commit a2c30ce
Show file tree
Hide file tree
Showing 164 changed files with 895 additions and 801 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ description: Report a generic issue which is not necessarily a bug
body:
- type: textarea
attributes:
label: Description
label: Description
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue_template_bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ body:
attributes:
label: DataLad information
description: |
What version of DataLad and git-annex do you use (run `datalad --version`)?
What version of DataLad and git-annex do you use (run `datalad --version`)?
On what operating system (consider running `datalad wtf`)?
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@
"access_right": "open",
"license": "MIT",
"upload_type": "software"
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# 10000-ft. overview

DataLad's purpose is to make data management and data distribution more accessible.
DataLad's purpose is to make data management and data distribution more accessible.
To do so, it stands on the shoulders of [Git] and [Git-annex] to deliver a
decentralized system for data exchange. This includes automated ingestion of
data from online portals and exposing it in readily usable form as Git(-annex)
Expand Down
1 change: 1 addition & 0 deletions datalad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def enable_librarymode():
ConfigManager,
warn_on_undefined_git_identity,
)

cfg = ConfigManager()
warn_on_undefined_git_identity(cfg)

Expand Down
3 changes: 2 additions & 1 deletion datalad/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Helper to use datalad as a "runnable" module with -m datalad"""

import sys

from . import __version__
from .log import lgr

Expand Down Expand Up @@ -44,8 +45,8 @@ def runctx(cmd, globals=None, locals=None):


def main(argv=None):
import os
import getopt
import os

if argv is None:
argv = sys.argv
Expand Down
7 changes: 5 additions & 2 deletions datalad/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
"""Git implementation of _version.py."""

import errno
import functools
import os
import re
import subprocess
import sys
from typing import Callable, Dict
import functools
from typing import (
Callable,
Dict,
)


def get_keywords():
Expand Down
21 changes: 12 additions & 9 deletions datalad/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
def _command_summary():
# Import here to avoid polluting the datalad.api namespace.
from collections import defaultdict
from datalad.interface.base import alter_interface_docs_for_api
from datalad.interface.base import get_api_name
from datalad.interface.base import get_cmd_doc
from datalad.interface.base import get_cmd_summaries
from datalad.interface.base import get_interface_groups
from datalad.interface.base import load_interface

from datalad.interface.base import (
alter_interface_docs_for_api,
get_api_name,
get_cmd_doc,
get_cmd_summaries,
get_interface_groups,
load_interface,
)

groups = get_interface_groups()
grp_short_descriptions = defaultdict(list)
Expand All @@ -43,13 +46,13 @@ def _command_summary():
def _generate_extension_api():
"""Auto detect all available extensions and generate an API from them
"""
from datalad.support.entrypoints import iter_entrypoints
import logging

from datalad.interface.base import (
get_api_name,
load_interface,
)

import logging
from datalad.support.entrypoints import iter_entrypoints
lgr = logging.getLogger('datalad.api')

for ename, _, (grp_descr, interfaces) in iter_entrypoints(
Expand Down
1 change: 1 addition & 0 deletions datalad/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
__docformat__ = 'restructuredtext'

import logging

lgr = logging.getLogger('datalad.cli')
6 changes: 3 additions & 3 deletions datalad/cli/common_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

__all__ = ['common_args']

from datalad.interface.base import eval_params
from datalad.utils import ensure_unicode

from .helpers import (
HelpAction,
LogLevelAction,
)
from datalad.interface.base import eval_params
from datalad.utils import ensure_unicode


_log_level_names = ['critical', 'error', 'warning', 'info', 'debug']

Expand Down
11 changes: 4 additions & 7 deletions datalad/cli/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@
# caused unconditionally by .main, and .parser.

from datalad import cfg

from datalad.interface.base import (
is_api_arg,
)
from datalad.utils import (
getargspec,
)
from datalad.interface.base import is_api_arg
from datalad.utils import getargspec

# only imported during command execution
# .interface._has_eval_results_call
Expand Down Expand Up @@ -50,6 +45,7 @@ def call_from_parser(cls, args):
"""
# XXX needs safety check for name collisions
import inspect

from datalad.interface.base import _has_eval_results_call

argspec = getargspec(cls.__call__, include_kwonlyargs=True)
Expand Down Expand Up @@ -82,6 +78,7 @@ def call_from_parser(cls, args):
kwargs['result_xfm'] = None
if '{' in args.common_result_renderer:
from .renderer import DefaultOutputRenderer

# stupid hack, could and should become more powerful
kwargs['result_renderer'] = DefaultOutputRenderer(
args.common_result_renderer)
Expand Down
16 changes: 9 additions & 7 deletions datalad/cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,26 @@
__docformat__ = 'restructuredtext'

import argparse
import gzip
import os
import re
import sys
import gzip
import textwrap
from textwrap import wrap

from platformdirs import AppDirs

from datalad import __version__
# delay?
from datalad.support.exceptions import CapturedException
from datalad.ui.utils import get_console_width
from datalad.utils import is_interactive

from platformdirs import AppDirs

dirs = AppDirs("datalad", "datalad.org")


from logging import getLogger

lgr = getLogger('datalad.cli.helpers')


Expand Down Expand Up @@ -88,9 +89,10 @@ def _get_long_help(self, parser):
get_cmd_doc,
load_interface,
)

from .interface import (
get_cmdline_command_name,
alter_interface_docs_for_cmdline,
get_cmdline_command_name,
)
preamble = get_description_with_cmd_summary(
# produce a mapping of command groups to
Expand Down Expand Up @@ -153,6 +155,7 @@ def _get_all_interfaces(self):
def _try_manpage(self, parser):
try:
import subprocess

# get the datalad manpage to use
manfile = os.environ.get('MANPATH', '/usr/share/man') \
+ '/man1/{0}.1.gz'.format(parser.prog.replace(' ', '-'))
Expand Down Expand Up @@ -221,10 +224,9 @@ def _fix_datalad_ri(s):

def get_description_with_cmd_summary(grp_short_descriptions, interface_groups,
parser_description):
from .interface import (
dedent_docstring,
)
from datalad.interface.base import get_cmd_summaries

from .interface import dedent_docstring
lgr.debug("Generating detailed description for the parser")

console_width = get_console_width()
Expand Down
5 changes: 2 additions & 3 deletions datalad/cli/renderer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""Render results in a terminal"""

from collections import (
defaultdict,
)
import string
from collections import defaultdict

from datalad.ui import ui

NA_STRING = 'N/A' # we might want to make it configurable via config
Expand Down
1 change: 0 additions & 1 deletion datalad/cli/tests/test_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,3 @@ def __call__(pos_arg, **kwargs):
args = parser.parse_args(["val"])
eq_(call_from_parser(Cmd, args),
"val")

3 changes: 0 additions & 3 deletions datalad/cli/tests/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ def test_nadict():
d = nadict({1: 2})
eq_(d[1], 2)
eq_(str(d[2]), NA_STRING)



3 changes: 0 additions & 3 deletions datalad/cli/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,3 @@ def our_post_mortem(tb):
our_exceptionhook(type_, value_, tb_)

eq_(old_exceptionhook, sys.excepthook)



1 change: 0 additions & 1 deletion datalad/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from datalad.log import is_interactive


_sys_excepthook = sys.excepthook # Just in case we ever need original one


Expand Down
1 change: 1 addition & 0 deletions datalad/cmdline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import warnings

warnings.warn(
"All of datalad.cmdline is deprecated/discontinued as of datalad 0.16. "
"A new CLI implementation is available at datalad.cli. "
Expand Down
4 changes: 2 additions & 2 deletions datalad/cmdline/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import os
import warnings

from logging import getLogger

lgr = getLogger('datalad.cmdline')


Expand Down Expand Up @@ -44,10 +44,10 @@ def get_repo_instance(path=os.curdir, class_=None):
"It will be removed in a future release.",
DeprecationWarning)

from datalad.utils import get_dataset_root
from datalad.distribution.dataset import Dataset
from datalad.support.annexrepo import AnnexRepo
from datalad.support.gitrepo import GitRepo
from datalad.utils import get_dataset_root

if class_ is not None:
if class_ == AnnexRepo:
Expand Down
1 change: 1 addition & 0 deletions datalad/cmdline/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

import warnings

warnings.warn("datalad.cmdline.main was replaced by datalad.cli.main in "
"datalad 0.16. Please update and reinstall extensions.",
DeprecationWarning)
Expand Down
2 changes: 1 addition & 1 deletion datalad/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import threading
import warnings
from collections import namedtuple
from fasteners import InterProcessLock
from functools import (
lru_cache,
wraps,
)
from pathlib import Path

from fasteners import InterProcessLock

import datalad
from datalad.consts import DATASET_CONFIG_FILE
Expand Down
2 changes: 1 addition & 1 deletion datalad/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"""

import os
from os.path import join
import re
from os.path import join

# directory containing prepared metadata of a dataset repository:
DATALAD_DOTDIR = ".datalad"
Expand Down
9 changes: 6 additions & 3 deletions datalad/core/distributed/clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from datalad.interface.base import (
Interface,
build_doc,
eval_results
eval_results,
)
from datalad.interface.common_opts import (
location_description,
Expand All @@ -45,8 +45,8 @@
)
from datalad.support.param import Parameter
from datalad.utils import (
knows_annex,
PurePath,
knows_annex,
rmtree,
)

Expand All @@ -60,7 +60,10 @@
_test_existing_clone_target,
_try_clone_candidates,
decode_source_spec,
# RIA imports needed b/c datalad-next imports it from here ATM;
)

from .clone_utils import ( # isort: skip
# RIA imports needed b/c datalad-next imports it from here ATM
# Remove after core was released and next dropped the ria patch.
postclone_preannex_cfg_ria,
postclonecfg_ria,
Expand Down
4 changes: 2 additions & 2 deletions datalad/core/distributed/clone_ria.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from typing import Dict

from datalad.distribution.dataset import Dataset

from . import clone as mod_clone
# For now kept in clone_utils, to avoid circular import (see datalad-next)
from .clone_utils import (
postclone_preannex_cfg_ria,
postclonecfg_ria,
)

from . import clone as mod_clone

# we need to preserve the original functions to be able to call them
# in the patch
orig_post_git_init_processing_ = mod_clone._post_git_init_processing_
Expand Down
3 changes: 1 addition & 2 deletions datalad/core/distributed/clone_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from datalad.support.annexrepo import AnnexRepo
from datalad.support.exceptions import (
CapturedException,
DownloadError
DownloadError,
)
from datalad.support.gitrepo import GitRepo
from datalad.support.network import (
Expand All @@ -54,7 +54,6 @@
rmtree,
)


__docformat__ = 'restructuredtext'

lgr = logging.getLogger('datalad.core.distributed.clone')
Expand Down
Loading

0 comments on commit a2c30ce

Please sign in to comment.