chore: apply pep8-naming rules for naming convention (#8261)
This commit is contained in:
parent
53f37a6704
commit
292220c596
95 changed files with 287 additions and 258 deletions
|
|
@ -31,7 +31,7 @@ from Crypto.Util.py3compat import _copy_bytes, bord
|
|||
from Crypto.Util.strxor import strxor
|
||||
|
||||
|
||||
class PKCS1OAEP_Cipher:
|
||||
class PKCS1OAepCipher:
|
||||
"""Cipher object for PKCS#1 v1.5 OAEP.
|
||||
Do not create directly: use :func:`new` instead."""
|
||||
|
||||
|
|
@ -237,4 +237,4 @@ def new(key, hashAlgo=None, mgfunc=None, label=b"", randfunc=None):
|
|||
|
||||
if randfunc is None:
|
||||
randfunc = Random.get_random_bytes
|
||||
return PKCS1OAEP_Cipher(key, hashAlgo, mgfunc, label, randfunc)
|
||||
return PKCS1OAepCipher(key, hashAlgo, mgfunc, label, randfunc)
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ def timestamp_value(timestamp):
|
|||
raise ValueError(error)
|
||||
|
||||
|
||||
class str_len:
|
||||
class StrLen:
|
||||
"""Restrict input to an integer in a range (inclusive)"""
|
||||
|
||||
def __init__(self, max_length, argument="argument"):
|
||||
|
|
@ -102,7 +102,7 @@ class str_len:
|
|||
return value
|
||||
|
||||
|
||||
class float_range:
|
||||
class FloatRange:
|
||||
"""Restrict input to an float in a range (inclusive)"""
|
||||
|
||||
def __init__(self, low, high, argument="argument"):
|
||||
|
|
@ -121,7 +121,7 @@ class float_range:
|
|||
return value
|
||||
|
||||
|
||||
class datetime_string:
|
||||
class DatetimeString:
|
||||
def __init__(self, format, argument="argument"):
|
||||
self.format = format
|
||||
self.argument = argument
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
|
||||
from core.llm_generator.output_parser.errors import OutputParserException
|
||||
from core.llm_generator.output_parser.errors import OutputParserError
|
||||
|
||||
|
||||
def parse_json_markdown(json_string: str) -> dict:
|
||||
|
|
@ -33,10 +33,10 @@ def parse_and_check_json_markdown(text: str, expected_keys: list[str]) -> dict:
|
|||
try:
|
||||
json_obj = parse_json_markdown(text)
|
||||
except json.JSONDecodeError as e:
|
||||
raise OutputParserException(f"Got invalid JSON object. Error: {e}")
|
||||
raise OutputParserError(f"Got invalid JSON object. Error: {e}")
|
||||
for key in expected_keys:
|
||||
if key not in json_obj:
|
||||
raise OutputParserException(
|
||||
raise OutputParserError(
|
||||
f"Got invalid return object. Expected key `{key}` " f"to be present, but got {json_obj}"
|
||||
)
|
||||
return json_obj
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue