Skip to content

Commit

Permalink
style: Minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Sep 7, 2024
1 parent fcd774a commit 4684711
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def _cli_patch(cli_args): # pragma: no coverage
# Imports and Python 2/3 unification ##########################################
###############################################################################

import base64, calendar, email.utils, functools, hmac, itertools,\
mimetypes, os, re, tempfile, threading, time, warnings, weakref, hashlib
import base64, calendar, email.utils, functools, hmac, itertools, \
mimetypes, os, re, tempfile, threading, time, warnings, weakref, hashlib

from types import FunctionType
from datetime import date as datedate, datetime, timedelta
Expand Down Expand Up @@ -104,6 +104,7 @@ def _cli_patch(cli_args): # pragma: no coverage
# getfullargspec was deprecated in 3.5 and un-deprecated in 3.6
# getargspec was deprecated in 3.0 and removed in 3.11
from inspect import getfullargspec

def getargspec(func):
spec = getfullargspec(func)
kwargs = makelist(spec[0]) + makelist(spec.kwonlyargs)
Expand All @@ -117,6 +118,7 @@ def getargspec(func):

def _raise(*a):
raise a[0](a[1]).with_traceback(a[2])

else: # 2.x
import httplib
import thread
Expand Down Expand Up @@ -2007,9 +2009,9 @@ def wrapper(*a, **ka):
rv = resp

if isinstance(rv, dict):
#Attempt to serialize, raises exception on failure
# Attempt to serialize, raises exception on failure
json_response = dumps(rv)
#Set content type only if serialization successful
# Set content type only if serialization successful
response.content_type = 'application/json'
return json_response
elif isinstance(rv, HTTPResponse) and isinstance(rv.body, dict):
Expand Down Expand Up @@ -4032,8 +4034,8 @@ class TemplateError(BottleException):
class BaseTemplate(object):
""" Base class and minimal API for template adapters """
extensions = ['tpl', 'html', 'thtml', 'stpl']
settings = {} #used in prepare()
defaults = {} #used in render()
settings = {} # used in prepare()
defaults = {} # used in render()

def __init__(self,
source=None,
Expand Down Expand Up @@ -4243,7 +4245,7 @@ def execute(self, _stdout, kwargs):
exec(self.co, env)
if env.get('_rebase'):
subtpl, rargs = env.pop('_rebase')
rargs['base'] = ''.join(_stdout) #copy stdout
rargs['base'] = ''.join(_stdout) # copy stdout
del _stdout[:] # clear stdout
return self._include(env, subtpl, **rargs)
return env
Expand Down

0 comments on commit 4684711

Please sign in to comment.