Skip to content

Commit e33e154

Browse files
committed
Run py-upgrade to specify a minimum supported python version of 3.8
1 parent 90950a9 commit e33e154

19 files changed

Lines changed: 242 additions & 254 deletions

docs/conf.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Odin documentation build configuration file, created by
43
# sphinx-quickstart on Tue Aug 20 18:57:24 2013.
@@ -53,8 +52,8 @@
5352
master_doc = "contents"
5453

5554
# General information about the project.
56-
project = u"Odin"
57-
copyright = u"2023, Tim Savage"
55+
project = "Odin"
56+
copyright = "2023, Tim Savage"
5857
author = "Tim Savage <tim@savage.company>"
5958

6059
# The version info for the project you're documenting, acts as replacement for
@@ -205,8 +204,8 @@
205204
(
206205
"index",
207206
"Odin.tex",
208-
u"Odin Documentation",
209-
u"Tim Savage \\textless{}tim@savage.company\\textgreater{}",
207+
"Odin Documentation",
208+
"Tim Savage \\textless{}tim@savage.company\\textgreater{}",
210209
"manual",
211210
),
212211
]
@@ -236,7 +235,7 @@
236235

237236
# One entry per manual page. List of tuples
238237
# (source start file, name, description, authors, manual section).
239-
man_pages = [("index", "odin", u"Odin Documentation", [author], 1)]
238+
man_pages = [("index", "odin", "Odin Documentation", [author], 1)]
240239

241240
# If true, show URL addresses after external links.
242241
# man_show_urls = False
@@ -251,7 +250,7 @@
251250
(
252251
"index",
253252
"Odin",
254-
u"Odin Documentation",
253+
"Odin Documentation",
255254
author,
256255
"Odin",
257256
"One line description of project.",

src/odin/codecs/csv_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
# Handle strict fields
102102
if self.strict_fields and self.extra_field_names:
103103
raise CodecDecodeError(
104-
"Extra unknown fields: {0}".format(",".join(self.extra_field_names))
104+
"Extra unknown fields: {}".format(",".join(self.extra_field_names))
105105
)
106106

107107
# Built in counters

src/odin/codecs/xml_codec.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ def dump(
6666
) # Encode attributes
6767
for f, v in attribute_field_iter_items(resource)
6868
)
69-
fp.write("<{}{}>{}".format(meta.name, attributes, line_ending))
69+
fp.write(f"<{meta.name}{attributes}>{line_ending}")
7070

7171
# Write any element fields
7272
for field, value in element_field_iter_items(resource):
7373
if isinstance(field, composite.ListOf):
7474
if field.use_container:
75-
fp.write("<{}>{}".format(field.name, line_ending))
75+
fp.write(f"<{field.name}>{line_ending}")
7676
for v in value:
7777
dump(fp, v, line_ending)
7878
if field.use_container:
79-
fp.write("</{}>{}".format(field.name, line_ending))
79+
fp.write(f"</{field.name}>{line_ending}")
8080

8181
elif isinstance(field, composite.DictAs):
8282
if value is not None:
@@ -108,7 +108,7 @@ def dump(
108108
)
109109
)
110110

111-
fp.write("</{}>{}".format(meta.name, line_ending))
111+
fp.write(f"</{meta.name}>{line_ending}")
112112

113113

114114
def dumps(resource, **kwargs):

src/odin/contrib/geo/datatypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class longitude(float): # NoQA
6565
def __new__(cls, x):
6666
lng = float.__new__(cls, x)
6767
if lng > 180.0 or lng < -180.0:
68-
raise ValueError("not in range -180.0 -> 180.0: '{}'".format(x))
68+
raise ValueError(f"not in range -180.0 -> 180.0: '{x}'")
6969
return lng
7070

7171
def __str__(self):

src/odin/contrib/geo/fields.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
from odin.validators import EMPTY_VALUES
44
from .datatypes import latitude, longitude, latlng, point
55

6-
__all__ = ('LatitudeField', 'LongitudeField', 'LatLngField', 'PointField')
6+
__all__ = ("LatitudeField", "LongitudeField", "LatLngField", "PointField")
77

88

99
class LatitudeField(ScalarField):
1010
"""
1111
Field that contains a latitude value.
1212
"""
13+
1314
default_error_messages = {
14-
'invalid': "'%s' value must be a latitude.",
15+
"invalid": "'%s' value must be a latitude.",
1516
}
1617
data_type_name = "Latitude"
1718

@@ -21,16 +22,17 @@ def to_python(self, value):
2122
try:
2223
return latitude(value)
2324
except (ValueError, TypeError):
24-
msg = self.error_messages['invalid'] % value
25+
msg = self.error_messages["invalid"] % value
2526
raise exceptions.ValidationError(msg)
2627

2728

2829
class LongitudeField(ScalarField):
2930
"""
3031
Field that contains a longitude value.
3132
"""
33+
3234
default_error_messages = {
33-
'invalid': "'%s' value must be a longitude.",
35+
"invalid": "'%s' value must be a longitude.",
3436
}
3537
data_type_name = "Longitude"
3638

@@ -40,16 +42,17 @@ def to_python(self, value):
4042
try:
4143
return longitude(value)
4244
except (ValueError, TypeError):
43-
msg = self.error_messages['invalid'] % value
45+
msg = self.error_messages["invalid"] % value
4446
raise exceptions.ValidationError(msg)
4547

4648

4749
class LatLngField(Field):
4850
"""
4951
Field that contains a lat/long pair.
5052
"""
53+
5154
default_error_messages = {
52-
'invalid': "'%s' value must be a (latitude, longitude).",
55+
"invalid": "'%s' value must be a (latitude, longitude).",
5356
}
5457
data_type_name = "LatLng"
5558

@@ -59,16 +62,17 @@ def to_python(self, value):
5962
try:
6063
return latlng(value)
6164
except (ValueError, TypeError):
62-
msg = self.error_messages['invalid'] % value
65+
msg = self.error_messages["invalid"] % value
6366
raise exceptions.ValidationError(msg)
6467

6568

6669
class PointField(Field):
6770
"""
6871
Field that contains a point in cartesian space. This can be either 2D (on a plain) or 3D (includes a z-axis).
6972
"""
73+
7074
default_error_messages = {
71-
'invalid': "'%s' value must be a point in 2D or 3D cartesian space.",
75+
"invalid": "'%s' value must be a point in 2D or 3D cartesian space.",
7276
}
7377
data_type_name = "Point"
7478

@@ -78,5 +82,5 @@ def to_python(self, value):
7882
try:
7983
return point(value)
8084
except (ValueError, TypeError):
81-
msg = self.error_messages['invalid'] % value
85+
msg = self.error_messages["invalid"] % value
8286
raise exceptions.ValidationError(msg)

0 commit comments

Comments
 (0)