Browse Source

Update Black to newest version

Updates the Black code-formatter to its newest version and applies it.
They made some small changes to how it handles numeric literals that
affected a few files - both always forcing a "0." prefix on float values
instead of allowing an implicit "0" to be there, as well as only adding
underscore separators if the number has at least 6 digits.
merge-requests/48/head
Deimos 6 years ago
parent
commit
813208ddec
  1. 6
      tildes/requirements.txt
  2. 2
      tildes/tests/test_simplestring_field.py
  3. 4
      tildes/tildes/metrics.py
  4. 2
      tildes/tildes/schemas/fields.py
  5. 2
      tildes/tildes/views/login.py

6
tildes/requirements.txt

@ -8,12 +8,12 @@ atomicwrites==1.2.1
attrs==18.2.0
backcall==0.1.0
beautifulsoup4==4.6.3
black==18.6b4
black==18.9b0
bleach==2.1.4
certifi==2018.8.24
cffi==1.11.5
chardet==3.0.4
click==6.7
Click==7.0
cornice==3.4.0
decorator==4.3.0
dodgy==0.1.9
@ -90,7 +90,7 @@ stripe==2.8.1
testing.common.database==2.0.3
testing.redis==1.1.1
titlecase==0.12.0
toml==0.9.6
toml==0.10.0
traitlets==4.3.2
transaction==2.2.1
translationstring==1.3

2
tildes/tests/test_simplestring_field.py

@ -40,7 +40,7 @@ def test_changing_max_length():
def test_long_string():
"""Ensure a long string fails validation."""
with raises(ValidationError):
process_string("A" * 10_000)
process_string("A" * 10000)
def test_empty_string():

4
tildes/tildes/metrics.py

@ -32,13 +32,13 @@ _HISTOGRAMS = {
"markdown_processing": Histogram(
"tildes_markdown_processing_seconds",
"Markdown processing",
buckets=[.001, .0025, .005, .01, 0.025, .05, .1, .5, 1.0],
buckets=[0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.5, 1.0],
),
"comment_tree_sorting": Histogram(
"tildes_comment_tree_sorting_seconds",
"Comment tree sorting time",
labelnames=["num_comments_range", "order"],
buckets=[.00001, .0001, .001, .01, .05, .1, .5, 1.0],
buckets=[0.00001, 0.0001, 0.001, 0.01, 0.05, 0.1, 0.5, 1.0],
),
}

2
tildes/tildes/schemas/fields.py

@ -81,7 +81,7 @@ class ShortTimePeriod(Field):
class Markdown(Field):
"""Field for markdown strings (comments, text topic, messages, etc.)."""
DEFAULT_MAX_LENGTH = 50_000
DEFAULT_MAX_LENGTH = 50000
def __init__(self, max_length: Optional[int] = None, **kwargs: Any) -> None:
"""Initialize the field with a length validator."""

2
tildes/tildes/views/login.py

@ -39,7 +39,7 @@ def finish_login(request: Request, user: User) -> None:
if request.params.get("keep"):
request.session.adjust_timeout_for_session(31_536_000)
else:
request.session.adjust_timeout_for_session(86_400)
request.session.adjust_timeout_for_session(86400)
# set request.user before logging so the user is associated with the event
request.user = user

Loading…
Cancel
Save