Skip to content

Commit

Permalink
πŸ“… Commit Fri, 16 Apr 2021 16:18:54
Browse files Browse the repository at this point in the history
πŸš€ 3.0.1
πŸ”οΈ better types
  • Loading branch information
securisec committed Apr 16, 2021
1 parent dfc3dee commit 96106de
Show file tree
Hide file tree
Showing 34 changed files with 777 additions and 674 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tests_multi_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
pip install .
pytest --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
- name: Test plugins ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
Expand All @@ -62,6 +63,7 @@ jobs:
pip install .
pytest --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
- name: Test plugins windows
if: matrix.os == 'windows-latest'
run: |
Expand All @@ -76,7 +78,7 @@ jobs:
bandit --recursive chepy/ --ignore-nosec --skip B101,B413,B303,B310,B112,B304,B320,B410,B404
- name: Test docs
if: ${{ !env.ACT }}
if: ${{ !env.ACT }} && contains(matrix.os, 'ubuntu')
run: |
make -C docs/ clean html
Expand Down
2 changes: 1 addition & 1 deletion chepy/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "3.0.0" # pragma: no cover
__version__ = "3.0.1" # pragma: no cover
__author__ = "Hapsida @securisec" # pragma: no cover
22 changes: 13 additions & 9 deletions chepy/modules/aritmeticlogic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import binascii
import statistics
from typing import TypeVar

from ..core import ChepyCore, ChepyDecorators
from .exceptions import StateNotList


AritmeticLogicT = TypeVar("AritmeticLogicT", bound="AritmeticLogic")


class AritmeticLogic(ChepyCore):
def __init__(self, *data):
super().__init__(*data)
Expand All @@ -16,7 +20,7 @@ def __hex_to_int(self, n): # pragma: no cover
return n

@ChepyDecorators.call_stack
def str_bit_shift_right(self, amount: int):
def str_bit_shift_right(self, amount: int) -> AritmeticLogicT:
"""Bit shift string right
Args:
Expand All @@ -31,7 +35,7 @@ def str_bit_shift_right(self, amount: int):
return self

@ChepyDecorators.call_stack
def add(self, n: int):
def add(self, n: int) -> AritmeticLogicT:
"""Add a number to the state
Args:
Expand All @@ -46,7 +50,7 @@ def add(self, n: int):
return self

@ChepyDecorators.call_stack
def subtract(self, n: int):
def subtract(self, n: int) -> AritmeticLogicT:
"""Subtract a number to the state
Args:
Expand All @@ -61,7 +65,7 @@ def subtract(self, n: int):
return self

@ChepyDecorators.call_stack
def multiply(self, n: int):
def multiply(self, n: int) -> AritmeticLogicT:
"""Multiply a number to the state
Args:
Expand All @@ -76,7 +80,7 @@ def multiply(self, n: int):
return self

@ChepyDecorators.call_stack
def divide(self, n: int):
def divide(self, n: int) -> AritmeticLogicT:
"""Divide a number to the state
Args:
Expand All @@ -91,7 +95,7 @@ def divide(self, n: int):
return self

@ChepyDecorators.call_stack
def power(self, n: int):
def power(self, n: int) -> AritmeticLogicT:
"""Convert state to the n power of
Args:
Expand All @@ -106,7 +110,7 @@ def power(self, n: int):
return self

@ChepyDecorators.call_stack
def sum(self):
def sum(self) -> AritmeticLogicT:
"""Calculate the sum of the state
Returns:
Expand All @@ -118,7 +122,7 @@ def sum(self):
return self

@ChepyDecorators.call_stack
def mean(self):
def mean(self) -> AritmeticLogicT:
"""Calculate the mean of the state
Returns:
Expand All @@ -130,7 +134,7 @@ def mean(self):
return self

@ChepyDecorators.call_stack
def median(self):
def median(self) -> AritmeticLogicT:
"""Calculate the median of the state
Returns:
Expand Down
22 changes: 12 additions & 10 deletions chepy/modules/aritmeticlogic.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from ..core import ChepyCore as ChepyCore, ChepyDecorators as ChepyDecorators
from .exceptions import StateNotList as StateNotList
from typing import Any
from typing import Any, TypeVar

AritmeticLogicT = TypeVar('AritmeticLogicT', bound='AritmeticLogic')

class AritmeticLogic(ChepyCore):
def __init__(self, *data: Any) -> None: ...
state: Any = ...
def str_bit_shift_right(self, amount: int) -> Any: ...
def add(self, n: int) -> Any: ...
def subtract(self, n: int) -> Any: ...
def multiply(self, n: int) -> Any: ...
def divide(self, n: int) -> Any: ...
def power(self, n: int) -> Any: ...
def sum(self): ...
def mean(self): ...
def median(self): ...
def str_bit_shift_right(self, amount: int) -> AritmeticLogicT: ...
def add(self, n: int) -> AritmeticLogicT: ...
def subtract(self, n: int) -> AritmeticLogicT: ...
def multiply(self, n: int) -> AritmeticLogicT: ...
def divide(self, n: int) -> AritmeticLogicT: ...
def power(self, n: int) -> AritmeticLogicT: ...
def sum(self) -> AritmeticLogicT: ...
def mean(self) -> AritmeticLogicT: ...
def median(self) -> AritmeticLogicT: ...
27 changes: 15 additions & 12 deletions chepy/modules/codetidy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import TypeVar
import lazy_import

import ujson
Expand All @@ -8,13 +9,15 @@
from lxml import etree
from ..core import ChepyCore, ChepyDecorators

CodeTidyT = TypeVar("CodeTidyT", bound="CodeTidy")


class CodeTidy(ChepyCore):
def __init__(self, *data):
super().__init__(*data)

@ChepyDecorators.call_stack
def minify_json(self):
def minify_json(self) -> CodeTidyT:
"""Minify JSON string
Returns:
Expand All @@ -28,7 +31,7 @@ def minify_json(self):
return self

