Skip to content

Commit fb4aee0

Browse files
authored
Merge pull request #42 from chavarera/main
Improved documentation
2 parents d14ddb3 + b14594b commit fb4aee0

File tree

10 files changed

+171
-101
lines changed

10 files changed

+171
-101
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ repos:
2828
rev: v0.27.1
2929
hooks:
3030
- id: markdownlint
31-
entry: markdownlint --ignore .github
31+
entry: markdownlint --ignore .github
32+
33+
- repo: https://github.com/econchick/interrogate
34+
rev: 1.4.0
35+
hooks:
36+
- id: interrogate
37+
args: [-vv, -i, --fail-under=80]

examples/with_class_object.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def __init__(self, *args, **kwargs):
1010
super().__init__(*args, **kwargs)
1111

1212
def run(self):
13+
"""Code to visit url and fetch cookies and basic info"""
1314
self.get("https://google.com")
1415
sessionid = self.session()
1516
url = self.url()

s_tool/driver.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,23 @@ def close(self):
4242
self.driver.quit()
4343

4444
def __exit__(self, type, value, traceback):
45-
"""release the resources occupied with the current session"""
45+
"""release the resources occupied with the current session
46+
47+
Args:
48+
type ([type]): type
49+
value ([type]): value
50+
traceback ([type]): and traceback
51+
"""
4652
self.close()
4753

4854
def __enter__(self):
55+
"""Returns an selenium webdriver
56+
Allows you to implement objects
57+
which can be used easily with the with statement
58+
59+
Returns:
60+
[webDriver]: selenium webdriver
61+
"""
4962
return self._load_driver()
5063

5164
def _load_driver(self):
@@ -91,6 +104,7 @@ def _load_driver(self):
91104
return self
92105

93106
def _load_methods(self):
107+
"""Load basic methods"""
94108
self.session = partial(get_session, self.driver)
95109
self.get = partial(visit, self.driver)
96110
self.text = partial(page_source, self.driver)

s_tool/exceptions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ class SToolException(Exception):
44
"""
55

66
def __init__(self, message):
7+
"""[summary]
8+
9+
Args:
10+
message ([str]): Exception message
11+
"""
712
self.message = message
813

914
def __str__(self):
15+
"""Return Exception message
16+
17+
Returns:
18+
[str]: Exception
19+
"""
1020
return str(self.message)

s_tool/parser.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
from s_tool.utils import get_element
33

44

5-
def select_options(element, swap=None, text_exclude=[]):
5+
def select_options(element, swap=None, text_exclude=set()):
66
"""Return dropdown option in key value pair
77
88
Args:
9-
element : An select element
10-
text_exclude : list of values to exclude from result
9+
element ([selenium.element]): An select element
10+
swap ([bool], optional): Value as key if True. Defaults to None.
11+
text_exclude (set, optional): to exclude from result. Defaults to set().
1112
1213
Returns:
13-
return dict of values and text of select element,
14-
return empty dict() if element is not valid or not exists
14+
[dict]: return dict of values and text of select element,
15+
return empty dict() if element is not valid or not exists
1516
"""
17+
1618
option_dict = dict()
1719
if element and hasattr(element, "tag_name") and element.tag_name == "select":
1820
options = get_element(element, "option", "tag_name", many=True)
@@ -36,7 +38,6 @@ def get_table(table):
3638
Returns:
3739
return list of row list,
3840
return [] if table not valid
39-
4041
"""
4142
results = []
4243
if table and hasattr(table, "tag_name") and table.tag_name == "table":

0 commit comments

Comments
 (0)