Skip to content

Commit 51d8a91

Browse files
committed
Rough fixes to get to a working oauth 2 flow
- Add docstrings - Get a new access token if you have a refresh token and the access token is expired - Update .travis.yml to use new container architecture - Remove oauth2 requirement - Change consumer/client key to client_id
1 parent d89a7a0 commit 51d8a91

File tree

9 files changed

+740
-224
lines changed

9 files changed

+740
-224
lines changed

.pep8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pep8]
2+
max-line-length = 120
3+
ignore = E111,E114,E121,E501,E261,E402,E731,E266
4+
exclude = migrations

.travis.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
1+
# Travis CI configuration file
2+
# http://about.travis-ci.org/docs/
3+
sudo: false
4+
15
language: python
6+
7+
# Available Python versions:
8+
# http://about.travis-ci.org/docs/user/ci-environment/#Python-VM-images
29
python:
310
- "2.7"
4-
script: python -m unittest discover -c tests
11+
# - "3.2"
12+
# - "3.3"
13+
# - "3.4"
514
install:
6-
- "pip install ."
15+
- pip install .
16+
- pip install pylint
17+
- pip install pyflakes
18+
- pip install pep8
19+
script:
20+
- pwd
21+
- pep8 rdioapi rdio-call tests
22+
- pylint rdioapi rdio-call tests
23+
- pyflakes rdioapi rdio-call tests
24+
- python -m unittest discover -c tests

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The library is just called rdio. It include an Rdio class and a few exception cl
4343

