c2cciutils 1.7.0.dev323__py3-none-any.whl → 1.7.0.dev326__py3-none-any.whl

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.

Potentially problematic release.


This version of c2cciutils might be problematic. Click here for more details.

c2cciutils/__init__.py CHANGED
@@ -22,7 +22,6 @@ def get_repository() -> str:
22
22
  """
23
23
  Get the current GitHub repository like `organization/project`.
24
24
  """
25
-
26
25
  if "GITHUB_REPOSITORY" in os.environ:
27
26
  return os.environ["GITHUB_REPOSITORY"]
28
27
 
@@ -47,7 +46,6 @@ def merge(default_config: Any, config: Any) -> Any:
47
46
  default_config: The default config that will be applied
48
47
  config: The base config, will be modified
49
48
  """
50
-
51
49
  if not isinstance(default_config, dict) or not isinstance(config, dict):
52
50
  return config
53
51
 
@@ -79,7 +77,6 @@ def get_config() -> c2cciutils.configuration.Configuration:
79
77
  """
80
78
  Get the configuration, with project and auto detections.
81
79
  """
82
-
83
80
  config: c2cciutils.configuration.Configuration = {}
84
81
  if os.path.exists("ci/config.yaml"):
85
82
  with open("ci/config.yaml", encoding="utf-8") as open_file:
@@ -279,7 +276,6 @@ def print_versions(config: c2cciutils.configuration.PrintVersions) -> bool:
279
276
  Arguments:
280
277
  config: The print configuration
281
278
  """
282
-
283
279
  for version in config.get("versions", c2cciutils.configuration.PRINT_VERSIONS_VERSIONS_DEFAULT):
284
280
  try:
285
281
  sys.stdout.flush()
@@ -383,7 +379,6 @@ def graphql(query_file: str, variables: dict[str, Any], default: Any = None) ->
383
379
  Return the data result
384
380
  In case of error it throw an exception
385
381
  """
386
-
387
382
  with open(os.path.join(os.path.dirname(__file__), query_file), encoding="utf-8") as query_open:
388
383
  query = query_open.read()
389
384
 
@@ -460,7 +455,6 @@ def get_branch(branch: Optional[str], master_branch: str = "master") -> str:
460
455
 
461
456
  Return the branch name
462
457
  """
463
-
464
458
  if branch is not None:
465
459
  return branch
466
460
  try:
