Skip to content

Added support for python 3.12 #2137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 24, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8,3.9,'3.10',3.11]
python-version: [3.8,3.9,'3.10',3.11,3.12]

steps:
- uses: actions/checkout@v4
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
21 changes: 1 addition & 20 deletions SoftLayer/CLI/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from json.decoder import JSONDecodeError

import click
import pkg_resources

from rich.console import Console
from rich.syntax import Syntax

Expand All @@ -23,9 +23,6 @@

# pylint: disable=too-many-instance-attributes, invalid-name

# Calling pkg_resources.iter_entry_points shows a false-positive
# pylint: disable=no-member


class Environment(object):
"""Provides access to the current CLI environment."""
Expand Down Expand Up @@ -165,8 +162,6 @@ def load(self):

self.load_modules_from_python(routes.ALL_ROUTES)
self.aliases.update(routes.ALL_ALIASES)
self._load_modules_from_entry_points('softlayer.cli')

self._modules_loaded = True

def load_modules_from_python(self, route_list):
Expand All @@ -178,20 +173,6 @@ def load_modules_from_python(self, route_list):
path, attr = modpath, None
self.commands[name] = ModuleLoader(path, attr=attr)

def _load_modules_from_entry_points(self, entry_point_group):
"""Load modules from the entry_points (slower).

Entry points can be used to add new commands to the CLI.

Usage:

entry_points={'softlayer.cli': ['new-cmd = mymodule.new_cmd.cli']}

"""
for obj in pkg_resources.iter_entry_points(group=entry_point_group,
name=None):
self.commands[obj.name] = obj

def ensure_client(self, config_file=None, is_demo=False, proxy=None):
"""Create a new SLAPI client to the environment.

Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/CLI/event_log/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metada
f"'{user}','{metadata_data}'")
else:
click.secho(f"'{log['eventName']}','{label}','{log['objectName']}',"
f"'{utils.clean_time(log['eventCreateDate'],in_format=log_time)}',"
f"'{utils.clean_time(log['eventCreateDate'], in_format=log_time)}',"
f"'{user}'")

row_count = row_count + 1
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/CLI/file/access/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@click.option('--sortby', help='Column to sort by', default='name')
@click.option('--columns',
callback=column_helper.get_formatter(storage_utils.COLUMNS),
help=f"Columns to display. Options: { ', '.join(column.name for column in storage_utils.COLUMNS)}",
help=f"Columns to display. Options: {', '.join(column.name for column in storage_utils.COLUMNS)}",
default=','.join(storage_utils.DEFAULT_COLUMNS))
@environment.pass_env
def cli(env, columns, sortby, volume_id):
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/managers/ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def get_package_by_key(self, package_keyname, mask=None):
"""
_filter = {'keyName': {'operation': package_keyname}}

packages = self.package_svc.getAllObjects(mask=mask, filter=_filter)
packages = self.client.call('SoftLayer_Product_Package', 'getAllObjects', mask=mask, filter=_filter)
if len(packages) == 0:
raise exceptions.SoftLayerError(f"Package {package_keyname} does not exist")

Expand Down
4 changes: 2 additions & 2 deletions SoftLayer/testing/xmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
# pylint: disable=invalid-name, broad-except, arguments-differ


class TestServer(http.server.HTTPServer):
class TestServer(http.server.ThreadingHTTPServer):
"""Test HTTP server which holds a given transport."""

def __init__(self, transport, *args, **kw):
http.server.HTTPServer.__init__(self, *args, **kw)
http.server.ThreadingHTTPServer.__init__(self, *args, **kw)
self.transport = transport


Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37,py38,py39,py310,py311,pypy3,analysis,coverage,docs
envlist = py38,py39,py310,py311,py312,pypy3,analysis,coverage,docs


[flake8]
Expand Down