4444
>>> from rdioapi import Rdio
4545
>>> state = {}
46-
>>> r = Rdio(CONSUMER_KEY, CONSUMER_SECRET, state)
46+
>>> r = Rdio(CLIENT_ID, CONSUMER_SECRET, state)
4747
>>> from pprint import pprint
4848
>>> pprint(r.get(keys='t7609753'))
4949
{u't7609753': {u'album': u'Hardcore Will Never Die, But You Will',

pylintrc

Lines changed: 330 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,330 @@
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="import os; root=os.popen('git rev-parse --show-toplevel').read().rstrip('\n'); import sys; sys.path.insert(0, os.path.join(root, 'contrib'))"
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+
[MESSAGES CONTROL]
26+
27+
# Enable the message, report, category or checker with the given id(s). You can
28+
# either give multiple identifier separated by comma (,) or put this option
29+
# multiple time. See also the "--disable" option for examples.
30+
#enable=
31+
32+
# Disable the message, report, category or checker with the given id(s). You
33+
# can either give multiple identifiers separated by comma (,) or put this
34+
# option multiple times (only on the command line, not in the configuration
35+
# file where it should appear only once).You can also use "--disable=all" to
36+
# disable everything first and then reenable specific checks. For example, if
37+
# you want to run only the similarities checker, you can use "--disable=all
38+
# --enable=similarities". If you want to run only the classes checker, but have
39+
# no Warning level messages displayed, use"--disable=all --enable=classes
40+
# --disable=W"
41+
disable=no-member,missing-docstring,C0103,R0912,W0621
42+
43+
44+
[REPORTS]
45+
46+
# Set the output format. Available formats are text, parseable, colorized, msvs
47+
# (visual studio) and html. You can also give a reporter class, eg
48+
# mypackage.mymodule.MyReporterClass.
49+
output-format=text
50+
51+
# Put messages in a separate file for each module / package specified on the
52+
# command line instead of printing them on stdout. Reports (if any) will be
53+
# written in a file name "pylint_global.[txt|html]".
54+
files-output=no
55+
56+
# Tells whether to display a full report or only the messages
57+
reports=yes
58+
59+
# Python expression which should return a note less than 10 (10 is the highest
60+
# note). You have access to the variables errors warning, statement which
61+
# respectively contain the number of errors / warnings messages and the total
62+
# number of statements analyzed. This is used by the global evaluation report
63+
# (RP0004).
64+
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
65+
66+
# Add a comment according to your evaluation note. This is used by the global
67+
# evaluation report (RP0004).
68+
comment=no
69+
70+
# Template used to display messages. This is a python new-style format string
71+
# used to format the message information. See doc for all details
72+
#msg-template=
73+
74+
75+
[BASIC]
76+
77+
# Required attributes for module, separated by a comma
78+
required-attributes=
79+
80+
# List of builtins function names that should not be used, separated by a comma
81+
bad-functions=map,filter,apply,input,file
82+
83+
# Good variable names which should always be accepted, separated by a comma
84+
good-names=i,j,k,ex,Run,_
85+
86+
# Bad variable names which should always be refused, separated by a comma
87+
bad-names=foo,bar,baz,toto,tutu,tata
88+
89+
# Colon-delimited sets of names that determine each other's naming style when
90+
# the name regexes allow several styles.
91+
name-group=
92+
93+
# Include a hint for the correct naming format with invalid-name
94+
include-naming-hint=no
95+
96+
# Regular expression matching correct function names
97+
function-rgx=[a-z_][a-z0-9_]{2,30}$
98+
99+
# Naming hint for function names
100+
function-name-hint=[a-z_][a-z0-9_]{2,30}$
101+
102+
# Regular expression matching correct variable names
103+
variable-rgx=[a-z_][a-z0-9_]{2,30}$
104+
105+
# Naming hint for variable names
106+
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
107+
108+
# Regular expression matching correct constant names
109+
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
110+
111+
# Naming hint for constant names
112+
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
113+
114+
# Regular expression matching correct attribute names
115+
attr-rgx=[a-z_][a-z0-9_]{2,30}$
116+
117+
# Naming hint for attribute names
118+
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
119+
120+
# Regular expression matching correct argument names
121+
argument-rgx=[a-z_][a-z0-9_]{2,30}$
122+
123+
# Naming hint for argument names
124+
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
125+
126+
# Regular expression matching correct class attribute names
127+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
128+
129+
# Naming hint for class attribute names
130+
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
131+
132+
# Regular expression matching correct inline iteration names
133+
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
134+
135+
# Naming hint for inline iteration names
136+
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
137+
138+
# Regular expression matching correct class names
139+
class-rgx=[A-Z_][a-zA-Z0-9]+$
140+
141+
# Naming hint for class names
142+
class-name-hint=[A-Z_][a-zA-Z0-9]+$
143+
144+
# Regular expression matching correct module names
145+
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
146+
147+
# Naming hint for module names
148+
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
149+
150+
# Regular expression matching correct method names
151+
method-rgx=[a-z_][a-z0-9_]{2,30}$
152+
153+
# Naming hint for method names
154+
method-name-hint=[a-z_][a-z0-9_]{2,30}$
155+
156+
# Regular expression which should only match function or class names that do
157+
# not require a docstring.
158+
no-docstring-rgx=__.*__
159+
160+
# Minimum line length for functions/classes that require docstrings, shorter
161+
# ones are exempt.
162+
docstring-min-length=-1
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+
# Number of spaces of indent required inside a hanging or continued line.
188+
indent-after-paren=2
189+
190+
191+
[LOGGING]
192+
193+
# Logging modules to check that the string format arguments are in logging
194+
# function parameter format
195+
logging-modules=logging
196+
197+
198+
[MISCELLANEOUS]
199+
200+
# List of note tags to take in consideration, separated by a comma.
201+
notes=FIXME,XXX,TODO
202+
203+
204+
[SIMILARITIES]
205+
206+
# Minimum lines number of a similarity.
207+
min-similarity-lines=4
208+
209+
# Ignore comments when computing similarities.
210+
ignore-comments=yes
211+
212+
# Ignore docstrings when computing similarities.
213+
ignore-docstrings=yes
214+
215+
# Ignore imports when computing similarities.
216+
ignore-imports=no
217+
218+
219+
[TYPECHECK]
220+
221+
# Tells whether missing members accessed in mixin class should be ignored. A
222+
# mixin class is detected if its name ends with "mixin" (case insensitive).
223+
ignore-mixin-members=yes
224+
225+
# List of module names for which member attributes should not be checked
226+
# (useful for modules/projects where namespaces are manipulated during runtime
227+
# and thus extisting member attributes cannot be deduced by static analysis
228+
ignored-modules=
229+
230+
# List of classes names for which member attributes should not be checked
231+
# (useful for classes with attributes dynamically set).
232+
ignored-classes=SQLObject
233+
234+
# When zope mode is activated, add a predefined set of Zope acquired attributes
235+
# to generated-members.
236+
zope=no
237+
238+
# List of members which are set dynamically and missed by pylint inference
239+
# system, and so shouldn't trigger E0201 when accessed. Python regular
240+
# expressions are accepted.
241+
generated-members=REQUEST,acl_users,aq_parent
242+
243+
244+
[VARIABLES]
245+
246+
# Tells whether we should check for unused import in __init__ files.
247+
init-import=no
248+
249+
# A regular expression matching the name of dummy variables (i.e. expectedly
250+
# not used).
251+
dummy-variables-rgx=_$|dummy
252+
253+
# List of additional names supposed to be defined in builtins. Remember that
254+
# you should avoid to define new builtins when possible.
255+
additional-builtins=
256+
257+
258+
[CLASSES]
259+
260+
# List of interface methods to ignore, separated by a comma. This is used for
261+
# instance to not check methods defines in Zope's Interface base class.
262+
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
263+
264+
# List of method names used to declare (i.e. assign) instance attributes.
265+
defining-attr-methods=__init__,__new__,setUp
266+
267+
# List of valid names for the first argument in a class method.
268+
valid-classmethod-first-arg=cls
269+
270+
# List of valid names for the first argument in a metaclass class method.
271+
valid-metaclass-classmethod-first-arg=mcs
272+
273+
274+
[DESIGN]
275+
276+
# Maximum number of arguments for function / method
277+
max-args=5
278+
279+
# Argument names that match this expression will be ignored. Default to name
280+
# with leading underscore
281+
ignored-argument-names=_.*
282+
283+
# Maximum number of locals for function / method body
284+
max-locals=15
285+
286+
# Maximum number of return / yield for function / method body
287+
max-returns=6
288+
289+
# Maximum number of branch for function / method body
290+
max-branches=12
291+
292+
# Maximum number of statements in function / method body
293+
max-statements=50
294+
295+
# Maximum number of parents for a class (see R0901).
296+
max-parents=7
297+
298+
# Maximum number of attributes for a class (see R0902).
299+
max-attributes=7
300+
301+
# Minimum number of public methods for a class (see R0903).
302+
min-public-methods=2
303+
304+
# Maximum number of public methods for a class (see R0904).
305+
max-public-methods=20
306+
307+
308+
[IMPORTS]
309+
310+
# Deprecated modules which should not be used, separated by a comma
311+
deprecated-modules=regsub,TERMIOS,Bastion,rexec
312+
313+
# Create a graph of every (i.e. internal and external) dependencies in the
314+
# given file (report RP0402 must not be disabled)
315+
import-graph=
316+
317+
# Create a graph of external dependencies in the given file (report RP0402 must
318+
# not be disabled)
319+
ext-import-graph=
320+
321+
# Create a graph of internal dependencies in the given file (report RP0402 must
322+
# not be disabled)
323+
int-import-graph=
324+
325+
326+
[EXCEPTIONS]
327+
328+
# Exceptions that will emit a warning when being caught. Defaults to
329+
# "Exception"
330+
overgeneral-exceptions=Exception

0 commit comments

Comments
 (0)