Skip to content

Commit 5b4beef

Browse files
committed
* Add async driver
* Resolved problems with downloads * Resolved problems with some JS functions * Get common groups feature * PEP8 * Other things I can't remember
1 parent 2c010ab commit 5b4beef

14 files changed

+749
-164
lines changed

Makefile

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
2+
PACKAGE_NAME = webwhatsapi
3+
PACKAGE_COVERAGE = webwhatsapi
4+
5+
help:
6+
@echo "Options"
7+
@echo "-----------------------------------------------------------------------"
8+
@echo "help: This help"
9+
@echo "requirements: Download requirements"
10+
@echo "requirements-test: Download requirements for tests"
11+
@echo "requirements-docs: Download requirements for docs"
12+
@echo "run-tests: Run tests with coverage"
13+
@echo "publish: Publish new version on Pypi"
14+
@echo "clean: Clean compiled files"
15+
@echo "flake: Run Flake8"
16+
@echo "prepush: Helper to run before to push to repo"
17+
@echo "pull-request: Helper to run before to merge a pull request"
18+
@echo "autopep: Reformat code using PEP8"
19+
@echo "-----------------------------------------------------------------------"
20+
21+
requirements:
22+
@echo "Installing ${PACKAGE_NAME} requirements..."
23+
pip install -r requirements.txt
24+
25+
requirements-test: requirements
26+
@echo "Installing ${PACKAGE_NAME} tests requirements..."
27+
pip install -r requirements-test.txt
28+
29+
requirements-docs: requirements
30+
@echo "Installing ${PACKAGE_NAME} docs requirements..."
31+
pip install -r requirements-docs.txt
32+
33+
run-tests:
34+
@echo "Running tests..."
35+
nosetests --with-coverage -d --cover-package=${PACKAGE_COVERAGE} --cover-erase
36+
37+
publish:
38+
@echo "Publishing new version on Pypi..."
39+
python setup.py bdist_wheel upload
40+
41+
clean:
42+
@echo "Cleaning compiled files..."
43+
find . | grep -E "(__pycache__|\.pyc|\.pyo)$ " | xargs rm -rf
44+
@echo "Cleaning distribution files..."
45+
rm -rf dist
46+
@echo "Cleaning build files..."
47+
rm -rf build
48+
@echo "Cleaning egg info files..."
49+
rm -rf ${PACKAGE_NAME}.egg-info
50+
@echo "Cleaning coverage files..."
51+
rm -f .coverage
52+
53+
build:
54+
python3 setup.py bdist_wheel
55+
56+
flake:
57+
@echo "Running flake8 tests..."
58+
flake8 ${PACKAGE_COVERAGE}
59+
flake8 tests
60+
61+
autopep:
62+
autopep8 --max-line-length 120 -r -j 8 -i .
63+
64+
prepush: flake run-tests
65+
66+
pull-request: flake run-tests

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ Possible arguments for constructor:
4545
6. Viewing all contacts
4646
` driver.get_all_chats() `
4747

48-
7. To send a message, get a Contact object, and call the send_message function with the message.
49-
`<Contact Object>.send_message("Hello")`
48+
7. To send a message, get a Contact object, and call the chat_send_message function with the message.
49+
`<Contact Object>.chat_send_message("Hello")`
5050

5151
## Limitation
5252
Phone has to be on and connected to the internet

pylint.rc

