Skip to content

Commit c263e9f

Browse files
Updated encoding to utf-8 (#82)
* Updated encoding to utf-8 * bumped version
1 parent 989840f commit c263e9f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

polyapi/generate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,20 +503,20 @@ def add_function_file(
503503
# Read current __init__.py content if it exists
504504
init_content = ""
505505
if os.path.exists(init_path):
506-
with open(init_path, "r") as f:
506+
with open(init_path, "r", encoding='utf-8') as f:
507507
init_content = f.read()
508508

509509
# Prepare new content to append to __init__.py
510510
new_init_content = init_content + f"\n\nfrom . import {func_namespace}\n\n{func_str}"
511511

512512
# Use temporary files for atomic writes
513513
# Write to __init__.py atomically
514-
with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp") as temp_init:
514+
with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp", encoding='utf-8') as temp_init:
515515
temp_init.write(new_init_content)
516516
temp_init_path = temp_init.name
517517

518518
# Write to function file atomically
519-
with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp") as temp_func:
519+
with tempfile.NamedTemporaryFile(mode="w", delete=False, dir=full_path, suffix=".tmp", encoding='utf-8') as temp_func:
520520
temp_func.write(func_type_defs)
521521
temp_func_path = temp_func.name
522522

polyapi/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def init_the_init(full_path: str, code_imports: Optional[str] = None) -> None:
2424
if not os.path.exists(init_path):
2525
if code_imports is None:
2626
code_imports = CODE_IMPORTS
27-
with open(init_path, "w") as f:
27+
with open(init_path, "w", encoding='utf-8') as f:
2828
f.write(code_imports)
2929

3030

@@ -33,7 +33,7 @@ def add_import_to_init(full_path: str, next: str, code_imports: Optional[str] =
3333
init_the_init(full_path, code_imports=code_imports)
3434

3535
init_path = os.path.join(full_path, "__init__.py")
36-
with open(init_path, "a+") as f:
36+
with open(init_path, "a+", encoding='utf-8') as f:
3737
import_stmt = "from . import {}\n".format(next)
3838
f.seek(0)
3939
lines = f.readlines()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
33

44
[project]
55
name = "polyapi-python"
6-
version = "0.3.9"
6+
version = "0.3.10.dev1"
77
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
88
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
99
dependencies = [

0 commit comments

Comments
 (0)