From 813208ddec4d4afbc3931a2d12b30bdc51a82f04 Mon Sep 17 00:00:00 2001 From: Deimos Date: Sun, 7 Oct 2018 16:36:35 -0600 Subject: [PATCH] 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. --- tildes/requirements.txt | 6 +++--- tildes/tests/test_simplestring_field.py | 2 +- tildes/tildes/metrics.py | 4 ++-- tildes/tildes/schemas/fields.py | 2 +- tildes/tildes/views/login.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tildes/requirements.txt b/tildes/requirements.txt index ac111e9..2eba6d2 100644 --- a/tildes/requirements.txt +++ b/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 diff --git a/tildes/tests/test_simplestring_field.py b/tildes/tests/test_simplestring_field.py index 2249df4..734339d 100644 --- a/tildes/tests/test_simplestring_field.py +++ b/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(): diff --git a/tildes/tildes/metrics.py b/tildes/tildes/metrics.py index c4268f0..0635a38 100644 --- a/tildes/tildes/metrics.py +++ b/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], ), } diff --git a/tildes/tildes/schemas/fields.py b/tildes/tildes/schemas/fields.py index 3a25a90..370711d 100644 --- a/tildes/tildes/schemas/fields.py +++ b/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.""" diff --git a/tildes/tildes/views/login.py b/tildes/tildes/views/login.py index a221c98..f6bfb2b 100644 --- a/tildes/tildes/views/login.py +++ b/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