@@ -573,7 +567,6 @@ def get_codespell_command(config: c2cciutils.configuration.Configuration, fix: b
573
567
 
574
568
  def snyk_exec() -> tuple[str, dict[str, str]]:
575
569
  """Get the Snyk cli executable path."""
576
-
577
570
  if not os.path.exists(os.path.join(os.path.dirname(__file__), "node_modules")):
578
571
  subprocess.run(["npm", "install"], cwd=os.path.dirname(__file__), check=True) # nosec
579
572
 
@@ -598,7 +591,6 @@ def create_pull_request_if_needed(
598
591
  """
599
592
  Create a pull request if there are changes.
600
593
  """
601
-
602
594
  if pull_request_extra_arguments is None:
603
595
  pull_request_extra_arguments = ["--fill"]
604
596
 
c2cciutils/audit.py CHANGED
@@ -7,8 +7,6 @@ import subprocess # nosec
7
7
  import sys
8
8
  from argparse import Namespace
9
9
 
10
- import security_md
11
-
12
10
  import c2cciutils
13
11
  import c2cciutils.configuration
14
12
 
@@ -160,6 +158,7 @@ def snyk(
160
158
  snyk_fix_message = snyk_fix_proc.stdout.strip()
161
159
  print("::endgroup::")
162
160
 
161
+ has_diff = False
163
162
  if not args.fix:
164
163
  current_branch = c2cciutils.get_branch(args.branch)
165
164
  fix_github_create_pull_request_arguments = config.get(
c2cciutils/env.py CHANGED
@@ -43,7 +43,6 @@ def print_environment_variables() -> None:
43
43
  """
44
44
  Print the environment variables.
45
45
  """
46
-
47
46
  for name, value in sorted(os.environ.items()):
48
47
  if name != "GITHUB_EVENT":
49
48
  print(f"{name}: {value}")
@@ -53,7 +52,6 @@ def print_github_event_file() -> None:
53
52
  """
54
53
  Print the GitHub event file.
55
54
  """
56
-
57
55
  if "GITHUB_EVENT_PATH" in os.environ:
58
56
  with open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8") as event:
59
57
  print(event.read())
@@ -63,7 +61,6 @@ def print_github_event_object() -> None:
63
61
  """
64
62
  Print the GitHub event object.
65
63
  """
66
-
67
64
  github_event = json.loads(os.environ["GITHUB_EVENT"])
68
65
  print(yaml.dump(github_event, indent=2))
69
66
 
@@ -72,7 +69,6 @@ def print_python_package_version() -> None:
72
69
  """
73
70
  Print the version of the Python packages.
74
71
  """
75
-
76
72
  subprocess.run(["python3", "-m", "pip", "freeze", "--all"]) # pylint: disable=subprocess-run-check
77
73
 
78
74
 
@@ -80,7 +76,6 @@ def print_node_package_version() -> None:
80
76
  """
81
77
  Print the version of the Python packages.
82
78
  """
83
-
84
79
  subprocess.run(["npm", "list", "--global"]) # pylint: disable=subprocess-run-check
85
80
 
86
81
 
@@ -88,13 +83,11 @@ def print_debian_package_version() -> None:
88
83
  """
89
84
  Print the version of the Python packages.
90
85
  """
91
-
92
86
  subprocess.run(["dpkg", "--list"]) # pylint: disable=subprocess-run-check
93
87
 
94
88
 
95
89
  def print_environment(config: c2cciutils.configuration.Configuration, prefix: str = "Print ") -> None:
96
90
  """Print the GitHub environment information."""
97
-
98
91
  functions = [
99
92
  (
100
93
  "version",
c2cciutils/lib/docker.py CHANGED
@@ -26,7 +26,6 @@ def get_dpkg_packages_versions(
26
26
  Where `debian_11` corresponds on last path element for 'Debian 11'
27
27
  from https://repology.org/repositories/statistics
28
28
  """
29
-
30
29
  dpkg_configuration = c2cciutils.get_config().get("dpkg", {})
31
30
 
32
31
  os_release = {}
@@ -127,7 +126,6 @@ def check_versions(
127
126
  The versions of packages in the image should be present in the config file.
128
127
  The versions of packages in the image shouldn't be older than the versions of the config file.
129
128
  """
130
-
131
129
  result, versions_image = get_dpkg_packages_versions(image, default_distribution, default_release)
132
130
  if not result:
133
131
  return False
c2cciutils/publish.py CHANGED
@@ -72,7 +72,7 @@ class GoogleCalendar:
72
72
  with open(self.credentials_pickle_file, "rb") as token:
73
73
  creds = pickle.load(token) # nosec
74
74
  # If there are no (valid) credentials available, let the user log in.
75
- if not creds or not creds.valid:
75
+ if not creds or not creds.valid: # pylint: disable=possibly-used-before-assignment
76
76
  if creds and creds.expired and creds.refresh_token:
77
77
  creds.refresh(Request()) # type: ignore
78
78
  else:
@@ -194,6 +194,9 @@ class GoogleCalendar:
194
194
  c2cciutils.gopass_put(secret, key)
195
195
 
196
196
  def __del__(self) -> None:
197
+ """
198
+ Delete the credentials file.
199
+ """
197
200
  if os.path.exists(self.credentials_pickle_file):
198
201
  os.remove(self.credentials_pickle_file)
199
202
 
@@ -228,7 +231,9 @@ def main_calendar() -> None:
228
231
  parser.print_help()
229
232
 
230
233
  if args.show_events_since:
231
- google_calendar.print_latest_events(args.show_events_since)
234
+ google_calendar.print_latest_events( # pylint: disable=possibly-used-before-assignment
235
+ args.show_events_since
236
+ )
232
237
 
233
238
  if args.refresh_gopass_credentials:
234
239
  google_calendar.save_credentials_to_gopass()
@@ -250,7 +255,6 @@ def pip(
250
255
  publish: If False only check the package
251
256
  package: The package configuration
252
257
  """
253
-
254
258
  print(f"::group::{'Publishing' if publish else 'Checking'} '{package.get('path')}' to pypi")
255
259
  sys.stdout.flush()
256
260
  sys.stderr.flush()
@@ -349,7 +353,6 @@ def docker(
349
353
  dst_tags: Publish using the provided tags
350
354
  images_full: The list of published images (with tag), used to build the dispatch event
351
355
  """
352
-
353
356
  print(
354
357
  f"::group::Publishing {image_config['name']} to the server {name} using the tags {', '.join(dst_tags)}"
355
358
  )
@@ -409,7 +412,6 @@ def helm(folder: str, version: str, owner: str, repo: str, commit_sha: str, toke
409
412
  commit_sha: The sha of the current commit
410
413
  token: The GitHub token
411
414
  """
412
-
413
415
  print(f"::group::Publishing Helm chart from '{folder}' to GitHub release")
414
416
  sys.stdout.flush()
415
417
  sys.stderr.flush()
@@ -25,7 +25,6 @@ def clean(image: str, tag: str, token: str) -> None:
25
25
  tag: The tag that should be deleted
26
26
  token: The token used to be authenticated on Docker hub
27
27
  """
28
-
29
28
  print(f"Delete image '{image}:{tag}'.")
30
29
 
31
30
  response = requests.head(
@@ -7,7 +7,6 @@ import c2cciutils.lib.docker
7
7
 
8
8
  def main() -> None:
9
9
  """Dump the actual versions of packages in image to file ci/dpkg-versions.yaml."""
10
-
11
10
  argparser = argparse.ArgumentParser(
12
11
  description="Dump the actual versions of packages in image to file ci/dpkg-versions.yaml."
13
12
  )
@@ -17,7 +17,6 @@ from c2cciutils import applications_definition
17
17
 
18
18
  def main() -> None:
19
19
  """Download applications from GitHub releases or any other URLs to the ~/.local/bin folder."""
20
-
21
20
  argparser = argparse.ArgumentParser(
22
21
  description="""Download applications from GitHub releases or any other URLs to the ~/.local/bin folder.
23
22
  Based on tow files, the first contains the information about from where to download the applications,
@@ -60,7 +59,6 @@ def download_applications(
60
59
  applications: applications_definition.ApplicationsConfiguration, versions: dict[str, str]
61
60
  ) -> None:
62
61
  """Download the versions of applications specified in the configuration."""
63
-
64
62
  bin_path = os.path.join(os.environ["HOME"], ".local", "bin")
65
63
  if not os.path.exists(bin_path):
66
64
  os.makedirs(bin_path)
@@ -63,7 +63,6 @@ def dispatch(repository: str, event_type: str, images_full: list[str]) -> None:
63
63
  """
64
64
  Trigger an image update on the argocd repository.
65
65
  """
66
-
67
66
  id_ = random.randint(1, 100000) # nosec
68
67
  print(f"Triggering {event_type}:{id_} on {repository} with {','.join(images_full)}")
69
68
 
@@ -14,7 +14,6 @@ import c2cciutils
14
14
 
15
15
  def main() -> None:
16
16
  """Create a new version with its stabilization branch."""
17
-
18
17
  args_parser = argparse.ArgumentParser(
19
18
  description="Create a new version with its stabilization branch",
20
19
  usage="""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cciutils
3
- Version: 1.7.0.dev323
3
+ Version: 1.7.0.dev326
4
4
  Summary: Common utilities for Camptocamp CI
5
5
  Home-page: https://github.com/camptocamp/c2cciutils
6
6
  License: FreeBSD
@@ -1,27 +1,27 @@
1
- c2cciutils/__init__.py,sha256=M6hqae9Eai2yB2dD4igKHktBJ5ZRqh6Cpv18fLP9Kzo,20992
1
+ c2cciutils/__init__.py,sha256=4t1pSEN4U7aByo9XncQxboIIfZoKHTGgzAVnEciEk7o,20984
2
2
  c2cciutils/applications-versions.yaml,sha256=Toxkfq4-WBUh91fKqmo5ntoE-6fPbceePoXMk1grXik,224
3
3
  c2cciutils/applications.yaml,sha256=yn0XRi08cS29A_jXPofcBPxsGBv7PEBliztjRC3WtfM,504
4
4
  c2cciutils/applications_definition.py,sha256=rOEZ3ISl5fUNDrow6H58Immy3KWJtWwGshicVDpnyNA,1321
5
- c2cciutils/audit.py,sha256=-WIinz3U6u3-JBQ2ltyuU95UWczLiwUyMuqHYczFKas,5571
5
+ c2cciutils/audit.py,sha256=1daWHdzQLJzHOu-79eRzDdwBYWG5MurK42raA37KTV0,5572
6
6
  c2cciutils/branches.graphql,sha256=UZrj1RO-H527M1SKqWm1VnkWtNsuKTnPTf4BCU2YcOU,358
7
7
  c2cciutils/commits.graphql,sha256=3HAuIEig5V7j1L-6mqBaOkiTD3Fb8_gl1ilpZjPJf74,308
8
8
  c2cciutils/configuration.py,sha256=yGv9L9OVAMb1Rnxt4NKf92pLNl7zHnbXeyUgKnhE2Vs,27857
9
9
  c2cciutils/default_branch.graphql,sha256=CaP3rRsNiyg_7RvqbMk0tOJr0aqWd8cOeSV-ZKgvKY4,131
10
- c2cciutils/env.py,sha256=J-lC7GdOkdFVIrWFZEkAxHmIuTYwhDJiE30BICj2UoM,3425
11
- c2cciutils/lib/docker.py,sha256=lwvCarwSSUWK1Y4O7qcTILPdpkTf2Ujhl_fCwZ6dBUY,5677
10
+ c2cciutils/env.py,sha256=fm_cMLKWM1fVvTWph2ikNyUPAaog0Am59DNzU68qkEI,3418
11
+ c2cciutils/lib/docker.py,sha256=d_YAUGCw2fXil7IaHFPxO3F_D5AWL4zz4gZj7M3fxj8,5675
12
12
  c2cciutils/lib/oidc.py,sha256=2UdalnADG173oSPwp1qqH7-w96AcUwT5A7vlll-RmZU,6229
13
13
  c2cciutils/package-lock.json,sha256=aLnN3q1ufs_2pn-Zy6_2v8wL09JT8MZzJidxJi8E9Lc,15611
14
14
  c2cciutils/package.json,sha256=A3gItP1CsTXzsMdigeCu3fNeltY08nYVs_LCU4B5PJs,134
15
15
  c2cciutils/pr_checks.py,sha256=tBwDHxThcu6648pE2cqpLNsaU711lwwgRc7sB4qR6fU,10109
16
- c2cciutils/publish.py,sha256=9L2R39DQ_c1SKt-tu2wf4mSxb4ntUKx8rB-JBy6ykyU,17094
16
+ c2cciutils/publish.py,sha256=k-POvs6oUMhkJPgf2PUbaMjGu3SCAYs4xh34cRqXwXE,17276
17
17
  c2cciutils/schema-applications.json,sha256=Tus-s9NB7uwKhTrQwhWQM4_oJygF_yHUqShtZhN1IxE,1551
18
18
  c2cciutils/schema.json,sha256=zKRqIjpNg6H2kvuixP64CK5CAJFhyu-_aUEub0_rAqc,22841
19
19
  c2cciutils/scripts/__init__.py,sha256=N4tcdvUifXQrK9vEvFWrGvoyY9oZ0uRcjb-FoYe41cc,36
20
20
  c2cciutils/scripts/audit.py,sha256=MUQqpA8CNkbSyK5e0HiSC5w-4GPKYEqFgV82lIwKkQk,1104
21
- c2cciutils/scripts/clean.py,sha256=tpyipZjqK7om9_dNiLxvz6-l6le7N0L03inkrKe7Y_A,3039
21
+ c2cciutils/scripts/clean.py,sha256=7_DWG8GjMiUsiv1RDgR_CR65p-aAXa3jEbrS5lYaqDw,3038
22
22
  c2cciutils/scripts/docker_logs.py,sha256=lcOLJzme0NpFQSqoz0cKL8Hqcr_7a3POh0hp8TKAh6A,1715
23
- c2cciutils/scripts/docker_versions_gen.py,sha256=M_VzKlhqsmUwd9GgPIU9EW6eCmMmytkJQEhOFjYVZl4,1316
24
- c2cciutils/scripts/download_applications.py,sha256=Lxnm2XJSfDtZc47xUtJQx52N2tIARYioTvPEXKOMMJ0,4490
23
+ c2cciutils/scripts/docker_versions_gen.py,sha256=yp1I_UqxyIABKxHek3q3UYWh0YR8tqKWzliC2kqZOa0,1315
24
+ c2cciutils/scripts/download_applications.py,sha256=x0SPm4MCWCIYMp1AWekIpbOicwUixitEAJ69quMq698,4488
25
25
  c2cciutils/scripts/env.py,sha256=4AmCZa2NPF1TaPrzpk5DnrCrMO_cWbFjKK3IM3XSg8s,375
26
26
  c2cciutils/scripts/k8s/__init__.py,sha256=ESPfnAzxPBK-TXColaFlz0OxAouX_fHV8MDamhVEsYw,69
27
27
  c2cciutils/scripts/k8s/db.py,sha256=GK1tzzyCqrCyIJzcBdIXjyNJUXrBPFNa-9fdtwxyrlU,3268
@@ -32,10 +32,10 @@ c2cciutils/scripts/main.py,sha256=ZksoYEDRJD0igEU6i0PnuOFtch4OzsxyHZQxbrjd5AY,10
32
32
  c2cciutils/scripts/pin_pipenv.py,sha256=jBTwlolcEL0MUyq6VYzO-adkcL1gqN7B3kBb3UjTo2k,2150
33
33
  c2cciutils/scripts/pr_checks.py,sha256=PA9z9QB81H2JhGSr4T02eoxyeWDjQZ4XoIKFzS5o5A0,2190
34
34
  c2cciutils/scripts/publish.py,sha256=lc75i0BP4zHKWqeWpseVY1-hO4mJVTy57zEOCmeideg,20422
35
- c2cciutils/scripts/trigger_image_update.py,sha256=UPCSgFcllewo1NOC7kUkJ2QMXU0dCA2QAq6LFQHr0Uw,2780
36
- c2cciutils/scripts/version.py,sha256=BU6I3nG3ofgUXCLrUBNOql45Dz9Loox4gt4ebHRM3iQ,8912
37
- c2cciutils-1.7.0.dev323.dist-info/LICENSE,sha256=EMCYfDu0AgsMQO6k8Hl_xHzoFxM0db1xu9n_asZW9Vc,1307
38
- c2cciutils-1.7.0.dev323.dist-info/METADATA,sha256=phV_6aDhIOtAxIfHblpeo_G5SkJCUmO3K2wXCp0lsOU,19200
39
- c2cciutils-1.7.0.dev323.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
40
- c2cciutils-1.7.0.dev323.dist-info/entry_points.txt,sha256=jPDp7KeB0Fz_TpOwbOODeW2WEcdLNJZACPtKpRqtHs4,1030
41
- c2cciutils-1.7.0.dev323.dist-info/RECORD,,
35
+ c2cciutils/scripts/trigger_image_update.py,sha256=cDNFVXH_t6CE4b-8l9dn6Ivqf0vhEspKaujrUQdOaIQ,2779
36
+ c2cciutils/scripts/version.py,sha256=BAhoEBr6pz8WJOf4SGSjP9DINIRhw7LVNr2h0aLJDOo,8911
37
+ c2cciutils-1.7.0.dev326.dist-info/LICENSE,sha256=EMCYfDu0AgsMQO6k8Hl_xHzoFxM0db1xu9n_asZW9Vc,1307
38
+ c2cciutils-1.7.0.dev326.dist-info/METADATA,sha256=PpQCxb7zSYo0nVbH35Dv6uwTRgo5D8Ye1kF-Fa4AXa0,19200
39
+ c2cciutils-1.7.0.dev326.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
40
+ c2cciutils-1.7.0.dev326.dist-info/entry_points.txt,sha256=jPDp7KeB0Fz_TpOwbOODeW2WEcdLNJZACPtKpRqtHs4,1030
41
+ c2cciutils-1.7.0.dev326.dist-info/RECORD,,