Skip to content

Commit

Permalink
Fix findings by black and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Feb 28, 2024
1 parent caecddd commit 2aaa4b4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/pcloud/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

PORT = 65432
REDIRECT_URL = f"http://localhost:{PORT}/"
AUTHORIZE_URL = f"https://my.pcloud.com/oauth2/authorize"


class HTTPServerHandler(BaseHTTPRequestHandler):
Expand Down Expand Up @@ -47,7 +48,7 @@ class TokenHandler(object):

def __init__(self, client_id):
self._id = client_id
self.auth_url = f"https://my.pcloud.com/oauth2/authorize?response_type=code&redirect_uri={self.redirect_url}&client_id={self._id}"
self.auth_url = f"{AUTHORIZE_URL}?response_type=code&redirect_uri={self.redirect_url}&client_id={self._id}"

def open_browser(self):
"""Hook which is called before request is handled."""
Expand Down
19 changes: 9 additions & 10 deletions src/pcloud/pcloudfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
import os
import tempfile

from contextlib import closing
from datetime import datetime
from fs import errors
from fs.enums import ResourceType
from fs.base import FS
from fs.info import Info
from fs.opener import Opener
from fs import errors
from fs.enums import ResourceType
from fs.path import abspath, dirname
from fs.path import abspath
from fs.path import dirname
from fs.mode import Mode
from fs.subfs import SubFS
from pcloud import api
from fs.enums import ResourceType
from contextlib import closing

from datetime import datetime


DT_FORMAT_STRING = "%a, %d %b %Y %H:%M:%S %z"
Expand Down Expand Up @@ -359,7 +358,7 @@ def remove(self, path):
_path = self.validatepath(path)
if not self.exists(_path):
raise errors.ResourceNotFound(path=_path)
if self.getinfo(_path).is_dir == True:
if self.getinfo(_path).is_dir:
raise errors.FileExpected(_path)
with self._lock:
resp = self.pcloud.deletefile(path=_path)
Expand All @@ -371,7 +370,7 @@ def removedir(self, path):
if not self.exists(_path):
raise errors.ResourceNotFound(path=_path)
info = self.getinfo(_path)
if info.is_dir == False:
if not info.is_dir:
raise errors.DirectoryExpected(_path)
if not self.isempty(_path):
raise errors.DirectoryNotEmpty(_path)
Expand All @@ -384,7 +383,7 @@ def removetree(self, dir_path):
_path = self.validatepath(dir_path)
if not self.exists(_path):
raise errors.ResourceNotFound(path=_path)
if self.getinfo(_path).is_dir == False:
if not self.getinfo(_path).is_dir:
raise errors.DirectoryExpected(_path)
with self._lock:
resp = self.pcloud.deletefolderrecursive(path=_path)
Expand Down
2 changes: 0 additions & 2 deletions src/pcloud/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import time
import zipfile

from fs import opener
from io import BytesIO
from pathlib import Path
from pcloud.api import PyCloud
from pcloud.api import O_CREAT
from urllib.parse import quote


@pytest.fixture
Expand Down

0 comments on commit 2aaa4b4

Please sign in to comment.