Skip to content

Commit dac0832

Browse files
authored
Update streams.py
support python3.11 python/cpython#100458 python/cpython#84247
1 parent 363c4b1 commit dac0832

File tree

1 file changed

+34
-13
lines changed
  • airbyte-integrations/connectors/source-tiktok-marketing/source_tiktok_marketing

1 file changed

+34
-13
lines changed

airbyte-integrations/connectors/source-tiktok-marketing/source_tiktok_marketing/streams.py

+34-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
from abc import ABC, abstractmethod
88
from datetime import datetime
99
from decimal import Decimal
10-
from enum import Enum
10+
if sys.version_info >= (3, 11):
11+
from enum import StrEnum
12+
else:
13+
from enum import Enum
1114
from functools import total_ordering
1215
from typing import Any, Dict, Iterable, List, Mapping, MutableMapping, Optional, Tuple, TypeVar, Union
1316

@@ -141,21 +144,39 @@ def __lt__(self, other):
141144
return self.current_stream_state < other
142145

143146

144-
class ReportLevel(str, Enum):
145-
ADVERTISER = "ADVERTISER"
146-
CAMPAIGN = "CAMPAIGN"
147-
ADGROUP = "ADGROUP"
148-
AD = "AD"
147+
if sys.version_info >= (3, 11):
149148

149+
class ReportLevel(StrEnum):
150+
ADVERTISER = "ADVERTISER"
151+
CAMPAIGN = "CAMPAIGN"
152+
ADGROUP = "ADGROUP"
153+
AD = "AD"
150154

151-
class ReportGranularity(str, Enum):
152-
LIFETIME = "LIFETIME"
153-
DAY = "DAY"
154-
HOUR = "HOUR"
155+
class ReportGranularity(StrEnum):
156+
LIFETIME = "LIFETIME"
157+
DAY = "DAY"
158+
HOUR = "HOUR"
155159

156-
@classmethod
157-
def default(cls):
158-
return cls.DAY
160+
@classmethod
161+
def default(cls):
162+
return cls.DAY
163+
164+
else:
165+
166+
class ReportLevel(str, Enum):
167+
ADVERTISER = "ADVERTISER"
168+
CAMPAIGN = "CAMPAIGN"
169+
ADGROUP = "ADGROUP"
170+
AD = "AD"
171+
172+
class ReportGranularity(str, Enum):
173+
LIFETIME = "LIFETIME"
174+
DAY = "DAY"
175+
HOUR = "HOUR"
176+
177+
@classmethod
178+
def default(cls):
179+
return cls.DAY
159180

160181

161182
class Hourly:

0 commit comments

Comments
 (0)