Skip to content

Commit

Permalink
[DATALAD RUNCMD] Run pre-commit to harmonize code throughout
Browse files Browse the repository at this point in the history
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "pre-commit run --all || pre-commit run --all",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic committed Feb 5, 2025
1 parent 4d6eabf commit a2b6768
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ environment:

# Ubuntu core tests
- ID: Ubu

# The same but with the oldest supported Python.
- ID: Ubu-3.8
PY: '3.8'

# The same but removing busybox first - triggers different code paths in the tests
- ID: Ubu-nobusybox
BEFORE_CMD: docker rmi busybox:latest
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ repos:
- id: codespell
additional_dependencies:
- tomli

4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
- Drop use of `Runner` (to be removed in datalad 0.14.0) in favor of
`WitlessRunner`

# 1.1.0 (October 30, 2020) --
# 1.1.0 (October 30, 2020) --

- Datalad version 0.13.0 or later is now required.

Expand All @@ -222,7 +222,7 @@
to execute a container from underneath an uninstalled subdataset.


# 1.0.1 (June 23, 2020) --
# 1.0.1 (June 23, 2020) --

- Prefer `datalad.core.local.run` to `datalad.interface.run`. The
latter has been marked as obsolete since DataLad v0.12 (our minimum
Expand Down
18 changes: 9 additions & 9 deletions datalad_container/adapters/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ def save(image, path):
elif os.listdir(path):
raise OSError("Directory {} is not empty".format(path))
def is_within_directory(directory, target):

abs_directory = os.path.abspath(directory)
abs_target = os.path.abspath(target)

prefix = os.path.commonprefix([abs_directory, abs_target])

return prefix == abs_directory

def safe_extract(tar, path=".", members=None, *, numeric_owner=False):

for member in tar.getmembers():
member_path = os.path.join(path, member.name)
if not is_within_directory(path, member_path):
raise Exception("Attempted Path Traversal in Tar File")
tar.extractall(path, members, numeric_owner=numeric_owner)

tar.extractall(path, members, numeric_owner=numeric_owner)


safe_extract(tar, path=path)
lgr.info("Saved %s to %s", image, path)

Expand Down
2 changes: 1 addition & 1 deletion datalad_container/containers_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ContainersAdd(Interface):
the rest of the URL will be interpreted as the argument to
'docker pull', the image will be saved to a location
specified by `name`, and the call format will be auto-configured
to run docker, unless overwritten. The auto-configured call to docker
to run docker, unless overwritten. The auto-configured call to docker
run mounts the CWD to '/tmp' and sets the working directory to '/tmp'.""",
metavar="URL",
constraints=EnsureStr() | EnsureNone(),
Expand Down
2 changes: 1 addition & 1 deletion datalad_container/containers_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
container_name=Parameter(
args=('-n', '--container-name',),
metavar="NAME",
doc="""Specify the name of or a path to a known container to use
doc="""Specify the name of or a path to a known container to use
for execution, in case multiple containers are configured."""),
)

Expand Down
1 change: 0 additions & 1 deletion datalad_container/extractors/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest
from datalad.support.external_versions import external_versions

# Early detection before we try to import meta_extract
from datalad.tests.utils_pytest import SkipTest

Expand Down
2 changes: 1 addition & 1 deletion datalad_container/tests/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ def test_ensure_datalad_remote_maybe_enable(path=None, *, autoenable):
if not autoenable:
assert_not_in("datalad", repo.get_remotes())
_ensure_datalad_remote(repo)
assert_in("datalad", repo.get_remotes())
assert_in("datalad", repo.get_remotes())
2 changes: 1 addition & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Change log
**********
::

____ _ _ _
____ _ _ _
| _ \ __ _ | |_ __ _ | | __ _ __| |
| | | | / _` || __| / _` || | / _` | / _` |
| |_| || (_| || |_ | (_| || |___ | (_| || (_| |
Expand Down
2 changes: 1 addition & 1 deletion docs/source/metadata-extraction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For example:

`datalad meta-extract -d . container_inspect images/bids/bids-pymvpa--1.0.2.sing | jq`

.. code-block::
.. code-block::
{
"type": "file",
Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python

from setuptools import setup
import versioneer

from _datalad_buildsupport.setup import (
BuildManPage,
)
import versioneer
from _datalad_buildsupport.setup import BuildManPage

cmdclass = versioneer.get_cmdclass()
cmdclass.update(build_manpage=BuildManPage)
Expand Down
3 changes: 0 additions & 3 deletions tools/ci/prep-travis-forssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ ssh -v datalad-test exit

# tmp: don't run the actual tests:
# exit 1



0 comments on commit a2b6768

Please sign in to comment.