Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove pre Python 3.7 compatibility code for shutil #2066

Merged
merged 1 commit into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ and will be removed for release.
<!-- -->
<!-- -->

<!-- -->
<!-- -->
<!-- CHANGE BARRIER: START PR #2066 -->
<!-- -->
<!-- -->

- Removed pre python 3.7 compatibility code.
[PR #2066](https://github.com/RDFLib/rdflib/pull/2066).
- Removed fallback in case the `shutil` module does not have the `move`
function.

<!-- -->
<!-- -->
<!-- CHANGE BARRIER: END PR #2066 -->
<!-- -->
<!-- -->

<!-- -->
<!-- -->
<!-- CHANGE BARRIER: START -->
Expand Down
6 changes: 1 addition & 5 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,11 +1215,7 @@ def serialize(
serializer.serialize(stream, base=base, encoding=encoding, **args)
stream.close()
dest = url2pathname(path) if scheme == "file" else location
if hasattr(shutil, "move"):
shutil.move(name, dest)
else:
shutil.copy(name, dest)
os.remove(name)
shutil.move(name, dest)
return self

def print(self, format="turtle", encoding="utf-8", out=None):
Expand Down
6 changes: 1 addition & 5 deletions rdflib/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,7 @@ def serialize(
stream = os.fdopen(fd, "wb")
serializer.serialize(stream, encoding=encoding, **args)
stream.close()
if hasattr(shutil, "move"):
shutil.move(name, path)
else:
shutil.copy(name, path)
os.remove(name)
shutil.move(name, path)
return None

def __len__(self):
Expand Down