+280
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
[MASTER]
2+
3+
# Specify a configuration file.
4+
#rcfile=
5+
6+
# Python code to execute, usually for sys.path manipulation such as
7+
# pygtk.require().
8+
#init-hook=
9+
10+
# Profiled execution.
11+
profile=no
12+
13+
# Add files or directories to the blacklist. They should be base names, not
14+
# paths.
15+
ignore=CVS
16+
17+
# Pickle collected data for later comparisons.
18+
persistent=yes
19+
20+
# List of plugins (as comma separated values of python modules names) to load,
21+
# usually to register additional checkers.
22+
load-plugins=
23+
24+
25+
[REPORTS]
26+
27+
# Set the output format. Available formats are text, parseable, colorized, msvs
28+
# (visual studio) and html. You can also give a reporter class, eg
29+
# mypackage.mymodule.MyReporterClass.
30+
output-format=text
31+
32+
# Put messages in a separate file for each module / package specified on the
33+
# command line instead of printing them on stdout. Reports (if any) will be
34+
# written in a file name "pylint_global.[txt|html]".
35+
files-output=no
36+
37+
# Tells whether to display a full report or only the messages
38+
reports=yes
39+
40+
# Python expression which should return a note less than 10 (10 is the highest
41+
# note). You have access to the variables errors warning, statement which
42+
# respectively contain the number of errors / warnings messages and the total
43+
# number of statements analyzed. This is used by the global evaluation report
44+
# (RP0004).
45+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
46+
47+
# Add a comment according to your evaluation note. This is used by the global
48+
# evaluation report (RP0004).
49+
comment=no
50+
51+
# Template used to display messages. This is a python new-style format string
52+
# used to format the message information. See doc for all details
53+
#msg-template=
54+
55+
56+
[MESSAGES CONTROL]
57+
58+
# Enable the message, report, category or checker with the given id(s). You can
59+
# either give multiple identifier separated by comma (,) or put this option
60+
# multiple time. See also the "--disable" option for examples.
61+
#enable=
62+
63+
# Disable the message, report, category or checker with the given id(s). You
64+
# can either give multiple identifiers separated by comma (,) or put this
65+
# option multiple times (only on the command line, not in the configuration
66+
# file where it should appear only once).You can also use "--disable=all" to
67+
# disable everything first and then reenable specific checks. For example, if
68+
# you want to run only the similarities checker, you can use "--disable=all
69+
# --enable=similarities". If you want to run only the classes checker, but have
70+
# no Warning level messages displayed, use"--disable=all --enable=classes
71+
# --disable=W"
72+
disable=old-style-class,bad-mcs-classmethod-argument,super-on-old-class
73+
74+
75+
[MISCELLANEOUS]
76+
77+
# List of note tags to take in consideration, separated by a comma.
78+
notes=FIXME,XXX,TODO
79+
80+
81+
[SIMILARITIES]
82+
83+
# Minimum lines number of a similarity.
84+
min-similarity-lines=4
85+
86+
# Ignore comments when computing similarities.
87+
ignore-comments=yes
88+
89+
# Ignore docstrings when computing similarities.
90+
ignore-docstrings=yes
91+
92+
# Ignore imports when computing similarities.
93+
ignore-imports=no
94+
95+
96+
[BASIC]
97+
98+
# Required attributes for module, separated by a comma
99+
required-attributes=
100+
101+
# List of builtins function names that should not be used, separated by a comma
102+
bad-functions=map,filter,apply
103+
104+
# Regular expression which should only match correct module names
105+
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
106+
107+
# Regular expression which should only match correct module level names
108+
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
109+
110+
# Regular expression which should only match correct class names
111+
class-rgx=[A-Z_][a-zA-Z0-9]+$
112+
113+
# Regular expression which should only match correct function names
114+
function-rgx=[a-z_][a-z0-9_]{2,30}$
115+
116+
# Regular expression which should only match correct method names
117+
method-rgx=[a-z_][a-z0-9_]{2,30}$
118+
119+
# Regular expression which should only match correct instance attribute names
120+
attr-rgx=[a-z_][a-z0-9_]{2,30}$
121+
122+
# Regular expression which should only match correct argument names
123+
argument-rgx=[a-z_][a-z0-9_]{2,30}$
124+
125+
# Regular expression which should only match correct variable names
126+
variable-rgx=[a-z_][a-z0-9_]{2,30}$
127+
128+
# Regular expression which should only match correct attribute names in class
129+
# bodies
130+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
131+
132+
# Regular expression which should only match correct list comprehension /
133+
# generator expression variable names
134+
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
135+
136+
# Good variable names which should always be accepted, separated by a comma
137+
good-names=i,j,k,ex,Run,_
138+
139+
# Bad variable names which should always be refused, separated by a comma
140+
bad-names=foo,bar,baz,toto,tutu,tata
141+
142+
# Regular expression which should only match function or class names that do
143+
# not require a docstring.
144+
no-docstring-rgx=__.*__
145+
146+
# Minimum line length for functions/classes that require docstrings, shorter
147+
# ones are exempt.
148+
docstring-min-length=-1
149+
150+
151+
[VARIABLES]
152+
153+
# Tells whether we should check for unused import in __init__ files.
154+
init-import=no
155+
156+
# A regular expression matching the beginning of the name of dummy variables
157+
# (i.e. not used).
158+
dummy-variables-rgx=_$|dummy
159+
160+
# List of additional names supposed to be defined in builtins. Remember that
161+
# you should avoid to define new builtins when possible.
162+
additional-builtins=
163+
164+
165+
[FORMAT]
166+
167+
# Maximum number of characters on a single line.
168+
max-line-length=120
169+
170+
# Regexp for a line that is allowed to be longer than the limit.
171+
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
172+
173+
# Allow the body of an if to be on the same line as the test if there is no
174+
# else.
175+
single-line-if-stmt=no
176+
177+
# List of optional constructs for which whitespace checking is disabled
178+
no-space-check=trailing-comma,dict-separator
179+
180+
# Maximum number of lines in a module
181+
max-module-lines=1000
182+
183+
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
184+
# tab).
185+
indent-string=' '
186+
187+
188+
[TYPECHECK]
189+
190+
# Tells whether missing members accessed in mixin class should be ignored. A
191+
# mixin class is detected if its name ends with "mixin" (case insensitive).
192+
ignore-mixin-members=yes
193+
194+
# List of classes names for which member attributes should not be checked
195+
# (useful for classes with attributes dynamically set).
196+
ignored-classes=SQLObject
197+
198+
# When zope mode is activated, add a predefined set of Zope acquired attributes
199+
# to generated-members.
200+
zope=no
201+
202+
# List of members which are set dynamically and missed by pylint inference
203+
# system, and so shouldn't trigger E0201 when accessed. Python regular
204+
# expressions are accepted.
205+
generated-members=REQUEST,acl_users,aq_parent
206+
207+
208+
[DESIGN]
209+
210+
# Maximum number of arguments for function / method
211+
max-args=5
212+
213+
# Argument names that match this expression will be ignored. Default to name
214+
# with leading underscore
215+
ignored-argument-names=_.*
216+
217+
# Maximum number of locals for function / method body
218+
max-locals=15
219+
220+
# Maximum number of return / yield for function / method body
221+
max-returns=6
222+
223+
# Maximum number of branch for function / method body
224+
max-branches=12
225+
226+
# Maximum number of statements in function / method body
227+
max-statements=50
228+
229+
# Maximum number of parents for a class (see R0901).
230+
max-parents=7
231+
232+
# Maximum number of attributes for a class (see R0902).
233+
max-attributes=7
234+
235+
# Minimum number of public methods for a class (see R0903).
236+
min-public-methods=2
237+
238+
# Maximum number of public methods for a class (see R0904).
239+
max-public-methods=20
240+
241+
242+
[IMPORTS]
243+
244+
# Deprecated modules which should not be used, separated by a comma
245+
deprecated-modules=regsub,TERMIOS,Bastion,rexec
246+
247+
# Create a graph of every (i.e. internal and external) dependencies in the
248+
# given file (report RP0402 must not be disabled)
249+
import-graph=
250+
251+
# Create a graph of external dependencies in the given file (report RP0402 must
252+
# not be disabled)
253+
ext-import-graph=
254+
255+
# Create a graph of internal dependencies in the given file (report RP0402 must
256+
# not be disabled)
257+
int-import-graph=
258+
259+
260+
[CLASSES]
261+
262+
# List of interface methods to ignore, separated by a comma. This is used for
263+
# instance to not check methods defines in Zope's Interface base class.
264+
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
265+
266+
# List of method names used to declare (i.e. assign) instance attributes.
267+
defining-attr-methods=__init__,__new__,setUp
268+
269+
# List of valid names for the first argument in a class method.
270+
valid-classmethod-first-arg=cls
271+
272+
# List of valid names for the first argument in a metaclass class method.
273+
#valid-metaclass-classmethod-first-arg=mcs
274+
275+
276+
[EXCEPTIONS]
277+
278+
# Exceptions that will emit a warning when being caught. Defaults to
279+
# "Exception"
280+
overgeneral-exceptions=Exception

requirements-test.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pep8
2+
flake8
3+
coverage
4+
autopep8
5+

0 commit comments

Comments
 (0)