Skip to content

Commit

Permalink
Black formatting & new actions version
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Feb 28, 2024
1 parent 0b4c0a0 commit caecddd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pcloud-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: PyCloud package tests & linting
name: PCloud API Python package tests & linting

on:
push:
Expand All @@ -17,7 +17,7 @@ jobs:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
max-parallel: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup firefox
Expand All @@ -40,7 +40,7 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest src --cov=src/pcloud --cov-report=xml --cov-branch --cov-config=.coveragerc --capture=no -v --timeout=600 --reruns 3 --reruns-delay 3
pytest src --cov=src/pcloud --cov-report=xml --cov-branch --cov-config=.coveragerc --capture=no -v --timeout=600 --reruns 3 --reruns-delay 5
env:
PCLOUD_USERNAME: ${{ secrets.PCLOUD_USERNAME }}
PCLOUD_PASSWORD: ${{ secrets.PCLOUD_PASSWORD }}
Expand Down
1 change: 1 addition & 0 deletions src/pcloud/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,4 +530,5 @@ def trash_restorepath(self, **kwargs):
def trash_restore(self, **kwargs):
raise NotImplementedError


# EOF
15 changes: 8 additions & 7 deletions src/pcloud/pcloudfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def on_close(pcloudfile):
if dir_path != "/":
self.getinfo(path=dir_path)
try:
info = self.getinfo(path, namespaces=['details'])
info = self.getinfo(path, namespaces=["details"])
except errors.ResourceNotFound:
pass
else:
Expand All @@ -326,13 +326,13 @@ def on_close(pcloudfile):
fd = resp.get("fd")
if fd is not None:
data = self.pcloud.file_read(fd=fd, count=info.size)
if resp.get('result') != 0:
api.log.error(f'Error reading file {_path} failed with {resp}')
if resp.get("result") != 0:
api.log.error(f"Error reading file {_path} failed with {resp}")
pcloud_file.seek(0, os.SEEK_END)
pcloud_file.raw.write(data)
resp = self.pcloud.file_close(fd=fd)
else:
api.log.error(f'No open file found to write. {resp}')
api.log.error(f"No open file found to write. {resp}")

return pcloud_file

Expand All @@ -344,13 +344,13 @@ def on_close(pcloudfile):
resp = self.pcloud.file_open(path=_path, flags=api.O_WRITE)
fd = resp.get("fd")
if fd is None:
api.log.error(f'Error opening file {_path} failed with {resp}')
api.log.error(f"Error opening file {_path} failed with {resp}")
else:
data = self.pcloud.file_read(fd=fd, count=info.size)
pcloud_file.raw.write(data)
resp = self.pcloud.file_close(fd=fd)
if resp.get('result') != 0:
api.log.error(f'Error closing file {_path} failed with {resp}')
if resp.get("result") != 0:
api.log.error(f"Error closing file {_path} failed with {resp}")

pcloud_file.seek(0)
return pcloud_file
Expand Down Expand Up @@ -391,6 +391,7 @@ def removetree(self, dir_path):
if resp["result"] != 0:
api.log.error(f"Recurrsive removing of folder {_path} failed {resp}")


class PCloudOpener(Opener):
protocols = ["pcloud"]

Expand Down

0 comments on commit caecddd

Please sign in to comment.