skylos 2.2.2__py3-none-any.whl → 2.2.3__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 skylos might be problematic. Click here for more details.

skylos/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2.2.2"
1
+ __version__ = "2.2.3"
2
2
 
3
3
  def analyze(*args, **kwargs):
4
4
  from .analyzer import analyze as _analyze
skylos/codemods.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
  import libcst as cst
3
3
  from libcst.metadata import PositionProvider
4
+ from libcst.helpers import get_full_name_for_node
4
5
 
5
6
  class _CommentOutBlock(cst.CSTTransformer):
6
7
 
@@ -31,14 +32,16 @@ class _CommentOutFunctionAtLine(_CommentOutBlock):
31
32
  return pos and pos.start.line == self.target_line
32
33
 
33
34
  def leave_FunctionDef(self, orig: cst.FunctionDef, updated: cst.FunctionDef):
34
- if self._is_target(orig) and (orig.name.value == self.func_name):
35
+ target = self.func_name.split(".")[-1]
36
+ if self._is_target(orig) and (orig.name.value == target):
35
37
  self.changed = True
36
38
  pos = self.get_metadata(PositionProvider, orig)
37
39
  return cst.FlattenSentinel(self._comment_block(pos.start.line, pos.end.line))
38
40
  return updated
39
41
 
40
42
  def leave_AsyncFunctionDef(self, orig: cst.AsyncFunctionDef, updated: cst.AsyncFunctionDef):
41
- if self._is_target(orig) and (orig.name.value == self.func_name):
43
+ target = self.func_name.split(".")[-1]
44
+ if self._is_target(orig) and (orig.name.value == target):
42
45
  self.changed = True
43
46
  pos = self.get_metadata(PositionProvider, orig)
44
47
  return cst.FlattenSentinel(self._comment_block(pos.start.line, pos.end.line))
@@ -73,7 +76,9 @@ class _CommentOutImportAtLine(_CommentOutBlock):
73
76
  removed_for_comment= []
74
77
  for alias in list(aliases):
75
78
  bound = _bound_name_for_import_alias(alias)
76
- if bound == self.target_name:
79
+ name_code = get_full_name_for_node(alias.name)
80
+ tail = name_code.split(".")[-1]
81
+ if self.target_name in (bound, tail):
77
82
  self.changed = True
78
83
  removed_for_comment.append(self._render_single_alias_text(head, alias, is_from))
79
84
  else:
@@ -175,7 +180,9 @@ class _RemoveImportAtLine(cst.CSTTransformer):
175
180
  kept = []
176
181
  for alias in aliases:
177
182
  bound = _bound_name_for_import_alias(alias)
178
- if bound == self.target_name:
183
+ name_code = get_full_name_for_node(alias.name) or ""
184
+ tail = name_code.split(".")[-1]
185
+ if self.target_name in (bound, tail):
179
186
  self.changed = True
180
187
  continue
181
188
  kept.append(alias)
@@ -213,13 +220,15 @@ class _RemoveFunctionAtLine(cst.CSTTransformer):
213
220
  return pos and pos.start.line == self.target_line
214
221
 
215
222
  def leave_FunctionDef(self, orig: cst.FunctionDef, updated: cst.FunctionDef):
216
- if self._is_target(orig) and (orig.name.value == self.func_name):
223
+ target = self.func_name.split(".")[-1]
224
+ if self._is_target(orig) and (orig.name.value == target):
217
225
  self.changed = True
218
226
  return cst.RemoveFromParent()
219
227
  return updated
220
228
 
221
229
  def leave_AsyncFunctionDef(self, orig: cst.AsyncFunctionDef, updated: cst.AsyncFunctionDef):
222
- if self._is_target(orig) and (orig.name.value == self.func_name):
230
+ target = self.func_name.split(".")[-1]
231
+ if self._is_target(orig) and (orig.name.value == target):
223
232
  self.changed = True
224
233
  return cst.RemoveFromParent()
225
234
 
skylos/rules/secrets.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
  import re, ast
3
3
  from math import log2
4
- from typing import Dict, Any, Iterable, List, Optional
5
4
 
6
5
  __all__ = ["scan_ctx"]
7
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: skylos
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: A static analysis tool for Python codebases
5
5
  Author-email: oha <aaronoh2015@gmail.com>
