chore: apply ruff's pyupgrade linter rules to modernize Python code with targeted version (#2419)
This commit is contained in:
parent
589099a005
commit
063191889d
246 changed files with 912 additions and 937 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding:utf-8 -*-
|
||||
import random
|
||||
import re
|
||||
import string
|
||||
|
|
@ -57,7 +56,7 @@ def timestamp_value(timestamp):
|
|||
raise ValueError(error)
|
||||
|
||||
|
||||
class str_len(object):
|
||||
class str_len:
|
||||
""" Restrict input to an integer in a range (inclusive) """
|
||||
|
||||
def __init__(self, max_length, argument='argument'):
|
||||
|
|
@ -74,7 +73,7 @@ class str_len(object):
|
|||
return value
|
||||
|
||||
|
||||
class float_range(object):
|
||||
class float_range:
|
||||
""" Restrict input to an float in a range (inclusive) """
|
||||
def __init__(self, low, high, argument='argument'):
|
||||
self.low = low
|
||||
|
|
@ -91,7 +90,7 @@ class float_range(object):
|
|||
return value
|
||||
|
||||
|
||||
class datetime_string(object):
|
||||
class datetime_string:
|
||||
def __init__(self, format, argument='argument'):
|
||||
self.format = format
|
||||
self.argument = argument
|
||||
|
|
@ -111,7 +110,7 @@ def _get_float(value):
|
|||
try:
|
||||
return float(value)
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError('{0} is not a valid float'.format(value))
|
||||
raise ValueError('{} is not a valid float'.format(value))
|
||||
|
||||
def timezone(timezone_string):
|
||||
if timezone_string and timezone_string in available_timezones():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue