Skip to content

Commit

Permalink
tox -e format
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Dec 11, 2024
1 parent ed560be commit d31bc52
Show file tree
Hide file tree
Showing 38 changed files with 55 additions and 24 deletions.
3 changes: 1 addition & 2 deletions tests/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
subfolder10-10/
file10-10-1.txt -> 1k
"""

import datetime
import logging
import platform
Expand Down Expand Up @@ -80,7 +81,6 @@ def _setup_fixture(opts, client):


def _bench_litmus(opts):

try:
with Timing("litmus test suite"):
# Run litmus test suite without printing output
Expand Down Expand Up @@ -196,7 +196,6 @@ def _bench_script(opts):


def run_benchmarks(opts):

py_version = "{}.{}.{}".format(*sys.version_info)

print("#-- WsgiDAV Benchmark ---------------------------------------------")
Expand Down
5 changes: 3 additions & 2 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
Functional test suite for WsgiDAV.
Functional test suite for WsgiDAV.
This test suite uses requests to generate HTTP requests.
This test suite uses requests to generate HTTP requests.
"""

import unittest

import requests
Expand Down
1 change: 1 addition & 0 deletions tests/test_litmus.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
See here for details on the Docker image: https://github.com/mar10/docker-litmus
"""

import subprocess
import unittest

Expand Down
1 change: 1 addition & 0 deletions tests/test_lock_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""Unit test for lock_manager.py"""

import os
import unittest
from tempfile import gettempdir
Expand Down
1 change: 1 addition & 0 deletions tests/test_property_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""Unit test for property_manager.py"""

import os
import unittest
from tempfile import gettempdir
Expand Down
9 changes: 5 additions & 4 deletions tests/test_scripted.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
Functional test suite for WsgiDAV.
Functional test suite for WsgiDAV.
This test suite uses davclient to generate WebDAV requests.
This test suite uses davclient to generate WebDAV requests.
See http://chandlerproject.org/Projects/Davclient
http://svn.osafoundation.org/tools/davclient/trunk/src/davclient/davclient.py
See http://chandlerproject.org/Projects/Davclient
http://svn.osafoundation.org/tools/davclient/trunk/src/davclient/davclient.py
"""

import os
import time
import unittest
Expand Down
1 change: 1 addition & 0 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
with WsgiDavTestServer(opts):
... test methods
"""

import multiprocessing
import os
import shutil
Expand Down
1 change: 1 addition & 0 deletions wsgidav/dav_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
Implements a DAVError class that is used to signal WebDAV and HTTP errors.
"""

import datetime
from html import escape as html_escape

Expand Down
1 change: 1 addition & 0 deletions wsgidav/dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
See :doc:`reference_guide` for more information about the WsgiDAV architecture.
"""

import os
import sys
import time
Expand Down
1 change: 1 addition & 0 deletions wsgidav/dc/base_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
TODO: Work In Progress / Subject to change
"""

import sys
from abc import ABC, abstractmethod
from hashlib import md5
Expand Down
2 changes: 1 addition & 1 deletion wsgidav/dc/nt_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
This class is being tested for a network domain (I'm setting one up to test).
"""

import win32net
import win32netcon
import win32security
Expand Down Expand Up @@ -186,7 +187,6 @@ def _is_user(self, user_name, domain, server):
return False

def _auth_user(self, user_name, password, domain, server):

# TODO: implement caching?

# TODO: is this pre-test efficient, or should we simply try LogonUser()?
Expand Down
1 change: 1 addition & 0 deletions wsgidav/dc/pam_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
See https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html
"""

import os
import threading

Expand Down
1 change: 1 addition & 0 deletions wsgidav/dc/simple_dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
.. _DomainControllerBase : dc/base_dc.py
"""

from wsgidav import util
from wsgidav.dc.base_dc import BaseDomainController

Expand Down
1 change: 1 addition & 0 deletions wsgidav/default_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Default configuration.
"""

# from wsgidav.mw.debug_filter import WsgiDavDebugFilter
from wsgidav.dir_browser import WsgiDavDirBrowser
from wsgidav.error_printer import ErrorPrinter
Expand Down
1 change: 1 addition & 0 deletions wsgidav/dir_browser/_dir_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
WSGI middleware that handles GET requests on collections to display directories.
"""

import os
import sys
from fnmatch import fnmatch
Expand Down
1 change: 1 addition & 0 deletions wsgidav/error_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
WSGI middleware to catch application thrown DAVErrors and return proper
responses.
"""

import traceback

from wsgidav import util
Expand Down
1 change: 1 addition & 0 deletions wsgidav/fs_dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
and :class:`~wsgidav.fs_dav_provider.FolderResource` to represent files and
directories respectively.
"""

import os
import shutil
import stat
Expand Down
2 changes: 1 addition & 1 deletion wsgidav/http_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
all methods of the domain controller as a means for developers to pass information
from previous middleware or server config (if required).
"""

import base64
import inspect
import random
Expand Down Expand Up @@ -333,7 +334,6 @@ def send_digest_auth_response(self, environ, start_response):
return [body]

def handle_digest_auth_request(self, environ, start_response):

realm = self.domain_controller.get_domain_realm(environ["PATH_INFO"], environ)

if not realm:
Expand Down
1 change: 1 addition & 0 deletions wsgidav/lock_man/lock_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
Automatically generated unique token.
"""

import random
import time
from pprint import pformat
Expand Down
1 change: 1 addition & 0 deletions wsgidav/lock_man/lock_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
See :class:`~wsgidav.lock_man.lock_storage.LockStorageDict`
See :class:`~wsgidav.lock_man.lock_storage.LockStorageShelve`
"""

import os
import shelve
import time
Expand Down
1 change: 1 addition & 0 deletions wsgidav/mw/cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Respond to CORS preflight OPTIONS request and inject CORS headers.
"""

from wsgidav import util
from wsgidav.mw.base_mw import BaseMiddleware

Expand Down
1 change: 1 addition & 0 deletions wsgidav/mw/debug_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
debug_litmus = ["notowner_modify", "props: 16", ]
"""

import sys
import threading

Expand Down
5 changes: 2 additions & 3 deletions wsgidav/prop_man/couch_property_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
"""

from urllib.parse import quote
from uuid import uuid4

Expand Down Expand Up @@ -130,9 +131,7 @@ def _find_descendents(self, url):
if(doc.type === 'properties' && url.indexOf('%s') === 0) {
emit(doc.url, { 'id': doc._id, 'url': doc.url });
}
}""" % (
url + "/"
)
}""" % (url + "/")
vr = self.db.query(map_fun, include_docs=True)
for row in vr:
yield row.doc
Expand Down
1 change: 1 addition & 0 deletions wsgidav/prop_man/mongo_property_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
"""

