Skip to content

Commit daa890d

Browse files
committed
Flake8
1 parent bd3c288 commit daa890d

File tree

12 files changed

+40
-126
lines changed

12 files changed

+40
-126
lines changed

intercom_python_sdk/apis/articles/languages.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from enum import Enum
2+
3+
24
class ArticleLanguages(Enum):
35
ARABIC = "ar"
46
BULGARIAN = "bg"

intercom_python_sdk/apis/articles/models.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
# From Current Package
2727
from ...core.model_base import ModelBase
2828

29-
from .languages import ArticleLanguages
30-
3129
# Type Check Imports - TYPE_CHECKING is assumed True by type-checkers but is False at runtime.
3230
# See: https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING
3331
if TYPE_CHECKING:
@@ -245,7 +243,7 @@ def translated_content(self) -> dict:
245243
dict: The translated content of the Article.
246244
"""
247245
return self.__translated_content
248-
246+
249247
@property
250248
def content(self) -> BeautifulSoup:
251249
"""

intercom_python_sdk/apis/articles/schemas.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010
---
1111
- [1] https://developers.intercom.com/intercom-api-reference/reference/the-article-model
1212
"""
13-
14-
# Built-in
15-
from enum import Enum
16-
17-
# External
13+
# Third-party
1814
import marshmallow
1915
from marshmallow import fields
2016

2117
# From Current API
2218
from . import models as a_models
23-
from .languages import ArticleLanguages
2419

2520
# From Current Package
2621
from ...core.schema_base import SchemaBase
@@ -116,5 +111,3 @@ class ArticleListSchema(SchemaBase):
116111
@marshmallow.post_load
117112
def make_article_list(self, data, **kwargs):
118113
return a_models.ArticleList(**data)
119-
120-

intercom_python_sdk/apis/data_export/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import requests
1616
from typing import (
1717
TYPE_CHECKING,
18-
Optional
1918
)
2019

2120
# From Current Package
Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
"""
22
# Help Center API
33
44
`apis/help_center/api.py`
@@ -12,15 +12,13 @@
1212
"""
1313

1414
# Built-ins
15-
import functools
16-
from typing import Union, cast
15+
from typing import Union
1716

1817
# External
1918
from uplink import (
20-
get, put, post,
21-
returns, args,
22-
error_handler, response_handler,
23-
Field, Body, json, Url, Path, Query,delete
19+
get,
20+
returns,
21+
response_handler,
2422
)
2523

2624
# From Current API
@@ -31,22 +29,17 @@
3129
SectionListSchema,
3230
)
3331

34-
from .models import (
35-
Collection,
36-
CollectionList,
37-
38-
39-
)
4032

4133
# From Current Package
4234
from ...core.api_base import APIBase
4335
from ...core.errors import catch_api_error
4436

37+
4538
@response_handler(catch_api_error)
4639
class HelpCenterAPI(APIBase):
4740
URI = "/help_center/"
4841

49-
@returns(CollectionSchema(many=False)) # type: ignore
42+
@returns(CollectionSchema(many=False)) # type: ignore
5043
@get("collections/{collection_id}")
5144
def get_collection_by_id(self, collection_id: Union[str, int]):
5245
""" Get a Collection by ID.
@@ -58,7 +51,7 @@ def get_collection_by_id(self, collection_id: Union[str, int]):
5851
Collection: The Collection with the given ID.
5952
"""
6053

61-
@returns(CollectionListSchema(many=False)) # type: ignore
54+
@returns(CollectionListSchema(many=False)) # type: ignore
6255
@get("collections")
6356
def list_all_collections(self):
6457
""" List all Collections.
@@ -67,8 +60,7 @@ def list_all_collections(self):
6760
CollectionList: A list of all Collections.
6861
"""
6962

70-
71-
@returns(SectionSchema(many=False)) # type: ignore
63+
@returns(SectionSchema(many=False)) # type: ignore
7264
@get("sections/{section_id}")
7365
def get_section_by_id(self, section_id: Union[str, int]):
7466
""" Get a Section by ID.
@@ -80,12 +72,11 @@ def get_section_by_id(self, section_id: Union[str, int]):
8072
Section: The Section with the given ID.
8173
"""
8274

83-
@returns(SectionListSchema(many=False)) # type: ignore
75+
@returns(SectionListSchema(many=False)) # type: ignore
8476
@get("sections")
8577
def list_all_sections(self):
8678
""" List all Sections.
8779
8880
Returns:
8981
SectionList: A list of all Sections.
9082
"""
91-

intercom_python_sdk/apis/teams/api.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,32 @@
1010
[1] https://developers.intercom.com/intercom-api-reference/reference/listallteams
1111
[2] https://github.com/intercom/Intercom-OpenAPI
1212
"""
13-
14-
1513
# Built-ins
16-
import functools
17-
from typing import Union, cast
14+
from typing import Union
1815

