Move wsgitobytes and bytestowsgi into utils
Showing 2 of 2 files from the diff.
flask_apscheduler/utils.py
changed.
flask_apscheduler/auth.py
changed.
@@ -147,3 +147,18 @@
Loading
147 | 147 | mm, ss = divmod(delta.seconds, 60) |
|
148 | 148 | hh, mm = divmod(mm, 60) |
|
149 | 149 | return w, d, hh, mm, ss |
|
150 | + | ||
151 | + | ||
152 | + | def bytes_to_wsgi(data): |
|
153 | + | assert isinstance(data, bytes), "data must be bytes" |
|
154 | + | if isinstance(data, str): |
|
155 | + | return data |
|
156 | + | else: |
|
157 | + | return data.decode("latin1") |
|
158 | + | ||
159 | + | ||
160 | + | def wsgi_to_bytes(data): |
|
161 | + | """coerce wsgi unicode represented bytes to real ones""" |
|
162 | + | if isinstance(data, bytes): |
|
163 | + | return data |
|
164 | + | return data.encode("latin1") # XXX: utf8 fallback? |
@@ -17,21 +17,7 @@
Loading
17 | 17 | import base64 |
|
18 | 18 | ||
19 | 19 | from flask import request |
|
20 | - | ||
21 | - | ||
22 | - | def wsgi_to_bytes(data): |
|
23 | - | """coerce wsgi unicode represented bytes to real ones""" |
|
24 | - | if isinstance(data, bytes): |
|
25 | - | return data |
|
26 | - | return data.encode("latin1") # XXX: utf8 fallback? |
|
27 | - | ||
28 | - | ||
29 | - | def bytes_to_wsgi(data): |
|
30 | - | assert isinstance(data, bytes), "data must be bytes" |
|
31 | - | if isinstance(data, str): |
|
32 | - | return data |
|
33 | - | else: |
|
34 | - | return data.decode("latin1") |
|
20 | + | from .utils import bytes_to_wsgi, wsgi_to_bytes |
|
35 | 21 | ||
36 | 22 | ||
37 | 23 | def get_authorization_header(): |
Files | Coverage |
---|---|
flask_apscheduler | 94.44% |
Project Totals (6 files) | 94.44% |
135.4
TRAVIS_PYTHON_VERSION=3.4 TRAVIS_OS_NAME=linux
135.3
TRAVIS_PYTHON_VERSION=2.7 TRAVIS_OS_NAME=linux
135.2
TRAVIS_PYTHON_VERSION=3.9 TRAVIS_OS_NAME=linux
135.1
TRAVIS_PYTHON_VERSION=3.8 TRAVIS_OS_NAME=linux
135.5
TRAVIS_PYTHON_VERSION=3.5 TRAVIS_OS_NAME=linux
135.6
TRAVIS_PYTHON_VERSION=3.6 TRAVIS_OS_NAME=linux
135.7
TRAVIS_PYTHON_VERSION=3.7 TRAVIS_OS_NAME=linux
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.