from urllib.parse import quote

import pymongo
Expand Down
1 change: 1 addition & 0 deletions wsgidav/prop_man/property_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}
"""

import os
import shelve

Expand Down
1 change: 1 addition & 0 deletions wsgidav/request_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
environ['wsgidav.destresourceAL'] = fileabstractionlayer.MyOwnFilesystemAbstractionLayer()
"""

from wsgidav import util
from wsgidav.dav_error import HTTP_NOT_FOUND, DAVError
from wsgidav.mw.base_mw import BaseMiddleware
Expand Down
20 changes: 10 additions & 10 deletions wsgidav/request_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
WSGI application that handles one single WebDAV request.
"""

from urllib.parse import unquote, urlparse

from wsgidav import util, xml_tools
Expand Down Expand Up @@ -178,9 +179,9 @@ def _send_response(
assert isinstance(e, DAVError)
responseEL = etree.SubElement(multistatusEL, "{DAV:}response")
etree.SubElement(responseEL, "{DAV:}href").text = refurl
etree.SubElement(responseEL, "{DAV:}status").text = (
f"HTTP/1.1 {get_http_status_string(e)}"
)
etree.SubElement(
responseEL, "{DAV:}status"
).text = f"HTTP/1.1 {get_http_status_string(e)}"

return util.send_multi_status_response(environ, start_response, multistatusEL)

Expand Down Expand Up @@ -352,7 +353,6 @@ def do_PROPFIND(self, environ, start_response):
responsedescription = []

for child in reslist:

if propFindMode == "allprop":
propList = child.get_properties("allprop")
elif propFindMode == "name":
Expand All @@ -364,9 +364,9 @@ def do_PROPFIND(self, environ, start_response):
util.add_property_response(multistatusEL, href, propList)

if responsedescription:
etree.SubElement(multistatusEL, "{DAV:}responsedescription").text = (
"\n".join(responsedescription)
)
etree.SubElement(
multistatusEL, "{DAV:}responsedescription"
).text = "\n".join(responsedescription)

return util.send_multi_status_response(environ, start_response, multistatusEL)

Expand Down Expand Up @@ -478,9 +478,9 @@ def do_PROPPATCH(self, environ, start_response):
href = res.get_href()
util.add_property_response(multistatusEL, href, propResponseList)
if responsedescription:
etree.SubElement(multistatusEL, "{DAV:}responsedescription").text = (
"\n".join(responsedescription)
)
etree.SubElement(
multistatusEL, "{DAV:}responsedescription"
).text = "\n".join(responsedescription)

# Send response
return util.send_multi_status_response(environ, start_response, multistatusEL)
Expand Down
1 change: 1 addition & 0 deletions wsgidav/samples/dav_provider_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Tools that make it easier to implement custom WsgiDAV providers.
"""

import os
import stat

Expand Down
1 change: 1 addition & 0 deletions wsgidav/samples/hg_dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
from here: http://mercurial.berkwood.com/
http://mercurial.berkwood.com/binaries/mercurial-1.4.win32-py2.6.exe
"""

import os
import sys
import time
Expand Down
1 change: 1 addition & 0 deletions wsgidav/samples/mongo_dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
"""

from io import StringIO
from pprint import pformat

Expand Down
1 change: 1 addition & 0 deletions wsgidav/samples/mysql_dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
unnecessary queries to the database.
"""

import csv
import hashlib
import time
Expand Down
3 changes: 2 additions & 1 deletion wsgidav/samples/virtual_dav_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<share>/by_tag/hot/My doc 1
<share>/by_key/1
"""

import os
import stat
from io import BytesIO
Expand Down Expand Up @@ -150,7 +151,7 @@
},
{
"key": "3",
"title": "My doc (euro:\u20AC, uuml:��)".encode(),
"title": "My doc (euro:\u20ac, uuml:��)".encode(),
"orga": "marketing",
"tags": ["nice"],
"status": "published",
Expand Down
1 change: 1 addition & 0 deletions wsgidav/server/ext_wsgiutils_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
run the application by specifying ``server='ext_wsgiutils'`` in the ``server.conf`` or appropriate
paste configuration.
"""

__docformat__ = "reStructuredText"

import logging
Expand Down
1 change: 1 addition & 0 deletions wsgidav/server/run_reloading_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Wrapper for ``server_cli``, that restarts the server when source code is
modified.
"""

import os
import sys
from subprocess import Popen
Expand Down
1 change: 1 addition & 0 deletions wsgidav/server/server_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
Simple example how to a run WsgiDAV in a 3rd-party WSGI server.
"""

from cheroot import wsgi

from wsgidav import util
Expand Down
Loading

0 comments on commit d31bc52

Please sign in to comment.