Skip to content

Commit 0b6609d

Browse files
committed
Used json for non-JSON5 files in data.json.read() for improved speed
1 parent 2f3c593 commit 0b6609d

15 files changed

Lines changed: 15 additions & 15 deletions

File tree

  • computer-languages/utils/lib/data
  • data-languages/utils/lib/data
  • find-project-root/utils/lib/data
  • get-min-py/src/get_min_py/cli/lib/data
  • is-legacy-terminal/src/is_legacy_terminal/cli/lib/data
  • is-unicode-supported/src/is_unicode_supported/cli/lib/data
  • latin-locales/utils/lib/data
  • markup-languages/utils/lib/data
  • non-latin-locales/utils/lib/data
  • programming-languages/utils/lib/data
  • project-markers/utils/lib/data
  • prose-languages/utils/lib/data
  • remove-json-keys/src/remove_json_keys/cli/lib/data
  • sys-lang/src/sys_lang/cli/lib/data
  • translate-messages/src/translate_messages/cli/lib/data

computer-languages/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

data-languages/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

find-project-root/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

get-min-py/src/get_min_py/cli/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

is-legacy-terminal/src/is_legacy_terminal/cli/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

is-unicode-supported/src/is_unicode_supported/cli/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

latin-locales/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

markup-languages/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

non-latin-locales/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

programming-languages/utils/lib/data/json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(input: Union[Path, str], encoding: str = 'utf-8') -> Any:
3131
input_str = str(input)
3232
if input_str.endswith(('.json', '.json5')):
3333
with open(input_str, 'r', encoding=encoding) as file:
34-
return json5.load(file)
34+
return (json5 if input_str.endswith('.json5') else json).load(file)
3535
else : return json5.loads(input_str)
3636

3737
def write(file_path: Union[Path, str], data: Any, encoding: str = 'utf-8', ensure_ascii: bool = False,

0 commit comments

Comments
 (0)