Skip to content

Commit 0766828

Browse files
author
Rachel
committed
Lint and format repo
1 parent 5cbe439 commit 0766828

35 files changed

+1604
-916
lines changed

.pylintrc

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

examples/graspFuzeBottle.py

+20-24
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import herbpy
44
import os
55
import numpy
6-
import math
7-
import openravepy
8-
import sys # exit()
6+
import sys # exit()
97

108
# get the location of some objects (you'll need the pr_ordata package)
119
from catkin.find_in_workspaces import find_in_workspaces
@@ -17,13 +15,12 @@
1715
path=directory,
1816
first_match_only=True)
1917
if len(objects_path) == 0:
20-
print('Can\'t find directory %s/%s' % (package_name, directory))
18+
print 'Can\'t find directory {}{}'.format(package_name, directory)
2119
sys.exit()
2220
else:
23-
print objects_path # for me this is '/home/USERNAME/catkin_workspaces/herb_ws/src/pr-ordata/data/objects'
21+
print objects_path # for me this is '/home/USERNAME/catkin_workspaces/herb_ws/src/pr-ordata/data/objects'
2422
objects_path = objects_path[0]
2523

26-
2724
# ===========================
2825
# ENVIRONMENT SETUP
2926
# ===========================
@@ -34,27 +31,25 @@
3431
table_file = os.path.join(objects_path, 'table.kinbody.xml')
3532
table = env.ReadKinBodyXMLFile(table_file)
3633
if table == None:
37-
print('Failed to load table kinbody')
34+
print 'Failed to load table kinbody'
3835
sys.exit()
3936
env.AddKinBody(table)
40-
table_pose = numpy.array([[1., 0., 0., 2],
41-
[0., 0., -1., 2],
42-
[0., 1., 0., 0.0],
43-
[0., 0., 0., 1.]])
37+
table_pose = numpy.array([[1., 0., 0., 2], [0., 0., -1., 2], [0., 1., 0., 0.0],
38+
[0., 0., 0., 1.]])
4439
table.SetTransform(table_pose)
4540

4641
# add a fuze bottle on top of the table
4742
fuze_path = os.path.join(objects_path, 'fuze_bottle.kinbody.xml')
4843
fuze = env.ReadKinBodyXMLFile(fuze_path)
4944
if fuze == None:
50-
print('Failed to load fuze bottle kinbody')
45+
print 'Failed to load fuze bottle kinbody'
5146
sys.exit()
5247
table_aabb = table.ComputeAABB()
53-
x = table_aabb.pos()[0] + table_aabb.extents()[0]*0 # middle of table in x
54-
y = table_aabb.pos()[1] + table_aabb.extents()[1]*.6 # closer to one side of table in y
55-
z = table_aabb.pos()[2] + table_aabb.extents()[2] + .01 # slightly above table in z (so its not in collision
48+
x = table_aabb.pos()[0] + table_aabb.extents()[0] * 0 # middle of table in x
49+
y = table_aabb.pos()[1] + table_aabb.extents()[1] * .6 # closer to one side of table in y
50+
z = table_aabb.pos()[2] + table_aabb.extents()[2] + .01 # slightly above table in z (so its not in collision
5651
fuze_pose = fuze.GetTransform()
57-
fuze_pose[:3,3] = numpy.transpose([x, y, z])
52+
fuze_pose[:3, 3] = numpy.transpose([x, y, z])
5853
fuze.SetTransform(fuze_pose)
5954
env.AddKinBody(fuze)
6055

@@ -65,22 +60,22 @@
6560
raw_input('press enter to begin planning')
6661

6762
# move to a good start position
68-
robot.PlanToNamedConfiguration('relaxed_home') # move the arms to the 'relaxed_home' position
63+
robot.PlanToNamedConfiguration(
64+
'relaxed_home') # move the arms to the 'relaxed_home' position
6965
#indices, values = robot.configurations.get_configuration('relaxed_home') # Faster for testing
7066
#robot.SetDOFValues(values=values, dofindices=indices)
7167

7268
# drive to the table
73-
robot_in_table = numpy.array([[0., 1., 0., 0.],
74-
[0., 0., 1., 0.],
75-
[1., 0., 0., -1.025],
76-
[0., 0., 0., 1.]])
69+
robot_in_table = numpy.array([[0., 1., 0., 0.], [0., 0., 1., 0.],
70+
[1., 0., 0., -1.025], [0., 0., 0., 1.]])
7771
base_pose = numpy.dot(table.GetTransform(), robot_in_table)
78-
base_pose[2,3] = 0
72+
base_pose[2, 3] = 0
7973
robot.base.PlanToBasePose(base_pose)
8074
#robot.SetTransform(base_pose) # way faster for testing
8175

8276
# Grasp the bottle
83-
grasp_dofs, grasp_vals = robot.right_hand.configurations.get_configuration('glass_grasp')
77+
grasp_dofs, grasp_vals = robot.right_hand.configurations.get_configuration(
78+
'glass_grasp')
8479
robot.right_arm.PushGrasp(fuze, push_required=False, preshape=grasp_vals)
8580
robot.right_arm.PlanToNamedConfiguration('home', execute=True)
8681

@@ -89,4 +84,5 @@
8984
robot.right_arm.PlanToNamedConfiguration('home', execute=True)
9085

9186
# we do this so the viewer doesn't close when the example is done
92-
import IPython; IPython.embed()
87+
import IPython
88+
IPython.embed()

0 commit comments

Comments
 (0)