6
6
  Requires-Python: >=3.9
@@ -1,12 +1,12 @@
1
- skylos/__init__.py,sha256=C4oz_FAjQTq_0XiSSxpDnngdL9YlWLpuam7NNvB_vPs,229
1
+ skylos/__init__.py,sha256=cFxP_uUY-acB9iRs7SE3ccyWiX6v8mI-mJo9bfhC2aU,229
2
2
  skylos/analyzer.py,sha256=G_8pw7GmChATc5h5XXij2pcHirhh_5G9Y8dlAC1dx38,16735
3
3
  skylos/cli.py,sha256=DOV6nwPbi5zh-OJ3wXjIaPxCfXRtiPMNqo9Zp2nvDBA,19475
4
- skylos/codemods.py,sha256=QdOwtbE2PpLsgCqpeScFg-pCfcpfHw9hFu-0WKKKBQg,9084
4
+ skylos/codemods.py,sha256=-1ehjFLc1MmtK3inoSZF_RyBNWF7XZSOq2KH5_MDzuA,9519
5
5
  skylos/constants.py,sha256=kU-2FKQAV-ju4rYw62Tw25uRvqauzjZFUqtvGWaI6Es,1571
6
6
  skylos/server.py,sha256=oHuevjdDFvJVbvpTtCDjSLOJ6Zy1jL4BYLYV4VFNMXs,15903
7
7
  skylos/visitor.py,sha256=o_2JxjXKXAcWLQr8nmoatGAz2EhBk225qE_piHf3hDg,20458
8
8
  skylos/rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- skylos/rules/secrets.py,sha256=FD7cXZ4_Zfg_Si1qFXLVK-5OIX1HXtCr_yJM0OlRsbI,9425
9
+ skylos/rules/secrets.py,sha256=_cvi-NETScQWMPexb8R2_QtgTRMQGbb09BT1Os246DA,9370
10
10
  skylos/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  skylos/visitors/framework_aware.py,sha256=eX4oU0jQwDWejkkW4kjRNctre27sVLHK1CTDDiqPqRw,13054
12
12
  skylos/visitors/test_aware.py,sha256=kxYoMG2m02kbMlxtFOM-MWJO8qqxHviP9HgAMbKRfvU,2304
@@ -33,8 +33,8 @@ test/sample_repo/sample_repo/commands.py,sha256=b6gQ9YDabt2yyfqGbOpLo0osF7wya8O4
33
33
  test/sample_repo/sample_repo/models.py,sha256=xXIg3pToEZwKuUCmKX2vTlCF_VeFA0yZlvlBVPIy5Qw,3320
34
34
  test/sample_repo/sample_repo/routes.py,sha256=8yITrt55BwS01G7nWdESdx8LuxmReqop1zrGUKPeLi8,2475
35
35
  test/sample_repo/sample_repo/utils.py,sha256=S56hEYh8wkzwsD260MvQcmUFOkw2EjFU27nMLFE6G2k,1103
36
- skylos-2.2.2.dist-info/METADATA,sha256=LfA3i21DFqm9HGGJLXEkSwkK1Adv-58LPnIAmwguvwQ,314
37
- skylos-2.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- skylos-2.2.2.dist-info/entry_points.txt,sha256=zzRpN2ByznlQoLeuLolS_TFNYSQxUGBL1EXQsAd6bIA,43
39
- skylos-2.2.2.dist-info/top_level.txt,sha256=f8GA_7KwfaEopPMP8-EXDQXaqd4IbsOQPakZy01LkdQ,12
40
- skylos-2.2.2.dist-info/RECORD,,
36
+ skylos-2.2.3.dist-info/METADATA,sha256=ug19tHc6winuwwnlmWqv87j18KfrnAKs14KvFRA-ivo,314
37
+ skylos-2.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ skylos-2.2.3.dist-info/entry_points.txt,sha256=zzRpN2ByznlQoLeuLolS_TFNYSQxUGBL1EXQsAd6bIA,43
39
+ skylos-2.2.3.dist-info/top_level.txt,sha256=f8GA_7KwfaEopPMP8-EXDQXaqd4IbsOQPakZy01LkdQ,12
40
+ skylos-2.2.3.dist-info/RECORD,,
File without changes