stackit-core 0.0.1a2__tar.gz → 0.1.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stackit-core
3
- Version: 0.0.1a2
3
+ Version: 0.1.0
4
4
  Summary: Core functionality for the STACKIT SDK for Python
5
5
  Author: STACKIT Developer Tools
6
6
  Author-email: developer-tools@stackit.cloud
@@ -1,19 +1,15 @@
1
1
  [tool.poetry]
2
2
  name = "stackit-core"
3
- version = "v0.0.1a2"
4
- authors = [
5
- "STACKIT Developer Tools <developer-tools@stackit.cloud>",
6
- ]
3
+ version = "v0.1.0"
4
+ authors = ["STACKIT Developer Tools <developer-tools@stackit.cloud>"]
7
5
  description = "Core functionality for the STACKIT SDK for Python"
8
6
  readme = "README.md"
9
7
  classifiers = [
10
- "Programming Language :: Python :: 3",
11
- "License :: OSI Approved :: Apache Software License",
12
- "Operating System :: OS Independent",
13
- ]
14
- packages = [
15
- { include = "stackit", from="src" }
8
+ "Programming Language :: Python :: 3",
9
+ "License :: OSI Approved :: Apache Software License",
10
+ "Operating System :: OS Independent",
16
11
  ]
12
+ packages = [{ include = "stackit", from = "src" }]
17
13
 
18
14
 
19
15
  [tool.poetry.dependencies]
@@ -29,8 +25,8 @@ requests = ">=2.32.3"
29
25
  black = ">=24.8.0"
30
26
  pytest = ">=8.3.3"
31
27
  flake8 = [
32
- { version= ">=5.0.3", python="<3.12"},
33
- { version= ">=6.0.1", python=">=3.12"}
28
+ { version = ">=5.0.3", python = "<3.12" },
29
+ { version = ">=6.0.1", python = ">=3.12" },
34
30
  ]
35
31
  flake8-black = ">=0.3.6"
36
32
  flake8-pyproject = ">=1.2.3"
@@ -51,12 +47,8 @@ requires = ["setuptools", "poetry-core"]
51
47
  build-backend = "poetry.core.masonry.api"
52
48
 
53
49
  [tool.pytest.ini_options]
54
- pythonpath = [
55
- "src"
56
- ]
57
- testpaths = [
58
- "tests"
59
- ]
50
+ pythonpath = ["src"]
51
+ testpaths = ["tests"]
60
52
 
61
53
  [tool.black]
62
54
  line-length = 120
@@ -83,7 +75,20 @@ exclude = """
83
75
  profile = 'black'
84
76
 
85
77
  [tool.flake8]
86
- exclude= [".eggs", ".git", ".hg", ".mypy_cache", ".tox", ".venv", ".devcontainer", "venv", "_build", "buck-out", "build", "dist"]
78
+ exclude = [
79
+ ".eggs",
80
+ ".git",
81
+ ".hg",
82
+ ".mypy_cache",
83
+ ".tox",
84
+ ".venv",
85
+ ".devcontainer",
86
+ "venv",
87
+ "_build",
88
+ "buck-out",
89
+ "build",
90
+ "dist",
91
+ ]
87
92
  statistics = true
88
93
  show-source = false
89
94
  max-line-length = 120
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from dataclasses import dataclass
3
3
  from pathlib import Path
4
- from typing import Any, Optional
4
+ from typing import Optional
5
5
 
6
6
  from requests.auth import AuthBase
7
7
 
@@ -22,6 +22,7 @@ class Credentials:
22
22
  STACKIT_SERVICE_ACCOUNT_TOKEN: str = None,
23
23
  STACKIT_SERVICE_ACCOUNT_KEY_PATH: str = None,
24
24
  STACKIT_PRIVATE_KEY_PATH: str = None,
25
+ **kwargs,
25
26
  ):
26
27
  self.service_account_mail = STACKIT_SERVICE_ACCOUNT_EMAIL
27
28
  self.service_account_token = STACKIT_SERVICE_ACCOUNT_TOKEN
@@ -29,10 +30,6 @@ class Credentials:
29
30
  self.private_key_path = STACKIT_PRIVATE_KEY_PATH
30
31
 
31
32
 
32
- def either_this_or_that(this: Any, that: Any) -> Optional[Any]:
33
- return this if this else that
34
-
35
-
36
33
  class Authorization:
37
34
  DEFAULT_CREDENTIALS_FILE_PATH = ".stackit/credentials.json"
38
35
  service_account_mail: Optional[str] = None
@@ -45,16 +42,26 @@ class Authorization:
45
42
 
46
43
  def __init__(self, configuration: Configuration):
47
44
  credentials = self.__read_credentials_file(configuration.credentials_file_path)
48
- self.service_account_mail = either_this_or_that(
49
- configuration.service_account_mail, credentials.service_account_mail
45
+ self.service_account_mail = (
46
+ configuration.service_account_mail
47
+ if configuration.service_account_mail is not None
48
+ else credentials.service_account_mail
49
+ )
50
+ self.service_account_token = (
51
+ configuration.service_account_token
52
+ if configuration.service_account_token is not None
53
+ else credentials.service_account_token
50
54
  )
51
- self.service_account_token = either_this_or_that(
52
- configuration.service_account_token, credentials.service_account_token
55
+ self.service_account_key_path = (
56
+ configuration.service_account_key_path
57
+ if configuration.service_account_key_path is not None
58
+ else credentials.service_account_key_path
53
59
  )
54
- self.service_account_key_path = either_this_or_that(
55
- configuration.service_account_key_path, credentials.service_account_key_path
60
+ self.private_key_path = (
61
+ configuration.private_key_path
62
+ if configuration.private_key_path is not None
63
+ else credentials.private_key_path
56
64
  )
57
- self.private_key_path = either_this_or_that(configuration.private_key_path, credentials.private_key_path)
58
65
  self.auth_method = configuration.custom_auth
59
66
  self.token_endpoint = configuration.token_endpoint
60
67
  self.__read_keys()
File without changes
File without changes