Skip to content

Commit e90d424

Browse files
committed
Drop stub files
1 parent 60b9276 commit e90d424

File tree

10 files changed

+86
-209
lines changed

10 files changed

+86
-209
lines changed

reportportal_client/_internal/services/client_id.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import io
1818
import logging
1919
import os
20+
from typing import Iterable, Optional, Union
2021
from uuid import uuid4
2122

2223
from .constants import CLIENT_ID_PROPERTY, RP_FOLDER_PATH, RP_PROPERTIES_FILE_PATH
@@ -32,35 +33,35 @@ def __preprocess_file(self, fp):
3233
content = "[" + self.DEFAULT_SECTION + "]\n" + fp.read()
3334
return io.StringIO(content)
3435

35-
def read(self, filenames, encoding=None):
36+
def read(self, filenames: Union[Iterable[str], str], source: Optional[str] = None) -> None:
3637
if isinstance(filenames, str):
3738
filenames = [filenames]
3839
for filename in filenames:
3940
with open(filename, "r") as fp:
4041
preprocessed_fp = self.__preprocess_file(fp)
4142
self.read_file(preprocessed_fp, filename)
4243

43-
def write(self, fp, space_around_delimiters=True):
44+
def write(self, fp, space_around_delimiters: bool = True) -> None:
4445
for key, value in self.items(self.DEFAULT_SECTION):
4546
delimiter = " = " if space_around_delimiters else "="
4647
fp.write("{}{}{}\n".format(key, delimiter, value))
4748

4849

49-
def __read_config():
50+
def __read_config() -> configparser.ConfigParser:
5051
config = __NoSectionConfigParser()
5152
if os.path.exists(RP_PROPERTIES_FILE_PATH):
5253
config.read(RP_PROPERTIES_FILE_PATH)
5354
return config
5455

5556

56-
def _read_client_id():
57+
def _read_client_id() -> Optional[str]:
5758
config = __read_config()
5859
if config.has_option(__NoSectionConfigParser.DEFAULT_SECTION, CLIENT_ID_PROPERTY):
5960
return config.get(__NoSectionConfigParser.DEFAULT_SECTION, CLIENT_ID_PROPERTY)
6061
return None
6162

6263

63-
def _store_client_id(client_id):
64+
def _store_client_id(client_id: str) -> None:
6465
config = __read_config()
6566
if not os.path.exists(RP_FOLDER_PATH):
6667
os.makedirs(RP_FOLDER_PATH)
@@ -69,7 +70,7 @@ def _store_client_id(client_id):
6970
config.write(fp)
7071

7172

72-
def get_client_id():
73+
def get_client_id() -> str:
7374
"""Return unique client ID of the instance, generate new if not exists."""
7475
client_id = None
7576
try:

reportportal_client/_internal/services/client_id.pyi

Lines changed: 0 additions & 18 deletions
This file was deleted.

reportportal_client/_internal/services/constants.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import os
1818

1919

