Skip to content

Commit 1ebed20

Browse files
authored
Make a copy for __repr__ (#128)
* Make a copy for __repr__ * Run the formatter
1 parent 70a2ff0 commit 1ebed20

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

ada_url/ada_adapter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from copy import deepcopy
12
from enum import IntEnum
23
from typing import (
34
Dict,
@@ -271,11 +272,9 @@ def __str__(self):
271272
return self.href
272273

273274
def __repr__(self):
274-
password = self.password
275-
self.password = ''
276-
ret = f'<URL "{self.href}">'
277-
self.password = password
278-
return ret
275+
duplicate = deepcopy(self)
276+
duplicate.password = ''
277+
return f'<URL "{duplicate.href}">'
279278

280279
@staticmethod
281280
def can_parse(url: str, base: Optional[str] = None) -> bool:

ada_url/ada_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
ada_obj = Extension(
1111
'ada',
1212
define_macros=[('ADA_INCLUDE_URL_PATTERN', '0')],
13-
language="c++",
13+
language='c++',
1414
sources=['ada_url/ada.cpp'],
1515
include_dirs=[file_dir],
1616
extra_compile_args=compile_args,

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def build_extension(self, ext):
2424
ext.extra_objects[i] = objects[0]
2525
return super().build_extension(ext)
2626

27+
2728
setup(
2829
cmdclass={'build_ext': build_ext},
2930
cffi_modules=[

update_sdist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Run this script to remove compiled artifacts from source distribution tarballs.
55
"""
6+
67
from pathlib import Path
78
from tarfile import open as tar_open
89
from tempfile import TemporaryDirectory

0 commit comments

Comments
 (0)