1916
# External
2017
from uplink import (
21-
get, put, post,
22-
returns, args,
23-
error_handler, response_handler,
24-
Field, Body, json, Url, Path, Query,delete
18+
get,
19+
returns,
20+
response_handler,
2521
)
2622

2723
# From Current API
2824
from .schemas import (
2925
TeamSchema,
30-
AdminPriorityLevelSchema,
3126
TeamListSchema,
3227
)
3328

34-
from .models import (
35-
Team,
36-
AdminPriorityLevel,
37-
TeamList,
38-
39-
)
40-
4129
# From Current Package
4230
from ...core.api_base import APIBase
4331
from ...core.errors import catch_api_error
4432

33+
4534
@response_handler(catch_api_error)
4635
class TeamsAPI(APIBase):
4736
URI = "/teams/"
4837

49-
@returns(TeamListSchema(many=False)) # type: ignore
38+
@returns(TeamListSchema(many=False)) # type: ignore
5039
@get("")
5140
def get_all_teams(self):
5241
""" Get all Teams.
@@ -56,8 +45,7 @@ def get_all_teams(self):
5645
"""
5746
pass
5847

59-
60-
@returns(TeamSchema(many=False)) # type: ignore
48+
@returns(TeamSchema(many=False)) # type: ignore
6149
@get("{team_id}")
6250
def get_team_by_id(self, team_id: Union[str, int]):
6351
""" Get a Team by ID.
@@ -69,8 +57,3 @@ def get_team_by_id(self, team_id: Union[str, int]):
6957
Team: The Team with the given ID.
7058
"""
7159
pass
72-
73-
74-
75-
76-

intercom_python_sdk/apis/teams/models.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212

1313

1414
# External
15-
import marshmallow
16-
from marshmallow import fields
17-
from typing import List, Optional, Union , TYPE_CHECKING
18-
19-
# From Current API
20-
from . import schemas as t_schemas
15+
from typing import List, TYPE_CHECKING
2116

2217
# From Current Package
2318
from ...core.model_base import ModelBase
@@ -41,22 +36,18 @@ def __init__(self, *args, **kwargs):
4136
self.primary_admin_ids: List[int] = kwargs.get("primary_admin_ids", [])
4237
self.secondary_admin_ids: List[int] = kwargs.get("secondary_admin_ids", [])
4338

44-
4539
# Properties
4640
@property
4741
def api_client(self) -> 'TeamsAPI':
4842
return self._api_client
49-
5043

5144
@property
5245
def primary_admin_ids(self) -> List[int]:
5346
return self._primary_admin_ids
54-
5547

5648
@property
5749
def secondary_admin_ids(self) -> List[int]:
5850
return self._secondary_admin_ids
59-
6051

6152
@primary_admin_ids.setter
6253
def primary_admin_ids(self, primary_admin_ids: List[int]):
@@ -71,7 +62,6 @@ def api_client(self, api_client: 'TeamsAPI'):
7162
self._api_client = api_client
7263

