id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,300 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | CollidableObj.draw | def draw(self, milliseconds, surface):
"""Render the bounds of this collision ojbect onto the specified surface."""
super(CollidableObj, self).draw(milliseconds, surface) | python | def draw(self, milliseconds, surface):
"""Render the bounds of this collision ojbect onto the specified surface."""
super(CollidableObj, self).draw(milliseconds, surface) | [
"def",
"draw",
"(",
"self",
",",
"milliseconds",
",",
"surface",
")",
":",
"super",
"(",
"CollidableObj",
",",
"self",
")",
".",
"draw",
"(",
"milliseconds",
",",
"surface",
")"
] | Render the bounds of this collision ojbect onto the specified surface. | [
"Render",
"the",
"bounds",
"of",
"this",
"collision",
"ojbect",
"onto",
"the",
"specified",
"surface",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2039-L2041 |
53,301 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | AABoundingBox.is_colliding | def is_colliding(self, other):
"""Check to see if two AABoundingBoxes are colliding."""
if isinstance(other, AABoundingBox):
if self.rect.colliderect(other.rect):
return True
return False | python | def is_colliding(self, other):
"""Check to see if two AABoundingBoxes are colliding."""
if isinstance(other, AABoundingBox):
if self.rect.colliderect(other.rect):
return True
return False | [
"def",
"is_colliding",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"AABoundingBox",
")",
":",
"if",
"self",
".",
"rect",
".",
"colliderect",
"(",
"other",
".",
"rect",
")",
":",
"return",
"True",
"return",
"False"
] | Check to see if two AABoundingBoxes are colliding. | [
"Check",
"to",
"see",
"if",
"two",
"AABoundingBoxes",
"are",
"colliding",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2080-L2085 |
53,302 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | CollisionManager.remove_object | def remove_object(collision_object):
"""Remove the collision object from the Manager"""
global collidable_objects
if isinstance(collision_object, CollidableObj):
# print "Collision object of type ", type(collision_object), " removed from the collision manager."
try:
... | python | def remove_object(collision_object):
"""Remove the collision object from the Manager"""
global collidable_objects
if isinstance(collision_object, CollidableObj):
# print "Collision object of type ", type(collision_object), " removed from the collision manager."
try:
... | [
"def",
"remove_object",
"(",
"collision_object",
")",
":",
"global",
"collidable_objects",
"if",
"isinstance",
"(",
"collision_object",
",",
"CollidableObj",
")",
":",
"# print \"Collision object of type \", type(collision_object), \" removed from the collision manager.\"",
"try",
... | Remove the collision object from the Manager | [
"Remove",
"the",
"collision",
"object",
"from",
"the",
"Manager"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2115-L2125 |
53,303 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | CollisionManager.query_collision | def query_collision(collision_object):
"""
Check to see if the specified object is colliding with any of the objects currently in the Collision Manager
Returns the first object we are colliding with if there was a collision and None if no collisions was found
"""
global collidabl... | python | def query_collision(collision_object):
"""
Check to see if the specified object is colliding with any of the objects currently in the Collision Manager
Returns the first object we are colliding with if there was a collision and None if no collisions was found
"""
global collidabl... | [
"def",
"query_collision",
"(",
"collision_object",
")",
":",
"global",
"collidable_objects",
"# Note that we use a Brute Force approach for the time being.",
"# It performs horribly under heavy loads, but it meets",
"# our needs for the time being.",
"for",
"obj",
"in",
"collidable_objec... | Check to see if the specified object is colliding with any of the objects currently in the Collision Manager
Returns the first object we are colliding with if there was a collision and None if no collisions was found | [
"Check",
"to",
"see",
"if",
"the",
"specified",
"object",
"is",
"colliding",
"with",
"any",
"of",
"the",
"objects",
"currently",
"in",
"the",
"Collision",
"Manager",
"Returns",
"the",
"first",
"object",
"we",
"are",
"colliding",
"with",
"if",
"there",
"was",... | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2140-L2157 |
53,304 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | CollisionManager.draw | def draw(self, milliseconds, surface):
"""Render each of the collision objects onto the specified surface."""
if self.is_visible:
global collidable_objects
for obj in collidable_objects:
if obj.is_visible:
obj.draw(milliseconds, surface)
... | python | def draw(self, milliseconds, surface):
"""Render each of the collision objects onto the specified surface."""
if self.is_visible:
global collidable_objects
for obj in collidable_objects:
if obj.is_visible:
obj.draw(milliseconds, surface)
... | [
"def",
"draw",
"(",
"self",
",",
"milliseconds",
",",
"surface",
")",
":",
"if",
"self",
".",
"is_visible",
":",
"global",
"collidable_objects",
"for",
"obj",
"in",
"collidable_objects",
":",
"if",
"obj",
".",
"is_visible",
":",
"obj",
".",
"draw",
"(",
... | Render each of the collision objects onto the specified surface. | [
"Render",
"each",
"of",
"the",
"collision",
"objects",
"onto",
"the",
"specified",
"surface",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2209-L2216 |
53,305 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | GUIMenu.__wrap_index | def __wrap_index(self):
"""Wraps the current_index to the other side of the menu."""
if self.current_index < 0:
self.current_index = len(self.gui_buttons) - 1
elif self.current_index >= len(self.gui_buttons):
self.current_index = 0 | python | def __wrap_index(self):
"""Wraps the current_index to the other side of the menu."""
if self.current_index < 0:
self.current_index = len(self.gui_buttons) - 1
elif self.current_index >= len(self.gui_buttons):
self.current_index = 0 | [
"def",
"__wrap_index",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_index",
"<",
"0",
":",
"self",
".",
"current_index",
"=",
"len",
"(",
"self",
".",
"gui_buttons",
")",
"-",
"1",
"elif",
"self",
".",
"current_index",
">=",
"len",
"(",
"self",
... | Wraps the current_index to the other side of the menu. | [
"Wraps",
"the",
"current_index",
"to",
"the",
"other",
"side",
"of",
"the",
"menu",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2317-L2322 |
53,306 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | GUIMenu.move_up | def move_up(self):
"""
Try to select the button above the currently selected one.
If a button is not there, wrap down to the bottom of the menu and select the last button.
"""
old_index = self.current_index
self.current_index -= 1
self.__wrap_index()
self.... | python | def move_up(self):
"""
Try to select the button above the currently selected one.
If a button is not there, wrap down to the bottom of the menu and select the last button.
"""
old_index = self.current_index
self.current_index -= 1
self.__wrap_index()
self.... | [
"def",
"move_up",
"(",
"self",
")",
":",
"old_index",
"=",
"self",
".",
"current_index",
"self",
".",
"current_index",
"-=",
"1",
"self",
".",
"__wrap_index",
"(",
")",
"self",
".",
"__handle_selections",
"(",
"old_index",
",",
"self",
".",
"current_index",
... | Try to select the button above the currently selected one.
If a button is not there, wrap down to the bottom of the menu and select the last button. | [
"Try",
"to",
"select",
"the",
"button",
"above",
"the",
"currently",
"selected",
"one",
".",
"If",
"a",
"button",
"is",
"not",
"there",
"wrap",
"down",
"to",
"the",
"bottom",
"of",
"the",
"menu",
"and",
"select",
"the",
"last",
"button",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2336-L2344 |
53,307 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | GUIMenu.move_down | def move_down(self):
"""
Try to select the button under the currently selected one.
If a button is not there, wrap down to the top of the menu and select the first button.
"""
old_index = self.current_index
self.current_index += 1
self.__wrap_index()
self.... | python | def move_down(self):
"""
Try to select the button under the currently selected one.
If a button is not there, wrap down to the top of the menu and select the first button.
"""
old_index = self.current_index
self.current_index += 1
self.__wrap_index()
self.... | [
"def",
"move_down",
"(",
"self",
")",
":",
"old_index",
"=",
"self",
".",
"current_index",
"self",
".",
"current_index",
"+=",
"1",
"self",
".",
"__wrap_index",
"(",
")",
"self",
".",
"__handle_selections",
"(",
"old_index",
",",
"self",
".",
"current_index"... | Try to select the button under the currently selected one.
If a button is not there, wrap down to the top of the menu and select the first button. | [
"Try",
"to",
"select",
"the",
"button",
"under",
"the",
"currently",
"selected",
"one",
".",
"If",
"a",
"button",
"is",
"not",
"there",
"wrap",
"down",
"to",
"the",
"top",
"of",
"the",
"menu",
"and",
"select",
"the",
"first",
"button",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2346-L2354 |
53,308 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | GUIMenu.__update_keyboard | def __update_keyboard(self, milliseconds):
"""
Use the keyboard to control selection of the buttons.
"""
if Ragnarok.get_world().Keyboard.is_clicked(self.move_up_button):
self.move_up()
elif Ragnarok.get_world().Keyboard.is_clicked(self.move_down_button):
... | python | def __update_keyboard(self, milliseconds):
"""
Use the keyboard to control selection of the buttons.
"""
if Ragnarok.get_world().Keyboard.is_clicked(self.move_up_button):
self.move_up()
elif Ragnarok.get_world().Keyboard.is_clicked(self.move_down_button):
... | [
"def",
"__update_keyboard",
"(",
"self",
",",
"milliseconds",
")",
":",
"if",
"Ragnarok",
".",
"get_world",
"(",
")",
".",
"Keyboard",
".",
"is_clicked",
"(",
"self",
".",
"move_up_button",
")",
":",
"self",
".",
"move_up",
"(",
")",
"elif",
"Ragnarok",
... | Use the keyboard to control selection of the buttons. | [
"Use",
"the",
"keyboard",
"to",
"control",
"selection",
"of",
"the",
"buttons",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2374-L2386 |
53,309 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | MouseState.copy | def copy(self):
"""Create a copy of this MouseState and return it."""
ms = MouseState()
ms.left_pressed = self.left_pressed
ms.middle_pressed = self.middle_pressed
ms.right_pressed = self.right_pressed
ms.mouse_pos = self.mouse_pos
return ms | python | def copy(self):
"""Create a copy of this MouseState and return it."""
ms = MouseState()
ms.left_pressed = self.left_pressed
ms.middle_pressed = self.middle_pressed
ms.right_pressed = self.right_pressed
ms.mouse_pos = self.mouse_pos
return ms | [
"def",
"copy",
"(",
"self",
")",
":",
"ms",
"=",
"MouseState",
"(",
")",
"ms",
".",
"left_pressed",
"=",
"self",
".",
"left_pressed",
"ms",
".",
"middle_pressed",
"=",
"self",
".",
"middle_pressed",
"ms",
".",
"right_pressed",
"=",
"self",
".",
"right_pr... | Create a copy of this MouseState and return it. | [
"Create",
"a",
"copy",
"of",
"this",
"MouseState",
"and",
"return",
"it",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2425-L2432 |
53,310 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | MouseState.query_state | def query_state(self, StateType):
"""
Is a button depressed?
True if a button is pressed, false otherwise.
"""
if StateType == M_LEFT:
# Checking left mouse button
return self.left_pressed
elif StateType == M_MIDDLE:
# Checking middle m... | python | def query_state(self, StateType):
"""
Is a button depressed?
True if a button is pressed, false otherwise.
"""
if StateType == M_LEFT:
# Checking left mouse button
return self.left_pressed
elif StateType == M_MIDDLE:
# Checking middle m... | [
"def",
"query_state",
"(",
"self",
",",
"StateType",
")",
":",
"if",
"StateType",
"==",
"M_LEFT",
":",
"# Checking left mouse button",
"return",
"self",
".",
"left_pressed",
"elif",
"StateType",
"==",
"M_MIDDLE",
":",
"# Checking middle mouse button",
"return",
"sel... | Is a button depressed?
True if a button is pressed, false otherwise. | [
"Is",
"a",
"button",
"depressed?",
"True",
"if",
"a",
"button",
"is",
"pressed",
"false",
"otherwise",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2434-L2447 |
53,311 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Mouse.is_clicked | def is_clicked(self, MouseStateType):
"""
Did the user depress and release the button to signify a click?
MouseStateType is the button to query. Values found under StateTypes.py
"""
return self.previous_mouse_state.query_state(MouseStateType) and (
not self.current_mouse_... | python | def is_clicked(self, MouseStateType):
"""
Did the user depress and release the button to signify a click?
MouseStateType is the button to query. Values found under StateTypes.py
"""
return self.previous_mouse_state.query_state(MouseStateType) and (
not self.current_mouse_... | [
"def",
"is_clicked",
"(",
"self",
",",
"MouseStateType",
")",
":",
"return",
"self",
".",
"previous_mouse_state",
".",
"query_state",
"(",
"MouseStateType",
")",
"and",
"(",
"not",
"self",
".",
"current_mouse_state",
".",
"query_state",
"(",
"MouseStateType",
")... | Did the user depress and release the button to signify a click?
MouseStateType is the button to query. Values found under StateTypes.py | [
"Did",
"the",
"user",
"depress",
"and",
"release",
"the",
"button",
"to",
"signify",
"a",
"click?",
"MouseStateType",
"is",
"the",
"button",
"to",
"query",
".",
"Values",
"found",
"under",
"StateTypes",
".",
"py"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2467-L2473 |
53,312 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Keyboard.is_any_down | def is_any_down(self):
"""Is any button depressed?"""
for key in range(len(self.current_state.key_states)):
if self.is_down(key):
return True
return False | python | def is_any_down(self):
"""Is any button depressed?"""
for key in range(len(self.current_state.key_states)):
if self.is_down(key):
return True
return False | [
"def",
"is_any_down",
"(",
"self",
")",
":",
"for",
"key",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"current_state",
".",
"key_states",
")",
")",
":",
"if",
"self",
".",
"is_down",
"(",
"key",
")",
":",
"return",
"True",
"return",
"False"
] | Is any button depressed? | [
"Is",
"any",
"button",
"depressed?"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2526-L2531 |
53,313 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Keyboard.is_any_clicked | def is_any_clicked(self):
"""Is any button clicked?"""
for key in range(len(self.current_state.key_states)):
if self.is_clicked(key):
return True
return False | python | def is_any_clicked(self):
"""Is any button clicked?"""
for key in range(len(self.current_state.key_states)):
if self.is_clicked(key):
return True
return False | [
"def",
"is_any_clicked",
"(",
"self",
")",
":",
"for",
"key",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"current_state",
".",
"key_states",
")",
")",
":",
"if",
"self",
".",
"is_clicked",
"(",
"key",
")",
":",
"return",
"True",
"return",
"False"
] | Is any button clicked? | [
"Is",
"any",
"button",
"clicked?"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2533-L2538 |
53,314 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Tile.generate_bbox | def generate_bbox(self, collision_function=None, tag=""):
"""Create a bounding box around this tile so that it can collide with objects not included in the TileManager"""
boundingBox = AABoundingBox(None, collision_function, tag)
CollisionManager.add_object(boundingBox) | python | def generate_bbox(self, collision_function=None, tag=""):
"""Create a bounding box around this tile so that it can collide with objects not included in the TileManager"""
boundingBox = AABoundingBox(None, collision_function, tag)
CollisionManager.add_object(boundingBox) | [
"def",
"generate_bbox",
"(",
"self",
",",
"collision_function",
"=",
"None",
",",
"tag",
"=",
"\"\"",
")",
":",
"boundingBox",
"=",
"AABoundingBox",
"(",
"None",
",",
"collision_function",
",",
"tag",
")",
"CollisionManager",
".",
"add_object",
"(",
"boundingB... | Create a bounding box around this tile so that it can collide with objects not included in the TileManager | [
"Create",
"a",
"bounding",
"box",
"around",
"this",
"tile",
"so",
"that",
"it",
"can",
"collide",
"with",
"objects",
"not",
"included",
"in",
"the",
"TileManager"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2599-L2602 |
53,315 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | TileMap.pixels_to_tiles | def pixels_to_tiles(self, coords, clamp=True):
"""
Convert pixel coordinates into tile coordinates.
clamp determines if we should clamp the tiles to ones only on the tilemap.
"""
tile_coords = Vector2()
tile_coords.X = int(coords[0]) / self.spritesheet[0].width
ti... | python | def pixels_to_tiles(self, coords, clamp=True):
"""
Convert pixel coordinates into tile coordinates.
clamp determines if we should clamp the tiles to ones only on the tilemap.
"""
tile_coords = Vector2()
tile_coords.X = int(coords[0]) / self.spritesheet[0].width
ti... | [
"def",
"pixels_to_tiles",
"(",
"self",
",",
"coords",
",",
"clamp",
"=",
"True",
")",
":",
"tile_coords",
"=",
"Vector2",
"(",
")",
"tile_coords",
".",
"X",
"=",
"int",
"(",
"coords",
"[",
"0",
"]",
")",
"/",
"self",
".",
"spritesheet",
"[",
"0",
"... | Convert pixel coordinates into tile coordinates.
clamp determines if we should clamp the tiles to ones only on the tilemap. | [
"Convert",
"pixel",
"coordinates",
"into",
"tile",
"coordinates",
".",
"clamp",
"determines",
"if",
"we",
"should",
"clamp",
"the",
"tiles",
"to",
"ones",
"only",
"on",
"the",
"tilemap",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2777-L2789 |
53,316 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | TileMap.clamp_within_range | def clamp_within_range(self, x, y):
"""
Clamp x and y so that they fall within range of the tilemap.
"""
x = int(x)
y = int(y)
if x < 0:
x = 0
if y < 0:
y = 0
if x > self.size_in_tiles.X:
x = self.size_in_tiles.X
... | python | def clamp_within_range(self, x, y):
"""
Clamp x and y so that they fall within range of the tilemap.
"""
x = int(x)
y = int(y)
if x < 0:
x = 0
if y < 0:
y = 0
if x > self.size_in_tiles.X:
x = self.size_in_tiles.X
... | [
"def",
"clamp_within_range",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"x",
"=",
"int",
"(",
"x",
")",
"y",
"=",
"int",
"(",
"y",
")",
"if",
"x",
"<",
"0",
":",
"x",
"=",
"0",
"if",
"y",
"<",
"0",
":",
"y",
"=",
"0",
"if",
"x",
">",
... | Clamp x and y so that they fall within range of the tilemap. | [
"Clamp",
"x",
"and",
"y",
"so",
"that",
"they",
"fall",
"within",
"range",
"of",
"the",
"tilemap",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2791-L2807 |
53,317 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | TileMap.tiles_to_pixels | def tiles_to_pixels(self, tiles):
"""Convert tile coordinates into pixel coordinates"""
pixel_coords = Vector2()
pixel_coords.X = tiles[0] * self.spritesheet[0].width
pixel_coords.Y = tiles[1] * self.spritesheet[0].height
return pixel_coords | python | def tiles_to_pixels(self, tiles):
"""Convert tile coordinates into pixel coordinates"""
pixel_coords = Vector2()
pixel_coords.X = tiles[0] * self.spritesheet[0].width
pixel_coords.Y = tiles[1] * self.spritesheet[0].height
return pixel_coords | [
"def",
"tiles_to_pixels",
"(",
"self",
",",
"tiles",
")",
":",
"pixel_coords",
"=",
"Vector2",
"(",
")",
"pixel_coords",
".",
"X",
"=",
"tiles",
"[",
"0",
"]",
"*",
"self",
".",
"spritesheet",
"[",
"0",
"]",
".",
"width",
"pixel_coords",
".",
"Y",
"=... | Convert tile coordinates into pixel coordinates | [
"Convert",
"tile",
"coordinates",
"into",
"pixel",
"coordinates"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2809-L2814 |
53,318 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | TileMap.is_valid_tile | def is_valid_tile(self, x, y):
"""Check to see if the requested tile is part of the tile map."""
x = int(x)
y = int(y)
if x < 0:
return False
if y < 0:
return False
if x > self.size_in_tiles.X:
return False
if y > self.size_in_... | python | def is_valid_tile(self, x, y):
"""Check to see if the requested tile is part of the tile map."""
x = int(x)
y = int(y)
if x < 0:
return False
if y < 0:
return False
if x > self.size_in_tiles.X:
return False
if y > self.size_in_... | [
"def",
"is_valid_tile",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"x",
"=",
"int",
"(",
"x",
")",
"y",
"=",
"int",
"(",
"y",
")",
"if",
"x",
"<",
"0",
":",
"return",
"False",
"if",
"y",
"<",
"0",
":",
"return",
"False",
"if",
"x",
">",
"... | Check to see if the requested tile is part of the tile map. | [
"Check",
"to",
"see",
"if",
"the",
"requested",
"tile",
"is",
"part",
"of",
"the",
"tile",
"map",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2816-L2830 |
53,319 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | TileMapManager.unload | def unload():
"""Unload the current map from the world."""
global __tile_maps
global active_map
if TileMapManager.active_map != None:
world = Ragnarok.get_world()
for obj in TileMapManager.active_map.objects:
world.remove_obj(obj)
worl... | python | def unload():
"""Unload the current map from the world."""
global __tile_maps
global active_map
if TileMapManager.active_map != None:
world = Ragnarok.get_world()
for obj in TileMapManager.active_map.objects:
world.remove_obj(obj)
worl... | [
"def",
"unload",
"(",
")",
":",
"global",
"__tile_maps",
"global",
"active_map",
"if",
"TileMapManager",
".",
"active_map",
"!=",
"None",
":",
"world",
"=",
"Ragnarok",
".",
"get_world",
"(",
")",
"for",
"obj",
"in",
"TileMapManager",
".",
"active_map",
".",... | Unload the current map from the world. | [
"Unload",
"the",
"current",
"map",
"from",
"the",
"world",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2916-L2925 |
53,320 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | TileMapManager.load | def load(name):
"""Parse the tile map and add it to the world."""
global __tile_maps
# Remove the current map.
TileMapManager.unload()
TileMapManager.active_map = __tile_maps[name]
TileMapManager.active_map.parse_tilemap()
TileMapManager.active_map.parse_collisio... | python | def load(name):
"""Parse the tile map and add it to the world."""
global __tile_maps
# Remove the current map.
TileMapManager.unload()
TileMapManager.active_map = __tile_maps[name]
TileMapManager.active_map.parse_tilemap()
TileMapManager.active_map.parse_collisio... | [
"def",
"load",
"(",
"name",
")",
":",
"global",
"__tile_maps",
"# Remove the current map.",
"TileMapManager",
".",
"unload",
"(",
")",
"TileMapManager",
".",
"active_map",
"=",
"__tile_maps",
"[",
"name",
"]",
"TileMapManager",
".",
"active_map",
".",
"parse_tilem... | Parse the tile map and add it to the world. | [
"Parse",
"the",
"tile",
"map",
"and",
"add",
"it",
"to",
"the",
"world",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L2929-L2944 |
53,321 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Camera.get_movement_delta | def get_movement_delta(self):
"""Get the amount the camera has moved since get_movement_delta was last called."""
pos = self.pan - self.previous_pos
self.previous_pos = Vector2(self.pan.X, self.pan.Y)
return pos | python | def get_movement_delta(self):
"""Get the amount the camera has moved since get_movement_delta was last called."""
pos = self.pan - self.previous_pos
self.previous_pos = Vector2(self.pan.X, self.pan.Y)
return pos | [
"def",
"get_movement_delta",
"(",
"self",
")",
":",
"pos",
"=",
"self",
".",
"pan",
"-",
"self",
".",
"previous_pos",
"self",
".",
"previous_pos",
"=",
"Vector2",
"(",
"self",
".",
"pan",
".",
"X",
",",
"self",
".",
"pan",
".",
"Y",
")",
"return",
... | Get the amount the camera has moved since get_movement_delta was last called. | [
"Get",
"the",
"amount",
"the",
"camera",
"has",
"moved",
"since",
"get_movement_delta",
"was",
"last",
"called",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3010-L3014 |
53,322 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Camera.Reset | def Reset(self):
"""Reset the camera back to its defaults."""
self.pan = self.world_center
self.desired_pan = self.pos | python | def Reset(self):
"""Reset the camera back to its defaults."""
self.pan = self.world_center
self.desired_pan = self.pos | [
"def",
"Reset",
"(",
"self",
")",
":",
"self",
".",
"pan",
"=",
"self",
".",
"world_center",
"self",
".",
"desired_pan",
"=",
"self",
".",
"pos"
] | Reset the camera back to its defaults. | [
"Reset",
"the",
"camera",
"back",
"to",
"its",
"defaults",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3016-L3019 |
53,323 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Camera.check_bounds | def check_bounds(self):
"""Make sure the camera is not outside if its legal range."""
if not (self.camera_bounds == None):
if self.__pan.X < self.camera_bounds.Left:
self.__pan[0] = self.camera_bounds.Left
if self.__pan.X > self.camera_bounds.Right:
... | python | def check_bounds(self):
"""Make sure the camera is not outside if its legal range."""
if not (self.camera_bounds == None):
if self.__pan.X < self.camera_bounds.Left:
self.__pan[0] = self.camera_bounds.Left
if self.__pan.X > self.camera_bounds.Right:
... | [
"def",
"check_bounds",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"camera_bounds",
"==",
"None",
")",
":",
"if",
"self",
".",
"__pan",
".",
"X",
"<",
"self",
".",
"camera_bounds",
".",
"Left",
":",
"self",
".",
"__pan",
"[",
"0",
"]",
... | Make sure the camera is not outside if its legal range. | [
"Make",
"sure",
"the",
"camera",
"is",
"not",
"outside",
"if",
"its",
"legal",
"range",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3021-L3034 |
53,324 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Camera.get_cam_bounds | def get_cam_bounds(self):
"""Return the bounds of the camera in x, y, xMax, and yMax format."""
world_pos = self.get_world_pos()
screen_res = Ragnarok.get_world().get_backbuffer_size() * .5
return (self.pan.X - screen_res.X), (self.pan.Y - screen_res.Y), (self.pan.X + screen_res.X), (
... | python | def get_cam_bounds(self):
"""Return the bounds of the camera in x, y, xMax, and yMax format."""
world_pos = self.get_world_pos()
screen_res = Ragnarok.get_world().get_backbuffer_size() * .5
return (self.pan.X - screen_res.X), (self.pan.Y - screen_res.Y), (self.pan.X + screen_res.X), (
... | [
"def",
"get_cam_bounds",
"(",
"self",
")",
":",
"world_pos",
"=",
"self",
".",
"get_world_pos",
"(",
")",
"screen_res",
"=",
"Ragnarok",
".",
"get_world",
"(",
")",
".",
"get_backbuffer_size",
"(",
")",
"*",
".5",
"return",
"(",
"self",
".",
"pan",
".",
... | Return the bounds of the camera in x, y, xMax, and yMax format. | [
"Return",
"the",
"bounds",
"of",
"the",
"camera",
"in",
"x",
"y",
"xMax",
"and",
"yMax",
"format",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3036-L3041 |
53,325 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | Camera.update_view_bounds | def update_view_bounds(self):
"""Update the camera's view bounds."""
self.view_bounds.left = self.pan.X - self.world_center.X
self.view_bounds.top = self.pan.Y - self.world_center.Y
self.view_bounds.width = self.world_center.X * 2
self.view_bounds.height = self.world_center.Y * 2 | python | def update_view_bounds(self):
"""Update the camera's view bounds."""
self.view_bounds.left = self.pan.X - self.world_center.X
self.view_bounds.top = self.pan.Y - self.world_center.Y
self.view_bounds.width = self.world_center.X * 2
self.view_bounds.height = self.world_center.Y * 2 | [
"def",
"update_view_bounds",
"(",
"self",
")",
":",
"self",
".",
"view_bounds",
".",
"left",
"=",
"self",
".",
"pan",
".",
"X",
"-",
"self",
".",
"world_center",
".",
"X",
"self",
".",
"view_bounds",
".",
"top",
"=",
"self",
".",
"pan",
".",
"Y",
"... | Update the camera's view bounds. | [
"Update",
"the",
"camera",
"s",
"view",
"bounds",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3043-L3048 |
53,326 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.set_backbuffer | def set_backbuffer(self, preferred_backbuffer_size, flags=0):
"""Create the backbuffer for the game."""
if not (isinstance(preferred_backbuffer_size, Vector2)):
raise ValueError("preferred_backbuffer_size must be of type Vector2")
self.__backbuffer = pygame.display.set_mode(preferre... | python | def set_backbuffer(self, preferred_backbuffer_size, flags=0):
"""Create the backbuffer for the game."""
if not (isinstance(preferred_backbuffer_size, Vector2)):
raise ValueError("preferred_backbuffer_size must be of type Vector2")
self.__backbuffer = pygame.display.set_mode(preferre... | [
"def",
"set_backbuffer",
"(",
"self",
",",
"preferred_backbuffer_size",
",",
"flags",
"=",
"0",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"preferred_backbuffer_size",
",",
"Vector2",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"preferred_backbuffer_size must... | Create the backbuffer for the game. | [
"Create",
"the",
"backbuffer",
"for",
"the",
"game",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3095-L3101 |
53,327 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.set_display_at_native_res | def set_display_at_native_res(self, should_be_fullscreen=True):
"""Sets the resolution to the display's native resolution.
Sets as fullscreen if should_be_fullscreen is true."""
# Loop through all our display modes until we find one that works well.
for mode in self.display_modes:
... | python | def set_display_at_native_res(self, should_be_fullscreen=True):
"""Sets the resolution to the display's native resolution.
Sets as fullscreen if should_be_fullscreen is true."""
# Loop through all our display modes until we find one that works well.
for mode in self.display_modes:
... | [
"def",
"set_display_at_native_res",
"(",
"self",
",",
"should_be_fullscreen",
"=",
"True",
")",
":",
"# Loop through all our display modes until we find one that works well.",
"for",
"mode",
"in",
"self",
".",
"display_modes",
":",
"color_depth",
"=",
"pygame",
".",
"disp... | Sets the resolution to the display's native resolution.
Sets as fullscreen if should_be_fullscreen is true. | [
"Sets",
"the",
"resolution",
"to",
"the",
"display",
"s",
"native",
"resolution",
".",
"Sets",
"as",
"fullscreen",
"if",
"should_be_fullscreen",
"is",
"true",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3105-L3118 |
53,328 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.get_backbuffer_size | def get_backbuffer_size(self):
"""Get the width and height of the backbuffer as a Vector2."""
vec = Vector2()
vec.X = self.backbuffer.get_width()
vec.Y = self.backbuffer.get_height()
return vec | python | def get_backbuffer_size(self):
"""Get the width and height of the backbuffer as a Vector2."""
vec = Vector2()
vec.X = self.backbuffer.get_width()
vec.Y = self.backbuffer.get_height()
return vec | [
"def",
"get_backbuffer_size",
"(",
"self",
")",
":",
"vec",
"=",
"Vector2",
"(",
")",
"vec",
".",
"X",
"=",
"self",
".",
"backbuffer",
".",
"get_width",
"(",
")",
"vec",
".",
"Y",
"=",
"self",
".",
"backbuffer",
".",
"get_height",
"(",
")",
"return",... | Get the width and height of the backbuffer as a Vector2. | [
"Get",
"the",
"width",
"and",
"height",
"of",
"the",
"backbuffer",
"as",
"a",
"Vector2",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3128-L3133 |
53,329 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.find_obj_by_tag | def find_obj_by_tag(self, tag):
"""Search through all the objects in the world and
return the first instance whose tag matches the specified string."""
for obj in self.__up_objects:
if obj.tag == tag:
return obj
for obj in self.__draw_objects:
if ... | python | def find_obj_by_tag(self, tag):
"""Search through all the objects in the world and
return the first instance whose tag matches the specified string."""
for obj in self.__up_objects:
if obj.tag == tag:
return obj
for obj in self.__draw_objects:
if ... | [
"def",
"find_obj_by_tag",
"(",
"self",
",",
"tag",
")",
":",
"for",
"obj",
"in",
"self",
".",
"__up_objects",
":",
"if",
"obj",
".",
"tag",
"==",
"tag",
":",
"return",
"obj",
"for",
"obj",
"in",
"self",
".",
"__draw_objects",
":",
"if",
"obj",
".",
... | Search through all the objects in the world and
return the first instance whose tag matches the specified string. | [
"Search",
"through",
"all",
"the",
"objects",
"in",
"the",
"world",
"and",
"return",
"the",
"first",
"instance",
"whose",
"tag",
"matches",
"the",
"specified",
"string",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3166-L3177 |
53,330 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.remove_by_tag | def remove_by_tag(self, tag):
"""
Remove the first encountered object with the specified tag from the world.
Returns true if an object was found and removed.
Returns false if no object could be removed.
"""
obj = self.find_obj_by_tag(tag)
if obj != None:
... | python | def remove_by_tag(self, tag):
"""
Remove the first encountered object with the specified tag from the world.
Returns true if an object was found and removed.
Returns false if no object could be removed.
"""
obj = self.find_obj_by_tag(tag)
if obj != None:
... | [
"def",
"remove_by_tag",
"(",
"self",
",",
"tag",
")",
":",
"obj",
"=",
"self",
".",
"find_obj_by_tag",
"(",
"tag",
")",
"if",
"obj",
"!=",
"None",
":",
"self",
".",
"remove_obj",
"(",
"obj",
")",
"return",
"True",
"return",
"False"
] | Remove the first encountered object with the specified tag from the world.
Returns true if an object was found and removed.
Returns false if no object could be removed. | [
"Remove",
"the",
"first",
"encountered",
"object",
"with",
"the",
"specified",
"tag",
"from",
"the",
"world",
".",
"Returns",
"true",
"if",
"an",
"object",
"was",
"found",
"and",
"removed",
".",
"Returns",
"false",
"if",
"no",
"object",
"could",
"be",
"rem... | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3179-L3190 |
53,331 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.__draw_cmp | def __draw_cmp(self, obj1, obj2):
"""Defines how our drawable objects should be sorted"""
if obj1.draw_order > obj2.draw_order:
return 1
elif obj1.draw_order < obj2.draw_order:
return -1
else:
return 0 | python | def __draw_cmp(self, obj1, obj2):
"""Defines how our drawable objects should be sorted"""
if obj1.draw_order > obj2.draw_order:
return 1
elif obj1.draw_order < obj2.draw_order:
return -1
else:
return 0 | [
"def",
"__draw_cmp",
"(",
"self",
",",
"obj1",
",",
"obj2",
")",
":",
"if",
"obj1",
".",
"draw_order",
">",
"obj2",
".",
"draw_order",
":",
"return",
"1",
"elif",
"obj1",
".",
"draw_order",
"<",
"obj2",
".",
"draw_order",
":",
"return",
"-",
"1",
"el... | Defines how our drawable objects should be sorted | [
"Defines",
"how",
"our",
"drawable",
"objects",
"should",
"be",
"sorted"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3196-L3203 |
53,332 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.__up_cmp | def __up_cmp(self, obj1, obj2):
"""Defines how our updatable objects should be sorted"""
if obj1.update_order > obj2.update_order:
return 1
elif obj1.update_order < obj2.update_order:
return -1
else:
return 0 | python | def __up_cmp(self, obj1, obj2):
"""Defines how our updatable objects should be sorted"""
if obj1.update_order > obj2.update_order:
return 1
elif obj1.update_order < obj2.update_order:
return -1
else:
return 0 | [
"def",
"__up_cmp",
"(",
"self",
",",
"obj1",
",",
"obj2",
")",
":",
"if",
"obj1",
".",
"update_order",
">",
"obj2",
".",
"update_order",
":",
"return",
"1",
"elif",
"obj1",
".",
"update_order",
"<",
"obj2",
".",
"update_order",
":",
"return",
"-",
"1",... | Defines how our updatable objects should be sorted | [
"Defines",
"how",
"our",
"updatable",
"objects",
"should",
"be",
"sorted"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3205-L3212 |
53,333 | Scoppio/RagnarokEngine3 | RagnarokEngine3/RE3.py | World.update | def update(self, milliseconds):
"""Updates all of the objects in our world."""
self.__sort_up()
for obj in self.__up_objects:
obj.update(milliseconds) | python | def update(self, milliseconds):
"""Updates all of the objects in our world."""
self.__sort_up()
for obj in self.__up_objects:
obj.update(milliseconds) | [
"def",
"update",
"(",
"self",
",",
"milliseconds",
")",
":",
"self",
".",
"__sort_up",
"(",
")",
"for",
"obj",
"in",
"self",
".",
"__up_objects",
":",
"obj",
".",
"update",
"(",
"milliseconds",
")"
] | Updates all of the objects in our world. | [
"Updates",
"all",
"of",
"the",
"objects",
"in",
"our",
"world",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L3227-L3231 |
53,334 | vlukes/dicom2fem | dicom2fem/ioutils.py | ensure_path | def ensure_path(filename):
"""
Check if path to `filename` exists and if not, create the necessary
intermediate directories.
"""
dirname = os.path.dirname(filename)
if dirname and not os.path.exists(dirname):
os.makedirs(dirname) | python | def ensure_path(filename):
"""
Check if path to `filename` exists and if not, create the necessary
intermediate directories.
"""
dirname = os.path.dirname(filename)
if dirname and not os.path.exists(dirname):
os.makedirs(dirname) | [
"def",
"ensure_path",
"(",
"filename",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
"if",
"dirname",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dirname",
")",
":",
"os",
".",
"makedirs",
"(",
"dirname"... | Check if path to `filename` exists and if not, create the necessary
intermediate directories. | [
"Check",
"if",
"path",
"to",
"filename",
"exists",
"and",
"if",
"not",
"create",
"the",
"necessary",
"intermediate",
"directories",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/ioutils.py#L32-L39 |
53,335 | vlukes/dicom2fem | dicom2fem/ioutils.py | locate_files | def locate_files(pattern, root_dir=os.curdir):
"""
Locate all files matching fiven filename pattern in and below
supplied root directory.
"""
for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)):
for filename in fnmatch.filter(filenames, pattern):
yield os.path.... | python | def locate_files(pattern, root_dir=os.curdir):
"""
Locate all files matching fiven filename pattern in and below
supplied root directory.
"""
for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)):
for filename in fnmatch.filter(filenames, pattern):
yield os.path.... | [
"def",
"locate_files",
"(",
"pattern",
",",
"root_dir",
"=",
"os",
".",
"curdir",
")",
":",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"root_dir",
")",
")",
":",
"for",
... | Locate all files matching fiven filename pattern in and below
supplied root directory. | [
"Locate",
"all",
"files",
"matching",
"fiven",
"filename",
"pattern",
"in",
"and",
"below",
"supplied",
"root",
"directory",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/ioutils.py#L41-L48 |
53,336 | vlukes/dicom2fem | dicom2fem/ioutils.py | remove_files | def remove_files(root_dir):
"""
Remove all files and directories in supplied root directory.
"""
for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)):
for filename in filenames:
os.remove(os.path.join(root_dir, filename))
for dirname in dirnames:
... | python | def remove_files(root_dir):
"""
Remove all files and directories in supplied root directory.
"""
for dirpath, dirnames, filenames in os.walk(os.path.abspath(root_dir)):
for filename in filenames:
os.remove(os.path.join(root_dir, filename))
for dirname in dirnames:
... | [
"def",
"remove_files",
"(",
"root_dir",
")",
":",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"root_dir",
")",
")",
":",
"for",
"filename",
"in",
"filenames",
":",
"os",
"... | Remove all files and directories in supplied root directory. | [
"Remove",
"all",
"files",
"and",
"directories",
"in",
"supplied",
"root",
"directory",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/ioutils.py#L50-L59 |
53,337 | vlukes/dicom2fem | dicom2fem/ioutils.py | edit_filename | def edit_filename(filename, prefix='', suffix='', new_ext=None):
"""
Edit a file name by add a prefix, inserting a suffix in front of a file
name extension or replacing the extension.
Parameters
----------
filename : str
The file name.
prefix : str
The prefix to be added.
... | python | def edit_filename(filename, prefix='', suffix='', new_ext=None):
"""
Edit a file name by add a prefix, inserting a suffix in front of a file
name extension or replacing the extension.
Parameters
----------
filename : str
The file name.
prefix : str
The prefix to be added.
... | [
"def",
"edit_filename",
"(",
"filename",
",",
"prefix",
"=",
"''",
",",
"suffix",
"=",
"''",
",",
"new_ext",
"=",
"None",
")",
":",
"base",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"new_ext",
"is",
"None",
":... | Edit a file name by add a prefix, inserting a suffix in front of a file
name extension or replacing the extension.
Parameters
----------
filename : str
The file name.
prefix : str
The prefix to be added.
suffix : str
The suffix to be inserted.
new_ext : str, optional... | [
"Edit",
"a",
"file",
"name",
"by",
"add",
"a",
"prefix",
"inserting",
"a",
"suffix",
"in",
"front",
"of",
"a",
"file",
"name",
"extension",
"or",
"replacing",
"the",
"extension",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/ioutils.py#L66-L95 |
53,338 | laplacesdemon/django-social-friends-finder | social_friends_finder/backends/facebook_backend.py | FacebookFriendsProvider.fetch_friends | def fetch_friends(self, user, paginate=False):
"""
fethces friends from facebook using the oauth_token
fethched by django-social-auth.
Note - user isn't a user - it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth
Returns:
collection of f... | python | def fetch_friends(self, user, paginate=False):
"""
fethces friends from facebook using the oauth_token
fethched by django-social-auth.
Note - user isn't a user - it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth
Returns:
collection of f... | [
"def",
"fetch_friends",
"(",
"self",
",",
"user",
",",
"paginate",
"=",
"False",
")",
":",
"if",
"USING_ALLAUTH",
":",
"social_app",
"=",
"SocialApp",
".",
"objects",
".",
"get_current",
"(",
"'facebook'",
")",
"oauth_token",
"=",
"SocialToken",
".",
"object... | fethces friends from facebook using the oauth_token
fethched by django-social-auth.
Note - user isn't a user - it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth
Returns:
collection of friend objects fetched from facebook | [
"fethces",
"friends",
"from",
"facebook",
"using",
"the",
"oauth_token",
"fethched",
"by",
"django",
"-",
"social",
"-",
"auth",
"."
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/backends/facebook_backend.py#L15-L55 |
53,339 | Rediker-Software/doac | doac/contrib/rest_framework/authentication.py | DoacAuthentication.authenticate | def authenticate(self, request):
"""
Send the request through the authentication middleware that
is provided with DOAC and grab the user and token from it.
"""
from doac.middleware import AuthenticationMiddleware
try:
response = AuthenticationMiddleware().pr... | python | def authenticate(self, request):
"""
Send the request through the authentication middleware that
is provided with DOAC and grab the user and token from it.
"""
from doac.middleware import AuthenticationMiddleware
try:
response = AuthenticationMiddleware().pr... | [
"def",
"authenticate",
"(",
"self",
",",
"request",
")",
":",
"from",
"doac",
".",
"middleware",
"import",
"AuthenticationMiddleware",
"try",
":",
"response",
"=",
"AuthenticationMiddleware",
"(",
")",
".",
"process_request",
"(",
"request",
")",
"except",
":",
... | Send the request through the authentication middleware that
is provided with DOAC and grab the user and token from it. | [
"Send",
"the",
"request",
"through",
"the",
"authentication",
"middleware",
"that",
"is",
"provided",
"with",
"DOAC",
"and",
"grab",
"the",
"user",
"and",
"token",
"from",
"it",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/contrib/rest_framework/authentication.py#L6-L25 |
53,340 | Rediker-Software/doac | doac/decorators.py | scope_required | def scope_required(*scopes):
"""
Test for specific scopes that the access token has been authenticated for before
processing the request and eventual response.
The scopes that are passed in determine how the decorator will respond to incoming
requests:
- If no scopes are passed in the argument... | python | def scope_required(*scopes):
"""
Test for specific scopes that the access token has been authenticated for before
processing the request and eventual response.
The scopes that are passed in determine how the decorator will respond to incoming
requests:
- If no scopes are passed in the argument... | [
"def",
"scope_required",
"(",
"*",
"scopes",
")",
":",
"def",
"decorator",
"(",
"view_func",
")",
":",
"@",
"wraps",
"(",
"view_func",
",",
"assigned",
"=",
"available_attrs",
"(",
"view_func",
")",
")",
"def",
"_wrapped_view",
"(",
"request",
",",
"*",
... | Test for specific scopes that the access token has been authenticated for before
processing the request and eventual response.
The scopes that are passed in determine how the decorator will respond to incoming
requests:
- If no scopes are passed in the arguments, the decorator will test for any availa... | [
"Test",
"for",
"specific",
"scopes",
"that",
"the",
"access",
"token",
"has",
"been",
"authenticated",
"for",
"before",
"processing",
"the",
"request",
"and",
"eventual",
"response",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/decorators.py#L7-L77 |
53,341 | laplacesdemon/django-social-friends-finder | social_friends_finder/views.py | FriendListView.get | def get(self, request, provider=None):
"""prepare the social friend model"""
# Get the social auth connections
if USING_ALLAUTH:
self.social_auths = request.user.socialaccount_set.all()
else:
self.social_auths = request.user.social_auth.all()
... | python | def get(self, request, provider=None):
"""prepare the social friend model"""
# Get the social auth connections
if USING_ALLAUTH:
self.social_auths = request.user.socialaccount_set.all()
else:
self.social_auths = request.user.social_auth.all()
... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"provider",
"=",
"None",
")",
":",
"# Get the social auth connections",
"if",
"USING_ALLAUTH",
":",
"self",
".",
"social_auths",
"=",
"request",
".",
"user",
".",
"socialaccount_set",
".",
"all",
"(",
")",
"els... | prepare the social friend model | [
"prepare",
"the",
"social",
"friend",
"model"
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/views.py#L22-L41 |
53,342 | laplacesdemon/django-social-friends-finder | social_friends_finder/views.py | FriendListView.get_context_data | def get_context_data(self, **kwargs):
"""
checks if there is SocialFrind model record for the user
if not attempt to create one
if all fail, redirects to the next page
"""
context = super(FriendListView, self).get_context_data(**kwargs)
friends = []
for f... | python | def get_context_data(self, **kwargs):
"""
checks if there is SocialFrind model record for the user
if not attempt to create one
if all fail, redirects to the next page
"""
context = super(FriendListView, self).get_context_data(**kwargs)
friends = []
for f... | [
"def",
"get_context_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"context",
"=",
"super",
"(",
"FriendListView",
",",
"self",
")",
".",
"get_context_data",
"(",
"*",
"*",
"kwargs",
")",
"friends",
"=",
"[",
"]",
"for",
"friend_list",
"in",
"s... | checks if there is SocialFrind model record for the user
if not attempt to create one
if all fail, redirects to the next page | [
"checks",
"if",
"there",
"is",
"SocialFrind",
"model",
"record",
"for",
"the",
"user",
"if",
"not",
"attempt",
"to",
"create",
"one",
"if",
"all",
"fail",
"redirects",
"to",
"the",
"next",
"page"
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/views.py#L43-L65 |
53,343 | signalpillar/tox-battery | toxbat/requirements.py | are_requirements_changed | def are_requirements_changed(config):
"""Check if any of the requirement files used by testenv is updated.
:param tox.config.TestenvConfig config: Configuration object to observe.
:rtype: bool
"""
deps = (dep.name for dep in config.deps)
def build_fpath_for_previous_version(fname):
tox... | python | def are_requirements_changed(config):
"""Check if any of the requirement files used by testenv is updated.
:param tox.config.TestenvConfig config: Configuration object to observe.
:rtype: bool
"""
deps = (dep.name for dep in config.deps)
def build_fpath_for_previous_version(fname):
tox... | [
"def",
"are_requirements_changed",
"(",
"config",
")",
":",
"deps",
"=",
"(",
"dep",
".",
"name",
"for",
"dep",
"in",
"config",
".",
"deps",
")",
"def",
"build_fpath_for_previous_version",
"(",
"fname",
")",
":",
"tox_dir",
"=",
"config",
".",
"config",
".... | Check if any of the requirement files used by testenv is updated.
:param tox.config.TestenvConfig config: Configuration object to observe.
:rtype: bool | [
"Check",
"if",
"any",
"of",
"the",
"requirement",
"files",
"used",
"by",
"testenv",
"is",
"updated",
"."
] | 110c931c4cb7b803f2637f8f4a0feae1593f5522 | https://github.com/signalpillar/tox-battery/blob/110c931c4cb7b803f2637f8f4a0feae1593f5522/toxbat/requirements.py#L74-L92 |
53,344 | signalpillar/tox-battery | toxbat/requirements.py | parse_pip_requirements | def parse_pip_requirements(requirement_file_path):
"""
Parses requirements using the pip API.
:param str requirement_file_path: path of the requirement file to parse.
:returns list: list of requirements
"""
return sorted(
str(r.req)
for r in parse_requirements(requirement_file_p... | python | def parse_pip_requirements(requirement_file_path):
"""
Parses requirements using the pip API.
:param str requirement_file_path: path of the requirement file to parse.
:returns list: list of requirements
"""
return sorted(
str(r.req)
for r in parse_requirements(requirement_file_p... | [
"def",
"parse_pip_requirements",
"(",
"requirement_file_path",
")",
":",
"return",
"sorted",
"(",
"str",
"(",
"r",
".",
"req",
")",
"for",
"r",
"in",
"parse_requirements",
"(",
"requirement_file_path",
",",
"session",
"=",
"PipSession",
"(",
")",
")",
"if",
... | Parses requirements using the pip API.
:param str requirement_file_path: path of the requirement file to parse.
:returns list: list of requirements | [
"Parses",
"requirements",
"using",
"the",
"pip",
"API",
"."
] | 110c931c4cb7b803f2637f8f4a0feae1593f5522 | https://github.com/signalpillar/tox-battery/blob/110c931c4cb7b803f2637f8f4a0feae1593f5522/toxbat/requirements.py#L95-L107 |
53,345 | signalpillar/tox-battery | toxbat/requirements.py | is_changed | def is_changed(fpath, prev_version_fpath):
"""Check requirements file is updated relatively to prev. version of the file.
:param str fpath: Path to the requirements file.
:param str prev_version_fpath: Path to the prev. version requirements file.
:rtype: bool
:raise ValueError: Requirements file do... | python | def is_changed(fpath, prev_version_fpath):
"""Check requirements file is updated relatively to prev. version of the file.
:param str fpath: Path to the requirements file.
:param str prev_version_fpath: Path to the prev. version requirements file.
:rtype: bool
:raise ValueError: Requirements file do... | [
"def",
"is_changed",
"(",
"fpath",
",",
"prev_version_fpath",
")",
":",
"if",
"not",
"(",
"fpath",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"fpath",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"Requirements file {0!r} doesn't exist.\"",
".",
"format",
... | Check requirements file is updated relatively to prev. version of the file.
:param str fpath: Path to the requirements file.
:param str prev_version_fpath: Path to the prev. version requirements file.
:rtype: bool
:raise ValueError: Requirements file doesn't exist. | [
"Check",
"requirements",
"file",
"is",
"updated",
"relatively",
"to",
"prev",
".",
"version",
"of",
"the",
"file",
"."
] | 110c931c4cb7b803f2637f8f4a0feae1593f5522 | https://github.com/signalpillar/tox-battery/blob/110c931c4cb7b803f2637f8f4a0feae1593f5522/toxbat/requirements.py#L110-L143 |
53,346 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Objects.py | Key.check_player_collision | def check_player_collision(self):
"""Check to see if we are colliding with the player."""
player_tiles = r.TileMapManager.active_map.grab_collisions(self.char.coords)
enemy_tiles = r.TileMapManager.active_map.grab_collisions(self.coords)
#Check to see if any of the tiles are the same. I... | python | def check_player_collision(self):
"""Check to see if we are colliding with the player."""
player_tiles = r.TileMapManager.active_map.grab_collisions(self.char.coords)
enemy_tiles = r.TileMapManager.active_map.grab_collisions(self.coords)
#Check to see if any of the tiles are the same. I... | [
"def",
"check_player_collision",
"(",
"self",
")",
":",
"player_tiles",
"=",
"r",
".",
"TileMapManager",
".",
"active_map",
".",
"grab_collisions",
"(",
"self",
".",
"char",
".",
"coords",
")",
"enemy_tiles",
"=",
"r",
".",
"TileMapManager",
".",
"active_map",... | Check to see if we are colliding with the player. | [
"Check",
"to",
"see",
"if",
"we",
"are",
"colliding",
"with",
"the",
"player",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Objects.py#L9-L20 |
53,347 | tfeldmann/python-raumfeld | raumfeld/__init__.py | discover | def discover(timeout=1, retries=1):
"""Discover Raumfeld devices in the network
:param timeout: The timeout in seconds
:param retries: How often the search should be retried
:returns: A list of raumfeld devices, sorted by name
"""
locations = []
group = ('239.255.255.250', 1900)
... | python | def discover(timeout=1, retries=1):
"""Discover Raumfeld devices in the network
:param timeout: The timeout in seconds
:param retries: How often the search should be retried
:returns: A list of raumfeld devices, sorted by name
"""
locations = []
group = ('239.255.255.250', 1900)
... | [
"def",
"discover",
"(",
"timeout",
"=",
"1",
",",
"retries",
"=",
"1",
")",
":",
"locations",
"=",
"[",
"]",
"group",
"=",
"(",
"'239.255.255.250'",
",",
"1900",
")",
"service",
"=",
"'ssdp:urn:schemas-upnp-org:device:MediaRenderer:1'",
"# 'ssdp:all'",
"message"... | Discover Raumfeld devices in the network
:param timeout: The timeout in seconds
:param retries: How often the search should be retried
:returns: A list of raumfeld devices, sorted by name | [
"Discover",
"Raumfeld",
"devices",
"in",
"the",
"network"
] | 801c7c96b49ced982e1acb1743844db037ec09a4 | https://github.com/tfeldmann/python-raumfeld/blob/801c7c96b49ced982e1acb1743844db037ec09a4/raumfeld/__init__.py#L21-L65 |
53,348 | luizalabs/ramos | ramos/pool.py | BackendPool.get | def get(cls, backend_id):
"""
Return an instance of backend type
"""
for backend_class in cls._get_backends_classes():
if backend_class.id == backend_id:
return backend_class.create()
raise InvalidBackendError(
cls.backend_type,
... | python | def get(cls, backend_id):
"""
Return an instance of backend type
"""
for backend_class in cls._get_backends_classes():
if backend_class.id == backend_id:
return backend_class.create()
raise InvalidBackendError(
cls.backend_type,
... | [
"def",
"get",
"(",
"cls",
",",
"backend_id",
")",
":",
"for",
"backend_class",
"in",
"cls",
".",
"_get_backends_classes",
"(",
")",
":",
"if",
"backend_class",
".",
"id",
"==",
"backend_id",
":",
"return",
"backend_class",
".",
"create",
"(",
")",
"raise",... | Return an instance of backend type | [
"Return",
"an",
"instance",
"of",
"backend",
"type"
] | 1bafbcd38824e6e2ae51927064efb66b1ea3325c | https://github.com/luizalabs/ramos/blob/1bafbcd38824e6e2ae51927064efb66b1ea3325c/ramos/pool.py#L15-L28 |
53,349 | laplacesdemon/django-social-friends-finder | social_friends_finder/backends/google_backend.py | GoogleFriendsProvider.fetch_friends | def fetch_friends(self, user):
"""
fetches the friends from g+ using the
information on django-social-auth models
user is an instance of UserSocialAuth.
Notice that g+ contact api should be enabled in
google cloud console and social auth scope has been set
this wa... | python | def fetch_friends(self, user):
"""
fetches the friends from g+ using the
information on django-social-auth models
user is an instance of UserSocialAuth.
Notice that g+ contact api should be enabled in
google cloud console and social auth scope has been set
this wa... | [
"def",
"fetch_friends",
"(",
"self",
",",
"user",
")",
":",
"if",
"USING_ALLAUTH",
":",
"social_app",
"=",
"SocialApp",
".",
"objects",
".",
"get_current",
"(",
"'google'",
")",
"oauth_token",
"=",
"SocialToken",
".",
"objects",
".",
"get",
"(",
"account",
... | fetches the friends from g+ using the
information on django-social-auth models
user is an instance of UserSocialAuth.
Notice that g+ contact api should be enabled in
google cloud console and social auth scope has been set
this way in settings.py
GOOGLE_OAUTH_EXTRA_SCOPE ... | [
"fetches",
"the",
"friends",
"from",
"g",
"+",
"using",
"the",
"information",
"on",
"django",
"-",
"social",
"-",
"auth",
"models",
"user",
"is",
"an",
"instance",
"of",
"UserSocialAuth",
".",
"Notice",
"that",
"g",
"+",
"contact",
"api",
"should",
"be",
... | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/backends/google_backend.py#L21-L57 |
53,350 | laplacesdemon/django-social-friends-finder | social_friends_finder/backends/google_backend.py | GoogleFriendsProvider.fetch_friend_ids | def fetch_friend_ids(self, user):
"""
fetches friend email's from g+
Return:
collection of friend emails (ids)
"""
friends = self.fetch_friends(user)
return [friend['ns1_email']['address']
for friend in friends
if 'ns1_email' ... | python | def fetch_friend_ids(self, user):
"""
fetches friend email's from g+
Return:
collection of friend emails (ids)
"""
friends = self.fetch_friends(user)
return [friend['ns1_email']['address']
for friend in friends
if 'ns1_email' ... | [
"def",
"fetch_friend_ids",
"(",
"self",
",",
"user",
")",
":",
"friends",
"=",
"self",
".",
"fetch_friends",
"(",
"user",
")",
"return",
"[",
"friend",
"[",
"'ns1_email'",
"]",
"[",
"'address'",
"]",
"for",
"friend",
"in",
"friends",
"if",
"'ns1_email'",
... | fetches friend email's from g+
Return:
collection of friend emails (ids) | [
"fetches",
"friend",
"email",
"s",
"from",
"g",
"+"
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/backends/google_backend.py#L59-L70 |
53,351 | Rediker-Software/doac | doac/views.py | OAuthView.handle_exception | def handle_exception(self, exception):
"""
Handle a unspecified exception and return the correct method that should be used
for handling it.
If the exception has the `can_redirect` property set to False, it is
rendered to the browser. Otherwise, it will be redirected to the loc... | python | def handle_exception(self, exception):
"""
Handle a unspecified exception and return the correct method that should be used
for handling it.
If the exception has the `can_redirect` property set to False, it is
rendered to the browser. Otherwise, it will be redirected to the loc... | [
"def",
"handle_exception",
"(",
"self",
",",
"exception",
")",
":",
"can_redirect",
"=",
"getattr",
"(",
"exception",
",",
"\"can_redirect\"",
",",
"True",
")",
"redirect_uri",
"=",
"getattr",
"(",
"self",
",",
"\"redirect_uri\"",
",",
"None",
")",
"if",
"ca... | Handle a unspecified exception and return the correct method that should be used
for handling it.
If the exception has the `can_redirect` property set to False, it is
rendered to the browser. Otherwise, it will be redirected to the location
provided in the `RedirectUri` object that is ... | [
"Handle",
"a",
"unspecified",
"exception",
"and",
"return",
"the",
"correct",
"method",
"that",
"should",
"be",
"used",
"for",
"handling",
"it",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/views.py#L22-L38 |
53,352 | Rediker-Software/doac | doac/views.py | OAuthView.redirect_exception | def redirect_exception(self, exception):
"""
Build the query string for the exception and return a redirect to the
redirect uri that was associated with the request.
"""
from django.http import QueryDict, HttpResponseRedirect
query = QueryDict("").copy()
query["... | python | def redirect_exception(self, exception):
"""
Build the query string for the exception and return a redirect to the
redirect uri that was associated with the request.
"""
from django.http import QueryDict, HttpResponseRedirect
query = QueryDict("").copy()
query["... | [
"def",
"redirect_exception",
"(",
"self",
",",
"exception",
")",
":",
"from",
"django",
".",
"http",
"import",
"QueryDict",
",",
"HttpResponseRedirect",
"query",
"=",
"QueryDict",
"(",
"\"\"",
")",
".",
"copy",
"(",
")",
"query",
"[",
"\"error\"",
"]",
"="... | Build the query string for the exception and return a redirect to the
redirect uri that was associated with the request. | [
"Build",
"the",
"query",
"string",
"for",
"the",
"exception",
"and",
"return",
"a",
"redirect",
"to",
"the",
"redirect",
"uri",
"that",
"was",
"associated",
"with",
"the",
"request",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/views.py#L40-L53 |
53,353 | Rediker-Software/doac | doac/views.py | OAuthView.render_exception_js | def render_exception_js(self, exception):
"""
Return a response with the body containing a JSON-formatter version of the exception.
"""
from .http import JsonResponse
response = {}
response["error"] = exception.error
response["error_description"] = exception.rea... | python | def render_exception_js(self, exception):
"""
Return a response with the body containing a JSON-formatter version of the exception.
"""
from .http import JsonResponse
response = {}
response["error"] = exception.error
response["error_description"] = exception.rea... | [
"def",
"render_exception_js",
"(",
"self",
",",
"exception",
")",
":",
"from",
".",
"http",
"import",
"JsonResponse",
"response",
"=",
"{",
"}",
"response",
"[",
"\"error\"",
"]",
"=",
"exception",
".",
"error",
"response",
"[",
"\"error_description\"",
"]",
... | Return a response with the body containing a JSON-formatter version of the exception. | [
"Return",
"a",
"response",
"with",
"the",
"body",
"containing",
"a",
"JSON",
"-",
"formatter",
"version",
"of",
"the",
"exception",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/views.py#L64-L75 |
53,354 | Rediker-Software/doac | doac/views.py | OAuthView.verify_dictionary | def verify_dictionary(self, dict, *args):
"""
Based on a provided `dict`, validate all of the contents of that dictionary that are
provided.
For each argument provided that isn't the dictionary, this will set the raw value of
that key as the instance variable of the same name. ... | python | def verify_dictionary(self, dict, *args):
"""
Based on a provided `dict`, validate all of the contents of that dictionary that are
provided.
For each argument provided that isn't the dictionary, this will set the raw value of
that key as the instance variable of the same name. ... | [
"def",
"verify_dictionary",
"(",
"self",
",",
"dict",
",",
"*",
"args",
")",
":",
"for",
"arg",
"in",
"args",
":",
"setattr",
"(",
"self",
",",
"arg",
",",
"dict",
".",
"get",
"(",
"arg",
",",
"None",
")",
")",
"if",
"hasattr",
"(",
"self",
",",
... | Based on a provided `dict`, validate all of the contents of that dictionary that are
provided.
For each argument provided that isn't the dictionary, this will set the raw value of
that key as the instance variable of the same name. It will then call the verification
function named `ver... | [
"Based",
"on",
"a",
"provided",
"dict",
"validate",
"all",
"of",
"the",
"contents",
"of",
"that",
"dictionary",
"that",
"are",
"provided",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/views.py#L77-L92 |
53,355 | Rediker-Software/doac | doac/views.py | OAuthView.verify_client_id | def verify_client_id(self):
"""
Verify a provided client id against the database and set the `Client` object that is
associated with it to `self.client`.
TODO: Document all of the thrown exceptions.
"""
from .models import Client
from .exceptions.invalid_client ... | python | def verify_client_id(self):
"""
Verify a provided client id against the database and set the `Client` object that is
associated with it to `self.client`.
TODO: Document all of the thrown exceptions.
"""
from .models import Client
from .exceptions.invalid_client ... | [
"def",
"verify_client_id",
"(",
"self",
")",
":",
"from",
".",
"models",
"import",
"Client",
"from",
".",
"exceptions",
".",
"invalid_client",
"import",
"ClientDoesNotExist",
"from",
".",
"exceptions",
".",
"invalid_request",
"import",
"ClientNotProvided",
"if",
"... | Verify a provided client id against the database and set the `Client` object that is
associated with it to `self.client`.
TODO: Document all of the thrown exceptions. | [
"Verify",
"a",
"provided",
"client",
"id",
"against",
"the",
"database",
"and",
"set",
"the",
"Client",
"object",
"that",
"is",
"associated",
"with",
"it",
"to",
"self",
".",
"client",
"."
] | 398fdd64452e4ff8662297b0381926addd77505a | https://github.com/Rediker-Software/doac/blob/398fdd64452e4ff8662297b0381926addd77505a/doac/views.py#L94-L113 |
53,356 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Vector2.normalize | def normalize(self):
"""Gets the normalized Vector"""
length = self.length()
if length > 0:
self.X /= length
self.Y /= length
else:
print "Length 0, cannot normalize." | python | def normalize(self):
"""Gets the normalized Vector"""
length = self.length()
if length > 0:
self.X /= length
self.Y /= length
else:
print "Length 0, cannot normalize." | [
"def",
"normalize",
"(",
"self",
")",
":",
"length",
"=",
"self",
".",
"length",
"(",
")",
"if",
"length",
">",
"0",
":",
"self",
".",
"X",
"/=",
"length",
"self",
".",
"Y",
"/=",
"length",
"else",
":",
"print",
"\"Length 0, cannot normalize.\""
] | Gets the normalized Vector | [
"Gets",
"the",
"normalized",
"Vector"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L139-L146 |
53,357 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Matrix4.is_identity | def is_identity():
"""Check to see if this matrix is an identity matrix."""
for index, row in enumerate(self.dta):
if row[index] == 1:
for num, element in enumerate(row):
if num != index:
if element != 0:
... | python | def is_identity():
"""Check to see if this matrix is an identity matrix."""
for index, row in enumerate(self.dta):
if row[index] == 1:
for num, element in enumerate(row):
if num != index:
if element != 0:
... | [
"def",
"is_identity",
"(",
")",
":",
"for",
"index",
",",
"row",
"in",
"enumerate",
"(",
"self",
".",
"dta",
")",
":",
"if",
"row",
"[",
"index",
"]",
"==",
"1",
":",
"for",
"num",
",",
"element",
"in",
"enumerate",
"(",
"row",
")",
":",
"if",
... | Check to see if this matrix is an identity matrix. | [
"Check",
"to",
"see",
"if",
"this",
"matrix",
"is",
"an",
"identity",
"matrix",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L860-L871 |
53,358 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Ragnarok.run | def run(self):
"""Start the game loop"""
global world
self.__is_running = True
while(self.__is_running):
#Our game loop
#Catch our events
self.__handle_events()
#Update our clock
self.__clock.tick(self.preferred_fps)
... | python | def run(self):
"""Start the game loop"""
global world
self.__is_running = True
while(self.__is_running):
#Our game loop
#Catch our events
self.__handle_events()
#Update our clock
self.__clock.tick(self.preferred_fps)
... | [
"def",
"run",
"(",
"self",
")",
":",
"global",
"world",
"self",
".",
"__is_running",
"=",
"True",
"while",
"(",
"self",
".",
"__is_running",
")",
":",
"#Our game loop",
"#Catch our events",
"self",
".",
"__handle_events",
"(",
")",
"#Update our clock",
"self",... | Start the game loop | [
"Start",
"the",
"game",
"loop"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L1019-L1051 |
53,359 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Pool.request_object | def request_object(self):
"""Grab an object from the pool. If the pool is empty, a new object will be generated and returned."""
obj_to_return = None
if self.queue.count > 0:
obj_to_return = self.__dequeue()
else:
#The queue is empty, generate a new item.
... | python | def request_object(self):
"""Grab an object from the pool. If the pool is empty, a new object will be generated and returned."""
obj_to_return = None
if self.queue.count > 0:
obj_to_return = self.__dequeue()
else:
#The queue is empty, generate a new item.
... | [
"def",
"request_object",
"(",
"self",
")",
":",
"obj_to_return",
"=",
"None",
"if",
"self",
".",
"queue",
".",
"count",
">",
"0",
":",
"obj_to_return",
"=",
"self",
".",
"__dequeue",
"(",
")",
"else",
":",
"#The queue is empty, generate a new item.",
"self",
... | Grab an object from the pool. If the pool is empty, a new object will be generated and returned. | [
"Grab",
"an",
"object",
"from",
"the",
"pool",
".",
"If",
"the",
"pool",
"is",
"empty",
"a",
"new",
"object",
"will",
"be",
"generated",
"and",
"returned",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L1097-L1107 |
53,360 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Sprite.apply_texture | def apply_texture(self, image):
"""Place a preexisting texture as the sprite's texture."""
self.image = image.convert_alpha()
self.untransformed_image = self.image.copy()
## self.rect.x = 0
## self.rect.y = 0
## self.rect.width = self.image.get_width()
## self.rect.he... | python | def apply_texture(self, image):
"""Place a preexisting texture as the sprite's texture."""
self.image = image.convert_alpha()
self.untransformed_image = self.image.copy()
## self.rect.x = 0
## self.rect.y = 0
## self.rect.width = self.image.get_width()
## self.rect.he... | [
"def",
"apply_texture",
"(",
"self",
",",
"image",
")",
":",
"self",
".",
"image",
"=",
"image",
".",
"convert_alpha",
"(",
")",
"self",
".",
"untransformed_image",
"=",
"self",
".",
"image",
".",
"copy",
"(",
")",
"## self.rect.x = 0",
"## sel... | Place a preexisting texture as the sprite's texture. | [
"Place",
"a",
"preexisting",
"texture",
"as",
"the",
"sprite",
"s",
"texture",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L1288-L1302 |
53,361 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Sprite.__resize_surface_extents | def __resize_surface_extents(self):
"""Handles surface cleanup once a scale or rotation operation has been performed."""
#Set the new location of the origin, as the surface size may increase with rotation
self.__origin.X = self.image.get_width() * self.__untransformed_nor_origin.X
self._... | python | def __resize_surface_extents(self):
"""Handles surface cleanup once a scale or rotation operation has been performed."""
#Set the new location of the origin, as the surface size may increase with rotation
self.__origin.X = self.image.get_width() * self.__untransformed_nor_origin.X
self._... | [
"def",
"__resize_surface_extents",
"(",
"self",
")",
":",
"#Set the new location of the origin, as the surface size may increase with rotation",
"self",
".",
"__origin",
".",
"X",
"=",
"self",
".",
"image",
".",
"get_width",
"(",
")",
"*",
"self",
".",
"__untransformed_... | Handles surface cleanup once a scale or rotation operation has been performed. | [
"Handles",
"surface",
"cleanup",
"once",
"a",
"scale",
"or",
"rotation",
"operation",
"has",
"been",
"performed",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L1306-L1320 |
53,362 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Sprite.__execute_scale | def __execute_scale(self, surface, size_to_scale_from):
"""Execute the scaling operation"""
x = size_to_scale_from[0] * self.__scale[0]
y = size_to_scale_from[1] * self.__scale[1]
scaled_value = (int(x), int(y))
## #Find out what scaling technique we should use.
## if self... | python | def __execute_scale(self, surface, size_to_scale_from):
"""Execute the scaling operation"""
x = size_to_scale_from[0] * self.__scale[0]
y = size_to_scale_from[1] * self.__scale[1]
scaled_value = (int(x), int(y))
## #Find out what scaling technique we should use.
## if self... | [
"def",
"__execute_scale",
"(",
"self",
",",
"surface",
",",
"size_to_scale_from",
")",
":",
"x",
"=",
"size_to_scale_from",
"[",
"0",
"]",
"*",
"self",
".",
"__scale",
"[",
"0",
"]",
"y",
"=",
"size_to_scale_from",
"[",
"1",
"]",
"*",
"self",
".",
"__s... | Execute the scaling operation | [
"Execute",
"the",
"scaling",
"operation"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L1322-L1336 |
53,363 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | BoundingCircle.is_colliding | def is_colliding(self, other):
"""Check to see if two circles are colliding."""
if isinstance(other, BoundingCircle):
#Calculate the distance between two circles.
distance = Vector2.distance(self.coords, other.coords)
#Check to see if the sum of thier radi are greate... | python | def is_colliding(self, other):
"""Check to see if two circles are colliding."""
if isinstance(other, BoundingCircle):
#Calculate the distance between two circles.
distance = Vector2.distance(self.coords, other.coords)
#Check to see if the sum of thier radi are greate... | [
"def",
"is_colliding",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"BoundingCircle",
")",
":",
"#Calculate the distance between two circles.",
"distance",
"=",
"Vector2",
".",
"distance",
"(",
"self",
".",
"coords",
",",
"other",
... | Check to see if two circles are colliding. | [
"Check",
"to",
"see",
"if",
"two",
"circles",
"are",
"colliding",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L1974-L1990 |
53,364 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | CollisionManager.query_all_collisions | def query_all_collisions(collision_object):
"""
Check for and return the full list of objects colliding with collision_object
"""
global collidable_objects
colliding = []
for obj in collidable_objects:
#Make sure we don't check ourself against ourself.
... | python | def query_all_collisions(collision_object):
"""
Check for and return the full list of objects colliding with collision_object
"""
global collidable_objects
colliding = []
for obj in collidable_objects:
#Make sure we don't check ourself against ourself.
... | [
"def",
"query_all_collisions",
"(",
"collision_object",
")",
":",
"global",
"collidable_objects",
"colliding",
"=",
"[",
"]",
"for",
"obj",
"in",
"collidable_objects",
":",
"#Make sure we don't check ourself against ourself.",
"if",
"obj",
"is",
"not",
"collision_object",... | Check for and return the full list of objects colliding with collision_object | [
"Check",
"for",
"and",
"return",
"the",
"full",
"list",
"of",
"objects",
"colliding",
"with",
"collision_object"
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2077-L2090 |
53,365 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | CollisionManager.run_brute | def run_brute(self):
"""
A nightmare if looked at by a performance standpoint, but it gets the job done,
at least for now.
Checks everything against everything and handles all collision reactions.
"""
global collidable_objects
if self.collision_depth == self.SHAL... | python | def run_brute(self):
"""
A nightmare if looked at by a performance standpoint, but it gets the job done,
at least for now.
Checks everything against everything and handles all collision reactions.
"""
global collidable_objects
if self.collision_depth == self.SHAL... | [
"def",
"run_brute",
"(",
"self",
")",
":",
"global",
"collidable_objects",
"if",
"self",
".",
"collision_depth",
"==",
"self",
".",
"SHALLOW_DEPTH",
":",
"for",
"obj",
"in",
"collidable_objects",
":",
"collision",
"=",
"self",
".",
"query_collision",
"(",
"obj... | A nightmare if looked at by a performance standpoint, but it gets the job done,
at least for now.
Checks everything against everything and handles all collision reactions. | [
"A",
"nightmare",
"if",
"looked",
"at",
"by",
"a",
"performance",
"standpoint",
"but",
"it",
"gets",
"the",
"job",
"done",
"at",
"least",
"for",
"now",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2092-L2113 |
53,366 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | GUIMenu.set_keyboard_focus | def set_keyboard_focus(self, move_up, move_down, select):
"""
Set the keyboard as the object that controls the menu.
move_up is from the pygame.KEYS enum that defines what button causes the menu selection to move up.
move_down is from the pygame.KEYS enum that defines what button causes ... | python | def set_keyboard_focus(self, move_up, move_down, select):
"""
Set the keyboard as the object that controls the menu.
move_up is from the pygame.KEYS enum that defines what button causes the menu selection to move up.
move_down is from the pygame.KEYS enum that defines what button causes ... | [
"def",
"set_keyboard_focus",
"(",
"self",
",",
"move_up",
",",
"move_down",
",",
"select",
")",
":",
"self",
".",
"input_focus",
"=",
"StateTypes",
".",
"KEYBOARD",
"self",
".",
"move_up_button",
"=",
"move_up",
"self",
".",
"move_down_button",
"=",
"move_down... | Set the keyboard as the object that controls the menu.
move_up is from the pygame.KEYS enum that defines what button causes the menu selection to move up.
move_down is from the pygame.KEYS enum that defines what button causes the menu selection to move down.
select is from the pygame.KEYS enum t... | [
"Set",
"the",
"keyboard",
"as",
"the",
"object",
"that",
"controls",
"the",
"menu",
".",
"move_up",
"is",
"from",
"the",
"pygame",
".",
"KEYS",
"enum",
"that",
"defines",
"what",
"button",
"causes",
"the",
"menu",
"selection",
"to",
"move",
"up",
".",
"m... | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2214-L2224 |
53,367 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | GUIMenu.__update_mouse | def __update_mouse(self, milliseconds):
"""
Use the mouse to control selection of the buttons.
"""
for button in self.gui_buttons:
was_hovering = button.is_mouse_hovering
button.update(milliseconds)
#Provides capibilities for the mouse to select a but... | python | def __update_mouse(self, milliseconds):
"""
Use the mouse to control selection of the buttons.
"""
for button in self.gui_buttons:
was_hovering = button.is_mouse_hovering
button.update(milliseconds)
#Provides capibilities for the mouse to select a but... | [
"def",
"__update_mouse",
"(",
"self",
",",
"milliseconds",
")",
":",
"for",
"button",
"in",
"self",
".",
"gui_buttons",
":",
"was_hovering",
"=",
"button",
".",
"is_mouse_hovering",
"button",
".",
"update",
"(",
"milliseconds",
")",
"#Provides capibilities for the... | Use the mouse to control selection of the buttons. | [
"Use",
"the",
"mouse",
"to",
"control",
"selection",
"of",
"the",
"buttons",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2270-L2286 |
53,368 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | Warp.warp_object | def warp_object(self, tileMapObj):
"""Warp the tile map object from one warp to another."""
print "Collision"
if tileMapObj.can_warp:
#Check to see if we need to load a different tile map
if self.map_association != self.exitWarp.map_association:
#Load the ... | python | def warp_object(self, tileMapObj):
"""Warp the tile map object from one warp to another."""
print "Collision"
if tileMapObj.can_warp:
#Check to see if we need to load a different tile map
if self.map_association != self.exitWarp.map_association:
#Load the ... | [
"def",
"warp_object",
"(",
"self",
",",
"tileMapObj",
")",
":",
"print",
"\"Collision\"",
"if",
"tileMapObj",
".",
"can_warp",
":",
"#Check to see if we need to load a different tile map",
"if",
"self",
".",
"map_association",
"!=",
"self",
".",
"exitWarp",
".",
"ma... | Warp the tile map object from one warp to another. | [
"Warp",
"the",
"tile",
"map",
"object",
"from",
"one",
"warp",
"to",
"another",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2474-L2483 |
53,369 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | TileMap.parse_collisions | def parse_collisions(self):
"""Parses the collision map and sets the tile states as necessary."""
fs = open(self.collisionmap_path, "r")
self.collisionmap = fs.readlines()
fs.close()
x_index = 0
y_index = 0
for line in self.collisionmap:
if line[0] is... | python | def parse_collisions(self):
"""Parses the collision map and sets the tile states as necessary."""
fs = open(self.collisionmap_path, "r")
self.collisionmap = fs.readlines()
fs.close()
x_index = 0
y_index = 0
for line in self.collisionmap:
if line[0] is... | [
"def",
"parse_collisions",
"(",
"self",
")",
":",
"fs",
"=",
"open",
"(",
"self",
".",
"collisionmap_path",
",",
"\"r\"",
")",
"self",
".",
"collisionmap",
"=",
"fs",
".",
"readlines",
"(",
")",
"fs",
".",
"close",
"(",
")",
"x_index",
"=",
"0",
"y_i... | Parses the collision map and sets the tile states as necessary. | [
"Parses",
"the",
"collision",
"map",
"and",
"sets",
"the",
"tile",
"states",
"as",
"necessary",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2616-L2644 |
53,370 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | TileMap.draw | def draw(self, milliseconds, surface):
"""Draw out the tilemap."""
self.drawn_rects = []
cam = Ragnarok.get_world().Camera
cX, cY, cXMax, cYMax = cam.get_cam_bounds()
#Draw out only the tiles visible to the camera.
start_pos = self.pixels_to_tiles( (cX, cY) )
sta... | python | def draw(self, milliseconds, surface):
"""Draw out the tilemap."""
self.drawn_rects = []
cam = Ragnarok.get_world().Camera
cX, cY, cXMax, cYMax = cam.get_cam_bounds()
#Draw out only the tiles visible to the camera.
start_pos = self.pixels_to_tiles( (cX, cY) )
sta... | [
"def",
"draw",
"(",
"self",
",",
"milliseconds",
",",
"surface",
")",
":",
"self",
".",
"drawn_rects",
"=",
"[",
"]",
"cam",
"=",
"Ragnarok",
".",
"get_world",
"(",
")",
".",
"Camera",
"cX",
",",
"cY",
",",
"cXMax",
",",
"cYMax",
"=",
"cam",
".",
... | Draw out the tilemap. | [
"Draw",
"out",
"the",
"tilemap",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L2768-L2789 |
53,371 | Scoppio/RagnarokEngine3 | Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py | World.draw | def draw(self, milliseconds):
"""Draws all of the objects in our world."""
cam = Ragnarok.get_world().Camera
camPos = cam.get_world_pos()
self.__sort_draw()
self.clear_backbuffer()
for obj in self.__draw_objects:
#Check to see if the object is visible to the c... | python | def draw(self, milliseconds):
"""Draws all of the objects in our world."""
cam = Ragnarok.get_world().Camera
camPos = cam.get_world_pos()
self.__sort_draw()
self.clear_backbuffer()
for obj in self.__draw_objects:
#Check to see if the object is visible to the c... | [
"def",
"draw",
"(",
"self",
",",
"milliseconds",
")",
":",
"cam",
"=",
"Ragnarok",
".",
"get_world",
"(",
")",
".",
"Camera",
"camPos",
"=",
"cam",
".",
"get_world_pos",
"(",
")",
"self",
".",
"__sort_draw",
"(",
")",
"self",
".",
"clear_backbuffer",
"... | Draws all of the objects in our world. | [
"Draws",
"all",
"of",
"the",
"objects",
"in",
"our",
"world",
"."
] | 4395d419ccd64fe9327c41f200b72ee0176ad896 | https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/Tutorials/Platforming Block - PyGame Release/Game/Code/Ragnarok.py#L3120-L3135 |
53,372 | vlukes/dicom2fem | dicom2fem/base.py | mark_time | def mark_time(times, msg=None):
"""
Time measurement utility.
Measures times of execution between subsequent calls using
time.clock(). The time is printed if the msg argument is not None.
Examples
--------
>>> times = []
>>> mark_time(times)
... do something
>>> mark_time(time... | python | def mark_time(times, msg=None):
"""
Time measurement utility.
Measures times of execution between subsequent calls using
time.clock(). The time is printed if the msg argument is not None.
Examples
--------
>>> times = []
>>> mark_time(times)
... do something
>>> mark_time(time... | [
"def",
"mark_time",
"(",
"times",
",",
"msg",
"=",
"None",
")",
":",
"tt",
"=",
"time",
".",
"clock",
"(",
")",
"times",
".",
"append",
"(",
"tt",
")",
"if",
"(",
"msg",
"is",
"not",
"None",
")",
"and",
"(",
"len",
"(",
"times",
")",
">",
"1"... | Time measurement utility.
Measures times of execution between subsequent calls using
time.clock(). The time is printed if the msg argument is not None.
Examples
--------
>>> times = []
>>> mark_time(times)
... do something
>>> mark_time(times, 'elapsed')
elapsed 0.1
... do som... | [
"Time",
"measurement",
"utility",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/base.py#L99-L123 |
53,373 | vlukes/dicom2fem | dicom2fem/base.py | import_file | def import_file(filename, package_name=None):
"""
Import a file as a module. The module is explicitly reloaded to
prevent undesirable interactions.
"""
path = os.path.dirname(filename)
if not path in sys.path:
sys.path.append( path )
remove_path = True
else:
remove_... | python | def import_file(filename, package_name=None):
"""
Import a file as a module. The module is explicitly reloaded to
prevent undesirable interactions.
"""
path = os.path.dirname(filename)
if not path in sys.path:
sys.path.append( path )
remove_path = True
else:
remove_... | [
"def",
"import_file",
"(",
"filename",
",",
"package_name",
"=",
"None",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"filename",
")",
"if",
"not",
"path",
"in",
"sys",
".",
"path",
":",
"sys",
".",
"path",
".",
"append",
"(",
"pa... | Import a file as a module. The module is explicitly reloaded to
prevent undesirable interactions. | [
"Import",
"a",
"file",
"as",
"a",
"module",
".",
"The",
"module",
"is",
"explicitly",
"reloaded",
"to",
"prevent",
"undesirable",
"interactions",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/base.py#L125-L159 |
53,374 | vlukes/dicom2fem | dicom2fem/base.py | pause | def pause( msg = None ):
"""
Prints the line number and waits for a keypress.
If you press:
"q" ............. it will call sys.exit()
any other key ... it will continue execution of the program
This is useful for debugging.
"""
f = sys._getframe(1)
ff = f.f_code
if (msg):
... | python | def pause( msg = None ):
"""
Prints the line number and waits for a keypress.
If you press:
"q" ............. it will call sys.exit()
any other key ... it will continue execution of the program
This is useful for debugging.
"""
f = sys._getframe(1)
ff = f.f_code
if (msg):
... | [
"def",
"pause",
"(",
"msg",
"=",
"None",
")",
":",
"f",
"=",
"sys",
".",
"_getframe",
"(",
"1",
")",
"ff",
"=",
"f",
".",
"f_code",
"if",
"(",
"msg",
")",
":",
"print",
"'%s, %d: %s(), %d: %s'",
"%",
"(",
"ff",
".",
"co_filename",
",",
"ff",
".",... | Prints the line number and waits for a keypress.
If you press:
"q" ............. it will call sys.exit()
any other key ... it will continue execution of the program
This is useful for debugging. | [
"Prints",
"the",
"line",
"number",
"and",
"waits",
"for",
"a",
"keypress",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/base.py#L200-L218 |
53,375 | vlukes/dicom2fem | dicom2fem/base.py | Struct.update | def update(self, other, **kwargs):
"""
A dict-like update for Struct attributes.
"""
if other is None: return
if not isinstance(other, dict):
other = other.to_dict()
self.__dict__.update(other, **kwargs) | python | def update(self, other, **kwargs):
"""
A dict-like update for Struct attributes.
"""
if other is None: return
if not isinstance(other, dict):
other = other.to_dict()
self.__dict__.update(other, **kwargs) | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"other",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"other",
",",
"dict",
")",
":",
"other",
"=",
"other",
".",
"to_dict",
"(",
")",
"self",
".... | A dict-like update for Struct attributes. | [
"A",
"dict",
"-",
"like",
"update",
"for",
"Struct",
"attributes",
"."
] | 3056c977ca7119e01984d3aa0c4448a1c6c2430f | https://github.com/vlukes/dicom2fem/blob/3056c977ca7119e01984d3aa0c4448a1c6c2430f/dicom2fem/base.py#L414-L422 |
53,376 | laplacesdemon/django-social-friends-finder | social_friends_finder/models.py | SocialFriendsManager.fetch_social_friend_ids | def fetch_social_friend_ids(self, social_auth_user):
"""
fetches the user's social friends from its provider
user is an instance of UserSocialAuth
returns collection of ids
this method can be used asynchronously as a background process (celery)
"""
# Type check
... | python | def fetch_social_friend_ids(self, social_auth_user):
"""
fetches the user's social friends from its provider
user is an instance of UserSocialAuth
returns collection of ids
this method can be used asynchronously as a background process (celery)
"""
# Type check
... | [
"def",
"fetch_social_friend_ids",
"(",
"self",
",",
"social_auth_user",
")",
":",
"# Type check",
"self",
".",
"assert_user_is_social_auth_user",
"(",
"social_auth_user",
")",
"# Get friend finder backend",
"friends_provider",
"=",
"SocialFriendsFinderBackendFactory",
".",
"g... | fetches the user's social friends from its provider
user is an instance of UserSocialAuth
returns collection of ids
this method can be used asynchronously as a background process (celery) | [
"fetches",
"the",
"user",
"s",
"social",
"friends",
"from",
"its",
"provider",
"user",
"is",
"an",
"instance",
"of",
"UserSocialAuth",
"returns",
"collection",
"of",
"ids"
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/models.py#L24-L42 |
53,377 | laplacesdemon/django-social-friends-finder | social_friends_finder/models.py | SocialFriendsManager.existing_social_friends | def existing_social_friends(self, user_social_auth=None, friend_ids=None):
"""
fetches and matches social friends
if friend_ids is None, then fetches them from social network
Return:
User collection
"""
# Type check
self.assert_user_is_social_auth_use... | python | def existing_social_friends(self, user_social_auth=None, friend_ids=None):
"""
fetches and matches social friends
if friend_ids is None, then fetches them from social network
Return:
User collection
"""
# Type check
self.assert_user_is_social_auth_use... | [
"def",
"existing_social_friends",
"(",
"self",
",",
"user_social_auth",
"=",
"None",
",",
"friend_ids",
"=",
"None",
")",
":",
"# Type check",
"self",
".",
"assert_user_is_social_auth_user",
"(",
"user_social_auth",
")",
"if",
"not",
"friend_ids",
":",
"friend_ids",... | fetches and matches social friends
if friend_ids is None, then fetches them from social network
Return:
User collection | [
"fetches",
"and",
"matches",
"social",
"friends",
"if",
"friend_ids",
"is",
"None",
"then",
"fetches",
"them",
"from",
"social",
"network"
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/models.py#L44-L66 |
53,378 | richardcornish/django-applepodcast | podcast/views.py | EpisodeDetailView.get_object | def get_object(self, queryset=None):
"""Return object with episode number attached to episode."""
if settings.PODCAST_SINGULAR:
show = get_object_or_404(Show, id=settings.PODCAST_ID)
else:
show = get_object_or_404(Show, slug=self.kwargs['show_slug'])
obj = get_obj... | python | def get_object(self, queryset=None):
"""Return object with episode number attached to episode."""
if settings.PODCAST_SINGULAR:
show = get_object_or_404(Show, id=settings.PODCAST_ID)
else:
show = get_object_or_404(Show, slug=self.kwargs['show_slug'])
obj = get_obj... | [
"def",
"get_object",
"(",
"self",
",",
"queryset",
"=",
"None",
")",
":",
"if",
"settings",
".",
"PODCAST_SINGULAR",
":",
"show",
"=",
"get_object_or_404",
"(",
"Show",
",",
"id",
"=",
"settings",
".",
"PODCAST_ID",
")",
"else",
":",
"show",
"=",
"get_ob... | Return object with episode number attached to episode. | [
"Return",
"object",
"with",
"episode",
"number",
"attached",
"to",
"episode",
"."
] | 50732acfbe1ca258e5afb44c117a6ac5fa0c1219 | https://github.com/richardcornish/django-applepodcast/blob/50732acfbe1ca258e5afb44c117a6ac5fa0c1219/podcast/views.py#L52-L63 |
53,379 | laplacesdemon/django-social-friends-finder | social_friends_finder/utils.py | SocialFriendsFinderBackendFactory.get_backend | def get_backend(self, backend_name):
"""
returns the given backend instance
"""
if backend_name == 'twitter':
from social_friends_finder.backends.twitter_backend import TwitterFriendsProvider
friends_provider = TwitterFriendsProvider()
elif backend_name ==... | python | def get_backend(self, backend_name):
"""
returns the given backend instance
"""
if backend_name == 'twitter':
from social_friends_finder.backends.twitter_backend import TwitterFriendsProvider
friends_provider = TwitterFriendsProvider()
elif backend_name ==... | [
"def",
"get_backend",
"(",
"self",
",",
"backend_name",
")",
":",
"if",
"backend_name",
"==",
"'twitter'",
":",
"from",
"social_friends_finder",
".",
"backends",
".",
"twitter_backend",
"import",
"TwitterFriendsProvider",
"friends_provider",
"=",
"TwitterFriendsProvider... | returns the given backend instance | [
"returns",
"the",
"given",
"backend",
"instance"
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/utils.py#L7-L23 |
53,380 | laplacesdemon/django-social-friends-finder | social_friends_finder/backends/vkontakte_backend.py | VKontakteFriendsProvider.fetch_friends | def fetch_friends(self, user):
"""
fethces friends from VKontakte using the access_token
fethched by django-social-auth.
Note - user isn't a user - it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth
Returns:
collection of friend objects ... | python | def fetch_friends(self, user):
"""
fethces friends from VKontakte using the access_token
fethched by django-social-auth.
Note - user isn't a user - it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth
Returns:
collection of friend objects ... | [
"def",
"fetch_friends",
"(",
"self",
",",
"user",
")",
":",
"if",
"USING_ALLAUTH",
":",
"raise",
"NotImplementedError",
"(",
"\"VKontakte support is not implemented for django-allauth\"",
")",
"#social_app = SocialApp.objects.get_current('vkontakte')",
"#oauth_token = SocialToken.o... | fethces friends from VKontakte using the access_token
fethched by django-social-auth.
Note - user isn't a user - it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth
Returns:
collection of friend objects fetched from VKontakte | [
"fethces",
"friends",
"from",
"VKontakte",
"using",
"the",
"access_token",
"fethched",
"by",
"django",
"-",
"social",
"-",
"auth",
"."
] | cad63349b19b3c301626c24420ace13c63f45ad7 | https://github.com/laplacesdemon/django-social-friends-finder/blob/cad63349b19b3c301626c24420ace13c63f45ad7/social_friends_finder/backends/vkontakte_backend.py#L14-L37 |
53,381 | richardcornish/django-applepodcast | podcast/utils.py | EscapeFriendlyXMLGenerator.addQuickElement | def addQuickElement(self, name, contents=None, attrs=None, escape=True, cdata=False):
"""Convenience method for adding an element with no children."""
if attrs is None:
attrs = {}
self.startElement(name, attrs)
if contents is not None:
self.characters(contents, es... | python | def addQuickElement(self, name, contents=None, attrs=None, escape=True, cdata=False):
"""Convenience method for adding an element with no children."""
if attrs is None:
attrs = {}
self.startElement(name, attrs)
if contents is not None:
self.characters(contents, es... | [
"def",
"addQuickElement",
"(",
"self",
",",
"name",
",",
"contents",
"=",
"None",
",",
"attrs",
"=",
"None",
",",
"escape",
"=",
"True",
",",
"cdata",
"=",
"False",
")",
":",
"if",
"attrs",
"is",
"None",
":",
"attrs",
"=",
"{",
"}",
"self",
".",
... | Convenience method for adding an element with no children. | [
"Convenience",
"method",
"for",
"adding",
"an",
"element",
"with",
"no",
"children",
"."
] | 50732acfbe1ca258e5afb44c117a6ac5fa0c1219 | https://github.com/richardcornish/django-applepodcast/blob/50732acfbe1ca258e5afb44c117a6ac5fa0c1219/podcast/utils.py#L31-L38 |
53,382 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile._setitem_with_key_seq | def _setitem_with_key_seq(self, key_seq, value):
"""
Sets a the value in the TOML file located by the given key sequence.
Example:
self._setitem(('key1', 'key2', 'key3'), 'text_value')
is equivalent to doing
self['key1']['key2']['key3'] = 'text_value'
"""
... | python | def _setitem_with_key_seq(self, key_seq, value):
"""
Sets a the value in the TOML file located by the given key sequence.
Example:
self._setitem(('key1', 'key2', 'key3'), 'text_value')
is equivalent to doing
self['key1']['key2']['key3'] = 'text_value'
"""
... | [
"def",
"_setitem_with_key_seq",
"(",
"self",
",",
"key_seq",
",",
"value",
")",
":",
"table",
"=",
"self",
"key_so_far",
"=",
"tuple",
"(",
")",
"for",
"key",
"in",
"key_seq",
"[",
":",
"-",
"1",
"]",
":",
"key_so_far",
"+=",
"(",
"key",
",",
")",
... | Sets a the value in the TOML file located by the given key sequence.
Example:
self._setitem(('key1', 'key2', 'key3'), 'text_value')
is equivalent to doing
self['key1']['key2']['key3'] = 'text_value' | [
"Sets",
"a",
"the",
"value",
"in",
"the",
"TOML",
"file",
"located",
"by",
"the",
"given",
"key",
"sequence",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L36-L51 |
53,383 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile._array_setitem_with_key_seq | def _array_setitem_with_key_seq(self, array_name, index, key_seq, value):
"""
Sets a the array value in the TOML file located by the given key sequence.
Example:
self._array_setitem(array_name, index, ('key1', 'key2', 'key3'), 'text_value')
is equivalent to doing
self.ar... | python | def _array_setitem_with_key_seq(self, array_name, index, key_seq, value):
"""
Sets a the array value in the TOML file located by the given key sequence.
Example:
self._array_setitem(array_name, index, ('key1', 'key2', 'key3'), 'text_value')
is equivalent to doing
self.ar... | [
"def",
"_array_setitem_with_key_seq",
"(",
"self",
",",
"array_name",
",",
"index",
",",
"key_seq",
",",
"value",
")",
":",
"table",
"=",
"self",
".",
"array",
"(",
"array_name",
")",
"[",
"index",
"]",
"key_so_far",
"=",
"tuple",
"(",
")",
"for",
"key",... | Sets a the array value in the TOML file located by the given key sequence.
Example:
self._array_setitem(array_name, index, ('key1', 'key2', 'key3'), 'text_value')
is equivalent to doing
self.array(array_name)[index]['key1']['key2']['key3'] = 'text_value' | [
"Sets",
"a",
"the",
"array",
"value",
"in",
"the",
"TOML",
"file",
"located",
"by",
"the",
"given",
"key",
"sequence",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L53-L71 |
53,384 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile._detect_toplevels | def _detect_toplevels(self):
"""
Returns a sequence of TopLevel instances for the current state of this table.
"""
return tuple(e for e in toplevels.identify(self.elements) if isinstance(e, toplevels.Table)) | python | def _detect_toplevels(self):
"""
Returns a sequence of TopLevel instances for the current state of this table.
"""
return tuple(e for e in toplevels.identify(self.elements) if isinstance(e, toplevels.Table)) | [
"def",
"_detect_toplevels",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"e",
"for",
"e",
"in",
"toplevels",
".",
"identify",
"(",
"self",
".",
"elements",
")",
"if",
"isinstance",
"(",
"e",
",",
"toplevels",
".",
"Table",
")",
")"
] | Returns a sequence of TopLevel instances for the current state of this table. | [
"Returns",
"a",
"sequence",
"of",
"TopLevel",
"instances",
"for",
"the",
"current",
"state",
"of",
"this",
"table",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L136-L140 |
53,385 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile._update_table_fallbacks | def _update_table_fallbacks(self, table_toplevels):
"""
Updates the fallbacks on all the table elements to make relative table access possible.
Raises DuplicateKeysError if appropriate.
"""
if len(self.elements) <= 1:
return
def parent_of(toplevel):
... | python | def _update_table_fallbacks(self, table_toplevels):
"""
Updates the fallbacks on all the table elements to make relative table access possible.
Raises DuplicateKeysError if appropriate.
"""
if len(self.elements) <= 1:
return
def parent_of(toplevel):
... | [
"def",
"_update_table_fallbacks",
"(",
"self",
",",
"table_toplevels",
")",
":",
"if",
"len",
"(",
"self",
".",
"elements",
")",
"<=",
"1",
":",
"return",
"def",
"parent_of",
"(",
"toplevel",
")",
":",
"# Returns an TopLevel parent of the given entry, or None.",
"... | Updates the fallbacks on all the table elements to make relative table access possible.
Raises DuplicateKeysError if appropriate. | [
"Updates",
"the",
"fallbacks",
"on",
"all",
"the",
"table",
"elements",
"to",
"make",
"relative",
"table",
"access",
"possible",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L142-L163 |
53,386 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile.array | def array(self, name):
"""
Returns the array of tables with the given name.
"""
if name in self._navigable:
if isinstance(self._navigable[name], (list, tuple)):
return self[name]
else:
raise NoArrayFoundError
else:
... | python | def array(self, name):
"""
Returns the array of tables with the given name.
"""
if name in self._navigable:
if isinstance(self._navigable[name], (list, tuple)):
return self[name]
else:
raise NoArrayFoundError
else:
... | [
"def",
"array",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_navigable",
":",
"if",
"isinstance",
"(",
"self",
".",
"_navigable",
"[",
"name",
"]",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"self",
"[",
"n... | Returns the array of tables with the given name. | [
"Returns",
"the",
"array",
"of",
"tables",
"with",
"the",
"given",
"name",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L169-L179 |
53,387 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile.append_elements | def append_elements(self, elements):
"""
Appends more elements to the contained internal elements.
"""
self._elements = self._elements + list(elements)
self._on_element_change() | python | def append_elements(self, elements):
"""
Appends more elements to the contained internal elements.
"""
self._elements = self._elements + list(elements)
self._on_element_change() | [
"def",
"append_elements",
"(",
"self",
",",
"elements",
")",
":",
"self",
".",
"_elements",
"=",
"self",
".",
"_elements",
"+",
"list",
"(",
"elements",
")",
"self",
".",
"_on_element_change",
"(",
")"
] | Appends more elements to the contained internal elements. | [
"Appends",
"more",
"elements",
"to",
"the",
"contained",
"internal",
"elements",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L187-L192 |
53,388 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile.prepend_elements | def prepend_elements(self, elements):
"""
Prepends more elements to the contained internal elements.
"""
self._elements = list(elements) + self._elements
self._on_element_change() | python | def prepend_elements(self, elements):
"""
Prepends more elements to the contained internal elements.
"""
self._elements = list(elements) + self._elements
self._on_element_change() | [
"def",
"prepend_elements",
"(",
"self",
",",
"elements",
")",
":",
"self",
".",
"_elements",
"=",
"list",
"(",
"elements",
")",
"+",
"self",
".",
"_elements",
"self",
".",
"_on_element_change",
"(",
")"
] | Prepends more elements to the contained internal elements. | [
"Prepends",
"more",
"elements",
"to",
"the",
"contained",
"internal",
"elements",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L194-L199 |
53,389 | jumpscale7/python-consistent-toml | contoml/file/file.py | TOMLFile.append_fresh_table | def append_fresh_table(self, fresh_table):
"""
Gets called by FreshTable instances when they get written to.
"""
if fresh_table.name:
elements = []
if fresh_table.is_array:
elements += [element_factory.create_array_of_tables_header_element(fresh_ta... | python | def append_fresh_table(self, fresh_table):
"""
Gets called by FreshTable instances when they get written to.
"""
if fresh_table.name:
elements = []
if fresh_table.is_array:
elements += [element_factory.create_array_of_tables_header_element(fresh_ta... | [
"def",
"append_fresh_table",
"(",
"self",
",",
"fresh_table",
")",
":",
"if",
"fresh_table",
".",
"name",
":",
"elements",
"=",
"[",
"]",
"if",
"fresh_table",
".",
"is_array",
":",
"elements",
"+=",
"[",
"element_factory",
".",
"create_array_of_tables_header_ele... | Gets called by FreshTable instances when they get written to. | [
"Gets",
"called",
"by",
"FreshTable",
"instances",
"when",
"they",
"get",
"written",
"to",
"."
] | a0149c65313ccb8170aa99a0cc498e76231292b9 | https://github.com/jumpscale7/python-consistent-toml/blob/a0149c65313ccb8170aa99a0cc498e76231292b9/contoml/file/file.py#L244-L260 |
53,390 | spantaleev/sftpman | sftpman/helper.py | shell_exec | def shell_exec(command):
"""Executes the given shell command and returns its output."""
out = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
return out.decode('utf-8') | python | def shell_exec(command):
"""Executes the given shell command and returns its output."""
out = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
return out.decode('utf-8') | [
"def",
"shell_exec",
"(",
"command",
")",
":",
"out",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT",
")",
".",
"communicate",
"... | Executes the given shell command and returns its output. | [
"Executes",
"the",
"given",
"shell",
"command",
"and",
"returns",
"its",
"output",
"."
] | e4fc3e3e3af975937469e0b8944ba62c01b12a47 | https://github.com/spantaleev/sftpman/blob/e4fc3e3e3af975937469e0b8944ba62c01b12a47/sftpman/helper.py#L43-L46 |
53,391 | inveniosoftware/invenio-i18n | invenio_i18n/selectors.py | get_locale | def get_locale():
"""Get locale.
Searches for locale in the following the order:
- User has specified a concrete language in the query string.
- Current session has a language set.
- User has a language set in the profile.
- Headers of the HTTP request.
- Default language from ``BABEL_DEFA... | python | def get_locale():
"""Get locale.
Searches for locale in the following the order:
- User has specified a concrete language in the query string.
- Current session has a language set.
- User has a language set in the profile.
- Headers of the HTTP request.
- Default language from ``BABEL_DEFA... | [
"def",
"get_locale",
"(",
")",
":",
"locales",
"=",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"current_app",
".",
"extensions",
"[",
"'invenio-i18n'",
"]",
".",
"get_languages",
"(",
")",
"]",
"# In the case of the user specifies a language for the resource.",
... | Get locale.
Searches for locale in the following the order:
- User has specified a concrete language in the query string.
- Current session has a language set.
- User has a language set in the profile.
- Headers of the HTTP request.
- Default language from ``BABEL_DEFAULT_LOCALE``.
Will o... | [
"Get",
"locale",
"."
] | 3119bb7db3369b8ae0aecce5d7d7c79f807e2763 | https://github.com/inveniosoftware/invenio-i18n/blob/3119bb7db3369b8ae0aecce5d7d7c79f807e2763/invenio_i18n/selectors.py#L23-L67 |
53,392 | vulndb/python-sdk | vulndb/db_vuln.py | DBVuln.from_file | def from_file(cls, db_file, language=DEFAULT_LANG):
"""
This is an alternative "constructor" for the DBVuln class which loads
the data from a file.
:param db_file: Contents of a json file from the DB
:param language: The user's language (en, es, etc.)
"""
data = ... | python | def from_file(cls, db_file, language=DEFAULT_LANG):
"""
This is an alternative "constructor" for the DBVuln class which loads
the data from a file.
:param db_file: Contents of a json file from the DB
:param language: The user's language (en, es, etc.)
"""
data = ... | [
"def",
"from_file",
"(",
"cls",
",",
"db_file",
",",
"language",
"=",
"DEFAULT_LANG",
")",
":",
"data",
"=",
"DBVuln",
".",
"load_from_json",
"(",
"db_file",
",",
"language",
"=",
"language",
")",
"return",
"cls",
"(",
"*",
"*",
"data",
")"
] | This is an alternative "constructor" for the DBVuln class which loads
the data from a file.
:param db_file: Contents of a json file from the DB
:param language: The user's language (en, es, etc.) | [
"This",
"is",
"an",
"alternative",
"constructor",
"for",
"the",
"DBVuln",
"class",
"which",
"loads",
"the",
"data",
"from",
"a",
"file",
"."
] | c8b1b2929235191a49aa4ca332abaf7447ee8667 | https://github.com/vulndb/python-sdk/blob/c8b1b2929235191a49aa4ca332abaf7447ee8667/vulndb/db_vuln.py#L77-L86 |
53,393 | vulndb/python-sdk | vulndb/db_vuln.py | DBVuln.from_id | def from_id(cls, _id, language=DEFAULT_LANG):
"""
This is an alternative "constructor" for the DBVuln class which searches
the db directory to find the right file for the provided _id
"""
db_file = DBVuln.get_file_for_id(_id, language=language)
data = DBVuln.load_from_jso... | python | def from_id(cls, _id, language=DEFAULT_LANG):
"""
This is an alternative "constructor" for the DBVuln class which searches
the db directory to find the right file for the provided _id
"""
db_file = DBVuln.get_file_for_id(_id, language=language)
data = DBVuln.load_from_jso... | [
"def",
"from_id",
"(",
"cls",
",",
"_id",
",",
"language",
"=",
"DEFAULT_LANG",
")",
":",
"db_file",
"=",
"DBVuln",
".",
"get_file_for_id",
"(",
"_id",
",",
"language",
"=",
"language",
")",
"data",
"=",
"DBVuln",
".",
"load_from_json",
"(",
"db_file",
"... | This is an alternative "constructor" for the DBVuln class which searches
the db directory to find the right file for the provided _id | [
"This",
"is",
"an",
"alternative",
"constructor",
"for",
"the",
"DBVuln",
"class",
"which",
"searches",
"the",
"db",
"directory",
"to",
"find",
"the",
"right",
"file",
"for",
"the",
"provided",
"_id"
] | c8b1b2929235191a49aa4ca332abaf7447ee8667 | https://github.com/vulndb/python-sdk/blob/c8b1b2929235191a49aa4ca332abaf7447ee8667/vulndb/db_vuln.py#L89-L96 |
53,394 | vulndb/python-sdk | vulndb/db_vuln.py | DBVuln.get_file_for_id | def get_file_for_id(_id, language=DEFAULT_LANG):
"""
Given _id, search the DB for the file which contains the data
:param _id: The id to search (int)
:param language: The user's language (en, es, etc.)
:return: The filename
"""
file_start = '%s-' % _id
j... | python | def get_file_for_id(_id, language=DEFAULT_LANG):
"""
Given _id, search the DB for the file which contains the data
:param _id: The id to search (int)
:param language: The user's language (en, es, etc.)
:return: The filename
"""
file_start = '%s-' % _id
j... | [
"def",
"get_file_for_id",
"(",
"_id",
",",
"language",
"=",
"DEFAULT_LANG",
")",
":",
"file_start",
"=",
"'%s-'",
"%",
"_id",
"json_path",
"=",
"DBVuln",
".",
"get_json_path",
"(",
"language",
"=",
"language",
")",
"for",
"_file",
"in",
"os",
".",
"listdir... | Given _id, search the DB for the file which contains the data
:param _id: The id to search (int)
:param language: The user's language (en, es, etc.)
:return: The filename | [
"Given",
"_id",
"search",
"the",
"DB",
"for",
"the",
"file",
"which",
"contains",
"the",
"data"
] | c8b1b2929235191a49aa4ca332abaf7447ee8667 | https://github.com/vulndb/python-sdk/blob/c8b1b2929235191a49aa4ca332abaf7447ee8667/vulndb/db_vuln.py#L106-L122 |
53,395 | vulndb/python-sdk | vulndb/db_vuln.py | DBVuln.load_from_json | def load_from_json(db_file, language=DEFAULT_LANG):
"""
Parses the JSON data and returns it
:param db_file: File and path pointing to the JSON file to parse
:param language: The user's language (en, es, etc.)
:raises: All kind of exceptions if the file doesn't exist or JSON is
... | python | def load_from_json(db_file, language=DEFAULT_LANG):
"""
Parses the JSON data and returns it
:param db_file: File and path pointing to the JSON file to parse
:param language: The user's language (en, es, etc.)
:raises: All kind of exceptions if the file doesn't exist or JSON is
... | [
"def",
"load_from_json",
"(",
"db_file",
",",
"language",
"=",
"DEFAULT_LANG",
")",
":",
"# There are a couple of things I don't do here, and are on purpose:",
"# - I want to fail if the file doesn't exist",
"# - I want to fail if the file doesn't contain valid JSON",
"raw",
"=",
"... | Parses the JSON data and returns it
:param db_file: File and path pointing to the JSON file to parse
:param language: The user's language (en, es, etc.)
:raises: All kind of exceptions if the file doesn't exist or JSON is
invalid.
:return: None | [
"Parses",
"the",
"JSON",
"data",
"and",
"returns",
"it"
] | c8b1b2929235191a49aa4ca332abaf7447ee8667 | https://github.com/vulndb/python-sdk/blob/c8b1b2929235191a49aa4ca332abaf7447ee8667/vulndb/db_vuln.py#L188-L220 |
53,396 | spantaleev/sftpman | sftpman/model.py | SystemModel.export | def export(self):
"""Serializes to JSON."""
fields = ['id', 'host', 'port', 'user']
out = {}
for field in fields:
out[field] = getattr(self, field, None)
out['mountOptions'] = self.mount_opts
out['mountPoint'] = self.mount_point
out['beforeMount'] = se... | python | def export(self):
"""Serializes to JSON."""
fields = ['id', 'host', 'port', 'user']
out = {}
for field in fields:
out[field] = getattr(self, field, None)
out['mountOptions'] = self.mount_opts
out['mountPoint'] = self.mount_point
out['beforeMount'] = se... | [
"def",
"export",
"(",
"self",
")",
":",
"fields",
"=",
"[",
"'id'",
",",
"'host'",
",",
"'port'",
",",
"'user'",
"]",
"out",
"=",
"{",
"}",
"for",
"field",
"in",
"fields",
":",
"out",
"[",
"field",
"]",
"=",
"getattr",
"(",
"self",
",",
"field",
... | Serializes to JSON. | [
"Serializes",
"to",
"JSON",
"."
] | e4fc3e3e3af975937469e0b8944ba62c01b12a47 | https://github.com/spantaleev/sftpman/blob/e4fc3e3e3af975937469e0b8944ba62c01b12a47/sftpman/model.py#L182-L193 |
53,397 | spantaleev/sftpman | sftpman/model.py | SystemControllerModel.mount | def mount(self):
"""Mounts the sftp system if it's not already mounted."""
if self.mounted:
return
self._mount_point_local_create()
if len(self.system.mount_opts) == 0:
sshfs_opts = ""
else:
sshfs_opts = " -o %s" % " -o ".join(self.system.mou... | python | def mount(self):
"""Mounts the sftp system if it's not already mounted."""
if self.mounted:
return
self._mount_point_local_create()
if len(self.system.mount_opts) == 0:
sshfs_opts = ""
else:
sshfs_opts = " -o %s" % " -o ".join(self.system.mou... | [
"def",
"mount",
"(",
"self",
")",
":",
"if",
"self",
".",
"mounted",
":",
"return",
"self",
".",
"_mount_point_local_create",
"(",
")",
"if",
"len",
"(",
"self",
".",
"system",
".",
"mount_opts",
")",
"==",
"0",
":",
"sshfs_opts",
"=",
"\"\"",
"else",
... | Mounts the sftp system if it's not already mounted. | [
"Mounts",
"the",
"sftp",
"system",
"if",
"it",
"s",
"not",
"already",
"mounted",
"."
] | e4fc3e3e3af975937469e0b8944ba62c01b12a47 | https://github.com/spantaleev/sftpman/blob/e4fc3e3e3af975937469e0b8944ba62c01b12a47/sftpman/model.py#L263-L305 |
53,398 | spantaleev/sftpman | sftpman/model.py | SystemControllerModel.unmount | def unmount(self):
"""Unmounts the sftp system if it's currently mounted."""
if not self.mounted:
return
# Try to unmount properly.
cmd = 'fusermount -u %s' % self.mount_point_local
shell_exec(cmd)
# The filesystem is probably still in use.
# kill ss... | python | def unmount(self):
"""Unmounts the sftp system if it's currently mounted."""
if not self.mounted:
return
# Try to unmount properly.
cmd = 'fusermount -u %s' % self.mount_point_local
shell_exec(cmd)
# The filesystem is probably still in use.
# kill ss... | [
"def",
"unmount",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"mounted",
":",
"return",
"# Try to unmount properly.",
"cmd",
"=",
"'fusermount -u %s'",
"%",
"self",
".",
"mount_point_local",
"shell_exec",
"(",
"cmd",
")",
"# The filesystem is probably still in ... | Unmounts the sftp system if it's currently mounted. | [
"Unmounts",
"the",
"sftp",
"system",
"if",
"it",
"s",
"currently",
"mounted",
"."
] | e4fc3e3e3af975937469e0b8944ba62c01b12a47 | https://github.com/spantaleev/sftpman/blob/e4fc3e3e3af975937469e0b8944ba62c01b12a47/sftpman/model.py#L307-L322 |
53,399 | joowani/quadriga | quadriga/client.py | QuadrigaClient.book | def book(self, name):
"""Return an API wrapper for the given order book.
:param name: Order book name (e.g. "btc_cad").
:type name: str | unicode
:return: Order book API wrapper.
:rtype: quadriga.book.OrderBook
:raise InvalidOrderBookError: If an invalid order book is gi... | python | def book(self, name):
"""Return an API wrapper for the given order book.
:param name: Order book name (e.g. "btc_cad").
:type name: str | unicode
:return: Order book API wrapper.
:rtype: quadriga.book.OrderBook
:raise InvalidOrderBookError: If an invalid order book is gi... | [
"def",
"book",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_validate_order_book",
"(",
"name",
")",
"return",
"OrderBook",
"(",
"name",
",",
"self",
".",
"_rest_client",
",",
"self",
".",
"_logger",
")"
] | Return an API wrapper for the given order book.
:param name: Order book name (e.g. "btc_cad").
:type name: str | unicode
:return: Order book API wrapper.
:rtype: quadriga.book.OrderBook
:raise InvalidOrderBookError: If an invalid order book is given.
**Example**:
... | [
"Return",
"an",
"API",
"wrapper",
"for",
"the",
"given",
"order",
"book",
"."
] | 412f88f414ef0cb53efa6d5841b9674eb9718359 | https://github.com/joowani/quadriga/blob/412f88f414ef0cb53efa6d5841b9674eb9718359/quadriga/client.py#L130-L151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.