- Add pyupgrade to
.pre-commit-config.yaml.
If supporting py35, use --py3-plus instead of --py37-plus.
- repo: https://github.com/asottile/pyupgrade
rev: ...latest version...
hooks:
- id: pyupgrade
args: [--py37-plus].pre-commit-config.yaml.If supporting py35, use --py3-plus instead of --py37-plus.
- repo: https://github.com/asottile/pyupgrade
rev: ...latest version...
hooks:
- id: pyupgrade
args: [--py37-plus]| WITH | |
| dls AS ( | |
| SELECT | |
| DATE_SUB(DATE(@run_time), INTERVAL 1 DAY) AS date, | |
| file.project AS package, | |
| details.installer.name AS installer, | |
| details.python AS python_version, | |
| CAST(SPLIT(details.python, '.')[ | |
| OFFSET | |
| (0)] AS string) AS python_major, |
| {"lastUpload":"2021-08-17T14:10:13.842Z","extensionVersion":"v3.4.3"} |
| """Dead simple ANSI coloring.""" | |
| import os | |
| import sys | |
| RED = 31 | |
| GREEN = 32 | |
| YELLOW = 33 | |
| BOLD = 1 | |
| RESET_ALL = 0 |
| import timeit | |
| import uuid | |
| import colander | |
| import marshmallow | |
| class BarList(colander.SequenceSchema): | |
| item = colander.SchemaNode( | |
| colander.Integer(), validator=colander.Range(min=1)) |
I hereby claim:
To claim this, I am signing this object:
| # Recorded with the doitlive recorder | |
| #doitlive shell: /bin/bash | |
| #doitlive prompt: sorin | |
| ```python | |
| class Foo: | |
| pass | |
| # We can assign anything | |
| f = Foo() |
| from copy import deepcopy | |
| from marshmallow import Schema, fields | |
| def PartialSchemaFactory(schema_cls): | |
| schema = schema_cls(partial=True) | |
| for field_name, field in schema.fields.items(): | |
| if isinstance(field, fields.Nested): | |
| new_field = deepcopy(field) | |
| new_field.schema.partial = True |
| import os | |
| import re | |
| import urlparse | |
| import json as pyjson | |
| NOTSET = object() | |
| def shortcut(cast, **kwargs): | |
| def method(self, var, default=NOTSET): |