Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [2.7, 3.5, 3.6, 3.7, 3.8]
python: [3.6, 3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2
- name: Setup Python
Expand Down
10 changes: 4 additions & 6 deletions faculty_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

"""Command line interface."""

from __future__ import division

import contextlib
import operator
import os
Expand Down Expand Up @@ -1198,7 +1196,7 @@ def put(project, local, remote, server):
"-P",
str(details.port),
os.path.expanduser(local),
u"{}@{}:{}".format(
"{}@{}:{}".format(
details.username, details.hostname, escaped_remote
),
]
Expand Down Expand Up @@ -1230,7 +1228,7 @@ def get(project, remote, local, server):
filename,
"-P",
str(details.port),
u"{}@{}:{}".format(
"{}@{}:{}".format(
details.username, details.hostname, escaped_remote
),
os.path.expanduser(local),
Expand All @@ -1250,11 +1248,11 @@ def _rsync(project, local, remote, server, rsync_opts, up):
escaped_remote = faculty_cli.shell.quote(remote)
if up:
path_from = local
path_to = u"{}@{}:{}".format(
path_to = "{}@{}:{}".format(
details.username, details.hostname, escaped_remote
)
else:
path_from = u"{}@{}:{}".format(
path_from = "{}@{}:{}".format(
details.username, details.hostname, escaped_remote
)
path_to = local
Expand Down
46 changes: 14 additions & 32 deletions faculty_cli/shell.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
"""Shell helper functions.

Vendored from https://github.com/python/cpython/blob/3.6/Lib/shlex.py
"""

# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016, 2017 Python Software Foundation; All
# Rights Reserved
# Copyright 2016-2020 Faculty Science Limited
#
# This file is distributed under the terms of the Python Software Foundation
# License Version 2: see https://github.com/python/cpython/blob/3.6/LICENSE

from __future__ import unicode_literals

import six


if six.PY3:
from shlex import quote

else:
import re

_find_unsafe = re.compile(r"[^\w@%+=:,./-]").search
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

def quote(s):
"""Return a shell-escaped version of the string *s*."""
if not s:
return "''"
if _find_unsafe(s) is None:
return s
"""Shell helper functions."""

# use single quotes, and put single quotes into double quotes
# the string $'b is then quoted as '$'"'"'b'
return "'" + s.replace("'", "'\"'\"'") + "'"
from shlex import quote # noqa: F401
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ exclude = '''
| \.eggs
)/
'''

[tool.setuptools_scm]
version_scheme = "post-release"
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
[aliases]
test = pytest

[bdist_wheel]
universal = 1

6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,18 @@ def read_long_description():
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
],
keywords="data science platform",
packages=find_packages(),
use_scm_version={"version_scheme": "post-release"},
setup_requires=["setuptools_scm"],
python_requires=">=3.6",
install_requires=[
"click",
"python-dateutil",
"requests",
"six",
"tabulate",
"faculty>=0.26.0",
"faculty>=0.30.2",
],
entry_points={"console_scripts": ["faculty=faculty_cli.cli:cli"]},
)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{27,35,36,37,38}, flake8, black
envlist = py{36,37,38,39,310}, flake8, black

[testenv]
sitepackages = False
Expand All @@ -18,7 +18,7 @@ commands =
[testenv:black]
skip_install = True
deps =
black==18.9b0
black==22.3.0
commands =
black {posargs:--check setup.py faculty_cli test}

Expand Down