@ChepyDecorators.call_stack
def beautify_json(self, indent: int = 2):
def beautify_json(self, indent: int = 2) -> CodeTidyT:
"""Beautify minified JSON
Args:
Expand All @@ -45,7 +48,7 @@ def beautify_json(self, indent: int = 2):
return self

@ChepyDecorators.call_stack
def minify_xml(self):
def minify_xml(self) -> CodeTidyT:
"""Minify XML string
Returns:
Expand All @@ -62,7 +65,7 @@ def minify_xml(self):
return self

@ChepyDecorators.call_stack
def beautify_xml(self):
def beautify_xml(self) -> CodeTidyT:
"""Beautify compressed XML
Returns:
Expand All @@ -78,7 +81,7 @@ def beautify_xml(self):
return self

@ChepyDecorators.call_stack
def php_deserialize(self):
def php_deserialize(self) -> CodeTidyT:
"""Deserialize php to dict
Deserializes PHP serialized data, outputting keyed arrays as a python dict.
Expand All @@ -95,7 +98,7 @@ def php_deserialize(self):
return self

@ChepyDecorators.call_stack
def to_upper_case(self, by: str = "all"):
def to_upper_case(self, by: str = "all") -> CodeTidyT:
"""Convert string to uppercase
Args:
Expand Down Expand Up @@ -134,7 +137,7 @@ def to_upper_case(self, by: str = "all"):
return self

@ChepyDecorators.call_stack
def to_lower_case(self):
def to_lower_case(self) -> CodeTidyT:
"""Convert string to lowercase
Converts every character in the input to lower case.
Expand All @@ -150,7 +153,7 @@ def to_lower_case(self):
return self

@ChepyDecorators.call_stack
def to_snake_case(self):
def to_snake_case(self) -> CodeTidyT:
"""Convert string to snake case
Converts the input string to snake case. Snake case is all lower case
Expand All @@ -168,7 +171,7 @@ def to_snake_case(self):
return self

@ChepyDecorators.call_stack
def to_camel_case(self, ignore_space: bool = False):
def to_camel_case(self, ignore_space: bool = False) -> CodeTidyT:
"""Convert string to camel case
Converts the input string to camel case. Camel case is all lower case
Expand Down Expand Up @@ -196,7 +199,7 @@ def to_camel_case(self, ignore_space: bool = False):
return self

@ChepyDecorators.call_stack
def to_kebab_case(self):
def to_kebab_case(self) -> CodeTidyT:
"""Convert string to kebab case
Converts the input string to kebab case. Kebab case is all lower case
Expand All @@ -213,7 +216,7 @@ def to_kebab_case(self):
return self

@ChepyDecorators.call_stack
def swap_case(self):
def swap_case(self) -> CodeTidyT:
"""Swap case in a string
Returns:
Expand All @@ -227,7 +230,7 @@ def swap_case(self):
return self

@ChepyDecorators.call_stack
def to_leetspeak(self, special_chars: bool = True):
def to_leetspeak(self, special_chars: bool = True) -> CodeTidyT:
"""Convert string to l33t speak
Args:
Expand Down
27 changes: 14 additions & 13 deletions chepy/modules/codetidy.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
from ..core import ChepyCore as ChepyCore, ChepyDecorators as ChepyDecorators
from typing import Any
from typing import Any, TypeVar

pydash: Any
CodeTidyT = TypeVar('CodeTidyT', bound='CodeTidy')

class CodeTidy(ChepyCore):
def __init__(self, *data: Any) -> None: ...
state: Any = ...
def minify_json(self): ...
def beautify_json(self, indent: int=...) -> Any: ...
def minify_xml(self): ...
def beautify_xml(self): ...
def php_deserialize(self): ...
def to_upper_case(self, by: str=...) -> Any: ...
def to_lower_case(self): ...
def to_snake_case(self): ...
def to_camel_case(self, ignore_space: bool=...) -> Any: ...
def to_kebab_case(self): ...
def swap_case(self): ...
def to_leetspeak(self, special_chars: bool=...) -> Any: ...
def minify_json(self) -> CodeTidyT: ...
def beautify_json(self, indent: int=...) -> CodeTidyT: ...
def minify_xml(self) -> CodeTidyT: ...
def beautify_xml(self) -> CodeTidyT: ...
def php_deserialize(self) -> CodeTidyT: ...
def to_upper_case(self, by: str=...) -> CodeTidyT: ...
def to_lower_case(self) -> CodeTidyT: ...
def to_snake_case(self) -> CodeTidyT: ...
def to_camel_case(self, ignore_space: bool=...) -> CodeTidyT: ...
def to_kebab_case(self) -> CodeTidyT: ...
def swap_case(self) -> CodeTidyT: ...
def to_leetspeak(self, special_chars: bool=...) -> CodeTidyT: ...

0 comments on commit 96106de

Please sign in to comment.