Skip to content

Commit

Permalink
Merge pull request #3331 from plus3it/dependabot/pip/python-f41ba466cb
Browse files Browse the repository at this point in the history
Bump the python group with 3 updates
  • Loading branch information
mergify[bot] authored Apr 10, 2024
2 parents 336f8e0 + febc71a commit 5695fd1
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion requirements/build.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
boto3==1.34.74
boto3==1.34.80
pyinstaller==6.5.0
2 changes: 1 addition & 1 deletion requirements/check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
check-manifest==0.49
flake8==7.0.0
flake8-bugbear==24.2.6
flake8-builtins==2.4.0
flake8-builtins==2.5.0
flake8-docstrings==1.7.0
flake8-isort==6.1.1
flake8-future-import==0.4.7
Expand Down
2 changes: 1 addition & 1 deletion requirements/deploy.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
satsuki==0.1.50
awscli==1.32.74
awscli==1.32.80
4 changes: 2 additions & 2 deletions src/watchmaker/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import watchmaker.utils.imds.detect
from watchmaker.config.status import is_valid
from watchmaker.exceptions import WatchmakerError
from watchmaker.utils import urllib
from watchmaker.utils import urllib_utils

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -47,7 +47,7 @@ def get_configs(system, worker_args, config_path=None):
# Get the raw config data
try:
data = watchmaker.utils.urlopen_retry(config_path).read()
except (ValueError, urllib.error.URLError):
except (ValueError, urllib_utils.error.URLError):
msg = (
'Could not read config file from the provided value "{0}"! '
"Check that the config is available.".format(config_path)
Expand Down
4 changes: 2 additions & 2 deletions src/watchmaker/managers/platform_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import watchmaker.utils
from watchmaker.exceptions import WatchmakerError
from watchmaker.utils import urllib
from watchmaker.utils import urllib_utils


class PlatformManagerBase(object):
Expand Down Expand Up @@ -90,7 +90,7 @@ def retrieve_file(self, url, filename):
with open(filename, 'wb') as outfile:
self.log.debug('Saving file to local filesystem...')
shutil.copyfileobj(response, outfile)
except (ValueError, urllib.error.URLError):
except (ValueError, urllib_utils.error.URLError):
self.log.critical(
'Failed to retrieve the file. url = %s. filename = %s',
url, filename
Expand Down
2 changes: 1 addition & 1 deletion src/watchmaker/status/providers/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __tag_aws_instance(self, key, status):
def __get_response_from_server(self, metadata_url):
"""Get response for provided metadata_url."""
headers = self.provider.get_metadata_request_headers()
request = utils.urllib.request.Request(
request = utils.urllib_utils.request.Request(
metadata_url, data=None, headers=headers
)
response = utils.urlopen_retry(
Expand Down
21 changes: 13 additions & 8 deletions src/watchmaker/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import backoff

from watchmaker.utils import urllib
from watchmaker.utils import urllib_utils


def scheme_from_uri(uri):
Expand All @@ -24,38 +24,43 @@ def scheme_from_uri(uri):
# i.e. '/abspath/foo' or 'relpath/foo'
# Do not test `if parts.scheme` because of how urlparse handles Windows
# file paths -- i.e. 'C:\\foo' => scheme = 'c' :(
return uri.scheme if "://" in urllib.parse.urlunparse(uri) else "file"
return (
uri.scheme
if "://"
in urllib_utils.parse.urlunparse(uri)
else "file"
)


def uri_from_filepath(filepath):
"""Return a URI compatible with urllib, handling URIs and file paths."""
parts = urllib.parse.urlparse(filepath)
parts = urllib_utils.parse.urlparse(filepath)
scheme = scheme_from_uri(parts)

if scheme != "file":
# Return non-file paths unchanged
return filepath

# Expand relative file paths and convert them to uri-style
path = urllib.request.pathname2url(
path = urllib_utils.request.pathname2url(
os.path.abspath(
os.path.expanduser(
"".join([x for x in [parts.netloc, parts.path] if x])
)
)
)

return urllib.parse.urlunparse((scheme, "", path, "", "", ""))
return urllib_utils.parse.urlunparse((scheme, "", path, "", "", ""))


def basename_from_uri(uri):
"""Return the basename/filename/leaf part of a URI."""
# Do not split on '/' and return the last part because that will also
# include any query in the uri. Instead, parse the uri.
return os.path.basename(urllib.parse.urlparse(uri).path)
return os.path.basename(urllib_utils.parse.urlparse(uri).path)


@backoff.on_exception(backoff.expo, urllib.error.URLError, max_tries=5)
@backoff.on_exception(backoff.expo, urllib_utils.error.URLError, max_tries=5)
def urlopen_retry(uri, timeout=None):
"""Retry urlopen on exception."""
kwargs = {}
Expand All @@ -74,7 +79,7 @@ def urlopen_retry(uri, timeout=None):
pass

# pylint: disable=consider-using-with
return urllib.request.urlopen(uri, **kwargs)
return urllib_utils.request.urlopen(uri, **kwargs)


def copytree(src, dst, force=False, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion src/watchmaker/utils/imds/detect/providers/aws_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __request_token(self):
return None

def __call_urlopen_retry(self, uri, timeout, headers=None, method=None):
request_uri = utils.urllib.request.Request(
request_uri = utils.urllib_utils.request.Request(
uri,
data=None,
headers=headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
from watchmaker.conditions import HAS_BOTO3

if HAS_BOTO3:
from watchmaker.utils.urllib.request_handlers import S3Handler
from watchmaker.utils.urllib_utils.request_handlers import S3Handler
request.install_opener(request.build_opener(S3Handler))

0 comments on commit 5695fd1

Please sign in to comment.