Skip to content

Commit

Permalink
v1.20.10 Prefer NamedTuple over namedtuple
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Mar 22, 2024
1 parent 3b1f65b commit b669f59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tableschema/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.9
1.20.10
10 changes: 7 additions & 3 deletions tableschema/types/geopoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import six
import json
from collections import namedtuple
from typing import NamedTuple
from decimal import Decimal
from ..config import ERROR

Expand Down Expand Up @@ -50,5 +50,9 @@ def cast_geopoint(format, value, **options):

# Internal

_geopoint = namedtuple('geopoint', ['lon', 'lat'])
_geopoint.__repr__ = lambda self: str([float(self[0]), float(self[1])])
class _geopoint(NamedTuple):
lon: Decimal
lat: Decimal

def __repr__(self):
return '[%s, %s]' % (self.lon, self.lat)
7 changes: 4 additions & 3 deletions tableschema/types/yearmonth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import unicode_literals

import six
from collections import namedtuple
from typing import NamedTuple
from ..config import ERROR


Expand All @@ -32,5 +32,6 @@ def cast_yearmonth(format, value, **options):


# Internal

_yearmonth = namedtuple('yearmonth', ['year', 'month'])
class _yearmonth(NamedTuple):
year: int
month: int

0 comments on commit b669f59

Please sign in to comment.