cc-ampapi 0.0.0__tar.gz → 1.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {cc_ampapi-0.0.0/cc_ampapi.egg-info → cc_ampapi-1.0.7}/PKG-INFO +2 -1
  2. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/__init__.py +9 -4
  3. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/analytics.py +2 -1
  4. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/base.py +8 -10
  5. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/controller.py +1 -1
  6. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/core.py +1 -9
  7. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/dataclass.py +1 -1
  8. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/emailsender.py +0 -1
  9. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/filebackup.py +0 -1
  10. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/filemanager.py +2 -3
  11. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/instance.py +0 -1
  12. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/minecraft.py +1 -1
  13. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/modules.py +6 -0
  14. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/util.py +4 -12
  15. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7/cc_ampapi.egg-info}/PKG-INFO +2 -1
  16. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/pyproject.toml +17 -16
  17. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/LICENSE +0 -0
  18. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/LICENSE-dpy +0 -0
  19. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/MANIFEST.in +0 -0
  20. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/README.md +0 -0
  21. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/adsmodule.py +0 -0
  22. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/bridge.py +0 -0
  23. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/enums.py +0 -0
  24. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/ampapi/types_.py +0 -0
  25. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/cc_ampapi.egg-info/SOURCES.txt +0 -0
  26. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/cc_ampapi.egg-info/dependency_links.txt +0 -0
  27. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/cc_ampapi.egg-info/top_level.txt +0 -0
  28. {cc_ampapi-0.0.0 → cc_ampapi-1.0.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cc-ampapi
3
- Version: 0.0.0
3
+ Version: 1.0.7
4
4
  Summary: A Python wrapper for the AMP API by CubeCoders
5
5
  Author-email: k8thekat <Cadwalladerkatelynn+AMPAPI@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -685,6 +685,7 @@ License: GNU GENERAL PUBLIC LICENSE
685
685
 
686
686
  Project-URL: GitHub, https://github.com/k8thekat/AMPAPI_Python
687
687
  Project-URL: Changelog, https://github.com/k8thekat/AMPAPI_Python/blob/master/CHANGELOG.md
688
+ Keywords: cubecoders,cube coders,amp,api
688
689
  Classifier: Development Status :: 5 - Production/Stable
689
690
  Classifier: Intended Audience :: Developers
690
691
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
@@ -1,3 +1,4 @@
1
+ # ruff: noqa
1
2
  """
2
3
  Copyright (C) 2021-2022 Katelynn Cadwallader.
3
4
 
@@ -24,12 +25,16 @@ from __future__ import annotations
24
25
  __title__ = "CubeCoders AMP API"
25
26
  __author__ = "k8thekat"
26
27
  __license__ = "GNU"
27
- __version__ = "1.0.3"
28
+ __version__ = "1.0.7"
28
29
  __credits__ = "AMP by CubeCoders and associates."
29
30
 
30
31
  from typing import Literal, NamedTuple
31
32
 
32
- from . import dataclass as dataclass, enums as enums, modules as modules, types_ as types, util as util
33
+ from . import dataclass as dataclass
34
+ from . import enums as enums
35
+ from . import modules as modules
36
+ from . import types_ as types
37
+ from . import util as util
33
38
  from .adsmodule import *
34
39
  from .analytics import *
35
40
  from .base import *
@@ -47,9 +52,9 @@ class VersionInfo(NamedTuple):
47
52
  Major: int
48
53
  Minor: int
49
54
  Revision: int
50
- releaseLevel: Literal["alpha", "beta", "pre-release", "release", "development"] # noqa
55
+ releaseLevel: Literal["alpha", "beta", "pre-release", "release", "development"]
51
56
 
52
57
 
53
- version_info: VersionInfo = VersionInfo(Major=1, Minor=0, Revision=3, releaseLevel="release") # noqa
58
+ version_info: VersionInfo = VersionInfo(Major=1, Minor=0, Revision=6, releaseLevel="release")
54
59
 
55
60
  del NamedTuple, Literal, VersionInfo
@@ -3,7 +3,8 @@ from typing import Any, Union
3
3
 
4
4
  from .base import Base
5
5
  from .dataclass import AnalyticsFilter, AnalyticsSummary
6
- from .enums import *
6
+
7
+ # from .enums import *
7
8
 
8
9
  __all__ = ("AnalyticsPlugin",)
9
10
 
@@ -17,8 +17,6 @@ from pyotp import TOTP
17
17
 
18
18
  from .bridge import Bridge
19
19
  from .dataclass import APISession, Diagnostics, LoginResults, VersionInfo
20
- from .enums import *
21
- from .modules import DeploymentTemplate
22
20
 
23
21
  if TYPE_CHECKING:
24
22
  from collections.abc import Callable, Coroutine, Iterable
@@ -158,7 +156,7 @@ class Base:
158
156
  from .adsmodule import ADSModule
159
157
  from .instance import AMPADSInstance
160
158
 
161
- if self.module == "ADS" or type(self) == AMPADSInstance or isinstance(self, ADSModule):
159
+ if self.module == "ADS" or type(self) is AMPADSInstance or isinstance(self, ADSModule):
162
160
  return func(self, *args, **kwargs)
163
161
  else:
164
162
  raise RuntimeError(self._ads_only)
@@ -227,7 +225,7 @@ class Base:
227
225
  self.logger.debug("_call_api -> %s was called with %s", api, parameters)
228
226
 
229
227
  # This should save us some boiler plate code throughout our API calls.
230
- if parameters == None:
228
+ if parameters is None:
231
229
  parameters = {}
232
230
 
233
231
  api_session: APISession = self._bridge._sessions.get(self.instance_id, APISession(id="0", ttl=datetime.now()))
@@ -255,7 +253,7 @@ class Base:
255
253
 
256
254
  post_req_json: Any = await post_req.json()
257
255
 
258
- if post_req_json == None and _no_data == False:
256
+ if post_req_json is None and _no_data is False:
259
257
  raise ConnectionError(self._no_data)
260
258
 
261
259
  # They removed "result" from all replies thus breaking most if not all future code.
@@ -289,7 +287,7 @@ class Base:
289
287
  self.logger.error("%s failed because of %s", api, post_req_json)
290
288
  raise ValueError(self._failed_api)
291
289
 
292
- elif isinstance(post_req_json, dict) and "status" in post_req_json and post_req_json["status"] == False:
290
+ elif isinstance(post_req_json, dict) and "status" in post_req_json and post_req_json["status"] is False:
293
291
  self.logger.error("%s failed because of Status: %s", api, post_req_json)
294
292
  return ValueError(self._failed_api)
295
293
 
@@ -337,7 +335,7 @@ class Base:
337
335
  sessionID: str = session.id
338
336
 
339
337
  if sessionID == "0":
340
- if self._bridge.use_2fa == True:
338
+ if self._bridge.use_2fa is True:
341
339
  try:
342
340
  # Handles time based 2Factory Auth Key/Code
343
341
  code = TOTP(self._bridge.token).now()
@@ -478,7 +476,7 @@ class Base:
478
476
  raise TypeError(f"The object {dataclass_} is not of the same type as <dataclass>.")
479
477
  for field in fields(class_or_instance=dataclass_):
480
478
  value: Any = getattr(dataclass_, field.name)
481
- if value == None:
479
+ if value is None:
482
480
  continue
483
481
  parameters[field.name] = value
484
482
  return parameters
@@ -562,10 +560,10 @@ class Base:
562
560
  # so all connections will use the same session id (if possible)
563
561
  self._bridge = bridge
564
562
  self.url = bridge.url
565
- if bridge.use_2fa == True:
563
+ if bridge.use_2fa is True:
566
564
  if bridge.token == "":
567
565
  raise ValueError("You must provide a 2FA Token if you are using 2FA.")
568
- elif bridge.token.startswith(("'", '"')) == False or bridge.token.endswith(("'", '"')) == False:
566
+ elif bridge.token.startswith(("'", '"')) is False or bridge.token.endswith(("'", '"')) is False:
569
567
  raise ValueError("2FA Token must be enclosed in quotes.")
570
568
  # Removed starting and ending quotes
571
569
  elif len(bridge.token) < 8:
@@ -29,7 +29,7 @@ class AMPControllerInstance(ADSModule, Core, EmailSenderPlugin, FileManagerPlugi
29
29
  self.module: str = "ADS"
30
30
 
31
31
  def __getattr__(self, name: str) -> Union[AttributeError, Any]:
32
- if name in [field.name for field in fields(class_or_instance=Controller)] and self._controller_exists == False:
32
+ if name in [field.name for field in fields(class_or_instance=Controller)] and self._controller_exists is False:
33
33
  raise AttributeError(
34
34
  f"'{type(self).__name__}' object has no attribute '{name}' | You must call <AMPControllerInstance>.get_instances() with 'format_data=True' to update this object."
35
35
  )
@@ -28,7 +28,6 @@ from .dataclass import (
28
28
  User,
29
29
  VersionInfo,
30
30
  )
31
- from .enums import *
32
31
  from .modules import TriggerID, UserApplicationData
33
32
  from .types_ import ActionSpec, APISpec, PermissionNode, ScheduleDataData, TriggersData
34
33
 
@@ -45,17 +44,10 @@ class Core(Base):
45
44
 
46
45
  Attributes
47
46
  -----------
48
- events: EventID
49
- You can access all the event IDs an instance has via this attribute. See :class:`EventID` for more information.
50
47
  triggers: :class:`TriggerID`
51
48
  You can access all the trigger IDs an instance has via this attribute. See :class:`TriggerID` for more information.
52
49
  """
53
50
 
54
- # TODO - Need to finish developing this attribute.
55
- @property
56
- def events(self) -> None:
57
- print()
58
-
59
51
  @property
60
52
  def triggers(self) -> TriggerID:
61
53
  try:
@@ -1111,7 +1103,7 @@ class Core(Base):
1111
1103
  if format_data is None:
1112
1104
  format_data = self.format_data
1113
1105
 
1114
- if format_data == False:
1106
+ if format_data is False:
1115
1107
  return result
1116
1108
 
1117
1109
  elif isinstance(result, list):
@@ -17,7 +17,7 @@ if TYPE_CHECKING:
17
17
 
18
18
  from typing_extensions import ParamSpec, Self, TypeVar
19
19
 
20
- from .types_ import Consumes, MCUserData, ParameterMapping, PermissionNode
20
+ from .types_ import MCUserData
21
21
 
22
22
  D = TypeVar("D", bound="Instance")
23
23
  T = ParamSpec("T")
@@ -2,7 +2,6 @@ from typing import Union
2
2
 
3
3
  from .base import Base
4
4
  from .dataclass import ActionResult
5
- from .enums import *
6
5
 
7
6
  __all__ = ("EmailSenderPlugin",)
8
7
 
@@ -4,7 +4,6 @@ from typing import Any, Union
4
4
 
5
5
  from .base import Base
6
6
  from .dataclass import ActionResult, Backup, RunningTask
7
- from .enums import *
8
7
 
9
8
  __all__ = ("LocalFileBackupPlugin",)
10
9
 
@@ -2,7 +2,6 @@ from typing import Any, Union
2
2
 
3
3
  from .base import Base
4
4
  from .dataclass import ActionResult, Directory, FileChunk
5
- from .enums import *
6
5
 
7
6
  __all__ = ("FileManagerPlugin",)
8
7
 
@@ -268,7 +267,7 @@ class FileManagerPlugin(Base):
268
267
  await self._connect()
269
268
  parameters: dict[str, str] = {"ArchivePath": self.sanitize_path(file_path)}
270
269
 
271
- if destination_path != None:
270
+ if destination_path is not None:
272
271
  parameters["DestinationPath"] = destination_path
273
272
 
274
273
  result: Any = await self._call_api(
@@ -366,7 +365,7 @@ class FileManagerPlugin(Base):
366
365
 
367
366
  await self._connect()
368
367
  parameters: dict[str, Any] = {"Filename": self.sanitize_path(file_path), "Offset": offset}
369
- if chunk_size != None:
368
+ if chunk_size is not None:
370
369
  parameters["ChunkSize"] = chunk_size
371
370
 
372
371
  result: Any = await self._call_api(
@@ -7,7 +7,6 @@ from .analytics import AnalyticsPlugin
7
7
  from .core import Core
8
8
  from .dataclass import ActionResult, Instance, InstanceStatus, Updates
9
9
  from .emailsender import EmailSenderPlugin
10
- from .enums import *
11
10
  from .filebackup import LocalFileBackupPlugin
12
11
  from .filemanager import FileManagerPlugin
13
12
  from .minecraft import MinecraftModule
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any, Union
5
5
 
6
6
  from .base import Base
7
7
  from .dataclass import ActionResult, BukkitPlugin, MCUser, OPList, OPWhitelist, RunningTask
8
- from .enums import *
8
+
9
9
 
10
10
  if TYPE_CHECKING:
11
11
  from collections.abc import Callable, Coroutine
@@ -108,6 +108,12 @@ class DeploymentTemplate:
108
108
 
109
109
 
110
110
  class TriggerID:
111
+ """
112
+ Used for a multitude of functions all related to Triggers and their IDs.
113
+
114
+ Simply access the respective attribute and the unique GUID for that :class:`AMPInstance` Trigger ID will be returned.
115
+ """
116
+
111
117
  a_backup_finishes_archiving: str
112
118
  a_backup_finishes_restoring: str
113
119
  a_backup_has_failed: str
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  import json
4
4
  import logging
5
5
  import traceback
6
- from collections import defaultdict
7
6
  from datetime import datetime
8
7
  from logging import Logger
9
8
  from pathlib import Path
@@ -20,18 +19,11 @@ if TYPE_CHECKING:
20
19
  from io import TextIOWrapper
21
20
 
22
21
  from .controller import AMPADSInstance, AMPControllerInstance, AMPInstance
23
- from .core import Core
24
- from .dataclass import Diagnostics, Methods, SettingSpec, SettingsSpecParent, Triggers, TriggerTasks
22
+ from .dataclass import Diagnostics, Methods, SettingSpec, SettingsSpecParent, Triggers
25
23
  from .types_ import (
26
24
  APISpec,
27
- APISPecEndpointData,
28
- APISpecEndpointParameters,
29
- Consumes,
30
- MethodsData,
31
- ParameterMapping,
32
25
  PermissionNode,
33
26
  ScheduleDataData,
34
- TriggersData,
35
27
  )
36
28
 
37
29
 
@@ -203,7 +195,7 @@ def _permission_node_parse(
203
195
  if _dir.exists():
204
196
  mode = "w"
205
197
 
206
- if file == None:
198
+ if file is None:
207
199
  file = Path.open(_dir, mode)
208
200
 
209
201
  if index == 0:
@@ -333,7 +325,7 @@ def _settings_node_parse(
333
325
  if _dir.exists():
334
326
  mode = "w"
335
327
 
336
- if file == None:
328
+ if file is None:
337
329
  file = Path.open(_dir, mode)
338
330
 
339
331
  if index == 0:
@@ -358,7 +350,7 @@ def _settings_node_parse(
358
350
  if isinstance(data_key, list):
359
351
  for entry in sorted(data_key):
360
352
  file.write(f"\n**Name**: {entry.name}\n")
361
- if entry.description != None and len(entry.description) > 0:
353
+ if entry.description is not None and len(entry.description) > 0:
362
354
  file.write(f"\t| Description: {str_sanitizer_sphinx(string=entry.description, special_chars=('*',))}\n")
363
355
  file.write(f"\t| Node: `{entry.node}`\n")
364
356
  file.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cc-ampapi
3
- Version: 0.0.0
3
+ Version: 1.0.7
4
4
  Summary: A Python wrapper for the AMP API by CubeCoders
5
5
  Author-email: k8thekat <Cadwalladerkatelynn+AMPAPI@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -685,6 +685,7 @@ License: GNU GENERAL PUBLIC LICENSE
685
685
 
686
686
  Project-URL: GitHub, https://github.com/k8thekat/AMPAPI_Python
687
687
  Project-URL: Changelog, https://github.com/k8thekat/AMPAPI_Python/blob/master/CHANGELOG.md
688
+ Keywords: cubecoders,cube coders,amp,api
688
689
  Classifier: Development Status :: 5 - Production/Stable
689
690
  Classifier: Intended Audience :: Developers
690
691
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=61.0"]
2
+ requires = ["setuptools>=61.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -8,8 +8,8 @@ dynamic = ["version"]
8
8
  authors = [
9
9
  { name = "k8thekat", email = "Cadwalladerkatelynn+AMPAPI@gmail.com" },
10
10
  ]
11
+ readme = { file = "README.txt", content-type = "text/markdown" }
11
12
  description = "A Python wrapper for the AMP API by CubeCoders"
12
- readme = { file = "README", content-type = "text/markdown" }
13
13
  requires-python = ">=3.10.0"
14
14
  license = { file = "LICENSE" }
15
15
  classifiers = [
@@ -27,24 +27,25 @@ classifiers = [
27
27
  "Topic :: Utilities",
28
28
  "Typing :: Typed",
29
29
  ]
30
-
30
+ keywords = ["cubecoders", "cube coders", "amp", "api"]
31
31
  [project.urls]
32
- GitHub = "https://github.com/k8thekat/AMPAPI_Python"
32
+ GitHub = "https://github.com/k8thekat/AMPAPI_Python"
33
33
  Changelog = "https://github.com/k8thekat/AMPAPI_Python/blob/master/CHANGELOG.md"
34
34
 
35
35
  [tool.setuptools.dynamic]
36
36
  dependencies = { file = "requirements.txt" }
37
+ version = { attr = "ampapi.__version__" }
37
38
 
38
39
  [tool.setuptools]
39
- packages = ["ampapi"]
40
+ packages = ["ampapi"]
40
41
  include-package-data = true
41
42
 
42
43
  [tool.ruff]
43
44
  target-version = "py310"
44
- line-length = 125
45
+ line-length = 125
46
+ exclude = ["docs/extensions/*.py"]
45
47
 
46
48
  [tool.ruff.lint]
47
- exclude = ["docs/extensions/*.py"]
48
49
  select = [
49
50
  "A",
50
51
  "C4",
@@ -54,7 +55,7 @@ select = [
54
55
  "PTH",
55
56
  "RUF",
56
57
  "SIM",
57
- "TCH",
58
+ "TC",
58
59
  "UP",
59
60
  "W",
60
61
  "PERF",
@@ -72,25 +73,25 @@ ignore = [
72
73
  "UP034",
73
74
  "UP038",
74
75
  "UP007",
75
- "ANN101",
76
- "ANN102",
76
+ #"ANN101",
77
+ #"ANN102",
77
78
  "ANN401",
78
79
  ]
79
80
 
80
81
  [tool.ruff.lint.isort]
81
82
  split-on-trailing-comma = false
82
- combine-as-imports = true
83
+ combine-as-imports = true
83
84
 
84
85
  [tool.ruff.lint.flake8-annotations]
85
86
  allow-star-arg-any = true
86
87
 
87
88
  [tool.ruff.lint.flake8-pytest-style]
88
- fixture-parentheses = false
89
- mark-parentheses = false
89
+ fixture-parentheses = false
90
+ mark-parentheses = false
90
91
  parametrize-names-type = "tuple"
91
92
 
92
93
  [tool.pyright]
93
- useLibraryCodeForTypes = true
94
- typeCheckingMode = "standard"
95
- pythonVersion = "3.10"
94
+ useLibraryCodeForTypes = true
95
+ typeCheckingMode = "standard"
96
+ pythonVersion = "3.10"
96
97
  reportIncompatibleMethodOverride = false
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes