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

misc bugs + please pyflakes #89

Merged
merged 12 commits into from
Mar 31, 2024
Prev Previous commit
Next Next commit
remaining pyflakes
  • Loading branch information
a-detiste committed Mar 16, 2024
commit 1f7ea71f5eed1c99a04f0e2db8a81a67c327eceb
25 changes: 23 additions & 2 deletions paste/fileapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,29 @@
"""

import os, time, mimetypes, zipfile, tarfile
from paste.httpexceptions import *
from paste.httpheaders import *
from paste.httpexceptions import (
HTTPBadRequest,
HTTPForbidden,
HTTPMethodNotAllowed,
HTTPNotFound,
HTTPRequestRangeNotSatisfiable,
)
from paste.httpheaders import (
get_header,
list_headers,
ACCEPT_RANGES,
CACHE_CONTROL,
CONTENT_DISPOSITION,
CONTENT_LENGTH,
CONTENT_RANGE,
CONTENT_TYPE,
ETAG,
EXPIRES,
IF_MODIFIED_SINCE,
IF_NONE_MATCH,
LAST_MODIFIED,
RANGE,
)

CACHE_SIZE = 4096
BLOCK_SIZE = 4096 * 16
Expand Down
1 change: 0 additions & 1 deletion tests/test_auth/test_auth_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from paste.auth import cookie
from paste.wsgilib import raw_interactive, dump_environ
from paste.response import header_value
from paste.httpexceptions import *

def build(application,setenv, *args, **kwargs):
def setter(environ, start_response):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_auth/test_auth_digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

from paste.auth.digest import *
from paste.auth.digest import digest_password, AuthDigestHandler
from paste.wsgilib import raw_interactive
from paste.httpexceptions import *
from paste.httpexceptions import HTTPExceptionHandler
from paste.httpheaders import AUTHORIZATION, WWW_AUTHENTICATE, REMOTE_USER
import os

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cgiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from paste.cgiapp import CGIApplication, CGIError
from paste.fixture import *
from paste.fixture import TestApp

data_dir = os.path.join(os.path.dirname(__file__), 'cgiapp_data')

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cgitb_catcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from paste.fixture import *
from paste.fixture import TestApp
from paste.cgitb_catcher import CgitbMiddleware
from paste import lint
from .test_exceptions.test_error_middleware import clear_middleware
Expand Down
2 changes: 1 addition & 1 deletion tests/test_errordocument.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from paste.errordocument import forward
from paste.fixture import *
from paste.fixture import TestApp
from paste.recursive import RecursiveMiddleware

def simple_app(environ, start_response):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_exceptions/test_error_middleware.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from paste.fixture import *
from paste.fixture import TestApp
from paste.exceptions.errormiddleware import ErrorMiddleware
from paste import lint
from paste.util.quoting import strip_html
Expand Down
2 changes: 1 addition & 1 deletion tests/test_exceptions/test_reporter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import os
from paste.exceptions.reporter import *
from paste.exceptions.reporter import LogReporter
from paste.exceptions import collector

def setup_file(fn, content=None):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_fileapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from email.utils import parsedate_tz, mktime_tz

from paste import fileapp
from paste.fileapp import *
from paste.fixture import *
from paste.fileapp import DataApp
from paste.fixture import TestApp

# NOTE(haypo): don't use string.letters because the order of lower and upper
# case letters changes when locale.setlocale() is called for the first time
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grantip.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from paste.auth import grantip
from paste.fixture import *
from paste.fixture import TestApp

def _make_app():
def application(environ, start_response):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_import_string.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from paste.util.import_string import *
from paste.util.import_string import eval_import, simple_import
import sys
import os

Expand Down
4 changes: 2 additions & 2 deletions tests/test_profilemiddleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from paste.fixture import *
from paste.fixture import TestApp
try:
from paste.debug.profile import *
from paste.debug.profile import ProfileMiddleware, profile_decorator
disable = False
except ImportError:
disable = True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_recursive.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .test_errordocument import simple_app
from paste.fixture import *
from paste.fixture import TestApp
from paste.recursive import RecursiveMiddleware, ForwardRequestException

def error_docs_app(environ, start_response):
Expand Down
10 changes: 7 additions & 3 deletions tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

import pytest

from paste.fixture import *
from paste.registry import *
from paste.registry import Registry
from paste.fixture import TestApp
from paste.registry import (
Registry,
RegistryManager,
StackedObjectProxy,
restorer,
)
from paste.evalexception.middleware import EvalException

regobj = StackedObjectProxy()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# (c) 2005 Ben Bangert
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from paste.fixture import *
from paste.request import *
from paste.fixture import TestApp
from paste.request import get_cookie_dict
from paste.wsgiwrappers import WSGIRequest

def simpleapp(environ, start_response):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_request_form.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import io

from paste.request import *
from paste.request import parse_formvars, parse_querystring
from paste.util.multidict import MultiDict

def test_parse_querystring():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_response.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from paste.response import *
from paste.response import replace_header

def test_replace_header():
h = [('content-type', 'text/plain'),
Expand Down
5 changes: 3 additions & 2 deletions tests/test_urlparser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from paste.urlparser import *
from paste.fixture import *

from paste.urlparser import PkgResourcesParser, StaticURLParser, URLParser
from paste.fixture import TestApp
from pkg_resources import get_distribution

def relative_path(name):
Expand Down
10 changes: 9 additions & 1 deletion tests/test_util/test_mimeparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php

from paste.util.mimeparse import *
from paste.util.mimeparse import (
best_match,
desired_matches,
fitness_and_quality_parsed,
parse_media_range,
parse_mime_type,
quality,
quality_parsed,
)

def test_parse_mime_type():
parse = parse_mime_type
Expand Down
Loading