7364

74-
7565
class Team(ModelBase):
7666
"""
7767
This model represents a Team on Intercom.
@@ -91,37 +81,30 @@ def __init__(self, *args, **kwargs):
9181
self.admin_ids: List[int] = kwargs.get("admin_ids", [])
9282
self.admin_priority_level: AdminPriorityLevel = kwargs.get("admin_priority_level", None)
9383

94-
9584
# Properties
9685
@property
9786
def api_client(self) -> 'TeamsAPI':
9887
return self._api_client
99-
10088

10189
@property
10290
def id(self) -> int:
10391
return self._id
104-
10592

10693
@property
10794
def type(self) -> str:
10895
return self._type
109-
11096

11197
@property
11298
def name(self) -> str:
11399
return self._name
114-
115100

116101
@property
117102
def admin_ids(self) -> List[int]:
118103
return self._admin_ids
119-
120104

121105
@property
122106
def admin_priority_level(self) -> AdminPriorityLevel:
123107
return self._admin_priority_level
124-
125108

126109
@id.setter
127110
def id(self, id: int):
@@ -146,7 +129,6 @@ def admin_priority_level(self, admin_priority_level: AdminPriorityLevel):
146129
@api_client.setter
147130
def api_client(self, api_client: 'TeamsAPI'):
148131
self._api_client = api_client
149-
150132

151133

152134
class TeamList(ModelBase):
@@ -160,17 +142,14 @@ def __init__(self, *args, **kwargs):
160142
super().__init__(*args, **kwargs)
161143
self.teams: List[Team] = kwargs.get("teams", [])
162144

163-
164145
# Properties
165146
@property
166147
def api_client(self) -> 'TeamsAPI':
167148
return self._api_client
168-
169149

170150
@property
171151
def teams(self) -> List[Team]:
172152
return self._teams
173-
174153

175154
@teams.setter
176155
def teams(self, teams: List[Team]):
@@ -179,12 +158,3 @@ def teams(self, teams: List[Team]):
179158
@api_client.setter
180159
def api_client(self, api_client: 'TeamsAPI'):
181160
self._api_client = api_client
182-
183-
184-
185-
186-
187-
188-
189-
190-

intercom_python_sdk/apis/teams/schemas.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,13 @@
1111
- [1] https://developers.intercom.com/intercom-api-reference/reference/listteams
1212
"""
1313

14-
1514
# External
16-
import marshmallow
1715
from marshmallow import fields
1816

19-
# From Current API
20-
from . import models as t_models
21-
2217
# From Current Package
2318
from ...core.schema_base import SchemaBase
2419

25-
'''
26-
{
27-
"type": "team",
28-
"id": "814865",
29-
"name": "Example Team",
30-
"admin_ids": [
31-
493881
32-
814860
33-
]
34-
"admin_priority_level": {
35-
"primary_admin_ids": [
36-
493881
37-
],
38-
"secondary_admin_ids": [
39-
814860
40-
]
41-
},
42-
}
43-
'''
20+
4421
class AdminPriorityLevelSchema(SchemaBase):
4522
"""
4623
This schema represents a AdminPriorityLevel on Intercom.
@@ -52,6 +29,7 @@ class AdminPriorityLevelSchema(SchemaBase):
5229
primary_admin_ids = fields.List(fields.Int())
5330
secondary_admin_ids = fields.List(fields.Int())
5431

32+
5533
class TeamSchema(SchemaBase):
5634
"""
5735
This schema represents a Team on Intercom.
@@ -68,8 +46,6 @@ class TeamSchema(SchemaBase):
6846
name = fields.Str()
6947
admin_ids = fields.List(fields.Int())
7048
admin_priority_level = fields.Nested(AdminPriorityLevelSchema)
71-
72-
7349

7450

7551
class TeamListSchema(SchemaBase):

0 commit comments

Comments
 (0)