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
valid
search_images
Returns a Google images query formatted as a GoogleSearch list object.
lib/web/google.py
def search_images(q, start=0, size="", wait=10, asynchronous=False, cached=False): """ Returns a Google images query formatted as a GoogleSearch list object. """ service = GOOGLE_IMAGES return GoogleSearch(q, start, service, size, wait, asynchronous, cached)
def search_images(q, start=0, size="", wait=10, asynchronous=False, cached=False): """ Returns a Google images query formatted as a GoogleSearch list object. """ service = GOOGLE_IMAGES return GoogleSearch(q, start, service, size, wait, asynchronous, cached)
[ "Returns", "a", "Google", "images", "query", "formatted", "as", "a", "GoogleSearch", "list", "object", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/google.py#L220-L226
[ "def", "search_images", "(", "q", ",", "start", "=", "0", ",", "size", "=", "\"\"", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "service", "=", "GOOGLE_IMAGES", "return", "GoogleSearch", "(", "q", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
search_news
Returns a Google news query formatted as a GoogleSearch list object.
lib/web/google.py
def search_news(q, start=0, wait=10, asynchronous=False, cached=False): """ Returns a Google news query formatted as a GoogleSearch list object. """ service = GOOGLE_NEWS return GoogleSearch(q, start, service, "", wait, asynchronous, cached)
def search_news(q, start=0, wait=10, asynchronous=False, cached=False): """ Returns a Google news query formatted as a GoogleSearch list object. """ service = GOOGLE_NEWS return GoogleSearch(q, start, service, "", wait, asynchronous, cached)
[ "Returns", "a", "Google", "news", "query", "formatted", "as", "a", "GoogleSearch", "list", "object", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/google.py#L228-L234
[ "def", "search_news", "(", "q", ",", "start", "=", "0", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "service", "=", "GOOGLE_NEWS", "return", "GoogleSearch", "(", "q", ",", "start", ",", "service", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
search_blogs
Returns a Google blogs query formatted as a GoogleSearch list object.
lib/web/google.py
def search_blogs(q, start=0, wait=10, asynchronous=False, cached=False): """ Returns a Google blogs query formatted as a GoogleSearch list object. """ service = GOOGLE_BLOGS return GoogleSearch(q, start, service, "", wait, asynchronous, cached)
def search_blogs(q, start=0, wait=10, asynchronous=False, cached=False): """ Returns a Google blogs query formatted as a GoogleSearch list object. """ service = GOOGLE_BLOGS return GoogleSearch(q, start, service, "", wait, asynchronous, cached)
[ "Returns", "a", "Google", "blogs", "query", "formatted", "as", "a", "GoogleSearch", "list", "object", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/google.py#L236-L242
[ "def", "search_blogs", "(", "q", ",", "start", "=", "0", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "service", "=", "GOOGLE_BLOGS", "return", "GoogleSearch", "(", "q", ",", "start", ",", "service",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
GoogleResults._parse
Parses the text data from an XML element defined by tag.
lib/web/google.py
def _parse(self, str): """ Parses the text data from an XML element defined by tag. """ str = replace_entities(str) str = strip_tags(str) str = collapse_spaces(str) return str
def _parse(self, str): """ Parses the text data from an XML element defined by tag. """ str = replace_entities(str) str = strip_tags(str) str = collapse_spaces(str) return str
[ "Parses", "the", "text", "data", "from", "an", "XML", "element", "defined", "by", "tag", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/google.py#L138-L146
[ "def", "_parse", "(", "self", ",", "str", ")", ":", "str", "=", "replace_entities", "(", "str", ")", "str", "=", "strip_tags", "(", "str", ")", "str", "=", "collapse_spaces", "(", "str", ")", "return", "str" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Cache.hash
Creates a unique filename in the cache for the id.
lib/web/cache.py
def hash(self, id): """ Creates a unique filename in the cache for the id. """ h = md5(id).hexdigest() return os.path.join(self.path, h+self.type)
def hash(self, id): """ Creates a unique filename in the cache for the id. """ h = md5(id).hexdigest() return os.path.join(self.path, h+self.type)
[ "Creates", "a", "unique", "filename", "in", "the", "cache", "for", "the", "id", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/cache.py#L48-L54
[ "def", "hash", "(", "self", ",", "id", ")", ":", "h", "=", "md5", "(", "id", ")", ".", "hexdigest", "(", ")", "return", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "h", "+", "self", ".", "type", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Cache.age
Returns the age of the cache entry, in days.
lib/web/cache.py
def age(self, id): """ Returns the age of the cache entry, in days. """ path = self.hash(id) if os.path.exists(path): modified = datetime.datetime.fromtimestamp(os.stat(path)[8]) age = datetime.datetime.today() - modified return age.days else...
def age(self, id): """ Returns the age of the cache entry, in days. """ path = self.hash(id) if os.path.exists(path): modified = datetime.datetime.fromtimestamp(os.stat(path)[8]) age = datetime.datetime.today() - modified return age.days else...
[ "Returns", "the", "age", "of", "the", "cache", "entry", "in", "days", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/cache.py#L78-L89
[ "def", "age", "(", "self", ",", "id", ")", ":", "path", "=", "self", ".", "hash", "(", "id", ")", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "modified", "=", "datetime", ".", "datetime", ".", "fromtimestamp", "(", "os", ".", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
angle
Returns the angle between two points.
shoebot/data/geometry.py
def angle(x0, y0, x1, y1): """ Returns the angle between two points. """ return degrees(atan2(y1-y0, x1-x0))
def angle(x0, y0, x1, y1): """ Returns the angle between two points. """ return degrees(atan2(y1-y0, x1-x0))
[ "Returns", "the", "angle", "between", "two", "points", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L20-L23
[ "def", "angle", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ":", "return", "degrees", "(", "atan2", "(", "y1", "-", "y0", ",", "x1", "-", "x0", ")", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
distance
Returns the distance between two points.
shoebot/data/geometry.py
def distance(x0, y0, x1, y1): """ Returns the distance between two points. """ return sqrt(pow(x1-x0, 2) + pow(y1-y0, 2))
def distance(x0, y0, x1, y1): """ Returns the distance between two points. """ return sqrt(pow(x1-x0, 2) + pow(y1-y0, 2))
[ "Returns", "the", "distance", "between", "two", "points", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L26-L29
[ "def", "distance", "(", "x0", ",", "y0", ",", "x1", ",", "y1", ")", ":", "return", "sqrt", "(", "pow", "(", "x1", "-", "x0", ",", "2", ")", "+", "pow", "(", "y1", "-", "y0", ",", "2", ")", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
coordinates
Returns the location of a point by rotating around origin (x0,y0).
shoebot/data/geometry.py
def coordinates(x0, y0, distance, angle): """ Returns the location of a point by rotating around origin (x0,y0). """ return (x0 + cos(radians(angle)) * distance, y0 + sin(radians(angle)) * distance)
def coordinates(x0, y0, distance, angle): """ Returns the location of a point by rotating around origin (x0,y0). """ return (x0 + cos(radians(angle)) * distance, y0 + sin(radians(angle)) * distance)
[ "Returns", "the", "location", "of", "a", "point", "by", "rotating", "around", "origin", "(", "x0", "y0", ")", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L32-L36
[ "def", "coordinates", "(", "x0", ",", "y0", ",", "distance", ",", "angle", ")", ":", "return", "(", "x0", "+", "cos", "(", "radians", "(", "angle", ")", ")", "*", "distance", ",", "y0", "+", "sin", "(", "radians", "(", "angle", ")", ")", "*", "...
d554c1765c1899fa25727c9fc6805d221585562b
valid
rotate
Returns the coordinates of (x,y) rotated around origin (x0,y0).
shoebot/data/geometry.py
def rotate(x, y, x0, y0, angle): """ Returns the coordinates of (x,y) rotated around origin (x0,y0). """ x, y = x - x0, y - y0 a, b = cos(radians(angle)), sin(radians(angle)) return (x * a - y * b + x0, y * a + x * b + y0)
def rotate(x, y, x0, y0, angle): """ Returns the coordinates of (x,y) rotated around origin (x0,y0). """ x, y = x - x0, y - y0 a, b = cos(radians(angle)), sin(radians(angle)) return (x * a - y * b + x0, y * a + x * b + y0)
[ "Returns", "the", "coordinates", "of", "(", "x", "y", ")", "rotated", "around", "origin", "(", "x0", "y0", ")", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L39-L45
[ "def", "rotate", "(", "x", ",", "y", ",", "x0", ",", "y0", ",", "angle", ")", ":", "x", ",", "y", "=", "x", "-", "x0", ",", "y", "-", "y0", "a", ",", "b", "=", "cos", "(", "radians", "(", "angle", ")", ")", ",", "sin", "(", "radians", "...
d554c1765c1899fa25727c9fc6805d221585562b
valid
reflect
Returns the reflection of a point through origin (x0,y0).
shoebot/data/geometry.py
def reflect(x, y, x0, y0, d=1.0, a=180): """ Returns the reflection of a point through origin (x0,y0). """ return coordinates(x0, y0, d * distance(x0, y0, x, y), a + angle(x0, y0, x, y))
def reflect(x, y, x0, y0, d=1.0, a=180): """ Returns the reflection of a point through origin (x0,y0). """ return coordinates(x0, y0, d * distance(x0, y0, x, y), a + angle(x0, y0, x, y))
[ "Returns", "the", "reflection", "of", "a", "point", "through", "origin", "(", "x0", "y0", ")", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L48-L52
[ "def", "reflect", "(", "x", ",", "y", ",", "x0", ",", "y0", ",", "d", "=", "1.0", ",", "a", "=", "180", ")", ":", "return", "coordinates", "(", "x0", ",", "y0", ",", "d", "*", "distance", "(", "x0", ",", "y0", ",", "x", ",", "y", ")", ","...
d554c1765c1899fa25727c9fc6805d221585562b
valid
lerp
Returns the linear interpolation between a and b for time t between 0.0-1.0. For example: lerp(100, 200, 0.5) => 150.
shoebot/data/geometry.py
def lerp(a, b, t): """ Returns the linear interpolation between a and b for time t between 0.0-1.0. For example: lerp(100, 200, 0.5) => 150. """ if t < 0.0: return a if t > 1.0: return b return a + (b - a) * t
def lerp(a, b, t): """ Returns the linear interpolation between a and b for time t between 0.0-1.0. For example: lerp(100, 200, 0.5) => 150. """ if t < 0.0: return a if t > 1.0: return b return a + (b - a) * t
[ "Returns", "the", "linear", "interpolation", "between", "a", "and", "b", "for", "time", "t", "between", "0", ".", "0", "-", "1", ".", "0", ".", "For", "example", ":", "lerp", "(", "100", "200", "0", ".", "5", ")", "=", ">", "150", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L64-L72
[ "def", "lerp", "(", "a", ",", "b", ",", "t", ")", ":", "if", "t", "<", "0.0", ":", "return", "a", "if", "t", ">", "1.0", ":", "return", "b", "return", "a", "+", "(", "b", "-", "a", ")", "*", "t" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
smoothstep
Returns a smooth transition between 0.0 and 1.0 using Hermite interpolation (cubic spline), where x is a number between a and b. The return value will ease (slow down) as x nears a or b. For x smaller than a, returns 0.0. For x bigger than b, returns 1.0.
shoebot/data/geometry.py
def smoothstep(a, b, x): """ Returns a smooth transition between 0.0 and 1.0 using Hermite interpolation (cubic spline), where x is a number between a and b. The return value will ease (slow down) as x nears a or b. For x smaller than a, returns 0.0. For x bigger than b, returns 1.0. """ ...
def smoothstep(a, b, x): """ Returns a smooth transition between 0.0 and 1.0 using Hermite interpolation (cubic spline), where x is a number between a and b. The return value will ease (slow down) as x nears a or b. For x smaller than a, returns 0.0. For x bigger than b, returns 1.0. """ ...
[ "Returns", "a", "smooth", "transition", "between", "0", ".", "0", "and", "1", ".", "0", "using", "Hermite", "interpolation", "(", "cubic", "spline", ")", "where", "x", "is", "a", "number", "between", "a", "and", "b", ".", "The", "return", "value", "wil...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L75-L85
[ "def", "smoothstep", "(", "a", ",", "b", ",", "x", ")", ":", "if", "x", "<", "a", ":", "return", "0.0", "if", "x", ">=", "b", ":", "return", "1.0", "x", "=", "float", "(", "x", "-", "a", ")", "/", "(", "b", "-", "a", ")", "return", "x", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
line_line_intersection
Determines the intersection point of two lines, or two finite line segments if infinite=False. When the lines do not intersect, returns an empty list.
shoebot/data/geometry.py
def line_line_intersection(x1, y1, x2, y2, x3, y3, x4, y4, infinite=False): """ Determines the intersection point of two lines, or two finite line segments if infinite=False. When the lines do not intersect, returns an empty list. """ # Based on: P. Bourke, http://local.wasp.uwa.edu.au/~pbourke/...
def line_line_intersection(x1, y1, x2, y2, x3, y3, x4, y4, infinite=False): """ Determines the intersection point of two lines, or two finite line segments if infinite=False. When the lines do not intersect, returns an empty list. """ # Based on: P. Bourke, http://local.wasp.uwa.edu.au/~pbourke/...
[ "Determines", "the", "intersection", "point", "of", "two", "lines", "or", "two", "finite", "line", "segments", "if", "infinite", "=", "False", ".", "When", "the", "lines", "do", "not", "intersect", "returns", "an", "empty", "list", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L94-L115
[ "def", "line_line_intersection", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "x3", ",", "y3", ",", "x4", ",", "y4", ",", "infinite", "=", "False", ")", ":", "# Based on: P. Bourke, http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/\r", "ua", "=", "(...
d554c1765c1899fa25727c9fc6805d221585562b
valid
circle_line_intersection
Returns a list of points where the circle and the line intersect. Returns an empty list when the circle and the line do not intersect.
shoebot/data/geometry.py
def circle_line_intersection(cx, cy, radius, x1, y1, x2, y2, infinite=False): """ Returns a list of points where the circle and the line intersect. Returns an empty list when the circle and the line do not intersect. """ # Based on: http://www.vb-helper.com/howto_net_line_circle_intersection...
def circle_line_intersection(cx, cy, radius, x1, y1, x2, y2, infinite=False): """ Returns a list of points where the circle and the line intersect. Returns an empty list when the circle and the line do not intersect. """ # Based on: http://www.vb-helper.com/howto_net_line_circle_intersection...
[ "Returns", "a", "list", "of", "points", "where", "the", "circle", "and", "the", "line", "intersect", ".", "Returns", "an", "empty", "list", "when", "the", "circle", "and", "the", "line", "do", "not", "intersect", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L118-L147
[ "def", "circle_line_intersection", "(", "cx", ",", "cy", ",", "radius", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "infinite", "=", "False", ")", ":", "# Based on: http://www.vb-helper.com/howto_net_line_circle_intersections.html\r", "dx", "=", "x2", "-", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
point_in_polygon
Ray casting algorithm. Determines how many times a horizontal ray starting from the point intersects with the sides of the polygon. If it is an even number of times, the point is outside, if odd, inside. The algorithm does not always report correctly when the point is very close to t...
shoebot/data/geometry.py
def point_in_polygon(points, x, y): """ Ray casting algorithm. Determines how many times a horizontal ray starting from the point intersects with the sides of the polygon. If it is an even number of times, the point is outside, if odd, inside. The algorithm does not always repor...
def point_in_polygon(points, x, y): """ Ray casting algorithm. Determines how many times a horizontal ray starting from the point intersects with the sides of the polygon. If it is an even number of times, the point is outside, if odd, inside. The algorithm does not always repor...
[ "Ray", "casting", "algorithm", ".", "Determines", "how", "many", "times", "a", "horizontal", "ray", "starting", "from", "the", "point", "intersects", "with", "the", "sides", "of", "the", "polygon", ".", "If", "it", "is", "an", "even", "number", "of", "time...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L157-L174
[ "def", "point_in_polygon", "(", "points", ",", "x", ",", "y", ")", ":", "odd", "=", "False", "n", "=", "len", "(", "points", ")", "for", "i", "in", "range", "(", "n", ")", ":", "j", "=", "i", "<", "n", "-", "1", "and", "i", "+", "1", "or", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
AffineTransform._mmult
Returns the 3x3 matrix multiplication of A and B. Note that scale(), translate(), rotate() work with premultiplication, e.g. the matrix A followed by B = BA and not AB.
shoebot/data/geometry.py
def _mmult(self, a, b): """ Returns the 3x3 matrix multiplication of A and B. Note that scale(), translate(), rotate() work with premultiplication, e.g. the matrix A followed by B = BA and not AB. """ # No need to optimize (C version is just as fast). return...
def _mmult(self, a, b): """ Returns the 3x3 matrix multiplication of A and B. Note that scale(), translate(), rotate() work with premultiplication, e.g. the matrix A followed by B = BA and not AB. """ # No need to optimize (C version is just as fast). return...
[ "Returns", "the", "3x3", "matrix", "multiplication", "of", "A", "and", "B", ".", "Note", "that", "scale", "()", "translate", "()", "rotate", "()", "work", "with", "premultiplication", "e", ".", "g", ".", "the", "matrix", "A", "followed", "by", "B", "=", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L205-L221
[ "def", "_mmult", "(", "self", ",", "a", ",", "b", ")", ":", "# No need to optimize (C version is just as fast).\r", "return", "[", "a", "[", "0", "]", "*", "b", "[", "0", "]", "+", "a", "[", "1", "]", "*", "b", "[", "3", "]", ",", "a", "[", "0", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
AffineTransform.invert
Multiplying a matrix by its inverse produces the identity matrix.
shoebot/data/geometry.py
def invert(self): """ Multiplying a matrix by its inverse produces the identity matrix. """ m = self.matrix d = m[0] * m[4] - m[1] * m[3] self.matrix = [ m[4] / d, -m[1] / d, 0, -m[3] / d, m[0] / d, 0, (m[3] * m[7] - m[4] * m[6]) / ...
def invert(self): """ Multiplying a matrix by its inverse produces the identity matrix. """ m = self.matrix d = m[0] * m[4] - m[1] * m[3] self.matrix = [ m[4] / d, -m[1] / d, 0, -m[3] / d, m[0] / d, 0, (m[3] * m[7] - m[4] * m[6]) / ...
[ "Multiplying", "a", "matrix", "by", "its", "inverse", "produces", "the", "identity", "matrix", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L223-L234
[ "def", "invert", "(", "self", ")", ":", "m", "=", "self", ".", "matrix", "d", "=", "m", "[", "0", "]", "*", "m", "[", "4", "]", "-", "m", "[", "1", "]", "*", "m", "[", "3", "]", "self", ".", "matrix", "=", "[", "m", "[", "4", "]", "/"...
d554c1765c1899fa25727c9fc6805d221585562b
valid
AffineTransform.transform_point
Returns the new coordinates of (x,y) after transformation.
shoebot/data/geometry.py
def transform_point(self, x, y): """ Returns the new coordinates of (x,y) after transformation. """ m = self.matrix return (x*m[0]+y*m[3]+m[6], x*m[1]+y*m[4]+m[7])
def transform_point(self, x, y): """ Returns the new coordinates of (x,y) after transformation. """ m = self.matrix return (x*m[0]+y*m[3]+m[6], x*m[1]+y*m[4]+m[7])
[ "Returns", "the", "new", "coordinates", "of", "(", "x", "y", ")", "after", "transformation", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L257-L261
[ "def", "transform_point", "(", "self", ",", "x", ",", "y", ")", ":", "m", "=", "self", ".", "matrix", "return", "(", "x", "*", "m", "[", "0", "]", "+", "y", "*", "m", "[", "3", "]", "+", "m", "[", "6", "]", ",", "x", "*", "m", "[", "1",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
AffineTransform.transform_path
Returns a BezierPath object with the transformation applied.
shoebot/data/geometry.py
def transform_path(self, path): """ Returns a BezierPath object with the transformation applied. """ p = path.__class__() # Create a new BezierPath. for pt in path: if pt.cmd == "close": p.closepath() elif pt.cmd == "moveto": ...
def transform_path(self, path): """ Returns a BezierPath object with the transformation applied. """ p = path.__class__() # Create a new BezierPath. for pt in path: if pt.cmd == "close": p.closepath() elif pt.cmd == "moveto": ...
[ "Returns", "a", "BezierPath", "object", "with", "the", "transformation", "applied", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L265-L281
[ "def", "transform_path", "(", "self", ",", "path", ")", ":", "p", "=", "path", ".", "__class__", "(", ")", "# Create a new BezierPath.\r", "for", "pt", "in", "path", ":", "if", "pt", ".", "cmd", "==", "\"close\"", ":", "p", ".", "closepath", "(", ")", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Bounds.intersects
Return True if a part of the two bounds overlaps.
shoebot/data/geometry.py
def intersects(self, b): """ Return True if a part of the two bounds overlaps. """ return max(self.x, b.x) < min(self.x+self.width, b.x+b.width) \ and max(self.y, b.y) < min(self.y+self.height, b.y+b.height)
def intersects(self, b): """ Return True if a part of the two bounds overlaps. """ return max(self.x, b.x) < min(self.x+self.width, b.x+b.width) \ and max(self.y, b.y) < min(self.y+self.height, b.y+b.height)
[ "Return", "True", "if", "a", "part", "of", "the", "two", "bounds", "overlaps", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L349-L353
[ "def", "intersects", "(", "self", ",", "b", ")", ":", "return", "max", "(", "self", ".", "x", ",", "b", ".", "x", ")", "<", "min", "(", "self", ".", "x", "+", "self", ".", "width", ",", "b", ".", "x", "+", "b", ".", "width", ")", "and", "...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Bounds.intersection
Returns bounds that encompass the intersection of the two. If there is no overlap between the two, None is returned.
shoebot/data/geometry.py
def intersection(self, b): """ Returns bounds that encompass the intersection of the two. If there is no overlap between the two, None is returned. """ if not self.intersects(b): return None mx, my = max(self.x, b.x), max(self.y, b.y) return Bounds(...
def intersection(self, b): """ Returns bounds that encompass the intersection of the two. If there is no overlap between the two, None is returned. """ if not self.intersects(b): return None mx, my = max(self.x, b.x), max(self.y, b.y) return Bounds(...
[ "Returns", "bounds", "that", "encompass", "the", "intersection", "of", "the", "two", ".", "If", "there", "is", "no", "overlap", "between", "the", "two", "None", "is", "returned", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L355-L364
[ "def", "intersection", "(", "self", ",", "b", ")", ":", "if", "not", "self", ".", "intersects", "(", "b", ")", ":", "return", "None", "mx", ",", "my", "=", "max", "(", "self", ".", "x", ",", "b", ".", "x", ")", ",", "max", "(", "self", ".", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Bounds.union
Returns bounds that encompass the union of the two.
shoebot/data/geometry.py
def union(self, b): """ Returns bounds that encompass the union of the two. """ mx, my = min(self.x, b.x), min(self.y, b.y) return Bounds(mx, my, max(self.x+self.width, b.x+b.width) - mx, max(self.y+self.height, b.y+b.height) - my)
def union(self, b): """ Returns bounds that encompass the union of the two. """ mx, my = min(self.x, b.x), min(self.y, b.y) return Bounds(mx, my, max(self.x+self.width, b.x+b.width) - mx, max(self.y+self.height, b.y+b.height) - my)
[ "Returns", "bounds", "that", "encompass", "the", "union", "of", "the", "two", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L366-L372
[ "def", "union", "(", "self", ",", "b", ")", ":", "mx", ",", "my", "=", "min", "(", "self", ".", "x", ",", "b", ".", "x", ")", ",", "min", "(", "self", ".", "y", ",", "b", ".", "y", ")", "return", "Bounds", "(", "mx", ",", "my", ",", "ma...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Bounds.contains
Returns True if the given point or rectangle falls within the bounds.
shoebot/data/geometry.py
def contains(self, *a): """ Returns True if the given point or rectangle falls within the bounds. """ if len(a) == 2: a = [Point(a[0], a[1])] if len(a) == 1: a = a[0] if isinstance(a, Point): return a.x >= self.x and a.x <= self.x+self.width...
def contains(self, *a): """ Returns True if the given point or rectangle falls within the bounds. """ if len(a) == 2: a = [Point(a[0], a[1])] if len(a) == 1: a = a[0] if isinstance(a, Point): return a.x >= self.x and a.x <= self.x+self.width...
[ "Returns", "True", "if", "the", "given", "point", "or", "rectangle", "falls", "within", "the", "bounds", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/geometry.py#L374-L385
[ "def", "contains", "(", "self", ",", "*", "a", ")", ":", "if", "len", "(", "a", ")", "==", "2", ":", "a", "=", "[", "Point", "(", "a", "[", "0", "]", ",", "a", "[", "1", "]", ")", "]", "if", "len", "(", "a", ")", "==", "1", ":", "a", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
error
Prints an error message, the help message and quits
shoebot/run.py
def error(message): '''Prints an error message, the help message and quits''' global parser print (_("Error: ") + message) print () parser.print_help() sys.exit()
def error(message): '''Prints an error message, the help message and quits''' global parser print (_("Error: ") + message) print () parser.print_help() sys.exit()
[ "Prints", "an", "error", "message", "the", "help", "message", "and", "quits" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/run.py#L63-L69
[ "def", "error", "(", "message", ")", ":", "global", "parser", "print", "(", "_", "(", "\"Error: \"", ")", "+", "message", ")", "print", "(", ")", "parser", ".", "print_help", "(", ")", "sys", ".", "exit", "(", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.ellipse
Draws an ellipse starting from (x,y)
shoebot/grammar/drawbot.py
def ellipse(self, x, y, width, height, draw=True, **kwargs): '''Draws an ellipse starting from (x,y)''' path = self.BezierPath(**kwargs) path.ellipse(x,y,width,height) if draw: path.draw() return path
def ellipse(self, x, y, width, height, draw=True, **kwargs): '''Draws an ellipse starting from (x,y)''' path = self.BezierPath(**kwargs) path.ellipse(x,y,width,height) if draw: path.draw() return path
[ "Draws", "an", "ellipse", "starting", "from", "(", "x", "y", ")" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L64-L70
[ "def", "ellipse", "(", "self", ",", "x", ",", "y", ",", "width", ",", "height", ",", "draw", "=", "True", ",", "*", "*", "kwargs", ")", ":", "path", "=", "self", ".", "BezierPath", "(", "*", "*", "kwargs", ")", "path", ".", "ellipse", "(", "x",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.line
Draws a line from (x1,y1) to (x2,y2)
shoebot/grammar/drawbot.py
def line(self, x1, y1, x2, y2, draw=True): '''Draws a line from (x1,y1) to (x2,y2)''' p = self._path self.newpath() self.moveto(x1,y1) self.lineto(x2,y2) self.endpath(draw=draw) self._path = p return p
def line(self, x1, y1, x2, y2, draw=True): '''Draws a line from (x1,y1) to (x2,y2)''' p = self._path self.newpath() self.moveto(x1,y1) self.lineto(x2,y2) self.endpath(draw=draw) self._path = p return p
[ "Draws", "a", "line", "from", "(", "x1", "y1", ")", "to", "(", "x2", "y2", ")" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L75-L83
[ "def", "line", "(", "self", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "draw", "=", "True", ")", ":", "p", "=", "self", ".", "_path", "self", ".", "newpath", "(", ")", "self", ".", "moveto", "(", "x1", ",", "y1", ")", "self", ".", "li...
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.colormode
Sets the current colormode (can be RGB or HSB) and eventually the color range. If called without arguments, it returns the current colormode.
shoebot/grammar/drawbot.py
def colormode(self, mode=None, crange=None): '''Sets the current colormode (can be RGB or HSB) and eventually the color range. If called without arguments, it returns the current colormode. ''' if mode is not None: if mode == "rgb": self.color_mode = ...
def colormode(self, mode=None, crange=None): '''Sets the current colormode (can be RGB or HSB) and eventually the color range. If called without arguments, it returns the current colormode. ''' if mode is not None: if mode == "rgb": self.color_mode = ...
[ "Sets", "the", "current", "colormode", "(", "can", "be", "RGB", "or", "HSB", ")", "and", "eventually", "the", "color", "range", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L230-L245
[ "def", "colormode", "(", "self", ",", "mode", "=", "None", ",", "crange", "=", "None", ")", ":", "if", "mode", "is", "not", "None", ":", "if", "mode", "==", "\"rgb\"", ":", "self", ".", "color_mode", "=", "Bot", ".", "RGB", "elif", "mode", "==", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.fill
Sets a fill color, applying it to new paths.
shoebot/grammar/drawbot.py
def fill(self,*args): '''Sets a fill color, applying it to new paths.''' self._fillcolor = self.color(*args) return self._fillcolor
def fill(self,*args): '''Sets a fill color, applying it to new paths.''' self._fillcolor = self.color(*args) return self._fillcolor
[ "Sets", "a", "fill", "color", "applying", "it", "to", "new", "paths", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L250-L253
[ "def", "fill", "(", "self", ",", "*", "args", ")", ":", "self", ".", "_fillcolor", "=", "self", ".", "color", "(", "*", "args", ")", "return", "self", ".", "_fillcolor" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.stroke
Set a stroke color, applying it to new paths.
shoebot/grammar/drawbot.py
def stroke(self,*args): '''Set a stroke color, applying it to new paths.''' self._strokecolor = self.color(*args) return self._strokecolor
def stroke(self,*args): '''Set a stroke color, applying it to new paths.''' self._strokecolor = self.color(*args) return self._strokecolor
[ "Set", "a", "stroke", "color", "applying", "it", "to", "new", "paths", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L259-L262
[ "def", "stroke", "(", "self", ",", "*", "args", ")", ":", "self", ".", "_strokecolor", "=", "self", ".", "color", "(", "*", "args", ")", "return", "self", ".", "_strokecolor" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.textpath
Draws an outlined path of the input text
shoebot/grammar/drawbot.py
def textpath(self, txt, x, y, width=None, height=1000000, enableRendering=False, **kwargs): ''' Draws an outlined path of the input text ''' txt = self.Text(txt, x, y, width, height, **kwargs) path = txt.path if draw: path.draw() return path
def textpath(self, txt, x, y, width=None, height=1000000, enableRendering=False, **kwargs): ''' Draws an outlined path of the input text ''' txt = self.Text(txt, x, y, width, height, **kwargs) path = txt.path if draw: path.draw() return path
[ "Draws", "an", "outlined", "path", "of", "the", "input", "text" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L311-L319
[ "def", "textpath", "(", "self", ",", "txt", ",", "x", ",", "y", ",", "width", "=", "None", ",", "height", "=", "1000000", ",", "enableRendering", "=", "False", ",", "*", "*", "kwargs", ")", ":", "txt", "=", "self", ".", "Text", "(", "txt", ",", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
DrawBot.textmetrics
Returns the width and height of a string of text as a tuple (according to current font settings).
shoebot/grammar/drawbot.py
def textmetrics(self, txt, width=None, height=None, **kwargs): '''Returns the width and height of a string of text as a tuple (according to current font settings). ''' # for now only returns width and height (as per Nodebox behaviour) # but maybe we could use the other data from ...
def textmetrics(self, txt, width=None, height=None, **kwargs): '''Returns the width and height of a string of text as a tuple (according to current font settings). ''' # for now only returns width and height (as per Nodebox behaviour) # but maybe we could use the other data from ...
[ "Returns", "the", "width", "and", "height", "of", "a", "string", "of", "text", "as", "a", "tuple", "(", "according", "to", "current", "font", "settings", ")", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/drawbot.py#L321-L331
[ "def", "textmetrics", "(", "self", ",", "txt", ",", "width", "=", "None", ",", "height", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# for now only returns width and height (as per Nodebox behaviour)", "# but maybe we could use the other data from cairo", "# we send ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
draw_cornu_flat
Raph Levien's code draws fast LINETO segments.
lib/cornu/__init__.py
def draw_cornu_flat(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd): """ Raph Levien's code draws fast LINETO segments. """ for j in range(0, 100): t = j * .01 s, c = eval_cornu(t0 + t * (t1 - t0)) s *= flip s -= s0 c -= c0 #print '%', c, s x = c ...
def draw_cornu_flat(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd): """ Raph Levien's code draws fast LINETO segments. """ for j in range(0, 100): t = j * .01 s, c = eval_cornu(t0 + t * (t1 - t0)) s *= flip s -= s0 c -= c0 #print '%', c, s x = c ...
[ "Raph", "Levien", "s", "code", "draws", "fast", "LINETO", "segments", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/cornu/__init__.py#L272-L288
[ "def", "draw_cornu_flat", "(", "x0", ",", "y0", ",", "t0", ",", "t1", ",", "s0", ",", "c0", ",", "flip", ",", "cs", ",", "ss", ",", "cmd", ")", ":", "for", "j", "in", "range", "(", "0", ",", "100", ")", ":", "t", "=", "j", "*", ".01", "s"...
d554c1765c1899fa25727c9fc6805d221585562b
valid
draw_cornu_bezier
Mark Meyer's code draws elegant CURVETO segments.
lib/cornu/__init__.py
def draw_cornu_bezier(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd, scale, rot): """ Mark Meyer's code draws elegant CURVETO segments. """ s = None for j in range(0, 5): # travel along the function two points at a time (at time t and t2) # the first time through we'll need to get both poi...
def draw_cornu_bezier(x0, y0, t0, t1, s0, c0, flip, cs, ss, cmd, scale, rot): """ Mark Meyer's code draws elegant CURVETO segments. """ s = None for j in range(0, 5): # travel along the function two points at a time (at time t and t2) # the first time through we'll need to get both poi...
[ "Mark", "Meyer", "s", "code", "draws", "elegant", "CURVETO", "segments", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/cornu/__init__.py#L290-L349
[ "def", "draw_cornu_bezier", "(", "x0", ",", "y0", ",", "t0", ",", "t1", ",", "s0", ",", "c0", ",", "flip", ",", "cs", ",", "ss", ",", "cmd", ",", "scale", ",", "rot", ")", ":", "s", "=", "None", "for", "j", "in", "range", "(", "0", ",", "5"...
d554c1765c1899fa25727c9fc6805d221585562b
valid
search
Returns a Yahoo web query formatted as a YahooSearch list object.
lib/web/yahoo.py
def search(q, start=1, count=10, context=None, wait=10, asynchronous=False, cached=False): """ Returns a Yahoo web query formatted as a YahooSearch list object. """ service = YAHOO_SEARCH return YahooSearch(q, start, count, service, context, wait, asynchronous, cached)
def search(q, start=1, count=10, context=None, wait=10, asynchronous=False, cached=False): """ Returns a Yahoo web query formatted as a YahooSearch list object. """ service = YAHOO_SEARCH return YahooSearch(q, start, count, service, context, wait, asynchronous, cached)
[ "Returns", "a", "Yahoo", "web", "query", "formatted", "as", "a", "YahooSearch", "list", "object", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L201-L207
[ "def", "search", "(", "q", ",", "start", "=", "1", ",", "count", "=", "10", ",", "context", "=", "None", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "service", "=", "YAHOO_SEARCH", "return", "Ya...
d554c1765c1899fa25727c9fc6805d221585562b
valid
search_images
Returns a Yahoo images query formatted as a YahooSearch list object.
lib/web/yahoo.py
def search_images(q, start=1, count=10, wait=10, asynchronous=False, cached=False): """ Returns a Yahoo images query formatted as a YahooSearch list object. """ service = YAHOO_IMAGES return YahooSearch(q, start, count, service, None, wait, asynchronous, cached)
def search_images(q, start=1, count=10, wait=10, asynchronous=False, cached=False): """ Returns a Yahoo images query formatted as a YahooSearch list object. """ service = YAHOO_IMAGES return YahooSearch(q, start, count, service, None, wait, asynchronous, cached)
[ "Returns", "a", "Yahoo", "images", "query", "formatted", "as", "a", "YahooSearch", "list", "object", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L209-L215
[ "def", "search_images", "(", "q", ",", "start", "=", "1", ",", "count", "=", "10", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "service", "=", "YAHOO_IMAGES", "return", "YahooSearch", "(", "q", ",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
search_news
Returns a Yahoo news query formatted as a YahooSearch list object.
lib/web/yahoo.py
def search_news(q, start=1, count=10, wait=10, asynchronous=False, cached=False): """ Returns a Yahoo news query formatted as a YahooSearch list object. """ service = YAHOO_NEWS return YahooSearch(q, start, count, service, None, wait, asynchronous, cached)
def search_news(q, start=1, count=10, wait=10, asynchronous=False, cached=False): """ Returns a Yahoo news query formatted as a YahooSearch list object. """ service = YAHOO_NEWS return YahooSearch(q, start, count, service, None, wait, asynchronous, cached)
[ "Returns", "a", "Yahoo", "news", "query", "formatted", "as", "a", "YahooSearch", "list", "object", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L217-L223
[ "def", "search_news", "(", "q", ",", "start", "=", "1", ",", "count", "=", "10", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "service", "=", "YAHOO_NEWS", "return", "YahooSearch", "(", "q", ",", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
suggest_spelling
Returns list of suggested spelling corrections for the given query.
lib/web/yahoo.py
def suggest_spelling(q, wait=10, asynchronous=False, cached=False): """ Returns list of suggested spelling corrections for the given query. """ return YahooSpelling(q, wait, asynchronous, cached)
def suggest_spelling(q, wait=10, asynchronous=False, cached=False): """ Returns list of suggested spelling corrections for the given query. """ return YahooSpelling(q, wait, asynchronous, cached)
[ "Returns", "list", "of", "suggested", "spelling", "corrections", "for", "the", "given", "query", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L247-L252
[ "def", "suggest_spelling", "(", "q", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":", "return", "YahooSpelling", "(", "q", ",", "wait", ",", "asynchronous", ",", "cached", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
sort
Performs a Yahoo sort on the given list. Sorts the items in the list according to the result count Yahoo yields on an item. Setting a context sorts the items according to their relation to this context; for example sorting [red, green, blue] by "love" yields red as the highest results...
lib/web/yahoo.py
def sort(words, context="", strict=True, relative=True, service=YAHOO_SEARCH, wait=10, asynchronous=False, cached=False): """Performs a Yahoo sort on the given list. Sorts the items in the list according to the result count Yahoo yields on an item. Setting a context sorts the it...
def sort(words, context="", strict=True, relative=True, service=YAHOO_SEARCH, wait=10, asynchronous=False, cached=False): """Performs a Yahoo sort on the given list. Sorts the items in the list according to the result count Yahoo yields on an item. Setting a context sorts the it...
[ "Performs", "a", "Yahoo", "sort", "on", "the", "given", "list", ".", "Sorts", "the", "items", "in", "the", "list", "according", "to", "the", "result", "count", "Yahoo", "yields", "on", "an", "item", ".", "Setting", "a", "context", "sorts", "the", "items"...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L256-L289
[ "def", "sort", "(", "words", ",", "context", "=", "\"\"", ",", "strict", "=", "True", ",", "relative", "=", "True", ",", "service", "=", "YAHOO_SEARCH", ",", "wait", "=", "10", ",", "asynchronous", "=", "False", ",", "cached", "=", "False", ")", ":",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
YahooResults._parse
Parses the text data from an XML element defined by tag.
lib/web/yahoo.py
def _parse(self, e, tag): """ Parses the text data from an XML element defined by tag. """ tags = e.getElementsByTagName(tag) children = tags[0].childNodes if len(children) != 1: return None assert children[0].nodeType == xml.dom.minidom.Element.TEXT_NOD...
def _parse(self, e, tag): """ Parses the text data from an XML element defined by tag. """ tags = e.getElementsByTagName(tag) children = tags[0].childNodes if len(children) != 1: return None assert children[0].nodeType == xml.dom.minidom.Element.TEXT_NOD...
[ "Parses", "the", "text", "data", "from", "an", "XML", "element", "defined", "by", "tag", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/web/yahoo.py#L123-L137
[ "def", "_parse", "(", "self", ",", "e", ",", "tag", ")", ":", "tags", "=", "e", ".", "getElementsByTagName", "(", "tag", ")", "children", "=", "tags", "[", "0", "]", ".", "childNodes", "if", "len", "(", "children", ")", "!=", "1", ":", "return", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.layer
Creates a new layer from file, Layer, PIL Image. If img is an image file or PIL Image object, Creates a new layer with the given image file. The image is positioned on the canvas at x, y. If img is a Layer, uses that layer's x and y position and name.
lib/photobot/__init__.py
def layer(self, img, x=0, y=0, name=""): """Creates a new layer from file, Layer, PIL Image. If img is an image file or PIL Image object, Creates a new layer with the given image file. The image is positioned on the canvas at x, y. If img is a Layer, us...
def layer(self, img, x=0, y=0, name=""): """Creates a new layer from file, Layer, PIL Image. If img is an image file or PIL Image object, Creates a new layer with the given image file. The image is positioned on the canvas at x, y. If img is a Layer, us...
[ "Creates", "a", "new", "layer", "from", "file", "Layer", "PIL", "Image", ".", "If", "img", "is", "an", "image", "file", "or", "PIL", "Image", "object", "Creates", "a", "new", "layer", "with", "the", "given", "image", "file", ".", "The", "image", "is", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L57-L83
[ "def", "layer", "(", "self", ",", "img", ",", "x", "=", "0", ",", "y", "=", "0", ",", "name", "=", "\"\"", ")", ":", "from", "types", "import", "StringType", "if", "isinstance", "(", "img", ",", "Image", ".", "Image", ")", ":", "img", "=", "img...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.fill
Creates a new fill layer. Creates a new layer filled with the given rgb color. For example, fill((255,0,0)) creates a red fill. The layers fills the entire canvas by default.
lib/photobot/__init__.py
def fill(self, rgb, x=0, y=0, w=None, h=None, name=""): """Creates a new fill layer. Creates a new layer filled with the given rgb color. For example, fill((255,0,0)) creates a red fill. The layers fills the entire canvas by default. """ if w == None:...
def fill(self, rgb, x=0, y=0, w=None, h=None, name=""): """Creates a new fill layer. Creates a new layer filled with the given rgb color. For example, fill((255,0,0)) creates a red fill. The layers fills the entire canvas by default. """ if w == None:...
[ "Creates", "a", "new", "fill", "layer", ".", "Creates", "a", "new", "layer", "filled", "with", "the", "given", "rgb", "color", ".", "For", "example", "fill", "((", "255", "0", "0", "))", "creates", "a", "red", "fill", ".", "The", "layers", "fills", "...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L85-L98
[ "def", "fill", "(", "self", ",", "rgb", ",", "x", "=", "0", ",", "y", "=", "0", ",", "w", "=", "None", ",", "h", "=", "None", ",", "name", "=", "\"\"", ")", ":", "if", "w", "==", "None", ":", "w", "=", "self", ".", "w", "-", "x", "if", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.gradient
Creates a gradient layer. Creates a gradient layer, that is usually used together with the mask() function. All the image functions work on gradients, so they can easily be flipped, rotated, scaled, inverted, made brighter or darker, ... Styles for gradient...
lib/photobot/__init__.py
def gradient(self, style=LINEAR, w=1.0, h=1.0, name=""): """Creates a gradient layer. Creates a gradient layer, that is usually used together with the mask() function. All the image functions work on gradients, so they can easily be flipped, rotated, scaled, invert...
def gradient(self, style=LINEAR, w=1.0, h=1.0, name=""): """Creates a gradient layer. Creates a gradient layer, that is usually used together with the mask() function. All the image functions work on gradients, so they can easily be flipped, rotated, scaled, invert...
[ "Creates", "a", "gradient", "layer", ".", "Creates", "a", "gradient", "layer", "that", "is", "usually", "used", "together", "with", "the", "mask", "()", "function", ".", "All", "the", "image", "functions", "work", "on", "gradients", "so", "they", "can", "e...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L100-L144
[ "def", "gradient", "(", "self", ",", "style", "=", "LINEAR", ",", "w", "=", "1.0", ",", "h", "=", "1.0", ",", "name", "=", "\"\"", ")", ":", "from", "types", "import", "FloatType", "w0", "=", "self", ".", "w", "h0", "=", "self", ".", "h", "if",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.merge
Flattens the given layers on the canvas. Merges the given layers with the indices in the list on the bottom layer in the list. The other layers are discarded.
lib/photobot/__init__.py
def merge(self, layers): """Flattens the given layers on the canvas. Merges the given layers with the indices in the list on the bottom layer in the list. The other layers are discarded. """ layers.sort() if layers[0] == 0: del ...
def merge(self, layers): """Flattens the given layers on the canvas. Merges the given layers with the indices in the list on the bottom layer in the list. The other layers are discarded. """ layers.sort() if layers[0] == 0: del ...
[ "Flattens", "the", "given", "layers", "on", "the", "canvas", ".", "Merges", "the", "given", "layers", "with", "the", "indices", "in", "the", "list", "on", "the", "bottom", "layer", "in", "the", "list", ".", "The", "other", "layers", "are", "discarded", "...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L146-L158
[ "def", "merge", "(", "self", ",", "layers", ")", ":", "layers", ".", "sort", "(", ")", "if", "layers", "[", "0", "]", "==", "0", ":", "del", "layers", "[", "0", "]", "self", ".", "flatten", "(", "layers", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.flatten
Flattens all layers according to their blend modes. Merges all layers to the canvas, using the blend mode and opacity defined for each layer. Once flattened, the stack of layers is emptied except for the transparent background (bottom layer).
lib/photobot/__init__.py
def flatten(self, layers=[]): """Flattens all layers according to their blend modes. Merges all layers to the canvas, using the blend mode and opacity defined for each layer. Once flattened, the stack of layers is emptied except for the transparent background (bottom la...
def flatten(self, layers=[]): """Flattens all layers according to their blend modes. Merges all layers to the canvas, using the blend mode and opacity defined for each layer. Once flattened, the stack of layers is emptied except for the transparent background (bottom la...
[ "Flattens", "all", "layers", "according", "to", "their", "blend", "modes", ".", "Merges", "all", "layers", "to", "the", "canvas", "using", "the", "blend", "mode", "and", "opacity", "defined", "for", "each", "layer", ".", "Once", "flattened", "the", "stack", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L160-L270
[ "def", "flatten", "(", "self", ",", "layers", "=", "[", "]", ")", ":", "#When the layers argument is omitted,", "#flattens all the layers on the canvas.", "#When given, merges the indexed layers.", "#Layers that fall outside of the canvas are cropped:", "#this should be fixed by mergin...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.export
Exports the flattened canvas. Flattens the canvas. PNG retains the alpha channel information. Other possibilities are JPEG and GIF.
lib/photobot/__init__.py
def export(self, filename): """Exports the flattened canvas. Flattens the canvas. PNG retains the alpha channel information. Other possibilities are JPEG and GIF. """ self.flatten() self.layers[1].img.save(filename) return filename
def export(self, filename): """Exports the flattened canvas. Flattens the canvas. PNG retains the alpha channel information. Other possibilities are JPEG and GIF. """ self.flatten() self.layers[1].img.save(filename) return filename
[ "Exports", "the", "flattened", "canvas", ".", "Flattens", "the", "canvas", ".", "PNG", "retains", "the", "alpha", "channel", "information", ".", "Other", "possibilities", "are", "JPEG", "and", "GIF", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L272-L284
[ "def", "export", "(", "self", ",", "filename", ")", ":", "self", ".", "flatten", "(", ")", "self", ".", "layers", "[", "1", "]", ".", "img", ".", "save", "(", "filename", ")", "return", "filename" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Canvas.draw
Places the flattened canvas in NodeBox. Exports to a temporary PNG file. Draws the PNG in NodeBox using the image() command. Removes the temporary file.
lib/photobot/__init__.py
def draw(self, x, y): """Places the flattened canvas in NodeBox. Exports to a temporary PNG file. Draws the PNG in NodeBox using the image() command. Removes the temporary file. """ try: from time import time imp...
def draw(self, x, y): """Places the flattened canvas in NodeBox. Exports to a temporary PNG file. Draws the PNG in NodeBox using the image() command. Removes the temporary file. """ try: from time import time imp...
[ "Places", "the", "flattened", "canvas", "in", "NodeBox", ".", "Exports", "to", "a", "temporary", "PNG", "file", ".", "Draws", "the", "PNG", "in", "NodeBox", "using", "the", "image", "()", "command", ".", "Removes", "the", "temporary", "file", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L286-L308
[ "def", "draw", "(", "self", ",", "x", ",", "y", ")", ":", "try", ":", "from", "time", "import", "time", "import", "md5", "from", "os", "import", "unlink", "m", "=", "md5", ".", "new", "(", ")", "m", ".", "update", "(", "str", "(", "time", "(", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.index
Returns this layer's index in the canvas.layers[]. Searches the position of this layer in the canvas' layers list, return None when not found.
lib/photobot/__init__.py
def index(self): """Returns this layer's index in the canvas.layers[]. Searches the position of this layer in the canvas' layers list, return None when not found. """ for i in range(len(self.canvas.layers)): if self.canvas.layers[i]...
def index(self): """Returns this layer's index in the canvas.layers[]. Searches the position of this layer in the canvas' layers list, return None when not found. """ for i in range(len(self.canvas.layers)): if self.canvas.layers[i]...
[ "Returns", "this", "layer", "s", "index", "in", "the", "canvas", ".", "layers", "[]", ".", "Searches", "the", "position", "of", "this", "layer", "in", "the", "canvas", "layers", "list", "return", "None", "when", "not", "found", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L377-L391
[ "def", "index", "(", "self", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "canvas", ".", "layers", ")", ")", ":", "if", "self", ".", "canvas", ".", "layers", "[", "i", "]", "==", "self", ":", "break", "if", "self", ".", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.copy
Returns a copy of the layer. This is different from the duplicate() method, which duplicates the layer as a new layer on the canvas. The copy() method returns a copy of the layer that can be added to a different canvas.
lib/photobot/__init__.py
def copy(self): """Returns a copy of the layer. This is different from the duplicate() method, which duplicates the layer as a new layer on the canvas. The copy() method returns a copy of the layer that can be added to a different canvas. """ ...
def copy(self): """Returns a copy of the layer. This is different from the duplicate() method, which duplicates the layer as a new layer on the canvas. The copy() method returns a copy of the layer that can be added to a different canvas. """ ...
[ "Returns", "a", "copy", "of", "the", "layer", ".", "This", "is", "different", "from", "the", "duplicate", "()", "method", "which", "duplicates", "the", "layer", "as", "a", "new", "layer", "on", "the", "canvas", ".", "The", "copy", "()", "method", "return...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L393-L410
[ "def", "copy", "(", "self", ")", ":", "layer", "=", "Layer", "(", "None", ",", "self", ".", "img", ".", "copy", "(", ")", ",", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "name", ")", "layer", ".", "w", "=", "self", ".", "w",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.delete
Removes this layer from the canvas.
lib/photobot/__init__.py
def delete(self): """Removes this layer from the canvas. """ i = self.index() if i != None: del self.canvas.layers[i]
def delete(self): """Removes this layer from the canvas. """ i = self.index() if i != None: del self.canvas.layers[i]
[ "Removes", "this", "layer", "from", "the", "canvas", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L412-L419
[ "def", "delete", "(", "self", ")", ":", "i", "=", "self", ".", "index", "(", ")", "if", "i", "!=", "None", ":", "del", "self", ".", "canvas", ".", "layers", "[", "i", "]" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.up
Moves the layer up in the stacking order.
lib/photobot/__init__.py
def up(self): """Moves the layer up in the stacking order. """ i = self.index() if i != None: del self.canvas.layers[i] i = min(len(self.canvas.layers), i+1) self.canvas.layers.insert(i, self)
def up(self): """Moves the layer up in the stacking order. """ i = self.index() if i != None: del self.canvas.layers[i] i = min(len(self.canvas.layers), i+1) self.canvas.layers.insert(i, self)
[ "Moves", "the", "layer", "up", "in", "the", "stacking", "order", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L421-L431
[ "def", "up", "(", "self", ")", ":", "i", "=", "self", ".", "index", "(", ")", "if", "i", "!=", "None", ":", "del", "self", ".", "canvas", ".", "layers", "[", "i", "]", "i", "=", "min", "(", "len", "(", "self", ".", "canvas", ".", "layers", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.down
Moves the layer down in the stacking order.
lib/photobot/__init__.py
def down(self): """Moves the layer down in the stacking order. """ i = self.index() if i != None: del self.canvas.layers[i] i = max(0, i-1) self.canvas.layers.insert(i, self)
def down(self): """Moves the layer down in the stacking order. """ i = self.index() if i != None: del self.canvas.layers[i] i = max(0, i-1) self.canvas.layers.insert(i, self)
[ "Moves", "the", "layer", "down", "in", "the", "stacking", "order", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L433-L443
[ "def", "down", "(", "self", ")", ":", "i", "=", "self", ".", "index", "(", ")", "if", "i", "!=", "None", ":", "del", "self", ".", "canvas", ".", "layers", "[", "i", "]", "i", "=", "max", "(", "0", ",", "i", "-", "1", ")", "self", ".", "ca...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.select
Applies the polygonal lasso tool on a layer. The path paramater is a list of points, either [x1, y1, x2, y2, x3, y3, ...] or [(x1,y1), (x2,y2), (x3,y3), ...] The parts of the layer that fall outside this polygonal area are cut. The selection is not anti...
lib/photobot/__init__.py
def select(self, path, feather=True): """Applies the polygonal lasso tool on a layer. The path paramater is a list of points, either [x1, y1, x2, y2, x3, y3, ...] or [(x1,y1), (x2,y2), (x3,y3), ...] The parts of the layer that fall outside this polygonal ar...
def select(self, path, feather=True): """Applies the polygonal lasso tool on a layer. The path paramater is a list of points, either [x1, y1, x2, y2, x3, y3, ...] or [(x1,y1), (x2,y2), (x3,y3), ...] The parts of the layer that fall outside this polygonal ar...
[ "Applies", "the", "polygonal", "lasso", "tool", "on", "a", "layer", ".", "The", "path", "paramater", "is", "a", "list", "of", "points", "either", "[", "x1", "y1", "x2", "y2", "x3", "y3", "...", "]", "or", "[", "(", "x1", "y1", ")", "(", "x2", "y2...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L456-L484
[ "def", "select", "(", "self", ",", "path", ",", "feather", "=", "True", ")", ":", "w", ",", "h", "=", "self", ".", "img", ".", "size", "mask", "=", "Image", ".", "new", "(", "\"L\"", ",", "(", "w", ",", "h", ")", ",", "0", ")", "draw", "=",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.mask
Masks the layer below with this layer. Commits the current layer to the alpha channel of the previous layer. Primarily, mask() is useful when using gradient layers as masks on images below. For example: canvas.layer("image.jpg") canvas.gradient() canv...
lib/photobot/__init__.py
def mask(self): """Masks the layer below with this layer. Commits the current layer to the alpha channel of the previous layer. Primarily, mask() is useful when using gradient layers as masks on images below. For example: canvas.layer("image.jpg") ...
def mask(self): """Masks the layer below with this layer. Commits the current layer to the alpha channel of the previous layer. Primarily, mask() is useful when using gradient layers as masks on images below. For example: canvas.layer("image.jpg") ...
[ "Masks", "the", "layer", "below", "with", "this", "layer", ".", "Commits", "the", "current", "layer", "to", "the", "alpha", "channel", "of", "the", "previous", "layer", ".", "Primarily", "mask", "()", "is", "useful", "when", "using", "gradient", "layers", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L486-L524
[ "def", "mask", "(", "self", ")", ":", "if", "len", "(", "self", ".", "canvas", ".", "layers", ")", "<", "2", ":", "return", "i", "=", "self", ".", "index", "(", ")", "if", "i", "==", "0", ":", "return", "layer", "=", "self", ".", "canvas", "....
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.duplicate
Creates a copy of the current layer. This copy becomes the top layer on the canvas.
lib/photobot/__init__.py
def duplicate(self): """Creates a copy of the current layer. This copy becomes the top layer on the canvas. """ i = self.canvas.layer(self.img.copy(), self.x, self.y, self.name) clone = self.canvas.layers[i] clone.alpha = self.alpha clone.blend...
def duplicate(self): """Creates a copy of the current layer. This copy becomes the top layer on the canvas. """ i = self.canvas.layer(self.img.copy(), self.x, self.y, self.name) clone = self.canvas.layers[i] clone.alpha = self.alpha clone.blend...
[ "Creates", "a", "copy", "of", "the", "current", "layer", ".", "This", "copy", "becomes", "the", "top", "layer", "on", "the", "canvas", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L526-L537
[ "def", "duplicate", "(", "self", ")", ":", "i", "=", "self", ".", "canvas", ".", "layer", "(", "self", ".", "img", ".", "copy", "(", ")", ",", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "name", ")", "clone", "=", "self", ".", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.brightness
Increases or decreases the brightness in the layer. The given value is a percentage to increase or decrease the image brightness, for example 0.8 means brightness at 80%.
lib/photobot/__init__.py
def brightness(self, value=1.0): """Increases or decreases the brightness in the layer. The given value is a percentage to increase or decrease the image brightness, for example 0.8 means brightness at 80%. """ b = ImageEnhance.Brightness(self.img) ...
def brightness(self, value=1.0): """Increases or decreases the brightness in the layer. The given value is a percentage to increase or decrease the image brightness, for example 0.8 means brightness at 80%. """ b = ImageEnhance.Brightness(self.img) ...
[ "Increases", "or", "decreases", "the", "brightness", "in", "the", "layer", ".", "The", "given", "value", "is", "a", "percentage", "to", "increase", "or", "decrease", "the", "image", "brightness", "for", "example", "0", ".", "8", "means", "brightness", "at", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L563-L574
[ "def", "brightness", "(", "self", ",", "value", "=", "1.0", ")", ":", "b", "=", "ImageEnhance", ".", "Brightness", "(", "self", ".", "img", ")", "self", ".", "img", "=", "b", ".", "enhance", "(", "value", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.contrast
Increases or decreases the contrast in the layer. The given value is a percentage to increase or decrease the image contrast, for example 1.2 means contrast at 120%.
lib/photobot/__init__.py
def contrast(self, value=1.0): """Increases or decreases the contrast in the layer. The given value is a percentage to increase or decrease the image contrast, for example 1.2 means contrast at 120%. """ c = ImageEnhance.Contrast(self.img) self.im...
def contrast(self, value=1.0): """Increases or decreases the contrast in the layer. The given value is a percentage to increase or decrease the image contrast, for example 1.2 means contrast at 120%. """ c = ImageEnhance.Contrast(self.img) self.im...
[ "Increases", "or", "decreases", "the", "contrast", "in", "the", "layer", ".", "The", "given", "value", "is", "a", "percentage", "to", "increase", "or", "decrease", "the", "image", "contrast", "for", "example", "1", ".", "2", "means", "contrast", "at", "120...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L576-L587
[ "def", "contrast", "(", "self", ",", "value", "=", "1.0", ")", ":", "c", "=", "ImageEnhance", ".", "Contrast", "(", "self", ".", "img", ")", "self", ".", "img", "=", "c", ".", "enhance", "(", "value", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.desaturate
Desaturates the layer, making it grayscale. Instantly removes all color information from the layer, while maintaing its alpha channel.
lib/photobot/__init__.py
def desaturate(self): """Desaturates the layer, making it grayscale. Instantly removes all color information from the layer, while maintaing its alpha channel. """ alpha = self.img.split()[3] self.img = self.img.convert("L") self.img = self.img...
def desaturate(self): """Desaturates the layer, making it grayscale. Instantly removes all color information from the layer, while maintaing its alpha channel. """ alpha = self.img.split()[3] self.img = self.img.convert("L") self.img = self.img...
[ "Desaturates", "the", "layer", "making", "it", "grayscale", ".", "Instantly", "removes", "all", "color", "information", "from", "the", "layer", "while", "maintaing", "its", "alpha", "channel", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L589-L601
[ "def", "desaturate", "(", "self", ")", ":", "alpha", "=", "self", ".", "img", ".", "split", "(", ")", "[", "3", "]", "self", ".", "img", "=", "self", ".", "img", ".", "convert", "(", "\"L\"", ")", "self", ".", "img", "=", "self", ".", "img", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.invert
Inverts the layer.
lib/photobot/__init__.py
def invert(self): """Inverts the layer. """ alpha = self.img.split()[3] self.img = self.img.convert("RGB") self.img = ImageOps.invert(self.img) self.img = self.img.convert("RGBA") self.img.putalpha(alpha)
def invert(self): """Inverts the layer. """ alpha = self.img.split()[3] self.img = self.img.convert("RGB") self.img = ImageOps.invert(self.img) self.img = self.img.convert("RGBA") self.img.putalpha(alpha)
[ "Inverts", "the", "layer", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L603-L613
[ "def", "invert", "(", "self", ")", ":", "alpha", "=", "self", ".", "img", ".", "split", "(", ")", "[", "3", "]", "self", ".", "img", "=", "self", ".", "img", ".", "convert", "(", "\"RGB\"", ")", "self", ".", "img", "=", "ImageOps", ".", "invert...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.translate
Positions the layer at the given coordinates. The x and y parameters define where to position the top left corner of the layer, measured from the top left of the canvas.
lib/photobot/__init__.py
def translate(self, x, y): """Positions the layer at the given coordinates. The x and y parameters define where to position the top left corner of the layer, measured from the top left of the canvas. """ self.x = x self.y = y
def translate(self, x, y): """Positions the layer at the given coordinates. The x and y parameters define where to position the top left corner of the layer, measured from the top left of the canvas. """ self.x = x self.y = y
[ "Positions", "the", "layer", "at", "the", "given", "coordinates", ".", "The", "x", "and", "y", "parameters", "define", "where", "to", "position", "the", "top", "left", "corner", "of", "the", "layer", "measured", "from", "the", "top", "left", "of", "the", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L615-L626
[ "def", "translate", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "x", "=", "x", "self", ".", "y", "=", "y" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.scale
Resizes the layer to the given width and height. When width w or height h is a floating-point number, scales percentual, otherwise scales to the given size in pixels.
lib/photobot/__init__.py
def scale(self, w=1.0, h=1.0): """Resizes the layer to the given width and height. When width w or height h is a floating-point number, scales percentual, otherwise scales to the given size in pixels. """ from types import FloatType w0, h0 = self....
def scale(self, w=1.0, h=1.0): """Resizes the layer to the given width and height. When width w or height h is a floating-point number, scales percentual, otherwise scales to the given size in pixels. """ from types import FloatType w0, h0 = self....
[ "Resizes", "the", "layer", "to", "the", "given", "width", "and", "height", ".", "When", "width", "w", "or", "height", "h", "is", "a", "floating", "-", "point", "number", "scales", "percentual", "otherwise", "scales", "to", "the", "given", "size", "in", "...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L628-L645
[ "def", "scale", "(", "self", ",", "w", "=", "1.0", ",", "h", "=", "1.0", ")", ":", "from", "types", "import", "FloatType", "w0", ",", "h0", "=", "self", ".", "img", ".", "size", "if", "type", "(", "w", ")", "==", "FloatType", ":", "w", "=", "...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.distort
Distorts the layer. Distorts the layer by translating the four corners of its bounding box to the given coordinates: upper left (x1,y1), upper right(x2,y2), lower right (x3,y3) and lower left (x4,y4).
lib/photobot/__init__.py
def distort(self, x1=0,y1=0, x2=0,y2=0, x3=0,y3=0, x4=0,y4=0): """Distorts the layer. Distorts the layer by translating the four corners of its bounding box to the given coordinates: upper left (x1,y1), upper right(x2,y2), lower right (x3,y3) and lower left (x4,y4)...
def distort(self, x1=0,y1=0, x2=0,y2=0, x3=0,y3=0, x4=0,y4=0): """Distorts the layer. Distorts the layer by translating the four corners of its bounding box to the given coordinates: upper left (x1,y1), upper right(x2,y2), lower right (x3,y3) and lower left (x4,y4)...
[ "Distorts", "the", "layer", ".", "Distorts", "the", "layer", "by", "translating", "the", "four", "corners", "of", "its", "bounding", "box", "to", "the", "given", "coordinates", ":", "upper", "left", "(", "x1", "y1", ")", "upper", "right", "(", "x2", "y2"...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L647-L660
[ "def", "distort", "(", "self", ",", "x1", "=", "0", ",", "y1", "=", "0", ",", "x2", "=", "0", ",", "y2", "=", "0", ",", "x3", "=", "0", ",", "y3", "=", "0", ",", "x4", "=", "0", ",", "y4", "=", "0", ")", ":", "w", ",", "h", "=", "se...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.rotate
Rotates the layer. Rotates the layer by given angle. Positive numbers rotate counter-clockwise, negative numbers rotate clockwise. Rotate commands are executed instantly, so many subsequent rotates will distort the image.
lib/photobot/__init__.py
def rotate(self, angle): """Rotates the layer. Rotates the layer by given angle. Positive numbers rotate counter-clockwise, negative numbers rotate clockwise. Rotate commands are executed instantly, so many subsequent rotates will distort the image. ...
def rotate(self, angle): """Rotates the layer. Rotates the layer by given angle. Positive numbers rotate counter-clockwise, negative numbers rotate clockwise. Rotate commands are executed instantly, so many subsequent rotates will distort the image. ...
[ "Rotates", "the", "layer", ".", "Rotates", "the", "layer", "by", "given", "angle", ".", "Positive", "numbers", "rotate", "counter", "-", "clockwise", "negative", "numbers", "rotate", "clockwise", ".", "Rotate", "commands", "are", "executed", "instantly", "so", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L662-L724
[ "def", "rotate", "(", "self", ",", "angle", ")", ":", "#When a layer rotates, its corners will fall outside", "#of its defined width and height.", "#Thus, its bounding box needs to be expanded.", "#Calculate the diagonal width, and angle from the layer center.", "#This way we can use the lay...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.flip
Flips the layer, either HORIZONTAL or VERTICAL.
lib/photobot/__init__.py
def flip(self, axis=HORIZONTAL): """Flips the layer, either HORIZONTAL or VERTICAL. """ if axis == HORIZONTAL: self.img = self.img.transpose(Image.FLIP_LEFT_RIGHT) if axis == VERTICAL: self.img = self.img.transpose(Image.FLIP_TOP_BOTTOM)
def flip(self, axis=HORIZONTAL): """Flips the layer, either HORIZONTAL or VERTICAL. """ if axis == HORIZONTAL: self.img = self.img.transpose(Image.FLIP_LEFT_RIGHT) if axis == VERTICAL: self.img = self.img.transpose(Image.FLIP_TOP_BOTTOM)
[ "Flips", "the", "layer", "either", "HORIZONTAL", "or", "VERTICAL", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L726-L735
[ "def", "flip", "(", "self", ",", "axis", "=", "HORIZONTAL", ")", ":", "if", "axis", "==", "HORIZONTAL", ":", "self", ".", "img", "=", "self", ".", "img", ".", "transpose", "(", "Image", ".", "FLIP_LEFT_RIGHT", ")", "if", "axis", "==", "VERTICAL", ":"...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.sharpen
Increases or decreases the sharpness in the layer. The given value is a percentage to increase or decrease the image sharpness, for example 0.8 means sharpness at 80%.
lib/photobot/__init__.py
def sharpen(self, value=1.0): """Increases or decreases the sharpness in the layer. The given value is a percentage to increase or decrease the image sharpness, for example 0.8 means sharpness at 80%. """ s = ImageEnhance.Sharpness(self.img) self...
def sharpen(self, value=1.0): """Increases or decreases the sharpness in the layer. The given value is a percentage to increase or decrease the image sharpness, for example 0.8 means sharpness at 80%. """ s = ImageEnhance.Sharpness(self.img) self...
[ "Increases", "or", "decreases", "the", "sharpness", "in", "the", "layer", ".", "The", "given", "value", "is", "a", "percentage", "to", "increase", "or", "decrease", "the", "image", "sharpness", "for", "example", "0", ".", "8", "means", "sharpness", "at", "...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L745-L756
[ "def", "sharpen", "(", "self", ",", "value", "=", "1.0", ")", ":", "s", "=", "ImageEnhance", ".", "Sharpness", "(", "self", ".", "img", ")", "self", ".", "img", "=", "s", ".", "enhance", "(", "value", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Layer.levels
Returns a histogram for each RGBA channel. Returns a 4-tuple of lists, r, g, b, and a. Each list has 255 items, a count for each pixel value.
lib/photobot/__init__.py
def levels(self): """Returns a histogram for each RGBA channel. Returns a 4-tuple of lists, r, g, b, and a. Each list has 255 items, a count for each pixel value. """ h = self.img.histogram() r = h[0:255] g = h[256:511] ...
def levels(self): """Returns a histogram for each RGBA channel. Returns a 4-tuple of lists, r, g, b, and a. Each list has 255 items, a count for each pixel value. """ h = self.img.histogram() r = h[0:255] g = h[256:511] ...
[ "Returns", "a", "histogram", "for", "each", "RGBA", "channel", ".", "Returns", "a", "4", "-", "tuple", "of", "lists", "r", "g", "b", "and", "a", ".", "Each", "list", "has", "255", "items", "a", "count", "for", "each", "pixel", "value", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L762-L777
[ "def", "levels", "(", "self", ")", ":", "h", "=", "self", ".", "img", ".", "histogram", "(", ")", "r", "=", "h", "[", "0", ":", "255", "]", "g", "=", "h", "[", "256", ":", "511", "]", "b", "=", "h", "[", "512", ":", "767", "]", "a", "="...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Blend.overlay
Applies the overlay blend mode. Overlays image img2 on image img1. The overlay pixel combines multiply and screen: it multiplies dark pixels values and screen light values. Returns a composite image with the alpha channel retained.
lib/photobot/__init__.py
def overlay(self, img1, img2): """Applies the overlay blend mode. Overlays image img2 on image img1. The overlay pixel combines multiply and screen: it multiplies dark pixels values and screen light values. Returns a composite image with the alpha channel retained. ...
def overlay(self, img1, img2): """Applies the overlay blend mode. Overlays image img2 on image img1. The overlay pixel combines multiply and screen: it multiplies dark pixels values and screen light values. Returns a composite image with the alpha channel retained. ...
[ "Applies", "the", "overlay", "blend", "mode", ".", "Overlays", "image", "img2", "on", "image", "img1", ".", "The", "overlay", "pixel", "combines", "multiply", "and", "screen", ":", "it", "multiplies", "dark", "pixels", "values", "and", "screen", "light", "va...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L793-L832
[ "def", "overlay", "(", "self", ",", "img1", ",", "img2", ")", ":", "p1", "=", "list", "(", "img1", ".", "getdata", "(", ")", ")", "p2", "=", "list", "(", "img2", ".", "getdata", "(", ")", ")", "for", "i", "in", "range", "(", "len", "(", "p1",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Blend.hue
Applies the hue blend mode. Hues image img1 with image img2. The hue filter replaces the hues of pixels in img1 with the hues of pixels in img2. Returns a composite image with the alpha channel retained.
lib/photobot/__init__.py
def hue(self, img1, img2): """Applies the hue blend mode. Hues image img1 with image img2. The hue filter replaces the hues of pixels in img1 with the hues of pixels in img2. Returns a composite image with the alpha channel retained. """ import col...
def hue(self, img1, img2): """Applies the hue blend mode. Hues image img1 with image img2. The hue filter replaces the hues of pixels in img1 with the hues of pixels in img2. Returns a composite image with the alpha channel retained. """ import col...
[ "Applies", "the", "hue", "blend", "mode", ".", "Hues", "image", "img1", "with", "image", "img2", ".", "The", "hue", "filter", "replaces", "the", "hues", "of", "pixels", "in", "img1", "with", "the", "hues", "of", "pixels", "in", "img2", ".", "Returns", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L834-L873
[ "def", "hue", "(", "self", ",", "img1", ",", "img2", ")", ":", "import", "colorsys", "p1", "=", "list", "(", "img1", ".", "getdata", "(", ")", ")", "p2", "=", "list", "(", "img2", ".", "getdata", "(", ")", ")", "for", "i", "in", "range", "(", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Pixels.convolute
A (3,3) or (5,5) convolution kernel. The kernel argument is a list with either 9 or 25 elements, the weight for each surrounding pixels to convolute.
lib/photobot/__init__.py
def convolute(self, kernel, scale=None, offset=0): """A (3,3) or (5,5) convolution kernel. The kernel argument is a list with either 9 or 25 elements, the weight for each surrounding pixels to convolute. """ if len(kernel) == 9: size = (3,3)...
def convolute(self, kernel, scale=None, offset=0): """A (3,3) or (5,5) convolution kernel. The kernel argument is a list with either 9 or 25 elements, the weight for each surrounding pixels to convolute. """ if len(kernel) == 9: size = (3,3)...
[ "A", "(", "3", "3", ")", "or", "(", "5", "5", ")", "convolution", "kernel", ".", "The", "kernel", "argument", "is", "a", "list", "with", "either", "9", "or", "25", "elements", "the", "weight", "for", "each", "surrounding", "pixels", "to", "convolute", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/photobot/__init__.py#L969-L989
[ "def", "convolute", "(", "self", ",", "kernel", ",", "scale", "=", "None", ",", "offset", "=", "0", ")", ":", "if", "len", "(", "kernel", ")", "==", "9", ":", "size", "=", "(", "3", ",", "3", ")", "elif", "len", "(", "kernel", ")", "==", "25"...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grammar._load_namespace
Initialise bot namespace with info in shoebot.data :param filename: Will be set to __file__ in the namespace
shoebot/grammar/grammar.py
def _load_namespace(self, namespace, filename=None): """ Initialise bot namespace with info in shoebot.data :param filename: Will be set to __file__ in the namespace """ from shoebot import data for name in dir(data): namespace[name] = getattr(data, name) ...
def _load_namespace(self, namespace, filename=None): """ Initialise bot namespace with info in shoebot.data :param filename: Will be set to __file__ in the namespace """ from shoebot import data for name in dir(data): namespace[name] = getattr(data, name) ...
[ "Initialise", "bot", "namespace", "with", "info", "in", "shoebot", ".", "data" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L47-L62
[ "def", "_load_namespace", "(", "self", ",", "namespace", ",", "filename", "=", "None", ")", ":", "from", "shoebot", "import", "data", "for", "name", "in", "dir", "(", "data", ")", ":", "namespace", "[", "name", "]", "=", "getattr", "(", "data", ",", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grammar._should_run
Return False if bot should quit
shoebot/grammar/grammar.py
def _should_run(self, iteration, max_iterations): ''' Return False if bot should quit ''' if iteration == 0: # First frame always runs return True if max_iterations: if iteration < max_iterations: return True elif max_iterations is None...
def _should_run(self, iteration, max_iterations): ''' Return False if bot should quit ''' if iteration == 0: # First frame always runs return True if max_iterations: if iteration < max_iterations: return True elif max_iterations is None...
[ "Return", "False", "if", "bot", "should", "quit" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L66-L83
[ "def", "_should_run", "(", "self", ",", "iteration", ",", "max_iterations", ")", ":", "if", "iteration", "==", "0", ":", "# First frame always runs", "return", "True", "if", "max_iterations", ":", "if", "iteration", "<", "max_iterations", ":", "return", "True", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grammar._frame_limit
Limit to framerate, should be called after rendering has completed :param start_time: When execution started
shoebot/grammar/grammar.py
def _frame_limit(self, start_time): """ Limit to framerate, should be called after rendering has completed :param start_time: When execution started """ if self._speed: completion_time = time() exc_time = completion_time - start_time s...
def _frame_limit(self, start_time): """ Limit to framerate, should be called after rendering has completed :param start_time: When execution started """ if self._speed: completion_time = time() exc_time = completion_time - start_time s...
[ "Limit", "to", "framerate", "should", "be", "called", "after", "rendering", "has", "completed" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L85-L97
[ "def", "_frame_limit", "(", "self", ",", "start_time", ")", ":", "if", "self", ".", "_speed", ":", "completion_time", "=", "time", "(", ")", "exc_time", "=", "completion_time", "-", "start_time", "sleep_for", "=", "(", "1.0", "/", "abs", "(", "self", "."...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grammar._run_frame
Run single frame of the bot :param source_or_code: path to code to run, or actual code. :param limit: Time a frame should take to run (float - seconds)
shoebot/grammar/grammar.py
def _run_frame(self, executor, limit=False, iteration=0): """ Run single frame of the bot :param source_or_code: path to code to run, or actual code. :param limit: Time a frame should take to run (float - seconds) """ # # Gets a bit complex here... # # No...
def _run_frame(self, executor, limit=False, iteration=0): """ Run single frame of the bot :param source_or_code: path to code to run, or actual code. :param limit: Time a frame should take to run (float - seconds) """ # # Gets a bit complex here... # # No...
[ "Run", "single", "frame", "of", "the", "bot" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L101-L200
[ "def", "_run_frame", "(", "self", ",", "executor", ",", "limit", "=", "False", ",", "iteration", "=", "0", ")", ":", "#", "# Gets a bit complex here...", "#", "# Nodebox (which we are trying to be compatible with) supports two", "# kinds of bot 'dynamic' which has a 'draw' fu...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grammar.run
Executes the contents of a Nodebox/Shoebot script in current surface's context. :param inputcode: Path to shoebot source or string containing source :param iterations: None or Maximum amount of frames to run :param run_forever: If True then run until user quits the bot :param fr...
shoebot/grammar/grammar.py
def run(self, inputcode, iterations=None, run_forever=False, frame_limiter=False, verbose=False, break_on_error=False): ''' Executes the contents of a Nodebox/Shoebot script in current surface's context. :param inputcode: Path to shoebot source or string containing source ...
def run(self, inputcode, iterations=None, run_forever=False, frame_limiter=False, verbose=False, break_on_error=False): ''' Executes the contents of a Nodebox/Shoebot script in current surface's context. :param inputcode: Path to shoebot source or string containing source ...
[ "Executes", "the", "contents", "of", "a", "Nodebox", "/", "Shoebot", "script", "in", "current", "surface", "s", "context", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L202-L292
[ "def", "run", "(", "self", ",", "inputcode", ",", "iterations", "=", "None", ",", "run_forever", "=", "False", ",", "frame_limiter", "=", "False", ",", "verbose", "=", "False", ",", "break_on_error", "=", "False", ")", ":", "source", "=", "None", "filena...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grammar._addvar
Sets a new accessible variable. :param v: Variable.
shoebot/grammar/grammar.py
def _addvar(self, v): ''' Sets a new accessible variable. :param v: Variable. ''' oldvar = self._oldvars.get(v.name) if oldvar is not None: if isinstance(oldvar, Variable): if oldvar.compliesTo(v): v.value = oldvar.value ...
def _addvar(self, v): ''' Sets a new accessible variable. :param v: Variable. ''' oldvar = self._oldvars.get(v.name) if oldvar is not None: if isinstance(oldvar, Variable): if oldvar.compliesTo(v): v.value = oldvar.value ...
[ "Sets", "a", "new", "accessible", "variable", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/grammar.py#L301-L320
[ "def", "_addvar", "(", "self", ",", "v", ")", ":", "oldvar", "=", "self", ".", "_oldvars", ".", "get", "(", "v", ".", "name", ")", "if", "oldvar", "is", "not", "None", ":", "if", "isinstance", "(", "oldvar", ",", "Variable", ")", ":", "if", "oldv...
d554c1765c1899fa25727c9fc6805d221585562b
valid
parse_color
Receives a colour definition and returns a (r,g,b,a) tuple. Accepts: - v - (v) - (v,a) - (r,g,b) - (r,g,b,a) - #RRGGBB - RRGGBB - #RRGGBBAA - RRGGBBAA Returns a (red, green, blue, alpha) tuple, with values ranging from 0 to 1. The 'color_range' parameter sets the c...
shoebot/data/basecolor.py
def parse_color(v, color_range=1): '''Receives a colour definition and returns a (r,g,b,a) tuple. Accepts: - v - (v) - (v,a) - (r,g,b) - (r,g,b,a) - #RRGGBB - RRGGBB - #RRGGBBAA - RRGGBBAA Returns a (red, green, blue, alpha) tuple, with values ranging from 0 to 1. ...
def parse_color(v, color_range=1): '''Receives a colour definition and returns a (r,g,b,a) tuple. Accepts: - v - (v) - (v,a) - (r,g,b) - (r,g,b,a) - #RRGGBB - RRGGBB - #RRGGBBAA - RRGGBBAA Returns a (red, green, blue, alpha) tuple, with values ranging from 0 to 1. ...
[ "Receives", "a", "colour", "definition", "and", "returns", "a", "(", "r", "g", "b", "a", ")", "tuple", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/basecolor.py#L306-L376
[ "def", "parse_color", "(", "v", ",", "color_range", "=", "1", ")", ":", "# unpack one-element tuples, they show up sometimes", "while", "isinstance", "(", "v", ",", "(", "tuple", ",", "list", ")", ")", "and", "len", "(", "v", ")", "==", "1", ":", "v", "=...
d554c1765c1899fa25727c9fc6805d221585562b
valid
hex_to_rgb
Returns RGB values for a hex color string.
shoebot/data/basecolor.py
def hex_to_rgb(hex): """ Returns RGB values for a hex color string. """ hex = hex.lstrip("#") if len(hex) < 6: hex += hex[-1] * (6 - len(hex)) if len(hex) == 6: r, g, b = hex[0:2], hex[2:4], hex[4:] r, g, b = [int(n, 16) / 255.0 for n in (r, g, b)] a = 1.0 elif le...
def hex_to_rgb(hex): """ Returns RGB values for a hex color string. """ hex = hex.lstrip("#") if len(hex) < 6: hex += hex[-1] * (6 - len(hex)) if len(hex) == 6: r, g, b = hex[0:2], hex[2:4], hex[4:] r, g, b = [int(n, 16) / 255.0 for n in (r, g, b)] a = 1.0 elif le...
[ "Returns", "RGB", "values", "for", "a", "hex", "color", "string", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/basecolor.py#L381-L394
[ "def", "hex_to_rgb", "(", "hex", ")", ":", "hex", "=", "hex", ".", "lstrip", "(", "\"#\"", ")", "if", "len", "(", "hex", ")", "<", "6", ":", "hex", "+=", "hex", "[", "-", "1", "]", "*", "(", "6", "-", "len", "(", "hex", ")", ")", "if", "l...
d554c1765c1899fa25727c9fc6805d221585562b
valid
cmyk_to_rgb
Cyan, magenta, yellow, black to red, green, blue. ReportLab, http://www.koders.com/python/fid5C006F554616848C01AC7CB96C21426B69D2E5A9.aspx Results will differ from the way NSColor converts color spaces.
shoebot/data/basecolor.py
def cmyk_to_rgb(c, m, y, k): """ Cyan, magenta, yellow, black to red, green, blue. ReportLab, http://www.koders.com/python/fid5C006F554616848C01AC7CB96C21426B69D2E5A9.aspx Results will differ from the way NSColor converts color spaces. """ r = 1.0 - min(1.0, c + k) g = 1.0 - min(1.0, m + k) ...
def cmyk_to_rgb(c, m, y, k): """ Cyan, magenta, yellow, black to red, green, blue. ReportLab, http://www.koders.com/python/fid5C006F554616848C01AC7CB96C21426B69D2E5A9.aspx Results will differ from the way NSColor converts color spaces. """ r = 1.0 - min(1.0, c + k) g = 1.0 - min(1.0, m + k) ...
[ "Cyan", "magenta", "yellow", "black", "to", "red", "green", "blue", ".", "ReportLab", "http", ":", "//", "www", ".", "koders", ".", "com", "/", "python", "/", "fid5C006F554616848C01AC7CB96C21426B69D2E5A9", ".", "aspx", "Results", "will", "differ", "from", "the...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/basecolor.py#L444-L454
[ "def", "cmyk_to_rgb", "(", "c", ",", "m", ",", "y", ",", "k", ")", ":", "r", "=", "1.0", "-", "min", "(", "1.0", ",", "c", "+", "k", ")", "g", "=", "1.0", "-", "min", "(", "1.0", ",", "m", "+", "k", ")", "b", "=", "1.0", "-", "min", "...
d554c1765c1899fa25727c9fc6805d221585562b
valid
hsv_to_rgb
Hue, saturation, brightness to red, green, blue. http://www.koders.com/python/fidB2FE963F658FE74D9BF74EB93EFD44DCAE45E10E.aspx Results will differ from the way NSColor converts color spaces.
shoebot/data/basecolor.py
def hsv_to_rgb(h, s, v): """ Hue, saturation, brightness to red, green, blue. http://www.koders.com/python/fidB2FE963F658FE74D9BF74EB93EFD44DCAE45E10E.aspx Results will differ from the way NSColor converts color spaces. """ if s == 0: return v, v, v h = h / (60.0 / 360) i = floor(h) f ...
def hsv_to_rgb(h, s, v): """ Hue, saturation, brightness to red, green, blue. http://www.koders.com/python/fidB2FE963F658FE74D9BF74EB93EFD44DCAE45E10E.aspx Results will differ from the way NSColor converts color spaces. """ if s == 0: return v, v, v h = h / (60.0 / 360) i = floor(h) f ...
[ "Hue", "saturation", "brightness", "to", "red", "green", "blue", ".", "http", ":", "//", "www", ".", "koders", ".", "com", "/", "python", "/", "fidB2FE963F658FE74D9BF74EB93EFD44DCAE45E10E", ".", "aspx", "Results", "will", "differ", "from", "the", "way", "NSCol...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/basecolor.py#L476-L504
[ "def", "hsv_to_rgb", "(", "h", ",", "s", ",", "v", ")", ":", "if", "s", "==", "0", ":", "return", "v", ",", "v", ",", "v", "h", "=", "h", "/", "(", "60.0", "/", "360", ")", "i", "=", "floor", "(", "h", ")", "f", "=", "h", "-", "i", "p...
d554c1765c1899fa25727c9fc6805d221585562b
valid
simple_traceback
Format traceback, showing line number and surrounding source.
shoebot/grammar/format_traceback.py
def simple_traceback(ex, source): """ Format traceback, showing line number and surrounding source. """ exc_type, exc_value, exc_tb = sys.exc_info() exc = traceback.format_exception(exc_type, exc_value, exc_tb) source_arr = source.splitlines() # Defaults... exc_location = exc[-2] f...
def simple_traceback(ex, source): """ Format traceback, showing line number and surrounding source. """ exc_type, exc_value, exc_tb = sys.exc_info() exc = traceback.format_exception(exc_type, exc_value, exc_tb) source_arr = source.splitlines() # Defaults... exc_location = exc[-2] f...
[ "Format", "traceback", "showing", "line", "number", "and", "surrounding", "source", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/format_traceback.py#L6-L47
[ "def", "simple_traceback", "(", "ex", ",", "source", ")", ":", "exc_type", ",", "exc_value", ",", "exc_tb", "=", "sys", ".", "exc_info", "(", ")", "exc", "=", "traceback", ".", "format_exception", "(", "exc_type", ",", "exc_value", ",", "exc_tb", ")", "s...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Database.connect
Generic database. Opens the SQLite database with the given name. The .db extension is automatically appended to the name. For each table in the database an attribute is created, and assigned a Table object. You can do: database.table or database[table].
lib/database/__init__.py
def connect(self, name): """Generic database. Opens the SQLite database with the given name. The .db extension is automatically appended to the name. For each table in the database an attribute is created, and assigned a Table object. You can do...
def connect(self, name): """Generic database. Opens the SQLite database with the given name. The .db extension is automatically appended to the name. For each table in the database an attribute is created, and assigned a Table object. You can do...
[ "Generic", "database", ".", "Opens", "the", "SQLite", "database", "with", "the", "given", "name", ".", "The", ".", "db", "extension", "is", "automatically", "appended", "to", "the", "name", ".", "For", "each", "table", "in", "the", "database", "an", "attri...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L31-L63
[ "def", "connect", "(", "self", ",", "name", ")", ":", "self", ".", "_name", "=", "name", ".", "rstrip", "(", "\".db\"", ")", "self", ".", "_con", "=", "sqlite", ".", "connect", "(", "self", ".", "_name", "+", "\".db\"", ")", "self", ".", "_cur", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Database.create
Creates an SQLite database file. Creates an SQLite database with the given name. The .box file extension is added automatically. Overwrites any existing database by default.
lib/database/__init__.py
def create(self, name, overwrite=True): """Creates an SQLite database file. Creates an SQLite database with the given name. The .box file extension is added automatically. Overwrites any existing database by default. """ self._name = na...
def create(self, name, overwrite=True): """Creates an SQLite database file. Creates an SQLite database with the given name. The .box file extension is added automatically. Overwrites any existing database by default. """ self._name = na...
[ "Creates", "an", "SQLite", "database", "file", ".", "Creates", "an", "SQLite", "database", "with", "the", "given", "name", ".", "The", ".", "box", "file", "extension", "is", "added", "automatically", ".", "Overwrites", "any", "existing", "database", "by", "d...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L65-L81
[ "def", "create", "(", "self", ",", "name", ",", "overwrite", "=", "True", ")", ":", "self", ".", "_name", "=", "name", ".", "rstrip", "(", "\".db\"", ")", "from", "os", "import", "unlink", "if", "overwrite", ":", "try", ":", "unlink", "(", "self", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Database.create_table
Creates a new table. Creates a table with the given name, containing the list of given fields. Since SQLite uses manifest typing, no data type need be supplied. The primary key is "id" by default, an integer that can be set or otherwise autoincrements.
lib/database/__init__.py
def create_table(self, name, fields=[], key="id"): """Creates a new table. Creates a table with the given name, containing the list of given fields. Since SQLite uses manifest typing, no data type need be supplied. The primary key is "id" by default, an ...
def create_table(self, name, fields=[], key="id"): """Creates a new table. Creates a table with the given name, containing the list of given fields. Since SQLite uses manifest typing, no data type need be supplied. The primary key is "id" by default, an ...
[ "Creates", "a", "new", "table", ".", "Creates", "a", "table", "with", "the", "given", "name", "containing", "the", "list", "of", "given", "fields", ".", "Since", "SQLite", "uses", "manifest", "typing", "no", "data", "type", "need", "be", "supplied", ".", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L94-L115
[ "def", "create_table", "(", "self", ",", "name", ",", "fields", "=", "[", "]", ",", "key", "=", "\"id\"", ")", ":", "for", "f", "in", "fields", ":", "if", "f", "==", "key", ":", "fields", ".", "remove", "(", "key", ")", "sql", "=", "\"create tabl...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Database.create_index
Creates a table index. Creates an index on the given table, on the given field with unique values enforced or not, in ascending or descending order.
lib/database/__init__.py
def create_index(self, table, field, unique=False, ascending=True): """Creates a table index. Creates an index on the given table, on the given field with unique values enforced or not, in ascending or descending order. """ if unique: u...
def create_index(self, table, field, unique=False, ascending=True): """Creates a table index. Creates an index on the given table, on the given field with unique values enforced or not, in ascending or descending order. """ if unique: u...
[ "Creates", "a", "table", "index", ".", "Creates", "an", "index", "on", "the", "given", "table", "on", "the", "given", "field", "with", "unique", "values", "enforced", "or", "not", "in", "ascending", "or", "descending", "order", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L120-L137
[ "def", "create_index", "(", "self", ",", "table", ",", "field", ",", "unique", "=", "False", ",", "ascending", "=", "True", ")", ":", "if", "unique", ":", "u", "=", "\"unique \"", "else", ":", "u", "=", "\"\"", "if", "ascending", ":", "a", "=", "\"...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Database.close
Commits any pending transactions and closes the database.
lib/database/__init__.py
def close(self): """Commits any pending transactions and closes the database. """ self._con.commit() self._cur.close() self._con.close()
def close(self): """Commits any pending transactions and closes the database. """ self._con.commit() self._cur.close() self._con.close()
[ "Commits", "any", "pending", "transactions", "and", "closes", "the", "database", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L157-L164
[ "def", "close", "(", "self", ")", ":", "self", ".", "_con", ".", "commit", "(", ")", "self", ".", "_cur", ".", "close", "(", ")", "self", ".", "_con", ".", "close", "(", ")" ]
d554c1765c1899fa25727c9fc6805d221585562b
valid
Database.sql
Executes a raw SQL statement on the database.
lib/database/__init__.py
def sql(self, sql): """ Executes a raw SQL statement on the database. """ self._cur.execute(sql) if sql.lower().find("select") >= 0: matches = [] for r in self._cur: matches.append(r) return matches
def sql(self, sql): """ Executes a raw SQL statement on the database. """ self._cur.execute(sql) if sql.lower().find("select") >= 0: matches = [] for r in self._cur: matches.append(r) return matches
[ "Executes", "a", "raw", "SQL", "statement", "on", "the", "database", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L166-L175
[ "def", "sql", "(", "self", ",", "sql", ")", ":", "self", ".", "_cur", ".", "execute", "(", "sql", ")", "if", "sql", ".", "lower", "(", ")", ".", "find", "(", "\"select\"", ")", ">=", "0", ":", "matches", "=", "[", "]", "for", "r", "in", "self...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Table.find
A simple SQL SELECT query. Retrieves all rows from the table where the given query value is found in the given column (primary key if None). A different comparison operator (e.g. >, <, like) can be set. The wildcard character is * and automatically sets the operator to "like". ...
lib/database/__init__.py
def find(self, q, operator="=", fields="*", key=None): """A simple SQL SELECT query. Retrieves all rows from the table where the given query value is found in the given column (primary key if None). A different comparison operator (e.g. >, <, like) can be set. ...
def find(self, q, operator="=", fields="*", key=None): """A simple SQL SELECT query. Retrieves all rows from the table where the given query value is found in the given column (primary key if None). A different comparison operator (e.g. >, <, like) can be set. ...
[ "A", "simple", "SQL", "SELECT", "query", ".", "Retrieves", "all", "rows", "from", "the", "table", "where", "the", "given", "query", "value", "is", "found", "in", "the", "given", "column", "(", "primary", "key", "if", "None", ")", ".", "A", "different", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L259-L293
[ "def", "find", "(", "self", ",", "q", ",", "operator", "=", "\"=\"", ",", "fields", "=", "\"*\"", ",", "key", "=", "None", ")", ":", "if", "key", "==", "None", ":", "key", "=", "self", ".", "_key", "if", "fields", "!=", "\"*\"", ":", "fields", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Table.append
Adds a new row to a table. Adds a row to the given table. The column names and their corresponding values must either be supplied as a dictionary of {fields:values}, or a series of keyword arguments of field=value style.
lib/database/__init__.py
def append(self, *args, **kw): """Adds a new row to a table. Adds a row to the given table. The column names and their corresponding values must either be supplied as a dictionary of {fields:values}, or a series of keyword arguments of field=value style. ...
def append(self, *args, **kw): """Adds a new row to a table. Adds a row to the given table. The column names and their corresponding values must either be supplied as a dictionary of {fields:values}, or a series of keyword arguments of field=value style. ...
[ "Adds", "a", "new", "row", "to", "a", "table", ".", "Adds", "a", "row", "to", "the", "given", "table", ".", "The", "column", "names", "and", "their", "corresponding", "values", "must", "either", "be", "supplied", "as", "a", "dictionary", "of", "{", "fi...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L313-L340
[ "def", "append", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "args", "and", "kw", ":", "return", "if", "args", "and", "type", "(", "args", "[", "0", "]", ")", "==", "dict", ":", "fields", "=", "[", "k", "for", "k", "...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Table.edit
Edits the row with given id.
lib/database/__init__.py
def edit(self, id, *args, **kw): """ Edits the row with given id. """ if args and kw: return if args and type(args[0]) == dict: fields = [k for k in args[0]] v = [args[0][k] for k in args[0]] if kw: fields = [k fo...
def edit(self, id, *args, **kw): """ Edits the row with given id. """ if args and kw: return if args and type(args[0]) == dict: fields = [k for k in args[0]] v = [args[0][k] for k in args[0]] if kw: fields = [k fo...
[ "Edits", "the", "row", "with", "given", "id", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L342-L361
[ "def", "edit", "(", "self", ",", "id", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "args", "and", "kw", ":", "return", "if", "args", "and", "type", "(", "args", "[", "0", "]", ")", "==", "dict", ":", "fields", "=", "[", "k", "for...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Table.remove
Deletes the row with given id.
lib/database/__init__.py
def remove(self, id, operator="=", key=None): """ Deletes the row with given id. """ if key == None: key = self._key try: id = unicode(id) except: pass sql = "delete from "+self._name+" where "+key+" "+operator+" ?" self._db._cur.execute(sql, (id,))
def remove(self, id, operator="=", key=None): """ Deletes the row with given id. """ if key == None: key = self._key try: id = unicode(id) except: pass sql = "delete from "+self._name+" where "+key+" "+operator+" ?" self._db._cur.execute(sql, (id,))
[ "Deletes", "the", "row", "with", "given", "id", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L363-L372
[ "def", "remove", "(", "self", ",", "id", ",", "operator", "=", "\"=\"", ",", "key", "=", "None", ")", ":", "if", "key", "==", "None", ":", "key", "=", "self", ".", "_key", "try", ":", "id", "=", "unicode", "(", "id", ")", "except", ":", "pass",...
d554c1765c1899fa25727c9fc6805d221585562b
valid
next_event
Get the next available event or None :param block: :param timeout: :return: None or (event, data)
shoebot/core/events.py
def next_event(block=False, timeout=None): """ Get the next available event or None :param block: :param timeout: :return: None or (event, data) """ try: return channel.listen(block=block, timeout=timeout).next()['data'] except StopIteration: return None
def next_event(block=False, timeout=None): """ Get the next available event or None :param block: :param timeout: :return: None or (event, data) """ try: return channel.listen(block=block, timeout=timeout).next()['data'] except StopIteration: return None
[ "Get", "the", "next", "available", "event", "or", "None" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/events.py#L33-L44
[ "def", "next_event", "(", "block", "=", "False", ",", "timeout", "=", "None", ")", ":", "try", ":", "return", "channel", ".", "listen", "(", "block", "=", "block", ",", "timeout", "=", "timeout", ")", ".", "next", "(", ")", "[", "'data'", "]", "exc...
d554c1765c1899fa25727c9fc6805d221585562b
valid
publish_event
Publish an event ot any subscribers. :param event_t: event type :param data: event data :param extra_channels: :param wait: :return:
shoebot/core/events.py
def publish_event(event_t, data=None, extra_channels=None, wait=None): """ Publish an event ot any subscribers. :param event_t: event type :param data: event data :param extra_channels: :param wait: :return: """ event = Event(event_t, data) pubsub.publish("shoebot", event) ...
def publish_event(event_t, data=None, extra_channels=None, wait=None): """ Publish an event ot any subscribers. :param event_t: event type :param data: event data :param extra_channels: :param wait: :return: """ event = Event(event_t, data) pubsub.publish("shoebot", event) ...
[ "Publish", "an", "event", "ot", "any", "subscribers", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/events.py#L57-L73
[ "def", "publish_event", "(", "event_t", ",", "data", "=", "None", ",", "extra_channels", "=", "None", ",", "wait", "=", "None", ")", ":", "event", "=", "Event", "(", "event_t", ",", "data", ")", "pubsub", ".", "publish", "(", "\"shoebot\"", ",", "event...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grob._set_mode
Sets call_transform_mode to point to the center_transform or corner_transform
shoebot/data/grob.py
def _set_mode(self, mode): ''' Sets call_transform_mode to point to the center_transform or corner_transform ''' if mode == CENTER: self._call_transform_mode = self._center_transform elif mode == CORNER: self._call_transform_mode = self._corner_tra...
def _set_mode(self, mode): ''' Sets call_transform_mode to point to the center_transform or corner_transform ''' if mode == CENTER: self._call_transform_mode = self._center_transform elif mode == CORNER: self._call_transform_mode = self._corner_tra...
[ "Sets", "call_transform_mode", "to", "point", "to", "the", "center_transform", "or", "corner_transform" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/grob.py#L28-L38
[ "def", "_set_mode", "(", "self", ",", "mode", ")", ":", "if", "mode", "==", "CENTER", ":", "self", ".", "_call_transform_mode", "=", "self", ".", "_center_transform", "elif", "mode", "==", "CORNER", ":", "self", ".", "_call_transform_mode", "=", "self", "....
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grob._center_transform
Works like setupTransform of a version of java nodebox http://dev.nodebox.net/browser/nodebox-java/branches/rewrite/src/java/net/nodebox/graphics/Grob.java
shoebot/data/grob.py
def _center_transform(self, transform): '''' Works like setupTransform of a version of java nodebox http://dev.nodebox.net/browser/nodebox-java/branches/rewrite/src/java/net/nodebox/graphics/Grob.java ''' dx, dy = self._get_center() t = cairo.Matrix() t.translate(...
def _center_transform(self, transform): '''' Works like setupTransform of a version of java nodebox http://dev.nodebox.net/browser/nodebox-java/branches/rewrite/src/java/net/nodebox/graphics/Grob.java ''' dx, dy = self._get_center() t = cairo.Matrix() t.translate(...
[ "Works", "like", "setupTransform", "of", "a", "version", "of", "java", "nodebox", "http", ":", "//", "dev", ".", "nodebox", ".", "net", "/", "browser", "/", "nodebox", "-", "java", "/", "branches", "/", "rewrite", "/", "src", "/", "java", "/", "net", ...
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/grob.py#L60-L70
[ "def", "_center_transform", "(", "self", ",", "transform", ")", ":", "dx", ",", "dy", "=", "self", ".", "_get_center", "(", ")", "t", "=", "cairo", ".", "Matrix", "(", ")", "t", ".", "translate", "(", "dx", ",", "dy", ")", "t", "=", "transform", ...
d554c1765c1899fa25727c9fc6805d221585562b
valid
Grob.inheritFromContext
Doesn't store exactly the same items as Nodebox for ease of implementation, it has enough to get the Nodebox Dentrite example working.
shoebot/data/grob.py
def inheritFromContext(self, ignore=()): """ Doesn't store exactly the same items as Nodebox for ease of implementation, it has enough to get the Nodebox Dentrite example working. """ for canvas_attr, grob_attr in STATES.items(): if canvas_attr in ignore: ...
def inheritFromContext(self, ignore=()): """ Doesn't store exactly the same items as Nodebox for ease of implementation, it has enough to get the Nodebox Dentrite example working. """ for canvas_attr, grob_attr in STATES.items(): if canvas_attr in ignore: ...
[ "Doesn", "t", "store", "exactly", "the", "same", "items", "as", "Nodebox", "for", "ease", "of", "implementation", "it", "has", "enough", "to", "get", "the", "Nodebox", "Dentrite", "example", "working", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/data/grob.py#L89-L97
[ "def", "inheritFromContext", "(", "self", ",", "ignore", "=", "(", ")", ")", ":", "for", "canvas_attr", ",", "grob_attr", "in", "STATES", ".", "items", "(", ")", ":", "if", "canvas_attr", "in", "ignore", ":", "continue", "setattr", "(", "self", ",", "g...
d554c1765c1899fa25727c9fc6805d221585562b
valid
LiveExecution.load_edited_source
Load changed code into the execution environment. Until the code is executed correctly, it will be in the 'tenuous' state.
shoebot/grammar/livecode.py
def load_edited_source(self, source, good_cb=None, bad_cb=None, filename=None): """ Load changed code into the execution environment. Until the code is executed correctly, it will be in the 'tenuous' state. """ with LiveExecution.lock: self.good_cb = good_cb ...
def load_edited_source(self, source, good_cb=None, bad_cb=None, filename=None): """ Load changed code into the execution environment. Until the code is executed correctly, it will be in the 'tenuous' state. """ with LiveExecution.lock: self.good_cb = good_cb ...
[ "Load", "changed", "code", "into", "the", "execution", "environment", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L43-L64
[ "def", "load_edited_source", "(", "self", ",", "source", ",", "good_cb", "=", "None", ",", "bad_cb", "=", "None", ",", "filename", "=", "None", ")", ":", "with", "LiveExecution", ".", "lock", ":", "self", ".", "good_cb", "=", "good_cb", "self", ".", "b...
d554c1765c1899fa25727c9fc6805d221585562b
valid
LiveExecution.reload_functions
Replace functions in namespace with functions from edited_source.
shoebot/grammar/livecode.py
def reload_functions(self): """ Replace functions in namespace with functions from edited_source. """ with LiveExecution.lock: if self.edited_source: tree = ast.parse(self.edited_source) for f in [n for n in ast.walk(tree) if isinstance(n, ast....
def reload_functions(self): """ Replace functions in namespace with functions from edited_source. """ with LiveExecution.lock: if self.edited_source: tree = ast.parse(self.edited_source) for f in [n for n in ast.walk(tree) if isinstance(n, ast....
[ "Replace", "functions", "in", "namespace", "with", "functions", "from", "edited_source", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L66-L74
[ "def", "reload_functions", "(", "self", ")", ":", "with", "LiveExecution", ".", "lock", ":", "if", "self", ".", "edited_source", ":", "tree", "=", "ast", ".", "parse", "(", "self", ".", "edited_source", ")", "for", "f", "in", "[", "n", "for", "n", "i...
d554c1765c1899fa25727c9fc6805d221585562b
valid
LiveExecution.run_tenuous
Run edited source, if no exceptions occur then it graduates to known good.
shoebot/grammar/livecode.py
def run_tenuous(self): """ Run edited source, if no exceptions occur then it graduates to known good. """ with LiveExecution.lock: ns_snapshot = copy.copy(self.ns) try: source = self.edited_source self.edited_source = None ...
def run_tenuous(self): """ Run edited source, if no exceptions occur then it graduates to known good. """ with LiveExecution.lock: ns_snapshot = copy.copy(self.ns) try: source = self.edited_source self.edited_source = None ...
[ "Run", "edited", "source", "if", "no", "exceptions", "occur", "then", "it", "graduates", "to", "known", "good", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L84-L103
[ "def", "run_tenuous", "(", "self", ")", ":", "with", "LiveExecution", ".", "lock", ":", "ns_snapshot", "=", "copy", ".", "copy", "(", "self", ".", "ns", ")", "try", ":", "source", "=", "self", ".", "edited_source", "self", ".", "edited_source", "=", "N...
d554c1765c1899fa25727c9fc6805d221585562b
valid
LiveExecution.run
Attempt to known good or tenuous source.
shoebot/grammar/livecode.py
def run(self): """ Attempt to known good or tenuous source. """ with LiveExecution.lock: if self.edited_source: success, ex = self.run_tenuous() if success: return self.do_exec(self.known_good, self.ns)
def run(self): """ Attempt to known good or tenuous source. """ with LiveExecution.lock: if self.edited_source: success, ex = self.run_tenuous() if success: return self.do_exec(self.known_good, self.ns)
[ "Attempt", "to", "known", "good", "or", "tenuous", "source", "." ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L105-L115
[ "def", "run", "(", "self", ")", ":", "with", "LiveExecution", ".", "lock", ":", "if", "self", ".", "edited_source", ":", "success", ",", "ex", "=", "self", ".", "run_tenuous", "(", ")", "if", "success", ":", "return", "self", ".", "do_exec", "(", "se...
d554c1765c1899fa25727c9fc6805d221585562b
valid
LiveExecution.call_bad_cb
If bad_cb returns True then keep it :param tb: traceback that caused exception :return:
shoebot/grammar/livecode.py
def call_bad_cb(self, tb): """ If bad_cb returns True then keep it :param tb: traceback that caused exception :return: """ with LiveExecution.lock: if self.bad_cb and not self.bad_cb(tb): self.bad_cb = None
def call_bad_cb(self, tb): """ If bad_cb returns True then keep it :param tb: traceback that caused exception :return: """ with LiveExecution.lock: if self.bad_cb and not self.bad_cb(tb): self.bad_cb = None
[ "If", "bad_cb", "returns", "True", "then", "keep", "it", ":", "param", "tb", ":", "traceback", "that", "caused", "exception", ":", "return", ":" ]
shoebot/shoebot
python
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/grammar/livecode.py#L125-L133
[ "def", "call_bad_cb", "(", "self", ",", "tb", ")", ":", "with", "LiveExecution", ".", "lock", ":", "if", "self", ".", "bad_cb", "and", "not", "self", ".", "bad_cb", "(", "tb", ")", ":", "self", ".", "bad_cb", "=", "None" ]
d554c1765c1899fa25727c9fc6805d221585562b