partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
start_server
Starts up the imolecule server, complete with argparse handling.
imolecule/server/server.py
def start_server(): """Starts up the imolecule server, complete with argparse handling.""" parser = argparse.ArgumentParser(description="Opens a browser-based " "client that interfaces with the " "chemical format converter.") parser.a...
def start_server(): """Starts up the imolecule server, complete with argparse handling.""" parser = argparse.ArgumentParser(description="Opens a browser-based " "client that interfaces with the " "chemical format converter.") parser.a...
[ "Starts", "up", "the", "imolecule", "server", "complete", "with", "argparse", "handling", "." ]
patrickfuller/imolecule
python
https://github.com/patrickfuller/imolecule/blob/07e91600c805123935a78782871414754bd3696d/imolecule/server/server.py#L69-L105
[ "def", "start_server", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Opens a browser-based \"", "\"client that interfaces with the \"", "\"chemical format converter.\"", ")", "parser", ".", "add_argument", "(", "'--debug'", "...
07e91600c805123935a78782871414754bd3696d
train
WebSocket.on_message
Evaluates the function pointed to by json-rpc.
imolecule/server/server.py
def on_message(self, message): """Evaluates the function pointed to by json-rpc.""" json_rpc = json.loads(message) logging.log(logging.DEBUG, json_rpc) if self.pool is None: self.pool = multiprocessing.Pool(processes=args.workers) # Spawn a process to protect the se...
def on_message(self, message): """Evaluates the function pointed to by json-rpc.""" json_rpc = json.loads(message) logging.log(logging.DEBUG, json_rpc) if self.pool is None: self.pool = multiprocessing.Pool(processes=args.workers) # Spawn a process to protect the se...
[ "Evaluates", "the", "function", "pointed", "to", "by", "json", "-", "rpc", "." ]
patrickfuller/imolecule
python
https://github.com/patrickfuller/imolecule/blob/07e91600c805123935a78782871414754bd3696d/imolecule/server/server.py#L39-L66
[ "def", "on_message", "(", "self", ",", "message", ")", ":", "json_rpc", "=", "json", ".", "loads", "(", "message", ")", "logging", ".", "log", "(", "logging", ".", "DEBUG", ",", "json_rpc", ")", "if", "self", ".", "pool", "is", "None", ":", "self", ...
07e91600c805123935a78782871414754bd3696d
train
nearly_eq
implementation based on: http://floating-point-gui.de/errors/comparison/
Geometry/constants.py
def nearly_eq(valA, valB, maxf=None, minf=None, epsilon=None): ''' implementation based on: http://floating-point-gui.de/errors/comparison/ ''' if valA == valB: return True if maxf is None: maxf = float_info.max if minf is None: minf = float_info.min if epsil...
def nearly_eq(valA, valB, maxf=None, minf=None, epsilon=None): ''' implementation based on: http://floating-point-gui.de/errors/comparison/ ''' if valA == valB: return True if maxf is None: maxf = float_info.max if minf is None: minf = float_info.min if epsil...
[ "implementation", "based", "on", ":" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/constants.py#L12-L38
[ "def", "nearly_eq", "(", "valA", ",", "valB", ",", "maxf", "=", "None", ",", "minf", "=", "None", ",", "epsilon", "=", "None", ")", ":", "if", "valA", "==", "valB", ":", "return", "True", "if", "maxf", "is", "None", ":", "maxf", "=", "float_info", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point._convert
:other: Point or point equivalent :ignorescalars: optional boolean :return: Point Class private method for converting 'other' into a Point subclasss. If 'other' already is a Point subclass, nothing is done. If ignoreScalars is True and other is a float or int type, a Typ...
Geometry/point.py
def _convert(cls, other, ignoreScalars=False): ''' :other: Point or point equivalent :ignorescalars: optional boolean :return: Point Class private method for converting 'other' into a Point subclasss. If 'other' already is a Point subclass, nothing is done. If ig...
def _convert(cls, other, ignoreScalars=False): ''' :other: Point or point equivalent :ignorescalars: optional boolean :return: Point Class private method for converting 'other' into a Point subclasss. If 'other' already is a Point subclass, nothing is done. If ig...
[ ":", "other", ":", "Point", "or", "point", "equivalent", ":", "ignorescalars", ":", "optional", "boolean", ":", "return", ":", "Point" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L115-L131
[ "def", "_convert", "(", "cls", ",", "other", ",", "ignoreScalars", "=", "False", ")", ":", "if", "ignoreScalars", ":", "if", "isinstance", "(", "other", ",", "(", "int", ",", "float", ")", ")", ":", "msg", "=", "\"unable to convert {} to {}\"", ".", "for...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.units
:scale: optional integer scaling factor :return: list of three Point subclass Returns three points whose coordinates are the head of a unit vector from the origin ( conventionally i, j and k).
Geometry/point.py
def units(cls, scale=1): ''' :scale: optional integer scaling factor :return: list of three Point subclass Returns three points whose coordinates are the head of a unit vector from the origin ( conventionally i, j and k). ''' return [cls(x=scale), cls(y=scale), ...
def units(cls, scale=1): ''' :scale: optional integer scaling factor :return: list of three Point subclass Returns three points whose coordinates are the head of a unit vector from the origin ( conventionally i, j and k). ''' return [cls(x=scale), cls(y=scale), ...
[ ":", "scale", ":", "optional", "integer", "scaling", "factor", ":", "return", ":", "list", "of", "three", "Point", "subclass" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L148-L157
[ "def", "units", "(", "cls", ",", "scale", "=", "1", ")", ":", "return", "[", "cls", "(", "x", "=", "scale", ")", ",", "cls", "(", "y", "=", "scale", ")", ",", "cls", "(", "z", "=", "scale", ")", "]" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.gaussian
:mu: mean :sigma: standard deviation :return: Point subclass Returns a point whose coordinates are picked from a Gaussian distribution with mean 'mu' and standard deviation 'sigma'. See random.gauss for further explanation of those parameters.
Geometry/point.py
def gaussian(cls, mu=0, sigma=1): ''' :mu: mean :sigma: standard deviation :return: Point subclass Returns a point whose coordinates are picked from a Gaussian distribution with mean 'mu' and standard deviation 'sigma'. See random.gauss for further explanati...
def gaussian(cls, mu=0, sigma=1): ''' :mu: mean :sigma: standard deviation :return: Point subclass Returns a point whose coordinates are picked from a Gaussian distribution with mean 'mu' and standard deviation 'sigma'. See random.gauss for further explanati...
[ ":", "mu", ":", "mean", ":", "sigma", ":", "standard", "deviation", ":", "return", ":", "Point", "subclass" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L160-L172
[ "def", "gaussian", "(", "cls", ",", "mu", "=", "0", ",", "sigma", "=", "1", ")", ":", "return", "cls", "(", "random", ".", "gauss", "(", "mu", ",", "sigma", ")", ",", "random", ".", "gauss", "(", "mu", ",", "sigma", ")", ",", "random", ".", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.random
:origin: optional Point or point equivalent :radius: optional float, radius around origin :return: Point subclass Returns a point with random x, y and z coordinates bounded by the sphere defined by (origin,radius). If a sphere is not supplied, a unit sphere at the origin is ...
Geometry/point.py
def random(cls, origin=None, radius=1): ''' :origin: optional Point or point equivalent :radius: optional float, radius around origin :return: Point subclass Returns a point with random x, y and z coordinates bounded by the sphere defined by (origin,radius). If ...
def random(cls, origin=None, radius=1): ''' :origin: optional Point or point equivalent :radius: optional float, radius around origin :return: Point subclass Returns a point with random x, y and z coordinates bounded by the sphere defined by (origin,radius). If ...
[ ":", "origin", ":", "optional", "Point", "or", "point", "equivalent", ":", "radius", ":", "optional", "float", "radius", "around", "origin", ":", "return", ":", "Point", "subclass" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L175-L200
[ "def", "random", "(", "cls", ",", "origin", "=", "None", ",", "radius", "=", "1", ")", ":", "p", "=", "cls", "(", "origin", ")", "r", "=", "random", ".", "uniform", "(", "0", ",", "radius", ")", "u", "=", "random", ".", "uniform", "(", "0", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point._binary_
:other: Point or point equivalent :func: binary function to apply :inplace: optional boolean :return: Point Implementation private method. All of the binary operations funnel thru this method to reduce cut-and-paste code and enforce consistent behavior of ...
Geometry/point.py
def _binary_(self, other, func, inplace=False): ''' :other: Point or point equivalent :func: binary function to apply :inplace: optional boolean :return: Point Implementation private method. All of the binary operations funnel thru this method to r...
def _binary_(self, other, func, inplace=False): ''' :other: Point or point equivalent :func: binary function to apply :inplace: optional boolean :return: Point Implementation private method. All of the binary operations funnel thru this method to r...
[ ":", "other", ":", "Point", "or", "point", "equivalent", ":", "func", ":", "binary", "function", "to", "apply", ":", "inplace", ":", "optional", "boolean", ":", "return", ":", "Point" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L466-L502
[ "def", "_binary_", "(", "self", ",", "other", ",", "func", ",", "inplace", "=", "False", ")", ":", "dst", "=", "self", "if", "inplace", "else", "self", ".", "__class__", "(", "self", ")", "try", ":", "b", "=", "self", ".", "__class__", ".", "_conve...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point._unary_
:func: unary function to apply to each coordinate :inplace: optional boolean :return: Point Implementation private method. All of the unary operations funnel thru this method to reduce cut-and-paste code and enforce consistent behavior of unary ops. Applies 'fu...
Geometry/point.py
def _unary_(self, func, inplace=False): ''' :func: unary function to apply to each coordinate :inplace: optional boolean :return: Point Implementation private method. All of the unary operations funnel thru this method to reduce cut-and-paste code and enforce co...
def _unary_(self, func, inplace=False): ''' :func: unary function to apply to each coordinate :inplace: optional boolean :return: Point Implementation private method. All of the unary operations funnel thru this method to reduce cut-and-paste code and enforce co...
[ ":", "func", ":", "unary", "function", "to", "apply", "to", "each", "coordinate", ":", "inplace", ":", "optional", "boolean", ":", "return", ":", "Point" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L504-L530
[ "def", "_unary_", "(", "self", ",", "func", ",", "inplace", "=", "False", ")", ":", "dst", "=", "self", "if", "inplace", "else", "self", ".", "__class__", "(", "self", ")", "dst", ".", "x", "=", "func", "(", "dst", ".", "x", ")", "dst", ".", "y...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.cross
:other: Point or point equivalent :return: float Vector cross product of points U (self) and V (other), computed: U x V = (u1*i + u2*j + u3*k) x (v1*i + v2*j + v3*k) s1 = u2v3 - u3v2 s2 = u3v1 - u1v3 s3 = u1v2 - u2v1 U x V = s1 + s2 + s3 Returns a floa...
Geometry/point.py
def cross(self, other): ''' :other: Point or point equivalent :return: float Vector cross product of points U (self) and V (other), computed: U x V = (u1*i + u2*j + u3*k) x (v1*i + v2*j + v3*k) s1 = u2v3 - u3v2 s2 = u3v1 - u1v3 s3 = u1v2 - u2v1 ...
def cross(self, other): ''' :other: Point or point equivalent :return: float Vector cross product of points U (self) and V (other), computed: U x V = (u1*i + u2*j + u3*k) x (v1*i + v2*j + v3*k) s1 = u2v3 - u3v2 s2 = u3v1 - u1v3 s3 = u1v2 - u2v1 ...
[ ":", "other", ":", "Point", "or", "point", "equivalent", ":", "return", ":", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L1260-L1281
[ "def", "cross", "(", "self", ",", "other", ")", ":", "b", "=", "self", ".", "__class__", ".", "_convert", "(", "other", ")", "return", "sum", "(", "[", "(", "self", ".", "y", "*", "b", ".", "z", ")", "-", "(", "self", ".", "z", "*", "b", "....
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.isBetween
:a: Point or point equivalent :b: Point or point equivalent :axis: optional string :return: float Checks the coordinates specified in 'axes' of 'self' to determine if they are bounded by 'a' and 'b'. The range is inclusive of end-points. Returns boolean.
Geometry/point.py
def isBetween(self, a, b, axes='xyz'): ''' :a: Point or point equivalent :b: Point or point equivalent :axis: optional string :return: float Checks the coordinates specified in 'axes' of 'self' to determine if they are bounded by 'a' and 'b'. The range is...
def isBetween(self, a, b, axes='xyz'): ''' :a: Point or point equivalent :b: Point or point equivalent :axis: optional string :return: float Checks the coordinates specified in 'axes' of 'self' to determine if they are bounded by 'a' and 'b'. The range is...
[ ":", "a", ":", "Point", "or", "point", "equivalent", ":", "b", ":", "Point", "or", "point", "equivalent", ":", "axis", ":", "optional", "string", ":", "return", ":", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L1302-L1321
[ "def", "isBetween", "(", "self", ",", "a", ",", "b", ",", "axes", "=", "'xyz'", ")", ":", "a", "=", "self", ".", "__class__", ".", "_convert", "(", "a", ")", "b", "=", "self", ".", "__class__", ".", "_convert", "(", "b", ")", "fn", "=", "lambda...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.ccw
:b: Point or point equivalent :c: Point or point equivalent :axis: optional string or integer in set('x',0,'y',1,'z',2) :return: float CCW - Counter Clockwise Returns an integer signifying the direction of rotation around 'axis' described by the angle [b, self, c]. ...
Geometry/point.py
def ccw(self, b, c, axis='z'): ''' :b: Point or point equivalent :c: Point or point equivalent :axis: optional string or integer in set('x',0,'y',1,'z',2) :return: float CCW - Counter Clockwise Returns an integer signifying the direction of rotation around 'axis...
def ccw(self, b, c, axis='z'): ''' :b: Point or point equivalent :c: Point or point equivalent :axis: optional string or integer in set('x',0,'y',1,'z',2) :return: float CCW - Counter Clockwise Returns an integer signifying the direction of rotation around 'axis...
[ ":", "b", ":", "Point", "or", "point", "equivalent", ":", "c", ":", "Point", "or", "point", "equivalent", ":", "axis", ":", "optional", "string", "or", "integer", "in", "set", "(", "x", "0", "y", "1", "z", "2", ")", ":", "return", ":", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L1353-L1387
[ "def", "ccw", "(", "self", ",", "b", ",", "c", ",", "axis", "=", "'z'", ")", ":", "bsuba", "=", "b", "-", "self", "csuba", "=", "c", "-", "self", "if", "axis", "in", "[", "'z'", ",", "2", "]", ":", "return", "(", "bsuba", ".", "x", "*", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.isCCW
:b: Point or point equivalent :c: Point or point equivalent :axis: optional string or integer in set('x',0,'y',1,'z',2) :return: boolean True if the angle determined by a,self,b around 'axis' describes a counter-clockwise rotation, otherwise False. Raises CollinearPoint...
Geometry/point.py
def isCCW(self, b, c, axis='z'): ''' :b: Point or point equivalent :c: Point or point equivalent :axis: optional string or integer in set('x',0,'y',1,'z',2) :return: boolean True if the angle determined by a,self,b around 'axis' describes a counter-clockwise rota...
def isCCW(self, b, c, axis='z'): ''' :b: Point or point equivalent :c: Point or point equivalent :axis: optional string or integer in set('x',0,'y',1,'z',2) :return: boolean True if the angle determined by a,self,b around 'axis' describes a counter-clockwise rota...
[ ":", "b", ":", "Point", "or", "point", "equivalent", ":", "c", ":", "Point", "or", "point", "equivalent", ":", "axis", ":", "optional", "string", "or", "integer", "in", "set", "(", "x", "0", "y", "1", "z", "2", ")", ":", "return", ":", "boolean" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L1389-L1407
[ "def", "isCCW", "(", "self", ",", "b", ",", "c", ",", "axis", "=", "'z'", ")", ":", "result", "=", "self", ".", "ccw", "(", "b", ",", "c", ",", "axis", ")", "if", "result", "==", "0", ":", "raise", "CollinearPoints", "(", "b", ",", "self", ",...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.isCollinear
:b: Point or point equivalent :c: Point or point equivalent :return: boolean True if 'self' is collinear with 'b' and 'c', otherwise False.
Geometry/point.py
def isCollinear(self, b, c): ''' :b: Point or point equivalent :c: Point or point equivalent :return: boolean True if 'self' is collinear with 'b' and 'c', otherwise False. ''' return all(self.ccw(b, c, axis) == 0 for axis in self._keys)
def isCollinear(self, b, c): ''' :b: Point or point equivalent :c: Point or point equivalent :return: boolean True if 'self' is collinear with 'b' and 'c', otherwise False. ''' return all(self.ccw(b, c, axis) == 0 for axis in self._keys)
[ ":", "b", ":", "Point", "or", "point", "equivalent", ":", "c", ":", "Point", "or", "point", "equivalent", ":", "return", ":", "boolean" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L1409-L1418
[ "def", "isCollinear", "(", "self", ",", "b", ",", "c", ")", ":", "return", "all", "(", "self", ".", "ccw", "(", "b", ",", "c", ",", "axis", ")", "==", "0", "for", "axis", "in", "self", ".", "_keys", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Point.rotate2d
:theta: float radians to rotate self around origin :origin: optional Point, defaults to 0,0,0 Returns a Point rotated by :theta: around :origin:.
Geometry/point.py
def rotate2d(self, theta, origin=None, axis='z', radians=False): ''' :theta: float radians to rotate self around origin :origin: optional Point, defaults to 0,0,0 Returns a Point rotated by :theta: around :origin:. ''' origin = Point._convert(origin) delta = se...
def rotate2d(self, theta, origin=None, axis='z', radians=False): ''' :theta: float radians to rotate self around origin :origin: optional Point, defaults to 0,0,0 Returns a Point rotated by :theta: around :origin:. ''' origin = Point._convert(origin) delta = se...
[ ":", "theta", ":", "float", "radians", "to", "rotate", "self", "around", "origin", ":", "origin", ":", "optional", "Point", "defaults", "to", "0", "0", "0" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/point.py#L1420-L1455
[ "def", "rotate2d", "(", "self", ",", "theta", ",", "origin", "=", "None", ",", "axis", "=", "'z'", ",", "radians", "=", "False", ")", ":", "origin", "=", "Point", ".", "_convert", "(", "origin", ")", "delta", "=", "self", "-", "origin", "p", "=", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.withAngles
:origin: optional Point :alpha: optional float describing length of the side opposite A :beta: optional float describing length of the side opposite B :gamma: optional float describing length of the side opposite C :return: Triangle initialized with points comprising the triangle ...
Geometry/triangle2.py
def withAngles(cls, origin=None, base=1, alpha=None, beta=None, gamma=None, inDegrees=False): ''' :origin: optional Point :alpha: optional float describing length of the side opposite A :beta: optional float describing length of the side opposite B :gamma: opti...
def withAngles(cls, origin=None, base=1, alpha=None, beta=None, gamma=None, inDegrees=False): ''' :origin: optional Point :alpha: optional float describing length of the side opposite A :beta: optional float describing length of the side opposite B :gamma: opti...
[ ":", "origin", ":", "optional", "Point", ":", "alpha", ":", "optional", "float", "describing", "length", "of", "the", "side", "opposite", "A", ":", "beta", ":", "optional", "float", "describing", "length", "of", "the", "side", "opposite", "B", ":", "gamma"...
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle2.py#L45-L55
[ "def", "withAngles", "(", "cls", ",", "origin", "=", "None", ",", "base", "=", "1", ",", "alpha", "=", "None", ",", "beta", "=", "None", ",", "gamma", "=", "None", ",", "inDegrees", "=", "False", ")", ":", "raise", "NotImplementedError", "(", "\"with...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.heronsArea
Heron's forumla for computing the area of a triangle, float. Performance note: contains a square root.
Geometry/triangle2.py
def heronsArea(self): ''' Heron's forumla for computing the area of a triangle, float. Performance note: contains a square root. ''' s = self.semiperimeter return math.sqrt(s * ((s - self.a) * (s - self.b) * (s - self.c)))
def heronsArea(self): ''' Heron's forumla for computing the area of a triangle, float. Performance note: contains a square root. ''' s = self.semiperimeter return math.sqrt(s * ((s - self.a) * (s - self.b) * (s - self.c)))
[ "Heron", "s", "forumla", "for", "computing", "the", "area", "of", "a", "triangle", "float", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle2.py#L182-L191
[ "def", "heronsArea", "(", "self", ")", ":", "s", "=", "self", ".", "semiperimeter", "return", "math", ".", "sqrt", "(", "s", "*", "(", "(", "s", "-", "self", ".", "a", ")", "*", "(", "s", "-", "self", ".", "b", ")", "*", "(", "s", "-", "sel...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.circumradius
Distance from the circumcenter to all the verticies in the Triangle, float.
Geometry/triangle2.py
def circumradius(self): ''' Distance from the circumcenter to all the verticies in the Triangle, float. ''' return (self.a * self.b * self.c) / (self.area * 4)
def circumradius(self): ''' Distance from the circumcenter to all the verticies in the Triangle, float. ''' return (self.a * self.b * self.c) / (self.area * 4)
[ "Distance", "from", "the", "circumcenter", "to", "all", "the", "verticies", "in", "the", "Triangle", "float", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle2.py#L238-L244
[ "def", "circumradius", "(", "self", ")", ":", "return", "(", "self", ".", "a", "*", "self", ".", "b", "*", "self", ".", "c", ")", "/", "(", "self", ".", "area", "*", "4", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.altitudes
A list of the altitudes of each vertex [AltA, AltB, AltC], list of floats. An altitude is the shortest distance from a vertex to the side opposite of it.
Geometry/triangle2.py
def altitudes(self): ''' A list of the altitudes of each vertex [AltA, AltB, AltC], list of floats. An altitude is the shortest distance from a vertex to the side opposite of it. ''' A = self.area * 2 return [A / self.a, A / self.b, A / self.c]
def altitudes(self): ''' A list of the altitudes of each vertex [AltA, AltB, AltC], list of floats. An altitude is the shortest distance from a vertex to the side opposite of it. ''' A = self.area * 2 return [A / self.a, A / self.b, A / self.c]
[ "A", "list", "of", "the", "altitudes", "of", "each", "vertex", "[", "AltA", "AltB", "AltC", "]", "list", "of", "floats", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle2.py#L334-L345
[ "def", "altitudes", "(", "self", ")", ":", "A", "=", "self", ".", "area", "*", "2", "return", "[", "A", "/", "self", ".", "a", ",", "A", "/", "self", ".", "b", ",", "A", "/", "self", ".", "c", "]" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.isIsosceles
True iff two side lengths are equal, boolean.
Geometry/triangle2.py
def isIsosceles(self): ''' True iff two side lengths are equal, boolean. ''' return (self.a == self.b) or (self.a == self.c) or (self.b == self.c)
def isIsosceles(self): ''' True iff two side lengths are equal, boolean. ''' return (self.a == self.b) or (self.a == self.c) or (self.b == self.c)
[ "True", "iff", "two", "side", "lengths", "are", "equal", "boolean", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle2.py#L355-L359
[ "def", "isIsosceles", "(", "self", ")", ":", "return", "(", "self", ".", "a", "==", "self", ".", "b", ")", "or", "(", "self", ".", "a", "==", "self", ".", "c", ")", "or", "(", "self", ".", "b", "==", "self", ".", "c", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.congruent
A congruent B True iff all angles of 'A' equal angles in 'B' and all side lengths of 'A' equal all side lengths of 'B', boolean.
Geometry/triangle2.py
def congruent(self, other): ''' A congruent B True iff all angles of 'A' equal angles in 'B' and all side lengths of 'A' equal all side lengths of 'B', boolean. ''' a = set(self.angles) b = set(other.angles) if len(a) != len(b) or len(a.difference(b)) ...
def congruent(self, other): ''' A congruent B True iff all angles of 'A' equal angles in 'B' and all side lengths of 'A' equal all side lengths of 'B', boolean. ''' a = set(self.angles) b = set(other.angles) if len(a) != len(b) or len(a.difference(b)) ...
[ "A", "congruent", "B" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle2.py#L393-L411
[ "def", "congruent", "(", "self", ",", "other", ")", ":", "a", "=", "set", "(", "self", ".", "angles", ")", "b", "=", "set", "(", "other", ".", "angles", ")", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "or", "len", "(", "a", "."...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.center
Center point of the ellipse, equidistant from foci, Point class.\n Defaults to the origin.
Geometry/ellipse.py
def center(self): ''' Center point of the ellipse, equidistant from foci, Point class.\n Defaults to the origin. ''' try: return self._center except AttributeError: pass self._center = Point() return self._center
def center(self): ''' Center point of the ellipse, equidistant from foci, Point class.\n Defaults to the origin. ''' try: return self._center except AttributeError: pass self._center = Point() return self._center
[ "Center", "point", "of", "the", "ellipse", "equidistant", "from", "foci", "Point", "class", ".", "\\", "n", "Defaults", "to", "the", "origin", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L47-L57
[ "def", "center", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_center", "except", "AttributeError", ":", "pass", "self", ".", "_center", "=", "Point", "(", ")", "return", "self", ".", "_center" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.radius
Radius of the ellipse, Point class.
Geometry/ellipse.py
def radius(self): ''' Radius of the ellipse, Point class. ''' try: return self._radius except AttributeError: pass self._radius = Point(1, 1, 0) return self._radius
def radius(self): ''' Radius of the ellipse, Point class. ''' try: return self._radius except AttributeError: pass self._radius = Point(1, 1, 0) return self._radius
[ "Radius", "of", "the", "ellipse", "Point", "class", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L64-L73
[ "def", "radius", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_radius", "except", "AttributeError", ":", "pass", "self", ".", "_radius", "=", "Point", "(", "1", ",", "1", ",", "0", ")", "return", "self", ".", "_radius" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.xAxisIsMajor
Returns True if the major axis is parallel to the X axis, boolean.
Geometry/ellipse.py
def xAxisIsMajor(self): ''' Returns True if the major axis is parallel to the X axis, boolean. ''' return max(self.radius.x, self.radius.y) == self.radius.x
def xAxisIsMajor(self): ''' Returns True if the major axis is parallel to the X axis, boolean. ''' return max(self.radius.x, self.radius.y) == self.radius.x
[ "Returns", "True", "if", "the", "major", "axis", "is", "parallel", "to", "the", "X", "axis", "boolean", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L111-L115
[ "def", "xAxisIsMajor", "(", "self", ")", ":", "return", "max", "(", "self", ".", "radius", ".", "x", ",", "self", ".", "radius", ".", "y", ")", "==", "self", ".", "radius", ".", "x" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.xAxisIsMinor
Returns True if the minor axis is parallel to the X axis, boolean.
Geometry/ellipse.py
def xAxisIsMinor(self): ''' Returns True if the minor axis is parallel to the X axis, boolean. ''' return min(self.radius.x, self.radius.y) == self.radius.x
def xAxisIsMinor(self): ''' Returns True if the minor axis is parallel to the X axis, boolean. ''' return min(self.radius.x, self.radius.y) == self.radius.x
[ "Returns", "True", "if", "the", "minor", "axis", "is", "parallel", "to", "the", "X", "axis", "boolean", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L118-L122
[ "def", "xAxisIsMinor", "(", "self", ")", ":", "return", "min", "(", "self", ".", "radius", ".", "x", ",", "self", ".", "radius", ".", "y", ")", "==", "self", ".", "radius", ".", "x" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.yAxisIsMajor
Returns True if the major axis is parallel to the Y axis, boolean.
Geometry/ellipse.py
def yAxisIsMajor(self): ''' Returns True if the major axis is parallel to the Y axis, boolean. ''' return max(self.radius.x, self.radius.y) == self.radius.y
def yAxisIsMajor(self): ''' Returns True if the major axis is parallel to the Y axis, boolean. ''' return max(self.radius.x, self.radius.y) == self.radius.y
[ "Returns", "True", "if", "the", "major", "axis", "is", "parallel", "to", "the", "Y", "axis", "boolean", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L125-L129
[ "def", "yAxisIsMajor", "(", "self", ")", ":", "return", "max", "(", "self", ".", "radius", ".", "x", ",", "self", ".", "radius", ".", "y", ")", "==", "self", ".", "radius", ".", "y" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.yAxisIsMinor
Returns True if the minor axis is parallel to the Y axis, boolean.
Geometry/ellipse.py
def yAxisIsMinor(self): ''' Returns True if the minor axis is parallel to the Y axis, boolean. ''' return min(self.radius.x, self.radius.y) == self.radius.y
def yAxisIsMinor(self): ''' Returns True if the minor axis is parallel to the Y axis, boolean. ''' return min(self.radius.x, self.radius.y) == self.radius.y
[ "Returns", "True", "if", "the", "minor", "axis", "is", "parallel", "to", "the", "Y", "axis", "boolean", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L132-L136
[ "def", "yAxisIsMinor", "(", "self", ")", ":", "return", "min", "(", "self", ".", "radius", ".", "x", ",", "self", ".", "radius", ".", "y", ")", "==", "self", ".", "radius", ".", "y" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.a
Positive antipodal point on the major axis, Point class.
Geometry/ellipse.py
def a(self): ''' Positive antipodal point on the major axis, Point class. ''' a = Point(self.center) if self.xAxisIsMajor: a.x += self.majorRadius else: a.y += self.majorRadius return a
def a(self): ''' Positive antipodal point on the major axis, Point class. ''' a = Point(self.center) if self.xAxisIsMajor: a.x += self.majorRadius else: a.y += self.majorRadius return a
[ "Positive", "antipodal", "point", "on", "the", "major", "axis", "Point", "class", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L181-L192
[ "def", "a", "(", "self", ")", ":", "a", "=", "Point", "(", "self", ".", "center", ")", "if", "self", ".", "xAxisIsMajor", ":", "a", ".", "x", "+=", "self", ".", "majorRadius", "else", ":", "a", ".", "y", "+=", "self", ".", "majorRadius", "return"...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.a_neg
Negative antipodal point on the major axis, Point class.
Geometry/ellipse.py
def a_neg(self): ''' Negative antipodal point on the major axis, Point class. ''' na = Point(self.center) if self.xAxisIsMajor: na.x -= self.majorRadius else: na.y -= self.majorRadius return na
def a_neg(self): ''' Negative antipodal point on the major axis, Point class. ''' na = Point(self.center) if self.xAxisIsMajor: na.x -= self.majorRadius else: na.y -= self.majorRadius return na
[ "Negative", "antipodal", "point", "on", "the", "major", "axis", "Point", "class", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L195-L206
[ "def", "a_neg", "(", "self", ")", ":", "na", "=", "Point", "(", "self", ".", "center", ")", "if", "self", ".", "xAxisIsMajor", ":", "na", ".", "x", "-=", "self", ".", "majorRadius", "else", ":", "na", ".", "y", "-=", "self", ".", "majorRadius", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.b
Positive antipodal point on the minor axis, Point class.
Geometry/ellipse.py
def b(self): ''' Positive antipodal point on the minor axis, Point class. ''' b = Point(self.center) if self.xAxisIsMinor: b.x += self.minorRadius else: b.y += self.minorRadius return b
def b(self): ''' Positive antipodal point on the minor axis, Point class. ''' b = Point(self.center) if self.xAxisIsMinor: b.x += self.minorRadius else: b.y += self.minorRadius return b
[ "Positive", "antipodal", "point", "on", "the", "minor", "axis", "Point", "class", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L209-L220
[ "def", "b", "(", "self", ")", ":", "b", "=", "Point", "(", "self", ".", "center", ")", "if", "self", ".", "xAxisIsMinor", ":", "b", ".", "x", "+=", "self", ".", "minorRadius", "else", ":", "b", ".", "y", "+=", "self", ".", "minorRadius", "return"...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.b_neg
Negative antipodal point on the minor axis, Point class.
Geometry/ellipse.py
def b_neg(self): ''' Negative antipodal point on the minor axis, Point class. ''' nb = Point(self.center) if self.xAxisIsMinor: nb.x -= self.minorRadius else: nb.y -= self.minorRadius return nb
def b_neg(self): ''' Negative antipodal point on the minor axis, Point class. ''' nb = Point(self.center) if self.xAxisIsMinor: nb.x -= self.minorRadius else: nb.y -= self.minorRadius return nb
[ "Negative", "antipodal", "point", "on", "the", "minor", "axis", "Point", "class", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L223-L233
[ "def", "b_neg", "(", "self", ")", ":", "nb", "=", "Point", "(", "self", ".", "center", ")", "if", "self", ".", "xAxisIsMinor", ":", "nb", ".", "x", "-=", "self", ".", "minorRadius", "else", ":", "nb", ".", "y", "-=", "self", ".", "minorRadius", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.vertices
A dictionary of four points where the axes intersect the ellipse, dict.
Geometry/ellipse.py
def vertices(self): ''' A dictionary of four points where the axes intersect the ellipse, dict. ''' return {'a': self.a, 'a_neg': self.a_neg, 'b': self.b, 'b_neg': self.b_neg}
def vertices(self): ''' A dictionary of four points where the axes intersect the ellipse, dict. ''' return {'a': self.a, 'a_neg': self.a_neg, 'b': self.b, 'b_neg': self.b_neg}
[ "A", "dictionary", "of", "four", "points", "where", "the", "axes", "intersect", "the", "ellipse", "dict", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L236-L241
[ "def", "vertices", "(", "self", ")", ":", "return", "{", "'a'", ":", "self", ".", "a", ",", "'a_neg'", ":", "self", ".", "a_neg", ",", "'b'", ":", "self", ".", "b", ",", "'b_neg'", ":", "self", ".", "b_neg", "}" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Ellipse.focus0
First focus of the ellipse, Point class.
Geometry/ellipse.py
def focus0(self): ''' First focus of the ellipse, Point class. ''' f = Point(self.center) if self.xAxisIsMajor: f.x -= self.linearEccentricity else: f.y -= self.linearEccentricity return f
def focus0(self): ''' First focus of the ellipse, Point class. ''' f = Point(self.center) if self.xAxisIsMajor: f.x -= self.linearEccentricity else: f.y -= self.linearEccentricity return f
[ "First", "focus", "of", "the", "ellipse", "Point", "class", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L244-L255
[ "def", "focus0", "(", "self", ")", ":", "f", "=", "Point", "(", "self", ".", "center", ")", "if", "self", ".", "xAxisIsMajor", ":", "f", ".", "x", "-=", "self", ".", "linearEccentricity", "else", ":", "f", ".", "y", "-=", "self", ".", "linearEccent...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Circle.circumcircleForTriangle
:param: triangle - Triangle class :return: Circle class Returns the circle where every vertex in the input triangle is on the radius of that circle.
Geometry/ellipse.py
def circumcircleForTriangle(cls, triangle): ''' :param: triangle - Triangle class :return: Circle class Returns the circle where every vertex in the input triangle is on the radius of that circle. ''' if triangle.isRight: # circumcircle origin is th...
def circumcircleForTriangle(cls, triangle): ''' :param: triangle - Triangle class :return: Circle class Returns the circle where every vertex in the input triangle is on the radius of that circle. ''' if triangle.isRight: # circumcircle origin is th...
[ ":", "param", ":", "triangle", "-", "Triangle", "class", ":", "return", ":", "Circle", "class" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L416-L446
[ "def", "circumcircleForTriangle", "(", "cls", ",", "triangle", ")", ":", "if", "triangle", ".", "isRight", ":", "# circumcircle origin is the midpoint of the hypotenues", "o", "=", "triangle", ".", "hypotenuse", ".", "midpoint", "r", "=", "o", ".", "distance", "("...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Circle.doesIntersect
:param: other - Circle class Returns True iff: self.center.distance(other.center) <= self.radius+other.radius
Geometry/ellipse.py
def doesIntersect(self, other): ''' :param: other - Circle class Returns True iff: self.center.distance(other.center) <= self.radius+other.radius ''' otherType = type(other) if issubclass(otherType, Ellipse): distance = self.center.distance(other....
def doesIntersect(self, other): ''' :param: other - Circle class Returns True iff: self.center.distance(other.center) <= self.radius+other.radius ''' otherType = type(other) if issubclass(otherType, Ellipse): distance = self.center.distance(other....
[ ":", "param", ":", "other", "-", "Circle", "class" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/ellipse.py#L535-L553
[ "def", "doesIntersect", "(", "self", ",", "other", ")", ":", "otherType", "=", "type", "(", "other", ")", "if", "issubclass", "(", "otherType", ",", "Ellipse", ")", ":", "distance", "=", "self", ".", "center", ".", "distance", "(", "other", ".", "cente...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.AB
A list containing Points A and B.
Geometry/line.py
def AB(self): ''' A list containing Points A and B. ''' try: return self._AB except AttributeError: pass self._AB = [self.A, self.B] return self._AB
def AB(self): ''' A list containing Points A and B. ''' try: return self._AB except AttributeError: pass self._AB = [self.A, self.B] return self._AB
[ "A", "list", "containing", "Points", "A", "and", "B", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L117-L126
[ "def", "AB", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_AB", "except", "AttributeError", ":", "pass", "self", ".", "_AB", "=", "[", "self", ".", "A", ",", "self", ".", "B", "]", "return", "self", ".", "_AB" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.normal
:return: Line Returns a Line normal (perpendicular) to this Line.
Geometry/line.py
def normal(self): ''' :return: Line Returns a Line normal (perpendicular) to this Line. ''' d = self.B - self.A return Line([-d.y, d.x], [d.y, -d.x])
def normal(self): ''' :return: Line Returns a Line normal (perpendicular) to this Line. ''' d = self.B - self.A return Line([-d.y, d.x], [d.y, -d.x])
[ ":", "return", ":", "Line" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L173-L182
[ "def", "normal", "(", "self", ")", ":", "d", "=", "self", ".", "B", "-", "self", ".", "A", "return", "Line", "(", "[", "-", "d", ".", "y", ",", "d", ".", "x", "]", ",", "[", "d", ".", "y", ",", "-", "d", ".", "x", "]", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.t
:point: Point subclass :return: float If :point: is collinear, determine the 't' coefficient of the parametric equation: xyz = A<xyz> + t ( B<xyz> - A<xyz> ) if t < 0, point is less than A and B on the line if t >= 0 and <= 1, point is between A and B if t > 1 ...
Geometry/line.py
def t(self, point): ''' :point: Point subclass :return: float If :point: is collinear, determine the 't' coefficient of the parametric equation: xyz = A<xyz> + t ( B<xyz> - A<xyz> ) if t < 0, point is less than A and B on the line if t >= 0 and <= 1, po...
def t(self, point): ''' :point: Point subclass :return: float If :point: is collinear, determine the 't' coefficient of the parametric equation: xyz = A<xyz> + t ( B<xyz> - A<xyz> ) if t < 0, point is less than A and B on the line if t >= 0 and <= 1, po...
[ ":", "point", ":", "Point", "subclass", ":", "return", ":", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L198-L223
[ "def", "t", "(", "self", ",", "point", ")", ":", "# XXX could use for an ordering on points?", "if", "point", "not", "in", "self", ":", "msg", "=", "\"'{p}' is not collinear with '{l}'\"", "raise", "CollinearPoints", "(", "msg", ".", "format", "(", "p", "=", "po...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.flip
:returns: None Swaps the positions of A and B.
Geometry/line.py
def flip(self): ''' :returns: None Swaps the positions of A and B. ''' tmp = self.A.xyz self.A = self.B self.B = tmp
def flip(self): ''' :returns: None Swaps the positions of A and B. ''' tmp = self.A.xyz self.A = self.B self.B = tmp
[ ":", "returns", ":", "None" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L294-L302
[ "def", "flip", "(", "self", ")", ":", "tmp", "=", "self", ".", "A", ".", "xyz", "self", ".", "A", "=", "self", ".", "B", "self", ".", "B", "=", "tmp" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.doesIntersect
:param: other - Line subclass :return: boolean Returns True iff: ccw(self.A,self.B,other.A) * ccw(self.A,self.B,other.B) <= 0 and ccw(other.A,other.B,self.A) * ccw(other.A,other.B,self.B) <= 0
Geometry/line.py
def doesIntersect(self, other): ''' :param: other - Line subclass :return: boolean Returns True iff: ccw(self.A,self.B,other.A) * ccw(self.A,self.B,other.B) <= 0 and ccw(other.A,other.B,self.A) * ccw(other.A,other.B,self.B) <= 0 ''' if s...
def doesIntersect(self, other): ''' :param: other - Line subclass :return: boolean Returns True iff: ccw(self.A,self.B,other.A) * ccw(self.A,self.B,other.B) <= 0 and ccw(other.A,other.B,self.A) * ccw(other.A,other.B,self.B) <= 0 ''' if s...
[ ":", "param", ":", "other", "-", "Line", "subclass", ":", "return", ":", "boolean" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L304-L321
[ "def", "doesIntersect", "(", "self", ",", "other", ")", ":", "if", "self", ".", "A", ".", "ccw", "(", "self", ".", "B", ",", "other", ".", "A", ")", "*", "self", ".", "A", ".", "ccw", "(", "self", ".", "B", ",", "other", ".", "B", ")", ">",...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.intersection
:param: other - Line subclass :return: Point subclass Returns a Point object with the coordinates of the intersection between the current line and the other line. Will raise Parallel() if the two lines are parallel. Will raise Collinear() if the two lines are collinear.
Geometry/line.py
def intersection(self, other): ''' :param: other - Line subclass :return: Point subclass Returns a Point object with the coordinates of the intersection between the current line and the other line. Will raise Parallel() if the two lines are parallel. Will raise ...
def intersection(self, other): ''' :param: other - Line subclass :return: Point subclass Returns a Point object with the coordinates of the intersection between the current line and the other line. Will raise Parallel() if the two lines are parallel. Will raise ...
[ ":", "param", ":", "other", "-", "Line", "subclass", ":", "return", ":", "Point", "subclass" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L342-L379
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "if", "self", ".", "isCollinear", "(", "other", ")", ":", "msg", "=", "'{!r} and {!r} are collinear'", "raise", "CollinearLines", "(", "msg", ".", "format", "(", "self", ",", "other", ")", ")", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.distanceFromPoint
:param: point - Point subclass :return: float Distance from the line to the given point.
Geometry/line.py
def distanceFromPoint(self, point): ''' :param: point - Point subclass :return: float Distance from the line to the given point. ''' # XXX planar distance, doesn't take into account z ? d = self.m n = (d.y * point.x) - (d.x * point.y) + self.A.cross(self....
def distanceFromPoint(self, point): ''' :param: point - Point subclass :return: float Distance from the line to the given point. ''' # XXX planar distance, doesn't take into account z ? d = self.m n = (d.y * point.x) - (d.x * point.y) + self.A.cross(self....
[ ":", "param", ":", "point", "-", "Point", "subclass", ":", "return", ":", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L381-L391
[ "def", "distanceFromPoint", "(", "self", ",", "point", ")", ":", "# XXX planar distance, doesn't take into account z ?", "d", "=", "self", ".", "m", "n", "=", "(", "d", ".", "y", "*", "point", ".", "x", ")", "-", "(", "d", ".", "x", "*", "point", ".", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Line.radiansBetween
:param: other - Line subclass :return: float Returns the angle measured between two lines in radians with a range of [0, 2 * math.pi].
Geometry/line.py
def radiansBetween(self, other): ''' :param: other - Line subclass :return: float Returns the angle measured between two lines in radians with a range of [0, 2 * math.pi]. ''' # a dot b = |a||b| * cos(theta) # a dot b / |a||b| = cos(theta) # cos-...
def radiansBetween(self, other): ''' :param: other - Line subclass :return: float Returns the angle measured between two lines in radians with a range of [0, 2 * math.pi]. ''' # a dot b = |a||b| * cos(theta) # a dot b / |a||b| = cos(theta) # cos-...
[ ":", "param", ":", "other", "-", "Line", "subclass", ":", "return", ":", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/line.py#L403-L430
[ "def", "radiansBetween", "(", "self", ",", "other", ")", ":", "# a dot b = |a||b| * cos(theta)", "# a dot b / |a||b| = cos(theta)", "# cos-1(a dot b / |a||b|) = theta", "# translate each line so that it passes through the origin and", "# produce a new point whose distance (magnitude) from th...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
FloatProperty
:name: string - property name :default: float - property default value :readonly: boolean - if True, setter method is NOT generated Returns a property object that can be used to initialize a class instance variable as a property.
Geometry/propgen.py
def FloatProperty(name, default=0.0, readonly=False, docs=None): ''' :name: string - property name :default: float - property default value :readonly: boolean - if True, setter method is NOT generated Returns a property object that can be used to initialize a class instance variable as a proper...
def FloatProperty(name, default=0.0, readonly=False, docs=None): ''' :name: string - property name :default: float - property default value :readonly: boolean - if True, setter method is NOT generated Returns a property object that can be used to initialize a class instance variable as a proper...
[ ":", "name", ":", "string", "-", "property", "name", ":", "default", ":", "float", "-", "property", "default", "value", ":", "readonly", ":", "boolean", "-", "if", "True", "setter", "method", "is", "NOT", "generated" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/propgen.py#L25-L86
[ "def", "FloatProperty", "(", "name", ",", "default", "=", "0.0", ",", "readonly", "=", "False", ",", "docs", "=", "None", ")", ":", "private_name", "=", "'_'", "+", "name", "def", "getf", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.randomSizeAndLocation
:param: radius - float :param: widthLimits - iterable of floats with length >= 2 :param: heightLimits - iterable of floats with length >= 2 :param: origin - optional Point subclass :return: Rectangle
Geometry/rectangle.py
def randomSizeAndLocation(cls, radius, widthLimits, heightLimits, origin=None): ''' :param: radius - float :param: widthLimits - iterable of floats with length >= 2 :param: heightLimits - iterable of floats with length >= 2 :param: origin ...
def randomSizeAndLocation(cls, radius, widthLimits, heightLimits, origin=None): ''' :param: radius - float :param: widthLimits - iterable of floats with length >= 2 :param: heightLimits - iterable of floats with length >= 2 :param: origin ...
[ ":", "param", ":", "radius", "-", "float", ":", "param", ":", "widthLimits", "-", "iterable", "of", "floats", "with", "length", ">", "=", "2", ":", "param", ":", "heightLimits", "-", "iterable", "of", "floats", "with", "length", ">", "=", "2", ":", "...
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L26-L38
[ "def", "randomSizeAndLocation", "(", "cls", ",", "radius", ",", "widthLimits", ",", "heightLimits", ",", "origin", "=", "None", ")", ":", "r", "=", "cls", "(", "widthLimits", ",", "heightLimits", ",", "origin", ")", "r", ".", "origin", "=", "Point", ".",...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.randomSize
:param: widthLimits - iterable of integers with length >= 2 :param: heightLimits - iterable of integers with length >= 2 :param: origin - optional Point subclass :return: Rectangle
Geometry/rectangle.py
def randomSize(cls, widthLimits, heightLimits, origin=None): ''' :param: widthLimits - iterable of integers with length >= 2 :param: heightLimits - iterable of integers with length >= 2 :param: origin - optional Point subclass :return: Rectangle ''' r = cl...
def randomSize(cls, widthLimits, heightLimits, origin=None): ''' :param: widthLimits - iterable of integers with length >= 2 :param: heightLimits - iterable of integers with length >= 2 :param: origin - optional Point subclass :return: Rectangle ''' r = cl...
[ ":", "param", ":", "widthLimits", "-", "iterable", "of", "integers", "with", "length", ">", "=", "2", ":", "param", ":", "heightLimits", "-", "iterable", "of", "integers", "with", "length", ">", "=", "2", ":", "param", ":", "origin", "-", "optional", "...
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L41-L54
[ "def", "randomSize", "(", "cls", ",", "widthLimits", ",", "heightLimits", ",", "origin", "=", "None", ")", ":", "r", "=", "cls", "(", "0", ",", "0", ",", "origin", ")", "r", ".", "w", "=", "random", ".", "randint", "(", "widthLimits", "[", "0", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.randomLocation
:param: radius - float :param: width - float :param: height - float :param: origin - optional Point subclass :return: Rectangle
Geometry/rectangle.py
def randomLocation(cls, radius, width, height, origin=None): ''' :param: radius - float :param: width - float :param: height - float :param: origin - optional Point subclass :return: Rectangle ''' return cls(width, height, ...
def randomLocation(cls, radius, width, height, origin=None): ''' :param: radius - float :param: width - float :param: height - float :param: origin - optional Point subclass :return: Rectangle ''' return cls(width, height, ...
[ ":", "param", ":", "radius", "-", "float", ":", "param", ":", "width", "-", "float", ":", "param", ":", "height", "-", "float", ":", "param", ":", "origin", "-", "optional", "Point", "subclass", ":", "return", ":", "Rectangle" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L57-L67
[ "def", "randomLocation", "(", "cls", ",", "radius", ",", "width", ",", "height", ",", "origin", "=", "None", ")", ":", "return", "cls", "(", "width", ",", "height", ",", "Point", ".", "randomLocation", "(", "radius", ",", "origin", ")", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.origin
Point describing the origin of the rectangle. Defaults to (0,0,0).
Geometry/rectangle.py
def origin(self): ''' Point describing the origin of the rectangle. Defaults to (0,0,0). ''' try: return self._origin except AttributeError: pass self._origin = Point() return self._origin
def origin(self): ''' Point describing the origin of the rectangle. Defaults to (0,0,0). ''' try: return self._origin except AttributeError: pass self._origin = Point() return self._origin
[ "Point", "describing", "the", "origin", "of", "the", "rectangle", ".", "Defaults", "to", "(", "0", "0", "0", ")", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L87-L96
[ "def", "origin", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_origin", "except", "AttributeError", ":", "pass", "self", ".", "_origin", "=", "Point", "(", ")", "return", "self", ".", "_origin" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.B
Point whose coordinates are (maxX,minY,origin.z), Point.
Geometry/rectangle.py
def B(self): ''' Point whose coordinates are (maxX,minY,origin.z), Point. ''' return Point(self.maxX, self.minY, self.origin.z)
def B(self): ''' Point whose coordinates are (maxX,minY,origin.z), Point. ''' return Point(self.maxX, self.minY, self.origin.z)
[ "Point", "whose", "coordinates", "are", "(", "maxX", "minY", "origin", ".", "z", ")", "Point", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L302-L306
[ "def", "B", "(", "self", ")", ":", "return", "Point", "(", "self", ".", "maxX", ",", "self", ".", "minY", ",", "self", ".", "origin", ".", "z", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.C
Point whose coordinates are (maxX,maxY,origin.z), Point.
Geometry/rectangle.py
def C(self): ''' Point whose coordinates are (maxX,maxY,origin.z), Point. ''' return Point(self.maxX, self.maxY, self.origin.z)
def C(self): ''' Point whose coordinates are (maxX,maxY,origin.z), Point. ''' return Point(self.maxX, self.maxY, self.origin.z)
[ "Point", "whose", "coordinates", "are", "(", "maxX", "maxY", "origin", ".", "z", ")", "Point", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L314-L318
[ "def", "C", "(", "self", ")", ":", "return", "Point", "(", "self", ".", "maxX", ",", "self", ".", "maxY", ",", "self", ".", "origin", ".", "z", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.D
Point whose coordinates are (minX,maxY,origin.Z), Point.
Geometry/rectangle.py
def D(self): ''' Point whose coordinates are (minX,maxY,origin.Z), Point. ''' return Point(self.minX, self.maxY, self.origin.z)
def D(self): ''' Point whose coordinates are (minX,maxY,origin.Z), Point. ''' return Point(self.minX, self.maxY, self.origin.z)
[ "Point", "whose", "coordinates", "are", "(", "minX", "maxY", "origin", ".", "Z", ")", "Point", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L327-L331
[ "def", "D", "(", "self", ")", ":", "return", "Point", "(", "self", ".", "minX", ",", "self", ".", "maxY", ",", "self", ".", "origin", ".", "z", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.center
Point whose coordinates are (midX,midY,origin.z), Point.
Geometry/rectangle.py
def center(self): ''' Point whose coordinates are (midX,midY,origin.z), Point. ''' return Point(self.midX, self.midY, self.origin.z)
def center(self): ''' Point whose coordinates are (midX,midY,origin.z), Point. ''' return Point(self.midX, self.midY, self.origin.z)
[ "Point", "whose", "coordinates", "are", "(", "midX", "midY", "origin", ".", "z", ")", "Point", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L339-L343
[ "def", "center", "(", "self", ")", ":", "return", "Point", "(", "self", ".", "midX", ",", "self", ".", "midY", ",", "self", ".", "origin", ".", "z", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.scale
:param: dx - optional float :param: dy - optional float Scales the rectangle's width and height by dx and dy.
Geometry/rectangle.py
def scale(self, dx=1.0, dy=1.0): ''' :param: dx - optional float :param: dy - optional float Scales the rectangle's width and height by dx and dy. ''' self.width *= dx self.height *= dy
def scale(self, dx=1.0, dy=1.0): ''' :param: dx - optional float :param: dy - optional float Scales the rectangle's width and height by dx and dy. ''' self.width *= dx self.height *= dy
[ ":", "param", ":", "dx", "-", "optional", "float", ":", "param", ":", "dy", "-", "optional", "float" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L503-L512
[ "def", "scale", "(", "self", ",", "dx", "=", "1.0", ",", "dy", "=", "1.0", ")", ":", "self", ".", "width", "*=", "dx", "self", ".", "height", "*=", "dy" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Rectangle.containsPoint
:param: point - Point subclass :param: Zorder - optional Boolean Is true if the point is contain in the rectangle or along the rectangle's edges. If Zorder is True, the method will check point.z for equality with the rectangle origin's Z coordinate.
Geometry/rectangle.py
def containsPoint(self, point, Zorder=False): ''' :param: point - Point subclass :param: Zorder - optional Boolean Is true if the point is contain in the rectangle or along the rectangle's edges. If Zorder is True, the method will check point.z for equality wit...
def containsPoint(self, point, Zorder=False): ''' :param: point - Point subclass :param: Zorder - optional Boolean Is true if the point is contain in the rectangle or along the rectangle's edges. If Zorder is True, the method will check point.z for equality wit...
[ ":", "param", ":", "point", "-", "Point", "subclass", ":", "param", ":", "Zorder", "-", "optional", "Boolean" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/rectangle.py#L536-L556
[ "def", "containsPoint", "(", "self", ",", "point", ",", "Zorder", "=", "False", ")", ":", "if", "not", "point", ".", "isBetweenX", "(", "self", ".", "A", ",", "self", ".", "B", ")", ":", "return", "False", "if", "not", "point", ".", "isBetweenY", "...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.random
:origin: - optional Point subclass :radius: - optional float :return: Triangle Creates a triangle with random coordinates in the circle described by (origin,radius). If origin is unspecified, (0,0) is assumed. If the radius is unspecified, 1.0 is assumed.
Geometry/triangle.py
def random(cls, origin=None, radius=1): ''' :origin: - optional Point subclass :radius: - optional float :return: Triangle Creates a triangle with random coordinates in the circle described by (origin,radius). If origin is unspecified, (0,0) is assumed. If the r...
def random(cls, origin=None, radius=1): ''' :origin: - optional Point subclass :radius: - optional float :return: Triangle Creates a triangle with random coordinates in the circle described by (origin,radius). If origin is unspecified, (0,0) is assumed. If the r...
[ ":", "origin", ":", "-", "optional", "Point", "subclass", ":", "radius", ":", "-", "optional", "float", ":", "return", ":", "Triangle" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L47-L65
[ "def", "random", "(", "cls", ",", "origin", "=", "None", ",", "radius", "=", "1", ")", ":", "# XXX no collinearity checks, possible to generate a", "# line (not likely, just possible).", "#", "pts", "=", "set", "(", ")", "while", "len", "(", "pts", ")", "<",...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.equilateral
:origin: optional Point :side: optional float describing triangle side length :return: Triangle initialized with points comprising a equilateral triangle. XXX equilateral triangle definition
Geometry/triangle.py
def equilateral(cls, origin=None, side=1): ''' :origin: optional Point :side: optional float describing triangle side length :return: Triangle initialized with points comprising a equilateral triangle. XXX equilateral triangle definition ''' o =...
def equilateral(cls, origin=None, side=1): ''' :origin: optional Point :side: optional float describing triangle side length :return: Triangle initialized with points comprising a equilateral triangle. XXX equilateral triangle definition ''' o =...
[ ":", "origin", ":", "optional", "Point", ":", "side", ":", "optional", "float", "describing", "triangle", "side", "length", ":", "return", ":", "Triangle", "initialized", "with", "points", "comprising", "a", "equilateral", "triangle", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L68-L83
[ "def", "equilateral", "(", "cls", ",", "origin", "=", "None", ",", "side", "=", "1", ")", ":", "o", "=", "Point", "(", "origin", ")", "base", "=", "o", ".", "x", "+", "side", "h", "=", "0.5", "*", "Sqrt_3", "*", "side", "+", "o", ".", "y", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.isosceles
:origin: optional Point :base: optional float describing triangle base length :return: Triangle initialized with points comprising a isosceles triangle. XXX isoceles triangle definition
Geometry/triangle.py
def isosceles(cls, origin=None, base=1, alpha=90): ''' :origin: optional Point :base: optional float describing triangle base length :return: Triangle initialized with points comprising a isosceles triangle. XXX isoceles triangle definition ''' ...
def isosceles(cls, origin=None, base=1, alpha=90): ''' :origin: optional Point :base: optional float describing triangle base length :return: Triangle initialized with points comprising a isosceles triangle. XXX isoceles triangle definition ''' ...
[ ":", "origin", ":", "optional", "Point", ":", "base", ":", "optional", "float", "describing", "triangle", "base", "length", ":", "return", ":", "Triangle", "initialized", "with", "points", "comprising", "a", "isosceles", "triangle", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L87-L100
[ "def", "isosceles", "(", "cls", ",", "origin", "=", "None", ",", "base", "=", "1", ",", "alpha", "=", "90", ")", ":", "o", "=", "Point", "(", "origin", ")", "base", "=", "o", ".", "x", "+", "base", "return", "cls", "(", "o", ",", "[", "base",...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.C
Third vertex of triangle, Point subclass.
Geometry/triangle.py
def C(self): ''' Third vertex of triangle, Point subclass. ''' try: return self._C except AttributeError: pass self._C = Point(0, 1) return self._C
def C(self): ''' Third vertex of triangle, Point subclass. ''' try: return self._C except AttributeError: pass self._C = Point(0, 1) return self._C
[ "Third", "vertex", "of", "triangle", "Point", "subclass", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L216-L226
[ "def", "C", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_C", "except", "AttributeError", ":", "pass", "self", ".", "_C", "=", "Point", "(", "0", ",", "1", ")", "return", "self", ".", "_C" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.ABC
A list of the triangle's vertices, list.
Geometry/triangle.py
def ABC(self): ''' A list of the triangle's vertices, list. ''' try: return self._ABC except AttributeError: pass self._ABC = [self.A, self.B, self.C] return self._ABC
def ABC(self): ''' A list of the triangle's vertices, list. ''' try: return self._ABC except AttributeError: pass self._ABC = [self.A, self.B, self.C] return self._ABC
[ "A", "list", "of", "the", "triangle", "s", "vertices", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L233-L243
[ "def", "ABC", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_ABC", "except", "AttributeError", ":", "pass", "self", ".", "_ABC", "=", "[", "self", ".", "A", ",", "self", ".", "B", ",", "self", ".", "C", "]", "return", "self", ".", ...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.BA
Vertices B and A, list.
Geometry/triangle.py
def BA(self): ''' Vertices B and A, list. ''' try: return self._BA except AttributeError: pass self._BA = [self.B, self.A] return self._BA
def BA(self): ''' Vertices B and A, list. ''' try: return self._BA except AttributeError: pass self._BA = [self.B, self.A] return self._BA
[ "Vertices", "B", "and", "A", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L267-L277
[ "def", "BA", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_BA", "except", "AttributeError", ":", "pass", "self", ".", "_BA", "=", "[", "self", ".", "B", ",", "self", ".", "A", "]", "return", "self", ".", "_BA" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.AC
Vertices A and C, list.
Geometry/triangle.py
def AC(self): ''' Vertices A and C, list. ''' try: return self._AC except AttributeError: pass self._AC = [self.A, self.C] return self._AC
def AC(self): ''' Vertices A and C, list. ''' try: return self._AC except AttributeError: pass self._AC = [self.A, self.C] return self._AC
[ "Vertices", "A", "and", "C", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L284-L294
[ "def", "AC", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_AC", "except", "AttributeError", ":", "pass", "self", ".", "_AC", "=", "[", "self", ".", "A", ",", "self", ".", "C", "]", "return", "self", ".", "_AC" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.CA
Vertices C and A, list.
Geometry/triangle.py
def CA(self): ''' Vertices C and A, list. ''' try: return self._CA except AttributeError: pass self._CA = [self.C, self.A] return self._CA
def CA(self): ''' Vertices C and A, list. ''' try: return self._CA except AttributeError: pass self._CA = [self.C, self.A] return self._CA
[ "Vertices", "C", "and", "A", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L301-L311
[ "def", "CA", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_CA", "except", "AttributeError", ":", "pass", "self", ".", "_CA", "=", "[", "self", ".", "C", ",", "self", ".", "A", "]", "return", "self", ".", "_CA" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.BC
Vertices B and C, list.
Geometry/triangle.py
def BC(self): ''' Vertices B and C, list. ''' try: return self._BC except AttributeError: pass self._BC = [self.B, self.C] return self._BC
def BC(self): ''' Vertices B and C, list. ''' try: return self._BC except AttributeError: pass self._BC = [self.B, self.C] return self._BC
[ "Vertices", "B", "and", "C", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L318-L328
[ "def", "BC", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_BC", "except", "AttributeError", ":", "pass", "self", ".", "_BC", "=", "[", "self", ".", "B", ",", "self", ".", "C", "]", "return", "self", ".", "_BC" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.CB
Vertices C and B, list.
Geometry/triangle.py
def CB(self): ''' Vertices C and B, list. ''' try: return self._CB except AttributeError: pass self._CB = [self.C, self.B] return self._CB
def CB(self): ''' Vertices C and B, list. ''' try: return self._CB except AttributeError: pass self._CB = [self.C, self.B] return self._CB
[ "Vertices", "C", "and", "B", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L335-L345
[ "def", "CB", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_CB", "except", "AttributeError", ":", "pass", "self", ".", "_CB", "=", "[", "self", ".", "C", ",", "self", ".", "B", "]", "return", "self", ".", "_CB" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.segments
A list of the Triangle's line segments [AB, BC, AC], list.
Geometry/triangle.py
def segments(self): ''' A list of the Triangle's line segments [AB, BC, AC], list. ''' return [Segment(self.AB), Segment(self.BC), Segment(self.AC)]
def segments(self): ''' A list of the Triangle's line segments [AB, BC, AC], list. ''' return [Segment(self.AB), Segment(self.BC), Segment(self.AC)]
[ "A", "list", "of", "the", "Triangle", "s", "line", "segments", "[", "AB", "BC", "AC", "]", "list", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L364-L371
[ "def", "segments", "(", "self", ")", ":", "return", "[", "Segment", "(", "self", ".", "AB", ")", ",", "Segment", "(", "self", ".", "BC", ")", ",", "Segment", "(", "self", ".", "AC", ")", "]" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.circumcenter
The intersection of the median perpendicular bisectors, Point. The center of the circumscribed circle, which is the circle that passes through all vertices of the triangle. https://en.wikipedia.org/wiki/Circumscribed_circle#Cartesian_coordinates_2 BUG: only finds the circumcenter in t...
Geometry/triangle.py
def circumcenter(self): ''' The intersection of the median perpendicular bisectors, Point. The center of the circumscribed circle, which is the circle that passes through all vertices of the triangle. https://en.wikipedia.org/wiki/Circumscribed_circle#Cartesian_coordinates_2 ...
def circumcenter(self): ''' The intersection of the median perpendicular bisectors, Point. The center of the circumscribed circle, which is the circle that passes through all vertices of the triangle. https://en.wikipedia.org/wiki/Circumscribed_circle#Cartesian_coordinates_2 ...
[ "The", "intersection", "of", "the", "median", "perpendicular", "bisectors", "Point", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L424-L460
[ "def", "circumcenter", "(", "self", ")", ":", "if", "self", ".", "isRight", ":", "return", "self", ".", "hypotenuse", ".", "midpoint", "if", "self", ".", "A", ".", "isOrigin", ":", "t", "=", "self", "else", ":", "# translate triangle to origin", "t", "="...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.altitudes
A list of the altitudes of each vertex [AltA, AltB, AltC], list of floats. An altitude is the shortest distance from a vertex to the side opposite of it.
Geometry/triangle.py
def altitudes(self): ''' A list of the altitudes of each vertex [AltA, AltB, AltC], list of floats. An altitude is the shortest distance from a vertex to the side opposite of it. ''' a = self.area * 2 return [a / self.a, a / self.b, a / self.c]
def altitudes(self): ''' A list of the altitudes of each vertex [AltA, AltB, AltC], list of floats. An altitude is the shortest distance from a vertex to the side opposite of it. ''' a = self.area * 2 return [a / self.a, a / self.b, a / self.c]
[ "A", "list", "of", "the", "altitudes", "of", "each", "vertex", "[", "AltA", "AltB", "AltC", "]", "list", "of", "floats", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L560-L571
[ "def", "altitudes", "(", "self", ")", ":", "a", "=", "self", ".", "area", "*", "2", "return", "[", "a", "/", "self", ".", "a", ",", "a", "/", "self", ".", "b", ",", "a", "/", "self", ".", "c", "]" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.isEquilateral
True if all sides of the triangle are the same length. All equilateral triangles are also isosceles. All equilateral triangles are also acute.
Geometry/triangle.py
def isEquilateral(self): ''' True if all sides of the triangle are the same length. All equilateral triangles are also isosceles. All equilateral triangles are also acute. ''' if not nearly_eq(self.a, self.b): return False if not nearly_eq(self.b, s...
def isEquilateral(self): ''' True if all sides of the triangle are the same length. All equilateral triangles are also isosceles. All equilateral triangles are also acute. ''' if not nearly_eq(self.a, self.b): return False if not nearly_eq(self.b, s...
[ "True", "if", "all", "sides", "of", "the", "triangle", "are", "the", "same", "length", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L629-L643
[ "def", "isEquilateral", "(", "self", ")", ":", "if", "not", "nearly_eq", "(", "self", ".", "a", ",", "self", ".", "b", ")", ":", "return", "False", "if", "not", "nearly_eq", "(", "self", ".", "b", ",", "self", ".", "c", ")", ":", "return", "False...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.swap
:side: - optional string :inplace: - optional boolean :return: Triangle with flipped side. The optional side paramater should have one of three values: AB, BC, or AC. Changes the order of the triangle's points, swapping the specified points. Doing so will change the res...
Geometry/triangle.py
def swap(self, side='AB', inplace=False): ''' :side: - optional string :inplace: - optional boolean :return: Triangle with flipped side. The optional side paramater should have one of three values: AB, BC, or AC. Changes the order of the triangle's points, swapp...
def swap(self, side='AB', inplace=False): ''' :side: - optional string :inplace: - optional boolean :return: Triangle with flipped side. The optional side paramater should have one of three values: AB, BC, or AC. Changes the order of the triangle's points, swapp...
[ ":", "side", ":", "-", "optional", "string", ":", "inplace", ":", "-", "optional", "boolean", ":", "return", ":", "Triangle", "with", "flipped", "side", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L789-L814
[ "def", "swap", "(", "self", ",", "side", "=", "'AB'", ",", "inplace", "=", "False", ")", ":", "try", ":", "flipset", "=", "{", "'AB'", ":", "(", "self", ".", "B", ".", "xyz", ",", "self", ".", "A", ".", "xyz", ",", "self", ".", "C", ".", "x...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Triangle.doesIntersect
:param: other - Triangle or Line subclass :return: boolean Returns True iff: Any segment in self intersects any segment in other.
Geometry/triangle.py
def doesIntersect(self, other): ''' :param: other - Triangle or Line subclass :return: boolean Returns True iff: Any segment in self intersects any segment in other. ''' otherType = type(other) if issubclass(otherType, Triangle): for s in...
def doesIntersect(self, other): ''' :param: other - Triangle or Line subclass :return: boolean Returns True iff: Any segment in self intersects any segment in other. ''' otherType = type(other) if issubclass(otherType, Triangle): for s in...
[ ":", "param", ":", "other", "-", "Triangle", "or", "Line", "subclass", ":", "return", ":", "boolean" ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/triangle.py#L816-L842
[ "def", "doesIntersect", "(", "self", ",", "other", ")", ":", "otherType", "=", "type", "(", "other", ")", "if", "issubclass", "(", "otherType", ",", "Triangle", ")", ":", "for", "s", "in", "self", ".", "segments", ".", "values", "(", ")", ":", "for",...
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
Polygon.perimeter
Sum of the length of all sides, float.
Geometry/polygon.py
def perimeter(self): ''' Sum of the length of all sides, float. ''' return sum([a.distance(b) for a, b in self.pairs()])
def perimeter(self): ''' Sum of the length of all sides, float. ''' return sum([a.distance(b) for a, b in self.pairs()])
[ "Sum", "of", "the", "length", "of", "all", "sides", "float", "." ]
JnyJny/Geometry
python
https://github.com/JnyJny/Geometry/blob/3500f815fa56c535b36d1b6fd0afe69ce5d055be/Geometry/polygon.py#L42-L46
[ "def", "perimeter", "(", "self", ")", ":", "return", "sum", "(", "[", "a", ".", "distance", "(", "b", ")", "for", "a", ",", "b", "in", "self", ".", "pairs", "(", ")", "]", ")" ]
3500f815fa56c535b36d1b6fd0afe69ce5d055be
train
vl_dsift
Dense sift descriptors from an image. Returns: frames: num_frames x (2 or 3) matrix of x, y, (norm) descrs: num_frames x 128 matrix of descriptors
vlfeat/dsift.py
def vl_dsift(data, fast=False, norm=False, bounds=None, size=3, step=1, window_size=None, float_descriptors=False, verbose=False, matlab_style=True): ''' Dense sift descriptors from an image. Returns: frames: num_frames x (2 or 3) matrix of x, y, (norm) descrs: n...
def vl_dsift(data, fast=False, norm=False, bounds=None, size=3, step=1, window_size=None, float_descriptors=False, verbose=False, matlab_style=True): ''' Dense sift descriptors from an image. Returns: frames: num_frames x (2 or 3) matrix of x, y, (norm) descrs: n...
[ "Dense", "sift", "descriptors", "from", "an", "image", "." ]
dougalsutherland/vlfeat-ctypes
python
https://github.com/dougalsutherland/vlfeat-ctypes/blob/87367a1e18863e4effc98d7b3da0b85978e665d3/vlfeat/dsift.py#L105-L225
[ "def", "vl_dsift", "(", "data", ",", "fast", "=", "False", ",", "norm", "=", "False", ",", "bounds", "=", "None", ",", "size", "=", "3", ",", "step", "=", "1", ",", "window_size", "=", "None", ",", "float_descriptors", "=", "False", ",", "verbose", ...
87367a1e18863e4effc98d7b3da0b85978e665d3
train
rgb2gray
Converts an RGB image to grayscale using matlab's algorithm.
vlfeat/utils.py
def rgb2gray(img): """Converts an RGB image to grayscale using matlab's algorithm.""" T = np.linalg.inv(np.array([ [1.0, 0.956, 0.621], [1.0, -0.272, -0.647], [1.0, -1.106, 1.703], ])) r_c, g_c, b_c = T[0] r, g, b = np.rollaxis(as_float_image(img), axis=-1) return r_c ...
def rgb2gray(img): """Converts an RGB image to grayscale using matlab's algorithm.""" T = np.linalg.inv(np.array([ [1.0, 0.956, 0.621], [1.0, -0.272, -0.647], [1.0, -1.106, 1.703], ])) r_c, g_c, b_c = T[0] r, g, b = np.rollaxis(as_float_image(img), axis=-1) return r_c ...
[ "Converts", "an", "RGB", "image", "to", "grayscale", "using", "matlab", "s", "algorithm", "." ]
dougalsutherland/vlfeat-ctypes
python
https://github.com/dougalsutherland/vlfeat-ctypes/blob/87367a1e18863e4effc98d7b3da0b85978e665d3/vlfeat/utils.py#L31-L40
[ "def", "rgb2gray", "(", "img", ")", ":", "T", "=", "np", ".", "linalg", ".", "inv", "(", "np", ".", "array", "(", "[", "[", "1.0", ",", "0.956", ",", "0.621", "]", ",", "[", "1.0", ",", "-", "0.272", ",", "-", "0.647", "]", ",", "[", "1.0",...
87367a1e18863e4effc98d7b3da0b85978e665d3
train
rgb2hsv
Converts an RGB image to HSV using scikit-image's algorithm.
vlfeat/utils.py
def rgb2hsv(arr): """Converts an RGB image to HSV using scikit-image's algorithm.""" arr = np.asanyarray(arr) if arr.ndim != 3 or arr.shape[2] != 3: raise ValueError("the input array must have a shape == (.,.,3)") arr = as_float_image(arr) out = np.empty_like(arr) # -- V channel ou...
def rgb2hsv(arr): """Converts an RGB image to HSV using scikit-image's algorithm.""" arr = np.asanyarray(arr) if arr.ndim != 3 or arr.shape[2] != 3: raise ValueError("the input array must have a shape == (.,.,3)") arr = as_float_image(arr) out = np.empty_like(arr) # -- V channel ou...
[ "Converts", "an", "RGB", "image", "to", "HSV", "using", "scikit", "-", "image", "s", "algorithm", "." ]
dougalsutherland/vlfeat-ctypes
python
https://github.com/dougalsutherland/vlfeat-ctypes/blob/87367a1e18863e4effc98d7b3da0b85978e665d3/vlfeat/utils.py#L44-L87
[ "def", "rgb2hsv", "(", "arr", ")", ":", "arr", "=", "np", ".", "asanyarray", "(", "arr", ")", "if", "arr", ".", "ndim", "!=", "3", "or", "arr", ".", "shape", "[", "2", "]", "!=", "3", ":", "raise", "ValueError", "(", "\"the input array must have a sh...
87367a1e18863e4effc98d7b3da0b85978e665d3
train
_parse_command_response
Parse an SCI command response into ElementTree XML This is a helper method that takes a Requests Response object of an SCI command response and will parse it into an ElementTree Element representing the root of the XML response. :param response: The requests response object :return: An ElementTree...
devicecloud/file_system_service.py
def _parse_command_response(response): """Parse an SCI command response into ElementTree XML This is a helper method that takes a Requests Response object of an SCI command response and will parse it into an ElementTree Element representing the root of the XML response. :param response: The reques...
def _parse_command_response(response): """Parse an SCI command response into ElementTree XML This is a helper method that takes a Requests Response object of an SCI command response and will parse it into an ElementTree Element representing the root of the XML response. :param response: The reques...
[ "Parse", "an", "SCI", "command", "response", "into", "ElementTree", "XML" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L25-L42
[ "def", "_parse_command_response", "(", "response", ")", ":", "try", ":", "root", "=", "ET", ".", "fromstring", "(", "response", ".", "text", ")", "except", "ET", ".", "ParseError", ":", "raise", "ResponseParseError", "(", "\"Unexpected response format, could not p...
32529684a348a7830a269c32601604c78036bcb8
train
_parse_error_tree
Parse an error ElementTree Node to create an ErrorInfo object :param error: The ElementTree error node :return: An ErrorInfo object containing the error ID and the message.
devicecloud/file_system_service.py
def _parse_error_tree(error): """Parse an error ElementTree Node to create an ErrorInfo object :param error: The ElementTree error node :return: An ErrorInfo object containing the error ID and the message. """ errinf = ErrorInfo(error.get('id'), None) if error.text is not None: errinf.m...
def _parse_error_tree(error): """Parse an error ElementTree Node to create an ErrorInfo object :param error: The ElementTree error node :return: An ErrorInfo object containing the error ID and the message. """ errinf = ErrorInfo(error.get('id'), None) if error.text is not None: errinf.m...
[ "Parse", "an", "error", "ElementTree", "Node", "to", "create", "an", "ErrorInfo", "object" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L45-L58
[ "def", "_parse_error_tree", "(", "error", ")", ":", "errinf", "=", "ErrorInfo", "(", "error", ".", "get", "(", "'id'", ")", ",", "None", ")", "if", "error", ".", "text", "is", "not", "None", ":", "errinf", ".", "message", "=", "error", ".", "text", ...
32529684a348a7830a269c32601604c78036bcb8
train
FileInfo.get_data
Get the contents of this file :return: The contents of this file :rtype: six.binary_type
devicecloud/file_system_service.py
def get_data(self): """Get the contents of this file :return: The contents of this file :rtype: six.binary_type """ target = DeviceTarget(self.device_id) return self._fssapi.get_file(target, self.path)[self.device_id]
def get_data(self): """Get the contents of this file :return: The contents of this file :rtype: six.binary_type """ target = DeviceTarget(self.device_id) return self._fssapi.get_file(target, self.path)[self.device_id]
[ "Get", "the", "contents", "of", "this", "file" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L116-L124
[ "def", "get_data", "(", "self", ")", ":", "target", "=", "DeviceTarget", "(", "self", ".", "device_id", ")", "return", "self", ".", "_fssapi", ".", "get_file", "(", "target", ",", "self", ".", "path", ")", "[", "self", ".", "device_id", "]" ]
32529684a348a7830a269c32601604c78036bcb8
train
FileInfo.delete
Delete this file from the device .. note:: After deleting the file, this object will no longer contain valid information and further calls to delete or get_data will return :class:`~.ErrorInfo` objects
devicecloud/file_system_service.py
def delete(self): """Delete this file from the device .. note:: After deleting the file, this object will no longer contain valid information and further calls to delete or get_data will return :class:`~.ErrorInfo` objects """ target = DeviceTarget(self.device_id) ...
def delete(self): """Delete this file from the device .. note:: After deleting the file, this object will no longer contain valid information and further calls to delete or get_data will return :class:`~.ErrorInfo` objects """ target = DeviceTarget(self.device_id) ...
[ "Delete", "this", "file", "from", "the", "device" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L126-L134
[ "def", "delete", "(", "self", ")", ":", "target", "=", "DeviceTarget", "(", "self", ".", "device_id", ")", "return", "self", ".", "_fssapi", ".", "delete_file", "(", "target", ",", "self", ".", "path", ")", "[", "self", ".", "device_id", "]" ]
32529684a348a7830a269c32601604c78036bcb8
train
DirectoryInfo.list_contents
List the contents of this directory :return: A LsInfo object that contains directories and files :rtype: :class:`~.LsInfo` or :class:`~.ErrorInfo` Here is an example usage:: # let dirinfo be a DirectoryInfo object ldata = dirinfo.list_contents() if isinstan...
devicecloud/file_system_service.py
def list_contents(self): """List the contents of this directory :return: A LsInfo object that contains directories and files :rtype: :class:`~.LsInfo` or :class:`~.ErrorInfo` Here is an example usage:: # let dirinfo be a DirectoryInfo object ldata = dirinfo.lis...
def list_contents(self): """List the contents of this directory :return: A LsInfo object that contains directories and files :rtype: :class:`~.LsInfo` or :class:`~.ErrorInfo` Here is an example usage:: # let dirinfo be a DirectoryInfo object ldata = dirinfo.lis...
[ "List", "the", "contents", "of", "this", "directory" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L174-L197
[ "def", "list_contents", "(", "self", ")", ":", "target", "=", "DeviceTarget", "(", "self", ".", "device_id", ")", "return", "self", ".", "_fssapi", ".", "list_files", "(", "target", ",", "self", ".", "path", ")", "[", "self", ".", "device_id", "]" ]
32529684a348a7830a269c32601604c78036bcb8
train
LsCommand.parse_response
Parse the server response for this ls command This will parse xml of the following form:: <ls hash="hash_type"> <file path="file_path" last_modified=last_modified_time ... /> ... <dir path="dir_path" last_modified=last_modified_time /> ... ...
devicecloud/file_system_service.py
def parse_response(cls, response, device_id=None, fssapi=None, **kwargs): """Parse the server response for this ls command This will parse xml of the following form:: <ls hash="hash_type"> <file path="file_path" last_modified=last_modified_time ... /> ... ...
def parse_response(cls, response, device_id=None, fssapi=None, **kwargs): """Parse the server response for this ls command This will parse xml of the following form:: <ls hash="hash_type"> <file path="file_path" last_modified=last_modified_time ... /> ... ...
[ "Parse", "the", "server", "response", "for", "this", "ls", "command" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L282-L343
[ "def", "parse_response", "(", "cls", ",", "response", ",", "device_id", "=", "None", ",", "fssapi", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "response", ".", "tag", "!=", "cls", ".", "command_name", ":", "raise", "ResponseParseError", "(", ...
32529684a348a7830a269c32601604c78036bcb8
train
GetCommand.parse_response
Parse the server response for this get file command This will parse xml of the following form:: <get_file> <data> asdfasdfasdfasdfasf </data> </get_file> or with an error:: <get_file> <error ... />...
devicecloud/file_system_service.py
def parse_response(cls, response, **kwargs): """Parse the server response for this get file command This will parse xml of the following form:: <get_file> <data> asdfasdfasdfasdfasf </data> </get_file> or with an error...
def parse_response(cls, response, **kwargs): """Parse the server response for this get file command This will parse xml of the following form:: <get_file> <data> asdfasdfasdfasdfasf </data> </get_file> or with an error...
[ "Parse", "the", "server", "response", "for", "this", "get", "file", "command" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L375-L409
[ "def", "parse_response", "(", "cls", ",", "response", ",", "*", "*", "kwargs", ")", ":", "if", "response", ".", "tag", "!=", "cls", ".", "command_name", ":", "raise", "ResponseParseError", "(", "\"Received response of type {}, GetCommand can only parse responses of ty...
32529684a348a7830a269c32601604c78036bcb8
train
PutCommand.parse_response
Parse the server response for this put file command This will parse xml of the following form:: <put_file /> or with an error:: <put_file> <error ... /> </put_file> :param response: The XML root of the response for a put file command ...
devicecloud/file_system_service.py
def parse_response(cls, response, **kwargs): """Parse the server response for this put file command This will parse xml of the following form:: <put_file /> or with an error:: <put_file> <error ... /> </put_file> :param response: T...
def parse_response(cls, response, **kwargs): """Parse the server response for this put file command This will parse xml of the following form:: <put_file /> or with an error:: <put_file> <error ... /> </put_file> :param response: T...
[ "Parse", "the", "server", "response", "for", "this", "put", "file", "command" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L459-L484
[ "def", "parse_response", "(", "cls", ",", "response", ",", "*", "*", "kwargs", ")", ":", "if", "response", ".", "tag", "!=", "cls", ".", "command_name", ":", "raise", "ResponseParseError", "(", "\"Received response of type {}, PutCommand can only parse responses of ty...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.send_command_block
Send an arbitrary file system command block The primary use for this method is to send multiple file system commands with a single web service request. This can help to avoid throttling. :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sc...
devicecloud/file_system_service.py
def send_command_block(self, target, command_block): """Send an arbitrary file system command block The primary use for this method is to send multiple file system commands with a single web service request. This can help to avoid throttling. :param target: The device(s) to be targete...
def send_command_block(self, target, command_block): """Send an arbitrary file system command block The primary use for this method is to send multiple file system commands with a single web service request. This can help to avoid throttling. :param target: The device(s) to be targete...
[ "Send", "an", "arbitrary", "file", "system", "command", "block" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L542-L573
[ "def", "send_command_block", "(", "self", ",", "target", ",", "command_block", ")", ":", "root", "=", "_parse_command_response", "(", "self", ".", "_sci_api", ".", "send_sci", "(", "\"file_system\"", ",", "target", ",", "command_block", ".", "get_command_string", ...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.list_files
List all files and directories in the path on the target :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to list files and directories from ...
devicecloud/file_system_service.py
def list_files(self, target, path, hash='any'): """List all files and directories in the path on the target :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path:...
def list_files(self, target, path, hash='any'): """List all files and directories in the path on the target :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path:...
[ "List", "all", "files", "and", "directories", "in", "the", "path", "on", "the", "target" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L575-L660
[ "def", "list_files", "(", "self", ",", "target", ",", "path", ",", "hash", "=", "'any'", ")", ":", "command_block", "=", "FileSystemServiceCommandBlock", "(", ")", "command_block", ".", "add_command", "(", "LsCommand", "(", "path", ",", "hash", "=", "hash", ...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.get_file
Get the contents of a file on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to the file to retrieve :param offset: Star...
devicecloud/file_system_service.py
def get_file(self, target, path, offset=None, length=None): """Get the contents of a file on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The...
def get_file(self, target, path, offset=None, length=None): """Get the contents of a file on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The...
[ "Get", "the", "contents", "of", "a", "file", "on", "the", "device" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L662-L687
[ "def", "get_file", "(", "self", ",", "target", ",", "path", ",", "offset", "=", "None", ",", "length", "=", "None", ")", ":", "command_block", "=", "FileSystemServiceCommandBlock", "(", ")", "command_block", ".", "add_command", "(", "GetCommand", "(", "path"...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.put_file
Put data into a file on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to the file to write to. If the file already exists it w...
devicecloud/file_system_service.py
def put_file(self, target, path, file_data=None, server_file=None, offset=None, truncate=False): """Put data into a file on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` ins...
def put_file(self, target, path, file_data=None, server_file=None, offset=None, truncate=False): """Put data into a file on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` ins...
[ "Put", "data", "into", "a", "file", "on", "the", "device" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L689-L721
[ "def", "put_file", "(", "self", ",", "target", ",", "path", ",", "file_data", "=", "None", ",", "server_file", "=", "None", ",", "offset", "=", "None", ",", "truncate", "=", "False", ")", ":", "command_block", "=", "FileSystemServiceCommandBlock", "(", ")"...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.delete_file
Delete a file from a device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to the file to delete. :return: A dictionary with keys b...
devicecloud/file_system_service.py
def delete_file(self, target, path): """Delete a file from a device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to the file to d...
def delete_file(self, target, path): """Delete a file from a device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to the file to d...
[ "Delete", "a", "file", "from", "a", "device" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L723-L745
[ "def", "delete_file", "(", "self", ",", "target", ",", "path", ")", ":", "command_block", "=", "FileSystemServiceCommandBlock", "(", ")", "command_block", ".", "add_command", "(", "DeleteCommand", "(", "path", ")", ")", "root", "=", "_parse_command_response", "(...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.get_modified_items
Get all files and directories from a path on the device modified since a given time :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to the d...
devicecloud/file_system_service.py
def get_modified_items(self, target, path, last_modified_cutoff): """Get all files and directories from a path on the device modified since a given time :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud....
def get_modified_items(self, target, path, last_modified_cutoff): """Get all files and directories from a path on the device modified since a given time :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud....
[ "Get", "all", "files", "and", "directories", "from", "a", "path", "on", "the", "device", "modified", "since", "a", "given", "time" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L747-L776
[ "def", "get_modified_items", "(", "self", ",", "target", ",", "path", ",", "last_modified_cutoff", ")", ":", "file_list", "=", "self", ".", "list_files", "(", "target", ",", "path", ")", "out_dict", "=", "{", "}", "for", "device_id", ",", "device_data", "i...
32529684a348a7830a269c32601604c78036bcb8
train
FileSystemServiceAPI.exists
Check if path refers to an existing path on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The path on the target to check for existence. :para...
devicecloud/file_system_service.py
def exists(self, target, path, path_sep="/"): """Check if path refers to an existing path on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The...
def exists(self, target, path, path_sep="/"): """Check if path refers to an existing path on the device :param target: The device(s) to be targeted with this request :type target: :class:`devicecloud.sci.TargetABC` or list of :class:`devicecloud.sci.TargetABC` instances :param path: The...
[ "Check", "if", "path", "refers", "to", "an", "existing", "path", "on", "the", "device" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/file_system_service.py#L778-L805
[ "def", "exists", "(", "self", ",", "target", ",", "path", ",", "path_sep", "=", "\"/\"", ")", ":", "if", "path", ".", "endswith", "(", "path_sep", ")", ":", "path", "=", "path", "[", ":", "-", "len", "(", "path_sep", ")", "]", "par_dir", ",", "fi...
32529684a348a7830a269c32601604c78036bcb8
train
DeviceCoreAPI.get_devices
Iterates over each :class:`Device` for this device cloud account Examples:: # get a list of all devices all_devices = list(dc.devicecore.get_devices()) # build a mapping of devices by their vendor id using a # dict comprehension devices = dc.devicec...
devicecloud/devicecore.py
def get_devices(self, condition=None, page_size=1000): """Iterates over each :class:`Device` for this device cloud account Examples:: # get a list of all devices all_devices = list(dc.devicecore.get_devices()) # build a mapping of devices by their vendor id using a...
def get_devices(self, condition=None, page_size=1000): """Iterates over each :class:`Device` for this device cloud account Examples:: # get a list of all devices all_devices = list(dc.devicecore.get_devices()) # build a mapping of devices by their vendor id using a...
[ "Iterates", "over", "each", ":", "class", ":", "Device", "for", "this", "device", "cloud", "account" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L48-L83
[ "def", "get_devices", "(", "self", ",", "condition", "=", "None", ",", "page_size", "=", "1000", ")", ":", "condition", "=", "validate_type", "(", "condition", ",", "type", "(", "None", ")", ",", "Expression", ",", "*", "six", ".", "string_types", ")", ...
32529684a348a7830a269c32601604c78036bcb8
train
DeviceCoreAPI.get_group_tree_root
r"""Return the root group for this accounts' group tree This will return the root group for this tree but with all links between nodes (i.e. children starting from root) populated. Examples:: # print the group hierarchy to stdout dc.devicecore.get_group_tree_root().pri...
devicecloud/devicecore.py
def get_group_tree_root(self, page_size=1000): r"""Return the root group for this accounts' group tree This will return the root group for this tree but with all links between nodes (i.e. children starting from root) populated. Examples:: # print the group hierarchy to std...
def get_group_tree_root(self, page_size=1000): r"""Return the root group for this accounts' group tree This will return the root group for this tree but with all links between nodes (i.e. children starting from root) populated. Examples:: # print the group hierarchy to std...
[ "r", "Return", "the", "root", "group", "for", "this", "accounts", "group", "tree" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L85-L134
[ "def", "get_group_tree_root", "(", "self", ",", "page_size", "=", "1000", ")", ":", "# first pass, build mapping", "group_map", "=", "{", "}", "# map id -> group", "page_size", "=", "validate_type", "(", "page_size", ",", "*", "six", ".", "integer_types", ")", "...
32529684a348a7830a269c32601604c78036bcb8
train
DeviceCoreAPI.get_groups
Return an iterator over all groups in this device cloud account Optionally, a condition can be specified to limit the number of groups returned. Examples:: # Get all groups and print information about them for group in dc.devicecore.get_groups(): print ...
devicecloud/devicecore.py
def get_groups(self, condition=None, page_size=1000): """Return an iterator over all groups in this device cloud account Optionally, a condition can be specified to limit the number of groups returned. Examples:: # Get all groups and print information about them ...
def get_groups(self, condition=None, page_size=1000): """Return an iterator over all groups in this device cloud account Optionally, a condition can be specified to limit the number of groups returned. Examples:: # Get all groups and print information about them ...
[ "Return", "an", "iterator", "over", "all", "groups", "in", "this", "device", "cloud", "account" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L136-L167
[ "def", "get_groups", "(", "self", ",", "condition", "=", "None", ",", "page_size", "=", "1000", ")", ":", "query_kwargs", "=", "{", "}", "if", "condition", "is", "not", "None", ":", "query_kwargs", "[", "\"condition\"", "]", "=", "condition", ".", "compi...
32529684a348a7830a269c32601604c78036bcb8
train
DeviceCoreAPI.provision_devices
Provision multiple devices with a single API call This method takes an iterable of dictionaries where the values in the dictionary are expected to match the arguments of a call to :meth:`provision_device`. The contents of each dictionary will be validated. :param list devices: An iter...
devicecloud/devicecore.py
def provision_devices(self, devices): """Provision multiple devices with a single API call This method takes an iterable of dictionaries where the values in the dictionary are expected to match the arguments of a call to :meth:`provision_device`. The contents of each dictionary will be...
def provision_devices(self, devices): """Provision multiple devices with a single API call This method takes an iterable of dictionaries where the values in the dictionary are expected to match the arguments of a call to :meth:`provision_device`. The contents of each dictionary will be...
[ "Provision", "multiple", "devices", "with", "a", "single", "API", "call" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L237-L312
[ "def", "provision_devices", "(", "self", ",", "devices", ")", ":", "# Validate all the input for each device provided", "sio", "=", "six", ".", "StringIO", "(", ")", "def", "write_tag", "(", "tag", ",", "val", ")", ":", "sio", ".", "write", "(", "\"<{tag}>{val...
32529684a348a7830a269c32601604c78036bcb8
train
Group.from_json
Build and return a new Group object from json data (used internally)
devicecloud/devicecore.py
def from_json(cls, json_data): """Build and return a new Group object from json data (used internally)""" # Example Data: # { "grpId": "11817", "grpName": "7603_Digi", "grpDescription": "7603_Digi root group", # "grpPath": "\/7603_Digi\/", "grpParentId": "1"} return cls( ...
def from_json(cls, json_data): """Build and return a new Group object from json data (used internally)""" # Example Data: # { "grpId": "11817", "grpName": "7603_Digi", "grpDescription": "7603_Digi root group", # "grpPath": "\/7603_Digi\/", "grpParentId": "1"} return cls( ...
[ "Build", "and", "return", "a", "new", "Group", "object", "from", "json", "data", "(", "used", "internally", ")" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L335-L346
[ "def", "from_json", "(", "cls", ",", "json_data", ")", ":", "# Example Data:", "# { \"grpId\": \"11817\", \"grpName\": \"7603_Digi\", \"grpDescription\": \"7603_Digi root group\",", "# \"grpPath\": \"\\/7603_Digi\\/\", \"grpParentId\": \"1\"}", "return", "cls", "(", "group_id", "=", ...
32529684a348a7830a269c32601604c78036bcb8
train
Group.print_subtree
Print this group node and the subtree rooted at it
devicecloud/devicecore.py
def print_subtree(self, fobj=sys.stdout, level=0): """Print this group node and the subtree rooted at it""" fobj.write("{}{!r}\n".format(" " * (level * 2), self)) for child in self.get_children(): child.print_subtree(fobj, level + 1)
def print_subtree(self, fobj=sys.stdout, level=0): """Print this group node and the subtree rooted at it""" fobj.write("{}{!r}\n".format(" " * (level * 2), self)) for child in self.get_children(): child.print_subtree(fobj, level + 1)
[ "Print", "this", "group", "node", "and", "the", "subtree", "rooted", "at", "it" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L353-L357
[ "def", "print_subtree", "(", "self", ",", "fobj", "=", "sys", ".", "stdout", ",", "level", "=", "0", ")", ":", "fobj", ".", "write", "(", "\"{}{!r}\\n\"", ".", "format", "(", "\" \"", "*", "(", "level", "*", "2", ")", ",", "self", ")", ")", "for"...
32529684a348a7830a269c32601604c78036bcb8
train
Device.get_device_json
Get the JSON metadata for this device as a python data structure If ``use_cached`` is not True, then a web services request will be made synchronously in order to get the latest device metatdata. This will update the cached data for this device.
devicecloud/devicecore.py
def get_device_json(self, use_cached=True): """Get the JSON metadata for this device as a python data structure If ``use_cached`` is not True, then a web services request will be made synchronously in order to get the latest device metatdata. This will update the cached data for this d...
def get_device_json(self, use_cached=True): """Get the JSON metadata for this device as a python data structure If ``use_cached`` is not True, then a web services request will be made synchronously in order to get the latest device metatdata. This will update the cached data for this d...
[ "Get", "the", "JSON", "metadata", "for", "this", "device", "as", "a", "python", "data", "structure" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L405-L417
[ "def", "get_device_json", "(", "self", ",", "use_cached", "=", "True", ")", ":", "if", "not", "use_cached", ":", "devicecore_data", "=", "self", ".", "_conn", ".", "get_json", "(", "\"/ws/DeviceCore/{}\"", ".", "format", "(", "self", ".", "get_device_id", "(...
32529684a348a7830a269c32601604c78036bcb8
train
Device.get_tags
Get the list of tags for this device
devicecloud/devicecore.py
def get_tags(self, use_cached=True): """Get the list of tags for this device""" device_json = self.get_device_json(use_cached) potential_tags = device_json.get("dpTags") if potential_tags: return list(filter(None, potential_tags.split(","))) else: return [...
def get_tags(self, use_cached=True): """Get the list of tags for this device""" device_json = self.get_device_json(use_cached) potential_tags = device_json.get("dpTags") if potential_tags: return list(filter(None, potential_tags.split(","))) else: return [...
[ "Get", "the", "list", "of", "tags", "for", "this", "device" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L419-L426
[ "def", "get_tags", "(", "self", ",", "use_cached", "=", "True", ")", ":", "device_json", "=", "self", ".", "get_device_json", "(", "use_cached", ")", "potential_tags", "=", "device_json", ".", "get", "(", "\"dpTags\"", ")", "if", "potential_tags", ":", "retu...
32529684a348a7830a269c32601604c78036bcb8
train
Device.is_connected
Return True if the device is currrently connect and False if not
devicecloud/devicecore.py
def is_connected(self, use_cached=True): """Return True if the device is currrently connect and False if not""" device_json = self.get_device_json(use_cached) return int(device_json.get("dpConnectionStatus")) > 0
def is_connected(self, use_cached=True): """Return True if the device is currrently connect and False if not""" device_json = self.get_device_json(use_cached) return int(device_json.get("dpConnectionStatus")) > 0
[ "Return", "True", "if", "the", "device", "is", "currrently", "connect", "and", "False", "if", "not" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L428-L431
[ "def", "is_connected", "(", "self", ",", "use_cached", "=", "True", ")", ":", "device_json", "=", "self", ".", "get_device_json", "(", "use_cached", ")", "return", "int", "(", "device_json", ".", "get", "(", "\"dpConnectionStatus\"", ")", ")", ">", "0" ]
32529684a348a7830a269c32601604c78036bcb8
train
Device.get_connectware_id
Get the connectware id of this device (primary key)
devicecloud/devicecore.py
def get_connectware_id(self, use_cached=True): """Get the connectware id of this device (primary key)""" device_json = self.get_device_json(use_cached) return device_json.get("devConnectwareId")
def get_connectware_id(self, use_cached=True): """Get the connectware id of this device (primary key)""" device_json = self.get_device_json(use_cached) return device_json.get("devConnectwareId")
[ "Get", "the", "connectware", "id", "of", "this", "device", "(", "primary", "key", ")" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L433-L436
[ "def", "get_connectware_id", "(", "self", ",", "use_cached", "=", "True", ")", ":", "device_json", "=", "self", ".", "get_device_json", "(", "use_cached", ")", "return", "device_json", ".", "get", "(", "\"devConnectwareId\"", ")" ]
32529684a348a7830a269c32601604c78036bcb8
train
Device.get_device_id
Get this device's device id
devicecloud/devicecore.py
def get_device_id(self, use_cached=True): """Get this device's device id""" device_json = self.get_device_json(use_cached) return device_json["id"].get("devId")
def get_device_id(self, use_cached=True): """Get this device's device id""" device_json = self.get_device_json(use_cached) return device_json["id"].get("devId")
[ "Get", "this", "device", "s", "device", "id" ]
digidotcom/python-devicecloud
python
https://github.com/digidotcom/python-devicecloud/blob/32529684a348a7830a269c32601604c78036bcb8/devicecloud/devicecore.py#L438-L441
[ "def", "get_device_id", "(", "self", ",", "use_cached", "=", "True", ")", ":", "device_json", "=", "self", ".", "get_device_json", "(", "use_cached", ")", "return", "device_json", "[", "\"id\"", "]", ".", "get", "(", "\"devId\"", ")" ]
32529684a348a7830a269c32601604c78036bcb8