20-
def _decode_string(text):
20+
def _decode_string(text: str) -> str:
2121
"""Decode value of the given string.
2222
2323
:param text: Encoded string
@@ -28,8 +28,8 @@ def _decode_string(text):
2828
return message_bytes.decode("ascii")
2929

3030

31-
CLIENT_INFO = _decode_string("Ry1XUDU3UlNHOFhMOm5Ib3dqRjJQUVotNDFJbzBPcDRoZlE=")
32-
ENDPOINT = "https://www.google-analytics.com/mp/collect"
33-
CLIENT_ID_PROPERTY = "client.id"
34-
RP_FOLDER_PATH = os.path.join(os.path.expanduser("~"), ".rp")
35-
RP_PROPERTIES_FILE_PATH = os.path.join(RP_FOLDER_PATH, "rp.properties")
31+
CLIENT_INFO: str = _decode_string("Ry1XUDU3UlNHOFhMOm5Ib3dqRjJQUVotNDFJbzBPcDRoZlE=")
32+
ENDPOINT: str = "https://www.google-analytics.com/mp/collect"
33+
CLIENT_ID_PROPERTY: str = "client.id"
34+
RP_FOLDER_PATH: str = os.path.join(os.path.expanduser("~"), ".rp")
35+
RP_PROPERTIES_FILE_PATH: str = os.path.join(RP_FOLDER_PATH, "rp.properties")

reportportal_client/_internal/services/constants.pyi

Lines changed: 0 additions & 22 deletions
This file was deleted.

reportportal_client/core/rp_file.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,24 @@
1414
"""This module contains classes representing RP file object."""
1515

1616
import uuid
17+
from typing import Any, Optional
1718

1819

1920
class RPFile(object):
2021
"""Class representation for a file that will be attached to the log."""
2122

22-
def __init__(self, name=None, content=None, content_type=None, data=None, mime=None):
23+
content: Optional[Any]
24+
content_type: str
25+
name: str
26+
27+
def __init__(
28+
self,
29+
name: Optional[str] = None,
30+
content: Optional[Any] = None,
31+
content_type: Optional[str] = None,
32+
data: Optional[Any] = None,
33+
mime: Optional[str] = None,
34+
) -> None:
2335
"""Initialize instance attributes.
2436
2537
:param name: File name
@@ -33,6 +45,6 @@ def __init__(self, name=None, content=None, content_type=None, data=None, mime=N
3345
self.name = name if name and name.strip() else str(uuid.uuid4())
3446

3547
@property
36-
def payload(self):
48+
def payload(self) -> dict:
3749
"""Get HTTP payload for the request."""
3850
return {"content": self.content, "contentType": self.content_type, "name": self.name}

reportportal_client/core/rp_file.pyi

Lines changed: 0 additions & 23 deletions
This file was deleted.

reportportal_client/core/rp_issues.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,25 @@
3939
}
4040
"""
4141

42+
from typing import Any, Optional
43+
4244

4345
class Issue:
4446
"""This class represents an issue that can be attached to test result."""
4547

46-
def __init__(self, issue_type, comment=None, auto_analyzed=False, ignore_analyzer=True):
48+
_external_issues: list
49+
auto_analyzed: bool
50+
comment: Optional[str]
51+
ignore_analyzer: bool
52+
issue_type: str
53+
54+
def __init__(
55+
self,
56+
issue_type: str,
57+
comment: Optional[str] = None,
58+
auto_analyzed: bool = False,
59+
ignore_analyzer: bool = True,
60+
) -> None:
4761
"""Initialize instance attributes.
4862
4963
:param issue_type: Issue type locator. Allowable values: "pb***",
@@ -61,12 +75,12 @@ def __init__(self, issue_type, comment=None, auto_analyzed=False, ignore_analyze
6175
self.ignore_analyzer = ignore_analyzer
6276
self.issue_type = issue_type
6377

64-
def external_issue_add(self, issue):
78+
def external_issue_add(self, issue: "ExternalIssue") -> None:
6579
"""Add external system issue to the issue."""
6680
self._external_issues.append(issue.payload)
6781

6882
@property
69-
def payload(self):
83+
def payload(self) -> dict[str, Optional[Any]]:
7084
"""Form the correct dictionary for the issue."""
7185
return {
7286
"autoAnalyzed": self.auto_analyzed,
@@ -80,7 +94,20 @@ def payload(self):
8094
class ExternalIssue:
8195
"""This class represents external(BTS) system issue."""
8296

83-
def __init__(self, bts_url=None, bts_project=None, submit_date=None, ticket_id=None, url=None):
97+
bts_url: Optional[str]
98+
bts_project: Optional[str]
99+
submit_date: Optional[str]
100+
ticket_id: Optional[str]
101+
url: Optional[str]
102+
103+
def __init__(
104+
self,
105+
bts_url: Optional[str] = None,
106+
bts_project: Optional[str] = None,
107+
submit_date: Optional[str] = None,
108+
ticket_id: Optional[str] = None,
109+
url: Optional[str] = None,
110+
) -> None:
84111
"""Initialize instance attributes.
85112
86113
:param bts_url: Bug tracker system URL
@@ -96,7 +123,7 @@ def __init__(self, bts_url=None, bts_project=None, submit_date=None, ticket_id=N
96123
self.url = url
97124

98125
@property
99-
def payload(self):
126+
def payload(self) -> dict[str, Optional[str]]:
100127
"""Form the correct dictionary for the BTS issue."""
101128
return {
102129
"btsUrl": self.bts_url,

reportportal_client/core/rp_issues.pyi

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)