partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | WorldViewMouseRotatable.on_menu_exit | Fake event handler, same as :py:meth:`WorldView.on_menu_exit()` but force-disables mouse exclusivity. | peng3d/world.py | def on_menu_exit(self,new):
"""
Fake event handler, same as :py:meth:`WorldView.on_menu_exit()` but force-disables mouse exclusivity.
"""
super(WorldViewMouseRotatable,self).on_menu_exit(new)
self.world.peng.window.toggle_exclusivity(False) | def on_menu_exit(self,new):
"""
Fake event handler, same as :py:meth:`WorldView.on_menu_exit()` but force-disables mouse exclusivity.
"""
super(WorldViewMouseRotatable,self).on_menu_exit(new)
self.world.peng.window.toggle_exclusivity(False) | [
"Fake",
"event",
"handler",
"same",
"as",
":",
"py",
":",
"meth",
":",
"WorldView",
".",
"on_menu_exit",
"()",
"but",
"force",
"-",
"disables",
"mouse",
"exclusivity",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L264-L269 | [
"def",
"on_menu_exit",
"(",
"self",
",",
"new",
")",
":",
"super",
"(",
"WorldViewMouseRotatable",
",",
"self",
")",
".",
"on_menu_exit",
"(",
"new",
")",
"self",
".",
"world",
".",
"peng",
".",
"window",
".",
"toggle_exclusivity",
"(",
"False",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WorldViewMouseRotatable.on_key_press | Keyboard event handler handling only the escape key.
If an escape key press is detected, mouse exclusivity is toggled via :py:meth:`PengWindow.toggle_exclusivity()`\ . | peng3d/world.py | def on_key_press(self,symbol,modifiers):
"""
Keyboard event handler handling only the escape key.
If an escape key press is detected, mouse exclusivity is toggled via :py:meth:`PengWindow.toggle_exclusivity()`\ .
"""
if symbol == key.ESCAPE:
self.world.peng.w... | def on_key_press(self,symbol,modifiers):
"""
Keyboard event handler handling only the escape key.
If an escape key press is detected, mouse exclusivity is toggled via :py:meth:`PengWindow.toggle_exclusivity()`\ .
"""
if symbol == key.ESCAPE:
self.world.peng.w... | [
"Keyboard",
"event",
"handler",
"handling",
"only",
"the",
"escape",
"key",
".",
"If",
"an",
"escape",
"key",
"press",
"is",
"detected",
"mouse",
"exclusivity",
"is",
"toggled",
"via",
":",
"py",
":",
"meth",
":",
"PengWindow",
".",
"toggle_exclusivity",
"()... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L270-L278 | [
"def",
"on_key_press",
"(",
"self",
",",
"symbol",
",",
"modifiers",
")",
":",
"if",
"symbol",
"==",
"key",
".",
"ESCAPE",
":",
"self",
".",
"world",
".",
"peng",
".",
"window",
".",
"toggle_exclusivity",
"(",
")",
"return",
"pyglet",
".",
"event",
"."... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WorldViewMouseRotatable.on_mouse_motion | Handles mouse motion and rotates the attached camera accordingly.
For more information about how to customize mouse movement, see the class documentation here :py:class:`WorldViewMouseRotatable()`\ . | peng3d/world.py | def on_mouse_motion(self, x, y, dx, dy):
"""
Handles mouse motion and rotates the attached camera accordingly.
For more information about how to customize mouse movement, see the class documentation here :py:class:`WorldViewMouseRotatable()`\ .
"""
if not self.world.peng... | def on_mouse_motion(self, x, y, dx, dy):
"""
Handles mouse motion and rotates the attached camera accordingly.
For more information about how to customize mouse movement, see the class documentation here :py:class:`WorldViewMouseRotatable()`\ .
"""
if not self.world.peng... | [
"Handles",
"mouse",
"motion",
"and",
"rotates",
"the",
"attached",
"camera",
"accordingly",
".",
"For",
"more",
"information",
"about",
"how",
"to",
"customize",
"mouse",
"movement",
"see",
"the",
"class",
"documentation",
"here",
":",
"py",
":",
"class",
":",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/world.py#L279-L293 | [
"def",
"on_mouse_motion",
"(",
"self",
",",
"x",
",",
"y",
",",
"dx",
",",
"dy",
")",
":",
"if",
"not",
"self",
".",
"world",
".",
"peng",
".",
"window",
".",
"exclusive",
":",
"return",
"m",
"=",
"self",
".",
"world",
".",
"peng",
".",
"cfg",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Recorder.step | Start a new step. returns a context manager which allows you to
report an error | xunitgen/step_recording.py | def step(self, step_name):
"""Start a new step. returns a context manager which allows you to
report an error"""
@contextmanager
def step_context(step_name):
if self.event_receiver.current_case is not None:
raise Exception('cannot open a step within a step')
... | def step(self, step_name):
"""Start a new step. returns a context manager which allows you to
report an error"""
@contextmanager
def step_context(step_name):
if self.event_receiver.current_case is not None:
raise Exception('cannot open a step within a step')
... | [
"Start",
"a",
"new",
"step",
".",
"returns",
"a",
"context",
"manager",
"which",
"allows",
"you",
"to",
"report",
"an",
"error"
] | uucidl/uu.xunitgen | python | https://github.com/uucidl/uu.xunitgen/blob/3c74fe60dfd15a528622195577f2aab3027693f0/xunitgen/step_recording.py#L31-L50 | [
"def",
"step",
"(",
"self",
",",
"step_name",
")",
":",
"@",
"contextmanager",
"def",
"step_context",
"(",
"step_name",
")",
":",
"if",
"self",
".",
"event_receiver",
".",
"current_case",
"is",
"not",
"None",
":",
"raise",
"Exception",
"(",
"'cannot open a s... | 3c74fe60dfd15a528622195577f2aab3027693f0 |
test | ResourceManager.resourceNameToPath | Converts the given resource name to a file path.
A resource path is of the format ``<app>:<cat1>.<cat2>.<name>`` where cat1 and cat2 can be repeated as often as desired.
``ext`` is the file extension to use, e.g. ``.png`` or similar.
As an example, the resource name ``... | peng3d/resource.py | def resourceNameToPath(self,name,ext=""):
"""
Converts the given resource name to a file path.
A resource path is of the format ``<app>:<cat1>.<cat2>.<name>`` where cat1 and cat2 can be repeated as often as desired.
``ext`` is the file extension to use, e.g. ``.png`` or... | def resourceNameToPath(self,name,ext=""):
"""
Converts the given resource name to a file path.
A resource path is of the format ``<app>:<cat1>.<cat2>.<name>`` where cat1 and cat2 can be repeated as often as desired.
``ext`` is the file extension to use, e.g. ``.png`` or... | [
"Converts",
"the",
"given",
"resource",
"name",
"to",
"a",
"file",
"path",
".",
"A",
"resource",
"path",
"is",
"of",
"the",
"format",
"<app",
">",
":",
"<cat1",
">",
".",
"<cat2",
">",
".",
"<name",
">",
"where",
"cat1",
"and",
"cat2",
"can",
"be",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L84-L99 | [
"def",
"resourceNameToPath",
"(",
"self",
",",
"name",
",",
"ext",
"=",
"\"\"",
")",
":",
"nsplit",
"=",
"name",
".",
"split",
"(",
"\":\"",
")",
"[",
"1",
"]",
".",
"split",
"(",
"\".\"",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.resourceExists | Returns whether or not the resource with the given name and extension exists.
This must not mean that the resource is meaningful, it simply signals that the file exists. | peng3d/resource.py | def resourceExists(self,name,ext=""):
"""
Returns whether or not the resource with the given name and extension exists.
This must not mean that the resource is meaningful, it simply signals that the file exists.
"""
return os.path.exists(self.resourceNameToPath(name,ext)... | def resourceExists(self,name,ext=""):
"""
Returns whether or not the resource with the given name and extension exists.
This must not mean that the resource is meaningful, it simply signals that the file exists.
"""
return os.path.exists(self.resourceNameToPath(name,ext)... | [
"Returns",
"whether",
"or",
"not",
"the",
"resource",
"with",
"the",
"given",
"name",
"and",
"extension",
"exists",
".",
"This",
"must",
"not",
"mean",
"that",
"the",
"resource",
"is",
"meaningful",
"it",
"simply",
"signals",
"that",
"the",
"file",
"exists",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L100-L106 | [
"def",
"resourceExists",
"(",
"self",
",",
"name",
",",
"ext",
"=",
"\"\"",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"resourceNameToPath",
"(",
"name",
",",
"ext",
")",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.addCategory | Adds a new texture category with the given name.
If the category already exists, it will be overridden. | peng3d/resource.py | def addCategory(self,name):
"""
Adds a new texture category with the given name.
If the category already exists, it will be overridden.
"""
self.categories[name]={}
self.categoriesTexCache[name]={}
self.categoriesTexBin[name]=pyglet.image.atlas.TextureBin... | def addCategory(self,name):
"""
Adds a new texture category with the given name.
If the category already exists, it will be overridden.
"""
self.categories[name]={}
self.categoriesTexCache[name]={}
self.categoriesTexBin[name]=pyglet.image.atlas.TextureBin... | [
"Adds",
"a",
"new",
"texture",
"category",
"with",
"the",
"given",
"name",
".",
"If",
"the",
"category",
"already",
"exists",
"it",
"will",
"be",
"overridden",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L107-L116 | [
"def",
"addCategory",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"categories",
"[",
"name",
"]",
"=",
"{",
"}",
"self",
".",
"categoriesTexCache",
"[",
"name",
"]",
"=",
"{",
"}",
"self",
".",
"categoriesTexBin",
"[",
"name",
"]",
"=",
"pyglet"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.getTex | Gets the texture associated with the given name and category.
``category`` must have been created using :py:meth:`addCategory()` before.
If it was loaded previously, a cached version will be returned.
If it was not loaded, it will be loaded and inserted into the cache.
... | peng3d/resource.py | def getTex(self,name,category):
"""
Gets the texture associated with the given name and category.
``category`` must have been created using :py:meth:`addCategory()` before.
If it was loaded previously, a cached version will be returned.
If it was not loaded, it ... | def getTex(self,name,category):
"""
Gets the texture associated with the given name and category.
``category`` must have been created using :py:meth:`addCategory()` before.
If it was loaded previously, a cached version will be returned.
If it was not loaded, it ... | [
"Gets",
"the",
"texture",
"associated",
"with",
"the",
"given",
"name",
"and",
"category",
".",
"category",
"must",
"have",
"been",
"created",
"using",
":",
"py",
":",
"meth",
":",
"addCategory",
"()",
"before",
".",
"If",
"it",
"was",
"loaded",
"previousl... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L117-L132 | [
"def",
"getTex",
"(",
"self",
",",
"name",
",",
"category",
")",
":",
"if",
"category",
"not",
"in",
"self",
".",
"categoriesTexCache",
":",
"return",
"self",
".",
"getMissingTex",
"(",
"category",
")",
"if",
"name",
"not",
"in",
"self",
".",
"categories... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.loadTex | Loads the texture of the given name and category.
All textures currently must be PNG files, although support for more formats may be added soon.
If the texture cannot be found, a missing texture will instead be returned. See :py:meth:`getMissingTexture()` for more information.
... | peng3d/resource.py | def loadTex(self,name,category):
"""
Loads the texture of the given name and category.
All textures currently must be PNG files, although support for more formats may be added soon.
If the texture cannot be found, a missing texture will instead be returned. See :py:meth... | def loadTex(self,name,category):
"""
Loads the texture of the given name and category.
All textures currently must be PNG files, although support for more formats may be added soon.
If the texture cannot be found, a missing texture will instead be returned. See :py:meth... | [
"Loads",
"the",
"texture",
"of",
"the",
"given",
"name",
"and",
"category",
".",
"All",
"textures",
"currently",
"must",
"be",
"PNG",
"files",
"although",
"support",
"for",
"more",
"formats",
"may",
"be",
"added",
"soon",
".",
"If",
"the",
"texture",
"cann... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L133-L166 | [
"def",
"loadTex",
"(",
"self",
",",
"name",
",",
"category",
")",
":",
"try",
":",
"img",
"=",
"pyglet",
".",
"image",
".",
"load",
"(",
"self",
".",
"resourceNameToPath",
"(",
"name",
",",
"\".png\"",
")",
")",
"except",
"FileNotFoundError",
":",
"img... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.getMissingTexture | Returns a texture to be used as a placeholder for missing textures.
A default missing texture file is provided in the assets folder of the source distribution.
It consists of a simple checkerboard pattern of purple and black, this image may be copied to any project using peng3d for similar beha... | peng3d/resource.py | def getMissingTexture(self):
"""
Returns a texture to be used as a placeholder for missing textures.
A default missing texture file is provided in the assets folder of the source distribution.
It consists of a simple checkerboard pattern of purple and black, this image may be co... | def getMissingTexture(self):
"""
Returns a texture to be used as a placeholder for missing textures.
A default missing texture file is provided in the assets folder of the source distribution.
It consists of a simple checkerboard pattern of purple and black, this image may be co... | [
"Returns",
"a",
"texture",
"to",
"be",
"used",
"as",
"a",
"placeholder",
"for",
"missing",
"textures",
".",
"A",
"default",
"missing",
"texture",
"file",
"is",
"provided",
"in",
"the",
"assets",
"folder",
"of",
"the",
"source",
"distribution",
".",
"It",
"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L167-L186 | [
"def",
"getMissingTexture",
"(",
"self",
")",
":",
"if",
"self",
".",
"missingTexture",
"is",
"None",
":",
"if",
"self",
".",
"resourceExists",
"(",
"self",
".",
"missingtexturename",
",",
"\".png\"",
")",
":",
"self",
".",
"missingTexture",
"=",
"pyglet",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.addFromTex | Adds a new texture from the given image.
``img`` may be any object that supports Pyglet-style copying in form of the ``blit_to_texture()`` method.
This can be used to add textures that come from non-file sources, e.g. Render-to-texture. | peng3d/resource.py | def addFromTex(self,name,img,category):
"""
Adds a new texture from the given image.
``img`` may be any object that supports Pyglet-style copying in form of the ``blit_to_texture()`` method.
This can be used to add textures that come from non-file sources, e.g. Render-t... | def addFromTex(self,name,img,category):
"""
Adds a new texture from the given image.
``img`` may be any object that supports Pyglet-style copying in form of the ``blit_to_texture()`` method.
This can be used to add textures that come from non-file sources, e.g. Render-t... | [
"Adds",
"a",
"new",
"texture",
"from",
"the",
"given",
"image",
".",
"img",
"may",
"be",
"any",
"object",
"that",
"supports",
"Pyglet",
"-",
"style",
"copying",
"in",
"form",
"of",
"the",
"blit_to_texture",
"()",
"method",
".",
"This",
"can",
"be",
"used... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L191-L217 | [
"def",
"addFromTex",
"(",
"self",
",",
"name",
",",
"img",
",",
"category",
")",
":",
"texreg",
"=",
"self",
".",
"categoriesTexBin",
"[",
"category",
"]",
".",
"add",
"(",
"img",
")",
"#texreg = texreg.get_transform(True,True) # Mirrors the image due to how pyglets... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.getModel | Gets the model object by the given name.
If it was loaded previously, a cached version will be returned.
If it was not loaded, it will be loaded and inserted into the cache. | peng3d/resource.py | def getModel(self,name):
"""
Gets the model object by the given name.
If it was loaded previously, a cached version will be returned.
If it was not loaded, it will be loaded and inserted into the cache.
"""
if name in self.modelobjcache:
return self.m... | def getModel(self,name):
"""
Gets the model object by the given name.
If it was loaded previously, a cached version will be returned.
If it was not loaded, it will be loaded and inserted into the cache.
"""
if name in self.modelobjcache:
return self.m... | [
"Gets",
"the",
"model",
"object",
"by",
"the",
"given",
"name",
".",
"If",
"it",
"was",
"loaded",
"previously",
"a",
"cached",
"version",
"will",
"be",
"returned",
".",
"If",
"it",
"was",
"not",
"loaded",
"it",
"will",
"be",
"loaded",
"and",
"inserted",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L219-L228 | [
"def",
"getModel",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"modelobjcache",
":",
"return",
"self",
".",
"modelobjcache",
"[",
"name",
"]",
"return",
"self",
".",
"loadModel",
"(",
"name",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.loadModel | Loads the model of the given name.
The model will also be inserted into the cache. | peng3d/resource.py | def loadModel(self,name):
"""
Loads the model of the given name.
The model will also be inserted into the cache.
"""
m = model.Model(self.peng,self,name)
self.modelobjcache[name]=m
self.peng.sendEvent("peng3d:rsrc.model.load",{"peng":self.peng,"name":name... | def loadModel(self,name):
"""
Loads the model of the given name.
The model will also be inserted into the cache.
"""
m = model.Model(self.peng,self,name)
self.modelobjcache[name]=m
self.peng.sendEvent("peng3d:rsrc.model.load",{"peng":self.peng,"name":name... | [
"Loads",
"the",
"model",
"of",
"the",
"given",
"name",
".",
"The",
"model",
"will",
"also",
"be",
"inserted",
"into",
"the",
"cache",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L229-L238 | [
"def",
"loadModel",
"(",
"self",
",",
"name",
")",
":",
"m",
"=",
"model",
".",
"Model",
"(",
"self",
".",
"peng",
",",
"self",
",",
"name",
")",
"self",
".",
"modelobjcache",
"[",
"name",
"]",
"=",
"m",
"self",
".",
"peng",
".",
"sendEvent",
"("... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.getModelData | Gets the model data associated with the given name.
If it was loaded, a cached copy will be returned.
It it was not loaded, it will be loaded and cached. | peng3d/resource.py | def getModelData(self,name):
"""
Gets the model data associated with the given name.
If it was loaded, a cached copy will be returned.
It it was not loaded, it will be loaded and cached.
"""
if name in self.modelcache:
return self.modelcache[name]
... | def getModelData(self,name):
"""
Gets the model data associated with the given name.
If it was loaded, a cached copy will be returned.
It it was not loaded, it will be loaded and cached.
"""
if name in self.modelcache:
return self.modelcache[name]
... | [
"Gets",
"the",
"model",
"data",
"associated",
"with",
"the",
"given",
"name",
".",
"If",
"it",
"was",
"loaded",
"a",
"cached",
"copy",
"will",
"be",
"returned",
".",
"It",
"it",
"was",
"not",
"loaded",
"it",
"will",
"be",
"loaded",
"and",
"cached",
"."... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L240-L249 | [
"def",
"getModelData",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"modelcache",
":",
"return",
"self",
".",
"modelcache",
"[",
"name",
"]",
"return",
"self",
".",
"loadModelData",
"(",
"name",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ResourceManager.loadModelData | Loads the model data of the given name.
The model file must always be a .json file. | peng3d/resource.py | def loadModelData(self,name):
"""
Loads the model data of the given name.
The model file must always be a .json file.
"""
path = self.resourceNameToPath(name,".json")
try:
data = json.load(open(path,"r"))
except Exception:
# Tempor... | def loadModelData(self,name):
"""
Loads the model data of the given name.
The model file must always be a .json file.
"""
path = self.resourceNameToPath(name,".json")
try:
data = json.load(open(path,"r"))
except Exception:
# Tempor... | [
"Loads",
"the",
"model",
"data",
"of",
"the",
"given",
"name",
".",
"The",
"model",
"file",
"must",
"always",
"be",
"a",
".",
"json",
"file",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/resource.py#L250-L309 | [
"def",
"loadModelData",
"(",
"self",
",",
"name",
")",
":",
"path",
"=",
"self",
".",
"resourceNameToPath",
"(",
"name",
",",
"\".json\"",
")",
"try",
":",
"data",
"=",
"json",
".",
"load",
"(",
"open",
"(",
"path",
",",
"\"r\"",
")",
")",
"except",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Container.setBackground | Sets the background of the Container.
Similar to :py:meth:`peng3d.gui.SubMenu.setBackground()`\ , but only effects the region covered by the Container. | peng3d/gui/container.py | def setBackground(self,bg):
"""
Sets the background of the Container.
Similar to :py:meth:`peng3d.gui.SubMenu.setBackground()`\ , but only effects the region covered by the Container.
"""
self.bg = bg
if isinstance(bg,list) or isinstance(bg,tuple):
if... | def setBackground(self,bg):
"""
Sets the background of the Container.
Similar to :py:meth:`peng3d.gui.SubMenu.setBackground()`\ , but only effects the region covered by the Container.
"""
self.bg = bg
if isinstance(bg,list) or isinstance(bg,tuple):
if... | [
"Sets",
"the",
"background",
"of",
"the",
"Container",
".",
"Similar",
"to",
":",
"py",
":",
"meth",
":",
"peng3d",
".",
"gui",
".",
"SubMenu",
".",
"setBackground",
"()",
"\\",
"but",
"only",
"effects",
"the",
"region",
"covered",
"by",
"the",
"Containe... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L105-L118 | [
"def",
"setBackground",
"(",
"self",
",",
"bg",
")",
":",
"self",
".",
"bg",
"=",
"bg",
"if",
"isinstance",
"(",
"bg",
",",
"list",
")",
"or",
"isinstance",
"(",
"bg",
",",
"tuple",
")",
":",
"if",
"len",
"(",
"bg",
")",
"==",
"3",
"and",
"isin... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Container.addWidget | Adds a widget to this container.
Note that trying to add the Container to itself will be ignored. | peng3d/gui/container.py | def addWidget(self,widget):
"""
Adds a widget to this container.
Note that trying to add the Container to itself will be ignored.
"""
if self is widget: # Prevents being able to add the container to itself, causing a recursion loop on redraw
return
se... | def addWidget(self,widget):
"""
Adds a widget to this container.
Note that trying to add the Container to itself will be ignored.
"""
if self is widget: # Prevents being able to add the container to itself, causing a recursion loop on redraw
return
se... | [
"Adds",
"a",
"widget",
"to",
"this",
"container",
".",
"Note",
"that",
"trying",
"to",
"add",
"the",
"Container",
"to",
"itself",
"will",
"be",
"ignored",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L135-L143 | [
"def",
"addWidget",
"(",
"self",
",",
"widget",
")",
":",
"if",
"self",
"is",
"widget",
":",
"# Prevents being able to add the container to itself, causing a recursion loop on redraw",
"return",
"self",
".",
"widgets",
"[",
"widget",
".",
"name",
"]",
"=",
"widget"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Container.draw | Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing and may modify the scissor settings. | peng3d/gui/container.py | def draw(self):
"""
Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing and may modify the scissor settings.
"""
if not self.visible:
# Simple visibility check, has to be tested to see if it works properly
... | def draw(self):
"""
Draws the submenu and its background.
Note that this leaves the OpenGL state set to 2d drawing and may modify the scissor settings.
"""
if not self.visible:
# Simple visibility check, has to be tested to see if it works properly
... | [
"Draws",
"the",
"submenu",
"and",
"its",
"background",
".",
"Note",
"that",
"this",
"leaves",
"the",
"OpenGL",
"state",
"set",
"to",
"2d",
"drawing",
"and",
"may",
"modify",
"the",
"scissor",
"settings",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L150-L167 | [
"def",
"draw",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"visible",
":",
"# Simple visibility check, has to be tested to see if it works properly",
"return",
"if",
"not",
"isinstance",
"(",
"self",
".",
"submenu",
",",
"Container",
")",
":",
"glEnable",
"("... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Container.on_redraw | Redraws the background and any child widgets. | peng3d/gui/container.py | def on_redraw(self):
"""
Redraws the background and any child widgets.
"""
x,y = self.pos
sx,sy = self.size
self.bg_vlist.vertices = [x,y, x+sx,y, x+sx,y+sy, x,y+sy]
self.stencil_vlist.vertices = [x,y, x+sx,y, x+sx,y+sy, x,y+sy]
if isinstance(self.bg,Backg... | def on_redraw(self):
"""
Redraws the background and any child widgets.
"""
x,y = self.pos
sx,sy = self.size
self.bg_vlist.vertices = [x,y, x+sx,y, x+sx,y+sy, x,y+sy]
self.stencil_vlist.vertices = [x,y, x+sx,y, x+sx,y+sy, x,y+sy]
if isinstance(self.bg,Backg... | [
"Redraws",
"the",
"background",
"and",
"any",
"child",
"widgets",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L169-L181 | [
"def",
"on_redraw",
"(",
"self",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"pos",
"sx",
",",
"sy",
"=",
"self",
".",
"size",
"self",
".",
"bg_vlist",
".",
"vertices",
"=",
"[",
"x",
",",
"y",
",",
"x",
"+",
"sx",
",",
"y",
",",
"x",
"+",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ScrollableContainer.on_redraw | Redraws the background and contents, including scrollbar.
This method will also check the scrollbar for any movement and will be automatically called on movement of the slider. | peng3d/gui/container.py | def on_redraw(self):
"""
Redraws the background and contents, including scrollbar.
This method will also check the scrollbar for any movement and will be automatically called on movement of the slider.
"""
n = self._scrollbar.n
self.offset_y = -n # Causes the con... | def on_redraw(self):
"""
Redraws the background and contents, including scrollbar.
This method will also check the scrollbar for any movement and will be automatically called on movement of the slider.
"""
n = self._scrollbar.n
self.offset_y = -n # Causes the con... | [
"Redraws",
"the",
"background",
"and",
"contents",
"including",
"scrollbar",
".",
"This",
"method",
"will",
"also",
"check",
"the",
"scrollbar",
"for",
"any",
"movement",
"and",
"will",
"be",
"automatically",
"called",
"on",
"movement",
"of",
"the",
"slider",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/container.py#L237-L260 | [
"def",
"on_redraw",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"_scrollbar",
".",
"n",
"self",
".",
"offset_y",
"=",
"-",
"n",
"# Causes the content to move in the opposite direction of the slider",
"# Size of scrollbar",
"sx",
"=",
"24",
"# Currently constant, TOD... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | mouse_aabb | AABB Collision checker that can be used for most axis-aligned collisions.
Intended for use in widgets to check if the mouse is within the bounds of a particular widget. | peng3d/util/gui.py | def mouse_aabb(mpos,size,pos):
"""
AABB Collision checker that can be used for most axis-aligned collisions.
Intended for use in widgets to check if the mouse is within the bounds of a particular widget.
"""
return pos[0]<=mpos[0]<=pos[0]+size[0] and pos[1]<=mpos[1]<=pos[1]+size[1] | def mouse_aabb(mpos,size,pos):
"""
AABB Collision checker that can be used for most axis-aligned collisions.
Intended for use in widgets to check if the mouse is within the bounds of a particular widget.
"""
return pos[0]<=mpos[0]<=pos[0]+size[0] and pos[1]<=mpos[1]<=pos[1]+size[1] | [
"AABB",
"Collision",
"checker",
"that",
"can",
"be",
"used",
"for",
"most",
"axis",
"-",
"aligned",
"collisions",
".",
"Intended",
"for",
"use",
"in",
"widgets",
"to",
"check",
"if",
"the",
"mouse",
"is",
"within",
"the",
"bounds",
"of",
"a",
"particular",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/gui.py#L35-L41 | [
"def",
"mouse_aabb",
"(",
"mpos",
",",
"size",
",",
"pos",
")",
":",
"return",
"pos",
"[",
"0",
"]",
"<=",
"mpos",
"[",
"0",
"]",
"<=",
"pos",
"[",
"0",
"]",
"+",
"size",
"[",
"0",
"]",
"and",
"pos",
"[",
"1",
"]",
"<=",
"mpos",
"[",
"1",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | AdvancedProgressbar.addCategory | Adds a category with the given name.
If the category already exists, a :py:exc:`KeyError` will be thrown. Use
:py:meth:`updateCategory()` instead if you want to update a category. | peng3d/gui/slider.py | def addCategory(self,name,nmin=0,n=0,nmax=100):
"""
Adds a category with the given name.
If the category already exists, a :py:exc:`KeyError` will be thrown. Use
:py:meth:`updateCategory()` instead if you want to update a category.
"""
assert isinstance(name,base... | def addCategory(self,name,nmin=0,n=0,nmax=100):
"""
Adds a category with the given name.
If the category already exists, a :py:exc:`KeyError` will be thrown. Use
:py:meth:`updateCategory()` instead if you want to update a category.
"""
assert isinstance(name,base... | [
"Adds",
"a",
"category",
"with",
"the",
"given",
"name",
".",
"If",
"the",
"category",
"already",
"exists",
"a",
":",
"py",
":",
"exc",
":",
"KeyError",
"will",
"be",
"thrown",
".",
"Use",
":",
"py",
":",
"meth",
":",
"updateCategory",
"()",
"instead",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/slider.py#L304-L315 | [
"def",
"addCategory",
"(",
"self",
",",
"name",
",",
"nmin",
"=",
"0",
",",
"n",
"=",
"0",
",",
"nmax",
"=",
"100",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"# py2 compat is done at the top",
"if",
"name",
"in",
"self",
".... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | AdvancedProgressbar.updateCategory | Smartly updates the given category.
Only values that are given will be updated, others will be left unchanged.
If the category does not exist, a :py:exc:`KeyError` will be thrown. Use
:py:meth:`addCategory()` instead if you want to add a category. | peng3d/gui/slider.py | def updateCategory(self,name,nmin=None,n=None,nmax=None):
"""
Smartly updates the given category.
Only values that are given will be updated, others will be left unchanged.
If the category does not exist, a :py:exc:`KeyError` will be thrown. Use
:py:meth:`addCat... | def updateCategory(self,name,nmin=None,n=None,nmax=None):
"""
Smartly updates the given category.
Only values that are given will be updated, others will be left unchanged.
If the category does not exist, a :py:exc:`KeyError` will be thrown. Use
:py:meth:`addCat... | [
"Smartly",
"updates",
"the",
"given",
"category",
".",
"Only",
"values",
"that",
"are",
"given",
"will",
"be",
"updated",
"others",
"will",
"be",
"left",
"unchanged",
".",
"If",
"the",
"category",
"does",
"not",
"exist",
"a",
":",
"py",
":",
"exc",
":",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/slider.py#L316-L335 | [
"def",
"updateCategory",
"(",
"self",
",",
"name",
",",
"nmin",
"=",
"None",
",",
"n",
"=",
"None",
",",
"nmax",
"=",
"None",
")",
":",
"# smart update, only stuff that was given",
"if",
"name",
"not",
"in",
"self",
".",
"categories",
":",
"raise",
"KeyErr... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | AdvancedProgressbar.deleteCategory | Deletes the category with the given name.
If the category does not exist, a :py:exc:`KeyError` will be thrown. | peng3d/gui/slider.py | def deleteCategory(self,name):
"""
Deletes the category with the given name.
If the category does not exist, a :py:exc:`KeyError` will be thrown.
"""
if name not in self.categories:
raise KeyError("No Category with name '%s'"%name)
del self.categories... | def deleteCategory(self,name):
"""
Deletes the category with the given name.
If the category does not exist, a :py:exc:`KeyError` will be thrown.
"""
if name not in self.categories:
raise KeyError("No Category with name '%s'"%name)
del self.categories... | [
"Deletes",
"the",
"category",
"with",
"the",
"given",
"name",
".",
"If",
"the",
"category",
"does",
"not",
"exist",
"a",
":",
"py",
":",
"exc",
":",
"KeyError",
"will",
"be",
"thrown",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/slider.py#L336-L345 | [
"def",
"deleteCategory",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"categories",
":",
"raise",
"KeyError",
"(",
"\"No Category with name '%s'\"",
"%",
"name",
")",
"del",
"self",
".",
"categories",
"[",
"name",
"]",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Slider.p | Helper property containing the percentage this slider is "filled".
This property is read-only. | peng3d/gui/slider.py | def p(self):
"""
Helper property containing the percentage this slider is "filled".
This property is read-only.
"""
return (self.n-self.nmin)/max((self.nmax-self.nmin),1) | def p(self):
"""
Helper property containing the percentage this slider is "filled".
This property is read-only.
"""
return (self.n-self.nmin)/max((self.nmax-self.nmin),1) | [
"Helper",
"property",
"containing",
"the",
"percentage",
"this",
"slider",
"is",
"filled",
".",
"This",
"property",
"is",
"read",
"-",
"only",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/slider.py#L422-L428 | [
"def",
"p",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"n",
"-",
"self",
".",
"nmin",
")",
"/",
"max",
"(",
"(",
"self",
".",
"nmax",
"-",
"self",
".",
"nmin",
")",
",",
"1",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | Menu.addLayer | Adds a new layer to the stack, optionally at the specified z-value.
``layer`` must be an instance of Layer or subclasses.
``z`` can be used to override the index of the layer in the stack. Defaults to ``-1`` for appending. | peng3d/menu.py | def addLayer(self,layer,z=-1):
"""
Adds a new layer to the stack, optionally at the specified z-value.
``layer`` must be an instance of Layer or subclasses.
``z`` can be used to override the index of the layer in the stack. Defaults to ``-1`` for appending.
"""
... | def addLayer(self,layer,z=-1):
"""
Adds a new layer to the stack, optionally at the specified z-value.
``layer`` must be an instance of Layer or subclasses.
``z`` can be used to override the index of the layer in the stack. Defaults to ``-1`` for appending.
"""
... | [
"Adds",
"a",
"new",
"layer",
"to",
"the",
"stack",
"optionally",
"at",
"the",
"specified",
"z",
"-",
"value",
".",
"layer",
"must",
"be",
"an",
"instance",
"of",
"Layer",
"or",
"subclasses",
".",
"z",
"can",
"be",
"used",
"to",
"override",
"the",
"inde... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/menu.py#L124-L139 | [
"def",
"addLayer",
"(",
"self",
",",
"layer",
",",
"z",
"=",
"-",
"1",
")",
":",
"# Adds a new layer to the stack, optionally at the specified z-value",
"# The z-value is the index this layer should be inserted in, or -1 for appending",
"if",
"not",
"isinstance",
"(",
"layer",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | _get_region | Map a buffer region using this attribute as an accessor.
The returned region can be modified as if the buffer was a contiguous
array of this attribute (though it may actually be interleaved or
otherwise non-contiguous).
The returned region consists of a contiguous array of component
... | peng3d/pyglet_patch.py | def _get_region(self, buffer, start, count):
'''Map a buffer region using this attribute as an accessor.
The returned region can be modified as if the buffer was a contiguous
array of this attribute (though it may actually be interleaved or
otherwise non-contiguous).
The return... | def _get_region(self, buffer, start, count):
'''Map a buffer region using this attribute as an accessor.
The returned region can be modified as if the buffer was a contiguous
array of this attribute (though it may actually be interleaved or
otherwise non-contiguous).
The return... | [
"Map",
"a",
"buffer",
"region",
"using",
"this",
"attribute",
"as",
"an",
"accessor",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/pyglet_patch.py#L44-L83 | [
"def",
"_get_region",
"(",
"self",
",",
"buffer",
",",
"start",
",",
"count",
")",
":",
"byte_start",
"=",
"self",
".",
"stride",
"*",
"start",
"byte_size",
"=",
"self",
".",
"stride",
"*",
"count",
"array_count",
"=",
"self",
".",
"count",
"*",
"count... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | _draw | Draw vertices in the domain.
If `vertex_list` is not specified, all vertices in the domain are
drawn. This is the most efficient way to render primitives.
If `vertex_list` specifies a `VertexList`, only primitives in that
list will be drawn.
:Parameters:
`mode` : ... | peng3d/pyglet_patch.py | def _draw(self, mode, vertex_list=None):
'''Draw vertices in the domain.
If `vertex_list` is not specified, all vertices in the domain are
drawn. This is the most efficient way to render primitives.
If `vertex_list` specifies a `VertexList`, only primitives in that
list will b... | def _draw(self, mode, vertex_list=None):
'''Draw vertices in the domain.
If `vertex_list` is not specified, all vertices in the domain are
drawn. This is the most efficient way to render primitives.
If `vertex_list` specifies a `VertexList`, only primitives in that
list will b... | [
"Draw",
"vertices",
"in",
"the",
"domain",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/pyglet_patch.py#L136-L181 | [
"def",
"_draw",
"(",
"self",
",",
"mode",
",",
"vertex_list",
"=",
"None",
")",
":",
"glPushClientAttrib",
"(",
"GL_CLIENT_VERTEX_ARRAY_BIT",
")",
"for",
"buffer",
",",
"attributes",
"in",
"self",
".",
"buffer_attributes",
":",
"buffer",
".",
"bind",
"(",
")... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | patch_float2int | Patches the :py:mod:`pyglet.graphics.vertexattribute`\ , :py:mod:`pyglet.graphics.vertexbuffer` and :py:mod:`pyglet.graphics.vertexdomain` modules.
This patch is only needed with Python 3.x and will be applied automatically when initializing :py:class:`Peng()`\ .
The patches consist of simply converti... | peng3d/pyglet_patch.py | def patch_float2int():
"""
Patches the :py:mod:`pyglet.graphics.vertexattribute`\ , :py:mod:`pyglet.graphics.vertexbuffer` and :py:mod:`pyglet.graphics.vertexdomain` modules.
This patch is only needed with Python 3.x and will be applied automatically when initializing :py:class:`Peng()`\ .
The... | def patch_float2int():
"""
Patches the :py:mod:`pyglet.graphics.vertexattribute`\ , :py:mod:`pyglet.graphics.vertexbuffer` and :py:mod:`pyglet.graphics.vertexdomain` modules.
This patch is only needed with Python 3.x and will be applied automatically when initializing :py:class:`Peng()`\ .
The... | [
"Patches",
"the",
":",
"py",
":",
"mod",
":",
"pyglet",
".",
"graphics",
".",
"vertexattribute",
"\\",
":",
"py",
":",
"mod",
":",
"pyglet",
".",
"graphics",
".",
"vertexbuffer",
"and",
":",
"py",
":",
"mod",
":",
"pyglet",
".",
"graphics",
".",
"ver... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/pyglet_patch.py#L183-L196 | [
"def",
"patch_float2int",
"(",
")",
":",
"pyglet",
".",
"graphics",
".",
"vertexattribute",
".",
"AbstractAttribute",
".",
"get_region",
"=",
"_get_region",
"pyglet",
".",
"graphics",
".",
"vertexbuffer",
".",
"MappableVertexBufferObject",
".",
"bind",
"=",
"_bind... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | register_pyglet_handler | Registers the given pyglet-style event handler for the given pyglet event.
This function allows pyglet-style event handlers to receive events bridged
through the peng3d event system. Internally, this function creates a lambda
function that decodes the arguments and then calls the pyglet-style event han... | peng3d/util/__init__.py | def register_pyglet_handler(peng,func,event,raiseErrors=False):
"""
Registers the given pyglet-style event handler for the given pyglet event.
This function allows pyglet-style event handlers to receive events bridged
through the peng3d event system. Internally, this function creates a lambda
f... | def register_pyglet_handler(peng,func,event,raiseErrors=False):
"""
Registers the given pyglet-style event handler for the given pyglet event.
This function allows pyglet-style event handlers to receive events bridged
through the peng3d event system. Internally, this function creates a lambda
f... | [
"Registers",
"the",
"given",
"pyglet",
"-",
"style",
"event",
"handler",
"for",
"the",
"given",
"pyglet",
"event",
".",
"This",
"function",
"allows",
"pyglet",
"-",
"style",
"event",
"handlers",
"to",
"receive",
"events",
"bridged",
"through",
"the",
"peng3d",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L65-L79 | [
"def",
"register_pyglet_handler",
"(",
"peng",
",",
"func",
",",
"event",
",",
"raiseErrors",
"=",
"False",
")",
":",
"peng",
".",
"addEventListener",
"(",
"\"pyglet:%s\"",
"%",
"event",
",",
"(",
"lambda",
"data",
":",
"func",
"(",
"*",
"data",
"[",
"\"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ActionDispatcher.addAction | Adds a callback to the specified action.
All other positional and keyword arguments will be stored and passed to the function upon activation. | peng3d/util/__init__.py | def addAction(self,action,func,*args,**kwargs):
"""
Adds a callback to the specified action.
All other positional and keyword arguments will be stored and passed to the function upon activation.
"""
if not hasattr(self,"actions"):
self.actions = {}
if... | def addAction(self,action,func,*args,**kwargs):
"""
Adds a callback to the specified action.
All other positional and keyword arguments will be stored and passed to the function upon activation.
"""
if not hasattr(self,"actions"):
self.actions = {}
if... | [
"Adds",
"a",
"callback",
"to",
"the",
"specified",
"action",
".",
"All",
"other",
"positional",
"and",
"keyword",
"arguments",
"will",
"be",
"stored",
"and",
"passed",
"to",
"the",
"function",
"upon",
"activation",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L94-L104 | [
"def",
"addAction",
"(",
"self",
",",
"action",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"actions\"",
")",
":",
"self",
".",
"actions",
"=",
"{",
"}",
"if",
"action",
"not",
"in... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | ActionDispatcher.doAction | Helper method that calls all callbacks registered for the given action. | peng3d/util/__init__.py | def doAction(self,action):
"""
Helper method that calls all callbacks registered for the given action.
"""
if not hasattr(self,"actions"):
return
for f,args,kwargs in self.actions.get(action,[]):
f(*args,**kwargs) | def doAction(self,action):
"""
Helper method that calls all callbacks registered for the given action.
"""
if not hasattr(self,"actions"):
return
for f,args,kwargs in self.actions.get(action,[]):
f(*args,**kwargs) | [
"Helper",
"method",
"that",
"calls",
"all",
"callbacks",
"registered",
"for",
"the",
"given",
"action",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L105-L112 | [
"def",
"doAction",
"(",
"self",
",",
"action",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"actions\"",
")",
":",
"return",
"for",
"f",
",",
"args",
",",
"kwargs",
"in",
"self",
".",
"actions",
".",
"get",
"(",
"action",
",",
"[",
"]",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SmartRegistry.genNewID | Generates a new ID.
If ``reuse_ids`` was false, the new ID will be read from an internal counter
which is also automatically increased. This means that the newly generated ID is already reserved.
If ``reuse_ids`` was true, this method starts counting up from ``start_id`` until ... | peng3d/util/__init__.py | def genNewID(self):
"""
Generates a new ID.
If ``reuse_ids`` was false, the new ID will be read from an internal counter
which is also automatically increased. This means that the newly generated ID is already reserved.
If ``reuse_ids`` was true, this method sta... | def genNewID(self):
"""
Generates a new ID.
If ``reuse_ids`` was false, the new ID will be read from an internal counter
which is also automatically increased. This means that the newly generated ID is already reserved.
If ``reuse_ids`` was true, this method sta... | [
"Generates",
"a",
"new",
"ID",
".",
"If",
"reuse_ids",
"was",
"false",
"the",
"new",
"ID",
"will",
"be",
"read",
"from",
"an",
"internal",
"counter",
"which",
"is",
"also",
"automatically",
"increased",
".",
"This",
"means",
"that",
"the",
"newly",
"genera... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L181-L207 | [
"def",
"genNewID",
"(",
"self",
")",
":",
"if",
"self",
".",
"reuse_ids",
":",
"i",
"=",
"self",
".",
"start_id",
"while",
"True",
":",
"if",
"i",
"not",
"in",
"self",
".",
"_data",
"[",
"\"reg\"",
"]",
":",
"assert",
"i",
"<=",
"self",
".",
"max... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SmartRegistry.register | Registers a name to the registry.
``name`` is the name of the object and must be a string.
``force_id`` can be optionally set to override the automatic ID generation
and force a specific ID.
Note that using ``force_id`` is discouraged, since it may cause proble... | peng3d/util/__init__.py | def register(self,name,force_id=None):
"""
Registers a name to the registry.
``name`` is the name of the object and must be a string.
``force_id`` can be optionally set to override the automatic ID generation
and force a specific ID.
Note that u... | def register(self,name,force_id=None):
"""
Registers a name to the registry.
``name`` is the name of the object and must be a string.
``force_id`` can be optionally set to override the automatic ID generation
and force a specific ID.
Note that u... | [
"Registers",
"a",
"name",
"to",
"the",
"registry",
".",
"name",
"is",
"the",
"name",
"of",
"the",
"object",
"and",
"must",
"be",
"a",
"string",
".",
"force_id",
"can",
"be",
"optionally",
"set",
"to",
"override",
"the",
"automatic",
"ID",
"generation",
"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L209-L226 | [
"def",
"register",
"(",
"self",
",",
"name",
",",
"force_id",
"=",
"None",
")",
":",
"with",
"self",
".",
"registry_lock",
":",
"if",
"force_id",
"is",
"None",
":",
"new_id",
"=",
"self",
".",
"genNewID",
"(",
")",
"else",
":",
"new_id",
"=",
"force_... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SmartRegistry.normalizeID | Takes in an object and normalizes it to its ID/integer representation.
Currently, only integers and strings may be passed in, else a :py:exc:`TypeError`
will be thrown. | peng3d/util/__init__.py | def normalizeID(self,in_id):
"""
Takes in an object and normalizes it to its ID/integer representation.
Currently, only integers and strings may be passed in, else a :py:exc:`TypeError`
will be thrown.
"""
if isinstance(in_id,int):
assert in_id in sel... | def normalizeID(self,in_id):
"""
Takes in an object and normalizes it to its ID/integer representation.
Currently, only integers and strings may be passed in, else a :py:exc:`TypeError`
will be thrown.
"""
if isinstance(in_id,int):
assert in_id in sel... | [
"Takes",
"in",
"an",
"object",
"and",
"normalizes",
"it",
"to",
"its",
"ID",
"/",
"integer",
"representation",
".",
"Currently",
"only",
"integers",
"and",
"strings",
"may",
"be",
"passed",
"in",
"else",
"a",
":",
"py",
":",
"exc",
":",
"TypeError",
"wil... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L228-L242 | [
"def",
"normalizeID",
"(",
"self",
",",
"in_id",
")",
":",
"if",
"isinstance",
"(",
"in_id",
",",
"int",
")",
":",
"assert",
"in_id",
"in",
"self",
".",
"_data",
"[",
"\"reg\"",
"]",
"return",
"in_id",
"elif",
"isinstance",
"(",
"in_id",
",",
"str",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | SmartRegistry.normalizeName | Takes in an object and normalizes it to its name/string.
Currently, only integers and strings may be passed in, else a :py:exc:`TypeError`
will be thrown. | peng3d/util/__init__.py | def normalizeName(self,in_name):
"""
Takes in an object and normalizes it to its name/string.
Currently, only integers and strings may be passed in, else a :py:exc:`TypeError`
will be thrown.
"""
if isinstance(in_name,str):
assert in_name in self._dat... | def normalizeName(self,in_name):
"""
Takes in an object and normalizes it to its name/string.
Currently, only integers and strings may be passed in, else a :py:exc:`TypeError`
will be thrown.
"""
if isinstance(in_name,str):
assert in_name in self._dat... | [
"Takes",
"in",
"an",
"object",
"and",
"normalizes",
"it",
"to",
"its",
"name",
"/",
"string",
".",
"Currently",
"only",
"integers",
"and",
"strings",
"may",
"be",
"passed",
"in",
"else",
"a",
":",
"py",
":",
"exc",
":",
"TypeError",
"will",
"be",
"thro... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/util/__init__.py#L243-L257 | [
"def",
"normalizeName",
"(",
"self",
",",
"in_name",
")",
":",
"if",
"isinstance",
"(",
"in_name",
",",
"str",
")",
":",
"assert",
"in_name",
"in",
"self",
".",
"_data",
"[",
"\"reg\"",
"]",
".",
"inv",
"return",
"in_name",
"elif",
"isinstance",
"(",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LayerWorld.setView | Sets the view used to the specified ``name``\ .
The name must be known to the world or else a :py:exc:`ValueError` is raised. | peng3d/layer.py | def setView(self,name):
"""
Sets the view used to the specified ``name``\ .
The name must be known to the world or else a :py:exc:`ValueError` is raised.
"""
if name not in self.world.views:
raise ValueError("Invalid viewname for world!")
self.viewnam... | def setView(self,name):
"""
Sets the view used to the specified ``name``\ .
The name must be known to the world or else a :py:exc:`ValueError` is raised.
"""
if name not in self.world.views:
raise ValueError("Invalid viewname for world!")
self.viewnam... | [
"Sets",
"the",
"view",
"used",
"to",
"the",
"specified",
"name",
"\\",
".",
"The",
"name",
"must",
"be",
"known",
"to",
"the",
"world",
"or",
"else",
"a",
":",
"py",
":",
"exc",
":",
"ValueError",
"is",
"raised",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/layer.py#L184-L193 | [
"def",
"setView",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"world",
".",
"views",
":",
"raise",
"ValueError",
"(",
"\"Invalid viewname for world!\"",
")",
"self",
".",
"viewname",
"=",
"viewname",
"self",
".",
"view",
"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LayerWorld.predraw | Sets up the attributes used by :py:class:`Layer3D()` and calls :py:meth:`Layer3D.predraw()`\ . | peng3d/layer.py | def predraw(self):
"""
Sets up the attributes used by :py:class:`Layer3D()` and calls :py:meth:`Layer3D.predraw()`\ .
"""
self.cam = self.view.cam
super(LayerWorld,self).predraw() | def predraw(self):
"""
Sets up the attributes used by :py:class:`Layer3D()` and calls :py:meth:`Layer3D.predraw()`\ .
"""
self.cam = self.view.cam
super(LayerWorld,self).predraw() | [
"Sets",
"up",
"the",
"attributes",
"used",
"by",
":",
"py",
":",
"class",
":",
"Layer3D",
"()",
"and",
"calls",
":",
"py",
":",
"meth",
":",
"Layer3D",
".",
"predraw",
"()",
"\\",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/layer.py#L194-L199 | [
"def",
"predraw",
"(",
"self",
")",
":",
"self",
".",
"cam",
"=",
"self",
".",
"view",
".",
"cam",
"super",
"(",
"LayerWorld",
",",
"self",
")",
".",
"predraw",
"(",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LayeredWidget.addLayer | Adds the given layer at the given Z Index.
If ``z_index`` is not given, the Z Index specified by the layer will be used. | peng3d/gui/layered.py | def addLayer(self,layer,z_index=None):
"""
Adds the given layer at the given Z Index.
If ``z_index`` is not given, the Z Index specified by the layer will be used.
"""
if z_index is None:
z_index = layer.z_index
i = 0
for l,z in self.layers:
... | def addLayer(self,layer,z_index=None):
"""
Adds the given layer at the given Z Index.
If ``z_index`` is not given, the Z Index specified by the layer will be used.
"""
if z_index is None:
z_index = layer.z_index
i = 0
for l,z in self.layers:
... | [
"Adds",
"the",
"given",
"layer",
"at",
"the",
"given",
"Z",
"Index",
".",
"If",
"z_index",
"is",
"not",
"given",
"the",
"Z",
"Index",
"specified",
"by",
"the",
"layer",
"will",
"be",
"used",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L66-L80 | [
"def",
"addLayer",
"(",
"self",
",",
"layer",
",",
"z_index",
"=",
"None",
")",
":",
"if",
"z_index",
"is",
"None",
":",
"z_index",
"=",
"layer",
".",
"z_index",
"i",
"=",
"0",
"for",
"l",
",",
"z",
"in",
"self",
".",
"layers",
":",
"if",
"z",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LayeredWidget.redraw_layer | Redraws the given layer.
:raises ValueError: If there is no Layer with the given name. | peng3d/gui/layered.py | def redraw_layer(self,name):
"""
Redraws the given layer.
:raises ValueError: If there is no Layer with the given name.
"""
if name not in self._layers:
raise ValueError("Layer %s not part of widget, cannot redraw")
self._layers[name].on_redraw() | def redraw_layer(self,name):
"""
Redraws the given layer.
:raises ValueError: If there is no Layer with the given name.
"""
if name not in self._layers:
raise ValueError("Layer %s not part of widget, cannot redraw")
self._layers[name].on_redraw() | [
"Redraws",
"the",
"given",
"layer",
".",
":",
"raises",
"ValueError",
":",
"If",
"there",
"is",
"no",
"Layer",
"with",
"the",
"given",
"name",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L92-L100 | [
"def",
"redraw_layer",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"_layers",
":",
"raise",
"ValueError",
"(",
"\"Layer %s not part of widget, cannot redraw\"",
")",
"self",
".",
"_layers",
"[",
"name",
"]",
".",
"on_redraw",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LayeredWidget.draw | Draws all layers of this LayeredWidget.
This should normally be unneccessary, since it is recommended that layers use Vertex Lists instead of OpenGL Immediate Mode. | peng3d/gui/layered.py | def draw(self):
"""
Draws all layers of this LayeredWidget.
This should normally be unneccessary, since it is recommended that layers use Vertex Lists instead of OpenGL Immediate Mode.
"""
super(LayeredWidget,self).draw()
for layer,_ in self.layers:
l... | def draw(self):
"""
Draws all layers of this LayeredWidget.
This should normally be unneccessary, since it is recommended that layers use Vertex Lists instead of OpenGL Immediate Mode.
"""
super(LayeredWidget,self).draw()
for layer,_ in self.layers:
l... | [
"Draws",
"all",
"layers",
"of",
"this",
"LayeredWidget",
".",
"This",
"should",
"normally",
"be",
"unneccessary",
"since",
"it",
"is",
"recommended",
"that",
"layers",
"use",
"Vertex",
"Lists",
"instead",
"of",
"OpenGL",
"Immediate",
"Mode",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L101-L109 | [
"def",
"draw",
"(",
"self",
")",
":",
"super",
"(",
"LayeredWidget",
",",
"self",
")",
".",
"draw",
"(",
")",
"for",
"layer",
",",
"_",
"in",
"self",
".",
"layers",
":",
"layer",
".",
"_draw",
"(",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LayeredWidget.delete | Deletes all layers within this LayeredWidget before deleting itself.
Recommended to call if you are removing the widget, but not yet exiting the interpreter. | peng3d/gui/layered.py | def delete(self):
"""
Deletes all layers within this LayeredWidget before deleting itself.
Recommended to call if you are removing the widget, but not yet exiting the interpreter.
"""
for layer,_ in self.layers:
layer.delete()
self.layers = []
... | def delete(self):
"""
Deletes all layers within this LayeredWidget before deleting itself.
Recommended to call if you are removing the widget, but not yet exiting the interpreter.
"""
for layer,_ in self.layers:
layer.delete()
self.layers = []
... | [
"Deletes",
"all",
"layers",
"within",
"this",
"LayeredWidget",
"before",
"deleting",
"itself",
".",
"Recommended",
"to",
"call",
"if",
"you",
"are",
"removing",
"the",
"widget",
"but",
"not",
"yet",
"exiting",
"the",
"interpreter",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L110-L120 | [
"def",
"delete",
"(",
"self",
")",
":",
"for",
"layer",
",",
"_",
"in",
"self",
".",
"layers",
":",
"layer",
".",
"delete",
"(",
")",
"self",
".",
"layers",
"=",
"[",
"]",
"self",
".",
"_layers",
"=",
"{",
"}",
"super",
"(",
"LayeredWidget",
",",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WidgetLayer.on_redraw | Called when the Layer should be redrawn.
If a subclass uses the :py:meth:`initialize()` Method, it is very important to also call the Super Class Method to prevent crashes. | peng3d/gui/layered.py | def on_redraw(self):
"""
Called when the Layer should be redrawn.
If a subclass uses the :py:meth:`initialize()` Method, it is very important to also call the Super Class Method to prevent crashes.
"""
super(WidgetLayer,self).on_redraw()
if not self._initialized:... | def on_redraw(self):
"""
Called when the Layer should be redrawn.
If a subclass uses the :py:meth:`initialize()` Method, it is very important to also call the Super Class Method to prevent crashes.
"""
super(WidgetLayer,self).on_redraw()
if not self._initialized:... | [
"Called",
"when",
"the",
"Layer",
"should",
"be",
"redrawn",
".",
"If",
"a",
"subclass",
"uses",
"the",
":",
"py",
":",
"meth",
":",
"initialize",
"()",
"Method",
"it",
"is",
"very",
"important",
"to",
"also",
"call",
"the",
"Super",
"Class",
"Method",
... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L220-L229 | [
"def",
"on_redraw",
"(",
"self",
")",
":",
"super",
"(",
"WidgetLayer",
",",
"self",
")",
".",
"on_redraw",
"(",
")",
"if",
"not",
"self",
".",
"_initialized",
":",
"self",
".",
"initialize",
"(",
")",
"self",
".",
"_initialized",
"=",
"True"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WidgetLayer.border | Property to be used for setting and getting the border of the layer.
Note that setting this property causes an immediate redraw. | peng3d/gui/layered.py | def border(self):
"""
Property to be used for setting and getting the border of the layer.
Note that setting this property causes an immediate redraw.
"""
if callable(self._border):
return util.WatchingList(self._border(*(self.widget.pos+self.widget.size)),se... | def border(self):
"""
Property to be used for setting and getting the border of the layer.
Note that setting this property causes an immediate redraw.
"""
if callable(self._border):
return util.WatchingList(self._border(*(self.widget.pos+self.widget.size)),se... | [
"Property",
"to",
"be",
"used",
"for",
"setting",
"and",
"getting",
"the",
"border",
"of",
"the",
"layer",
".",
"Note",
"that",
"setting",
"this",
"property",
"causes",
"an",
"immediate",
"redraw",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L237-L246 | [
"def",
"border",
"(",
"self",
")",
":",
"if",
"callable",
"(",
"self",
".",
"_border",
")",
":",
"return",
"util",
".",
"WatchingList",
"(",
"self",
".",
"_border",
"(",
"*",
"(",
"self",
".",
"widget",
".",
"pos",
"+",
"self",
".",
"widget",
".",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WidgetLayer.offset | Property to be used for setting and getting the offset of the layer.
Note that setting this property causes an immediate redraw. | peng3d/gui/layered.py | def offset(self):
"""
Property to be used for setting and getting the offset of the layer.
Note that setting this property causes an immediate redraw.
"""
if callable(self._offset):
return util.WatchingList(self._offset(*(self.widget.pos+self.widget.size)),se... | def offset(self):
"""
Property to be used for setting and getting the offset of the layer.
Note that setting this property causes an immediate redraw.
"""
if callable(self._offset):
return util.WatchingList(self._offset(*(self.widget.pos+self.widget.size)),se... | [
"Property",
"to",
"be",
"used",
"for",
"setting",
"and",
"getting",
"the",
"offset",
"of",
"the",
"layer",
".",
"Note",
"that",
"setting",
"this",
"property",
"causes",
"an",
"immediate",
"redraw",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L253-L262 | [
"def",
"offset",
"(",
"self",
")",
":",
"if",
"callable",
"(",
"self",
".",
"_offset",
")",
":",
"return",
"util",
".",
"WatchingList",
"(",
"self",
".",
"_offset",
"(",
"*",
"(",
"self",
".",
"widget",
".",
"pos",
"+",
"self",
".",
"widget",
".",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WidgetLayer.getPos | Returns the absolute position and size of the layer.
This method is intended for use in vertex position calculation, as the border and offset have already been applied.
The returned value is a 4-tuple of ``(sx,sy,ex,ey)``\ .
The two values starting with an s are the "start" pos... | peng3d/gui/layered.py | def getPos(self):
"""
Returns the absolute position and size of the layer.
This method is intended for use in vertex position calculation, as the border and offset have already been applied.
The returned value is a 4-tuple of ``(sx,sy,ex,ey)``\ .
The two values ... | def getPos(self):
"""
Returns the absolute position and size of the layer.
This method is intended for use in vertex position calculation, as the border and offset have already been applied.
The returned value is a 4-tuple of ``(sx,sy,ex,ey)``\ .
The two values ... | [
"Returns",
"the",
"absolute",
"position",
"and",
"size",
"of",
"the",
"layer",
".",
"This",
"method",
"is",
"intended",
"for",
"use",
"in",
"vertex",
"position",
"calculation",
"as",
"the",
"border",
"and",
"offset",
"have",
"already",
"been",
"applied",
"."... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L273-L288 | [
"def",
"getPos",
"(",
"self",
")",
":",
"# Returns sx,sy,ex,ey",
"# sx,sy are bottom-left/lowest",
"# ex,ey are top-right/highest",
"sx",
",",
"sy",
"=",
"self",
".",
"widget",
".",
"pos",
"[",
"0",
"]",
"+",
"self",
".",
"border",
"[",
"0",
"]",
"+",
"self"... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | WidgetLayer.getSize | Returns the size of the layer, with the border size already subtracted. | peng3d/gui/layered.py | def getSize(self):
"""
Returns the size of the layer, with the border size already subtracted.
"""
return self.widget.size[0]-self.border[0]*2,self.widget.size[1]-self.border[1]*2 | def getSize(self):
"""
Returns the size of the layer, with the border size already subtracted.
"""
return self.widget.size[0]-self.border[0]*2,self.widget.size[1]-self.border[1]*2 | [
"Returns",
"the",
"size",
"of",
"the",
"layer",
"with",
"the",
"border",
"size",
"already",
"subtracted",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L289-L293 | [
"def",
"getSize",
"(",
"self",
")",
":",
"return",
"self",
".",
"widget",
".",
"size",
"[",
"0",
"]",
"-",
"self",
".",
"border",
"[",
"0",
"]",
"*",
"2",
",",
"self",
".",
"widget",
".",
"size",
"[",
"1",
"]",
"-",
"self",
".",
"border",
"["... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | DynImageWidgetLayer.addImage | Adds an image to the internal registry.
``rsrc`` should be a 2-tuple of ``(resource_name,category)``\ . | peng3d/gui/layered.py | def addImage(self,name,rsrc):
"""
Adds an image to the internal registry.
``rsrc`` should be a 2-tuple of ``(resource_name,category)``\ .
"""
self.imgs[name]=self.widget.peng.resourceMgr.getTex(*rsrc) | def addImage(self,name,rsrc):
"""
Adds an image to the internal registry.
``rsrc`` should be a 2-tuple of ``(resource_name,category)``\ .
"""
self.imgs[name]=self.widget.peng.resourceMgr.getTex(*rsrc) | [
"Adds",
"an",
"image",
"to",
"the",
"internal",
"registry",
".",
"rsrc",
"should",
"be",
"a",
"2",
"-",
"tuple",
"of",
"(",
"resource_name",
"category",
")",
"\\",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L389-L395 | [
"def",
"addImage",
"(",
"self",
",",
"name",
",",
"rsrc",
")",
":",
"self",
".",
"imgs",
"[",
"name",
"]",
"=",
"self",
".",
"widget",
".",
"peng",
".",
"resourceMgr",
".",
"getTex",
"(",
"*",
"rsrc",
")"
] | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | DynImageWidgetLayer.switchImage | Switches the active image to the given name.
:raises ValueError: If there is no such image | peng3d/gui/layered.py | def switchImage(self,name):
"""
Switches the active image to the given name.
:raises ValueError: If there is no such image
"""
if name not in self.imgs:
raise ValueError("No image of name '%s'"%name)
elif self.cur_img==name:
return
... | def switchImage(self,name):
"""
Switches the active image to the given name.
:raises ValueError: If there is no such image
"""
if name not in self.imgs:
raise ValueError("No image of name '%s'"%name)
elif self.cur_img==name:
return
... | [
"Switches",
"the",
"active",
"image",
"to",
"the",
"given",
"name",
".",
":",
"raises",
"ValueError",
":",
"If",
"there",
"is",
"no",
"such",
"image"
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L396-L408 | [
"def",
"switchImage",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"imgs",
":",
"raise",
"ValueError",
"(",
"\"No image of name '%s'\"",
"%",
"name",
")",
"elif",
"self",
".",
"cur_img",
"==",
"name",
":",
"return",
"self",... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | LabelWidgetLayer.redraw_label | Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the layer. | peng3d/gui/layered.py | def redraw_label(self):
"""
Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the layer.
"""
# Convenience variables
x,y,_,_ = self.getPos()
sx,sy = self.getSize()
self._label.x ... | def redraw_label(self):
"""
Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the layer.
"""
# Convenience variables
x,y,_,_ = self.getPos()
sx,sy = self.getSize()
self._label.x ... | [
"Re",
"-",
"draws",
"the",
"text",
"by",
"calculating",
"its",
"position",
".",
"Currently",
"the",
"text",
"will",
"always",
"be",
"centered",
"on",
"the",
"position",
"of",
"the",
"layer",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L491-L506 | [
"def",
"redraw_label",
"(",
"self",
")",
":",
"# Convenience variables",
"x",
",",
"y",
",",
"_",
",",
"_",
"=",
"self",
".",
"getPos",
"(",
")",
"sx",
",",
"sy",
"=",
"self",
".",
"getSize",
"(",
")",
"self",
".",
"_label",
".",
"x",
"=",
"x",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | FormattedLabelWidgetLayer.redraw_label | Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the layer. | peng3d/gui/layered.py | def redraw_label(self):
"""
Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the layer.
"""
# Convenience variables
x,y,_,_ = self.getPos()
sx,sy = self.getSize()
if self.font_n... | def redraw_label(self):
"""
Re-draws the text by calculating its position.
Currently, the text will always be centered on the position of the layer.
"""
# Convenience variables
x,y,_,_ = self.getPos()
sx,sy = self.getSize()
if self.font_n... | [
"Re",
"-",
"draws",
"the",
"text",
"by",
"calculating",
"its",
"position",
".",
"Currently",
"the",
"text",
"will",
"always",
"be",
"centered",
"on",
"the",
"position",
"of",
"the",
"layer",
"."
] | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L562-L584 | [
"def",
"redraw_label",
"(",
"self",
")",
":",
"# Convenience variables",
"x",
",",
"y",
",",
"_",
",",
"_",
"=",
"self",
".",
"getPos",
"(",
")",
"sx",
",",
"sy",
"=",
"self",
".",
"getSize",
"(",
")",
"if",
"self",
".",
"font_name",
"is",
"not",
... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BaseBorderWidgetLayer.getColors | Overrideable function that generates the colors to be used by various styles.
Should return a 5-tuple of ``(bg,o,i,s,h)``\ .
``bg`` is the base color of the background.
``o`` is the outer color, it is usually the same as the background color.
``i`` is ... | peng3d/gui/layered.py | def getColors(self):
"""
Overrideable function that generates the colors to be used by various styles.
Should return a 5-tuple of ``(bg,o,i,s,h)``\ .
``bg`` is the base color of the background.
``o`` is the outer color, it is usually the same as the bac... | def getColors(self):
"""
Overrideable function that generates the colors to be used by various styles.
Should return a 5-tuple of ``(bg,o,i,s,h)``\ .
``bg`` is the base color of the background.
``o`` is the outer color, it is usually the same as the bac... | [
"Overrideable",
"function",
"that",
"generates",
"the",
"colors",
"to",
"be",
"used",
"by",
"various",
"styles",
".",
"Should",
"return",
"a",
"5",
"-",
"tuple",
"of",
"(",
"bg",
"o",
"i",
"s",
"h",
")",
"\\",
".",
"bg",
"is",
"the",
"base",
"color",... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L674-L705 | [
"def",
"getColors",
"(",
"self",
")",
":",
"bg",
"=",
"self",
".",
"widget",
".",
"submenu",
".",
"bg",
"[",
":",
"3",
"]",
"if",
"isinstance",
"(",
"self",
".",
"widget",
".",
"submenu",
".",
"bg",
",",
"list",
")",
"or",
"isinstance",
"(",
"sel... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | BaseBorderWidgetLayer.genVertices | Called to generate the vertices used by this layer.
The length of the output of this method should be three times the :py:attr:`n_vertices` attribute.
See the source code of this method for more information about the order of the vertices. | peng3d/gui/layered.py | def genVertices(self):
"""
Called to generate the vertices used by this layer.
The length of the output of this method should be three times the :py:attr:`n_vertices` attribute.
See the source code of this method for more information about the order of the vertices.
... | def genVertices(self):
"""
Called to generate the vertices used by this layer.
The length of the output of this method should be three times the :py:attr:`n_vertices` attribute.
See the source code of this method for more information about the order of the vertices.
... | [
"Called",
"to",
"generate",
"the",
"vertices",
"used",
"by",
"this",
"layer",
".",
"The",
"length",
"of",
"the",
"output",
"of",
"this",
"method",
"should",
"be",
"three",
"times",
"the",
":",
"py",
":",
"attr",
":",
"n_vertices",
"attribute",
".",
"See"... | not-na/peng3d | python | https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/layered.py#L733-L798 | [
"def",
"genVertices",
"(",
"self",
")",
":",
"sx",
",",
"sy",
",",
"ex",
",",
"ey",
"=",
"self",
".",
"getPos",
"(",
")",
"b",
"=",
"self",
".",
"bborder",
"# Vertex Naming",
"# Y",
"# |1 2 3 4",
"# |5 6 7 8",
"# |9 10 11 12",
"# |13 14 15 16",
"# +... | 1151be665b26cc8a479f6307086ba919e4d32d85 |
test | read_h5 | DEPRECATED
Reads a mesh saved in the HDF5 format. | argiope/mesh.py | def read_h5(hdfstore, group = ""):
"""
DEPRECATED
Reads a mesh saved in the HDF5 format.
"""
m = Mesh()
m.elements.data = hdf["elements/connectivity"]
m.nodes.data = hdf["nodes/xyz"]
for key in hdf.keys():
if key.startswith("/nodes/sets"):
k = key.replace("/nodes/sets/", "")
m.nodes.s... | def read_h5(hdfstore, group = ""):
"""
DEPRECATED
Reads a mesh saved in the HDF5 format.
"""
m = Mesh()
m.elements.data = hdf["elements/connectivity"]
m.nodes.data = hdf["nodes/xyz"]
for key in hdf.keys():
if key.startswith("/nodes/sets"):
k = key.replace("/nodes/sets/", "")
m.nodes.s... | [
"DEPRECATED",
"Reads",
"a",
"mesh",
"saved",
"in",
"the",
"HDF5",
"format",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L684-L711 | [
"def",
"read_h5",
"(",
"hdfstore",
",",
"group",
"=",
"\"\"",
")",
":",
"m",
"=",
"Mesh",
"(",
")",
"m",
".",
"elements",
".",
"data",
"=",
"hdf",
"[",
"\"elements/connectivity\"",
"]",
"m",
".",
"nodes",
".",
"data",
"=",
"hdf",
"[",
"\"nodes/xyz\""... | 8170e431362dc760589f7d141090fd133dece259 |
test | read_msh | Reads a GMSH MSH file and returns a :class:`Mesh` instance.
:arg path: path to MSH file.
:type path: str | argiope/mesh.py | def read_msh(path):
"""
Reads a GMSH MSH file and returns a :class:`Mesh` instance.
:arg path: path to MSH file.
:type path: str
"""
elementMap = { 15:"point1",
1:"line2",
2:"tri3",
3:"quad4",
4:"tetra4",
5:"hexa8",
... | def read_msh(path):
"""
Reads a GMSH MSH file and returns a :class:`Mesh` instance.
:arg path: path to MSH file.
:type path: str
"""
elementMap = { 15:"point1",
1:"line2",
2:"tri3",
3:"quad4",
4:"tetra4",
5:"hexa8",
... | [
"Reads",
"a",
"GMSH",
"MSH",
"file",
"and",
"returns",
"a",
":",
"class",
":",
"Mesh",
"instance",
".",
":",
"arg",
"path",
":",
"path",
"to",
"MSH",
"file",
".",
":",
"type",
"path",
":",
"str"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L714-L776 | [
"def",
"read_msh",
"(",
"path",
")",
":",
"elementMap",
"=",
"{",
"15",
":",
"\"point1\"",
",",
"1",
":",
"\"line2\"",
",",
"2",
":",
"\"tri3\"",
",",
"3",
":",
"\"quad4\"",
",",
"4",
":",
"\"tetra4\"",
",",
"5",
":",
"\"hexa8\"",
",",
"6",
":",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | read_inp | Reads Abaqus inp file | argiope/mesh.py | def read_inp(path):
"""
Reads Abaqus inp file
"""
def lineInfo(line):
out = {"type": "data"}
if line[0] == "*":
if line[1] == "*":
out["type"] = "comment"
out["text"] = line[2:]
else:
out["type"] = "command"
words = line[1:].split(",")
out["value"... | def read_inp(path):
"""
Reads Abaqus inp file
"""
def lineInfo(line):
out = {"type": "data"}
if line[0] == "*":
if line[1] == "*":
out["type"] = "comment"
out["text"] = line[2:]
else:
out["type"] = "command"
words = line[1:].split(",")
out["value"... | [
"Reads",
"Abaqus",
"inp",
"file"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L778-L910 | [
"def",
"read_inp",
"(",
"path",
")",
":",
"def",
"lineInfo",
"(",
"line",
")",
":",
"out",
"=",
"{",
"\"type\"",
":",
"\"data\"",
"}",
"if",
"line",
"[",
"0",
"]",
"==",
"\"*\"",
":",
"if",
"line",
"[",
"1",
"]",
"==",
"\"*\"",
":",
"out",
"[",... | 8170e431362dc760589f7d141090fd133dece259 |
test | write_xdmf | Dumps the mesh to XDMF format. | argiope/mesh.py | def write_xdmf(mesh, path, dataformat = "XML"):
"""
Dumps the mesh to XDMF format.
"""
pattern = Template(open(MODPATH + "/templates/mesh/xdmf.xdmf").read())
attribute_pattern = Template(open(MODPATH + "/templates/mesh/xdmf_attribute.xdmf").read())
# MAPPINGS
cell_map = {
"tri3": 4,
"quad4":... | def write_xdmf(mesh, path, dataformat = "XML"):
"""
Dumps the mesh to XDMF format.
"""
pattern = Template(open(MODPATH + "/templates/mesh/xdmf.xdmf").read())
attribute_pattern = Template(open(MODPATH + "/templates/mesh/xdmf_attribute.xdmf").read())
# MAPPINGS
cell_map = {
"tri3": 4,
"quad4":... | [
"Dumps",
"the",
"mesh",
"to",
"XDMF",
"format",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L917-L1046 | [
"def",
"write_xdmf",
"(",
"mesh",
",",
"path",
",",
"dataformat",
"=",
"\"XML\"",
")",
":",
"pattern",
"=",
"Template",
"(",
"open",
"(",
"MODPATH",
"+",
"\"/templates/mesh/xdmf.xdmf\"",
")",
".",
"read",
"(",
")",
")",
"attribute_pattern",
"=",
"Template",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | write_inp | Exports the mesh to the INP format. | argiope/mesh.py | def write_inp(mesh, path = None, maxwidth = 40, sections = "solid"):
"""
Exports the mesh to the INP format.
"""
def set_to_inp(sets, keyword):
ss = ""
for sk in sets.keys():
labels = sets[sk].loc[sets[sk]].index.values
labels = list(labels)
labels.sort()
if len(labels)!= 0:
... | def write_inp(mesh, path = None, maxwidth = 40, sections = "solid"):
"""
Exports the mesh to the INP format.
"""
def set_to_inp(sets, keyword):
ss = ""
for sk in sets.keys():
labels = sets[sk].loc[sets[sk]].index.values
labels = list(labels)
labels.sort()
if len(labels)!= 0:
... | [
"Exports",
"the",
"mesh",
"to",
"the",
"INP",
"format",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L1048-L1145 | [
"def",
"write_inp",
"(",
"mesh",
",",
"path",
"=",
"None",
",",
"maxwidth",
"=",
"40",
",",
"sections",
"=",
"\"solid\"",
")",
":",
"def",
"set_to_inp",
"(",
"sets",
",",
"keyword",
")",
":",
"ss",
"=",
"\"\"",
"for",
"sk",
"in",
"sets",
".",
"keys... | 8170e431362dc760589f7d141090fd133dece259 |
test | _make_conn | Connectivity builder using Numba for speed boost. | argiope/mesh.py | def _make_conn(shape):
"""
Connectivity builder using Numba for speed boost.
"""
shape = np.array(shape)
Ne = shape.prod()
if len(shape) == 2:
nx, ny = np.array(shape) +1
conn = np.zeros((Ne, 4), dtype = np.int32)
counter = 0
pattern = np.array([0,1,1+nx,nx])
... | def _make_conn(shape):
"""
Connectivity builder using Numba for speed boost.
"""
shape = np.array(shape)
Ne = shape.prod()
if len(shape) == 2:
nx, ny = np.array(shape) +1
conn = np.zeros((Ne, 4), dtype = np.int32)
counter = 0
pattern = np.array([0,1,1+nx,nx])
... | [
"Connectivity",
"builder",
"using",
"Numba",
"for",
"speed",
"boost",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L1153-L1179 | [
"def",
"_make_conn",
"(",
"shape",
")",
":",
"shape",
"=",
"np",
".",
"array",
"(",
"shape",
")",
"Ne",
"=",
"shape",
".",
"prod",
"(",
")",
"if",
"len",
"(",
"shape",
")",
"==",
"2",
":",
"nx",
",",
"ny",
"=",
"np",
".",
"array",
"(",
"shape... | 8170e431362dc760589f7d141090fd133dece259 |
test | structured_mesh | Returns a structured mesh.
:arg shape: 2 or 3 integers (eg: shape = (10, 10, 10)).
:type shape: tuple
:arg dim: 2 or 3 floats (eg: dim = (4., 2., 1.))
:type dim: tuple
.. note::
This function does not use GMSH for mesh generation.
>>> import argiope as ag
>>> mesh =... | argiope/mesh.py | def structured_mesh(shape = (2,2,2), dim = (1.,1.,1.)):
"""
Returns a structured mesh.
:arg shape: 2 or 3 integers (eg: shape = (10, 10, 10)).
:type shape: tuple
:arg dim: 2 or 3 floats (eg: dim = (4., 2., 1.))
:type dim: tuple
.. note::
This function does not use GMSH for... | def structured_mesh(shape = (2,2,2), dim = (1.,1.,1.)):
"""
Returns a structured mesh.
:arg shape: 2 or 3 integers (eg: shape = (10, 10, 10)).
:type shape: tuple
:arg dim: 2 or 3 floats (eg: dim = (4., 2., 1.))
:type dim: tuple
.. note::
This function does not use GMSH for... | [
"Returns",
"a",
"structured",
"mesh",
".",
":",
"arg",
"shape",
":",
"2",
"or",
"3",
"integers",
"(",
"eg",
":",
"shape",
"=",
"(",
"10",
"10",
"10",
"))",
".",
":",
"type",
"shape",
":",
"tuple",
":",
"arg",
"dim",
":",
"2",
"or",
"3",
"floats... | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L1181-L1224 | [
"def",
"structured_mesh",
"(",
"shape",
"=",
"(",
"2",
",",
"2",
",",
"2",
")",
",",
"dim",
"=",
"(",
"1.",
",",
"1.",
",",
"1.",
")",
")",
":",
"# PREPROCESSING",
"shape",
"=",
"np",
".",
"array",
"(",
"shape",
")",
"dim",
"=",
"np",
".",
"a... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.set_nodes | r"""
Sets the node data.
:arg nlabels: node labels. Items be strictly positive and int typed
in 1D array-like with shape :math:`(N_n)`.
:type nlabels: 1D uint typed array-like
:arg coords: node coordinates. Must be float typed 2D array-like of shape
:math:`(N_n ... | argiope/mesh.py | def set_nodes(self, nlabels = [], coords = [], nsets = {}, **kwargs):
r"""
Sets the node data.
:arg nlabels: node labels. Items be strictly positive and int typed
in 1D array-like with shape :math:`(N_n)`.
:type nlabels: 1D uint typed array-like
:arg coords: node coordinates.... | def set_nodes(self, nlabels = [], coords = [], nsets = {}, **kwargs):
r"""
Sets the node data.
:arg nlabels: node labels. Items be strictly positive and int typed
in 1D array-like with shape :math:`(N_n)`.
:type nlabels: 1D uint typed array-like
:arg coords: node coordinates.... | [
"r",
"Sets",
"the",
"node",
"data",
".",
":",
"arg",
"nlabels",
":",
"node",
"labels",
".",
"Items",
"be",
"strictly",
"positive",
"and",
"int",
"typed",
"in",
"1D",
"array",
"-",
"like",
"with",
"shape",
":",
"math",
":",
"(",
"N_n",
")",
".",
":"... | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L189-L224 | [
"def",
"set_nodes",
"(",
"self",
",",
"nlabels",
"=",
"[",
"]",
",",
"coords",
"=",
"[",
"]",
",",
"nsets",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"# DATA PREPROCESSING",
"nlabels",
"=",
"np",
".",
"array",
"(",
"nlabels",
")",
".",
"a... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.set_elements | Sets the element data.
:arg elabels: element labels. Items be strictly positive and int typed
in 1D array-like with shape :math:`(N_e)`.
:type elabels: 1D uint typed array-like
:arg types: element types chosen among argiope specific element types.
:type types: str typed array-li... | argiope/mesh.py | def set_elements(self, elabels = None,
types = None,
stypes = "",
conn = None,
esets = {},
surfaces = {},
materials = "",
**kwargs):
""... | def set_elements(self, elabels = None,
types = None,
stypes = "",
conn = None,
esets = {},
surfaces = {},
materials = "",
**kwargs):
""... | [
"Sets",
"the",
"element",
"data",
".",
":",
"arg",
"elabels",
":",
"element",
"labels",
".",
"Items",
"be",
"strictly",
"positive",
"and",
"int",
"typed",
"in",
"1D",
"array",
"-",
"like",
"with",
"shape",
":",
"math",
":",
"(",
"N_e",
")",
".",
":",... | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L226-L288 | [
"def",
"set_elements",
"(",
"self",
",",
"elabels",
"=",
"None",
",",
"types",
"=",
"None",
",",
"stypes",
"=",
"\"\"",
",",
"conn",
"=",
"None",
",",
"esets",
"=",
"{",
"}",
",",
"surfaces",
"=",
"{",
"}",
",",
"materials",
"=",
"\"\"",
",",
"*"... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.set_fields | Sets the fields. | argiope/mesh.py | def set_fields(self, fields = None, **kwargs):
"""
Sets the fields.
"""
self.fields = []
if fields != None:
for field in fields:
self.fields.append(field) | def set_fields(self, fields = None, **kwargs):
"""
Sets the fields.
"""
self.fields = []
if fields != None:
for field in fields:
self.fields.append(field) | [
"Sets",
"the",
"fields",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L290-L297 | [
"def",
"set_fields",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"fields",
"=",
"[",
"]",
"if",
"fields",
"!=",
"None",
":",
"for",
"field",
"in",
"fields",
":",
"self",
".",
"fields",
".",
"append",
"... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.add_fields | Add the fields into the list of fields. | argiope/mesh.py | def add_fields(self, fields = None, **kwargs):
"""
Add the fields into the list of fields.
"""
if fields != None:
for field in fields:
self.fields.append(field) | def add_fields(self, fields = None, **kwargs):
"""
Add the fields into the list of fields.
"""
if fields != None:
for field in fields:
self.fields.append(field) | [
"Add",
"the",
"fields",
"into",
"the",
"list",
"of",
"fields",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L299-L305 | [
"def",
"add_fields",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"fields",
"!=",
"None",
":",
"for",
"field",
"in",
"fields",
":",
"self",
".",
"fields",
".",
"append",
"(",
"field",
")"
] | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.check_elements | Checks element definitions. | argiope/mesh.py | def check_elements(self):
"""
Checks element definitions.
"""
# ELEMENT TYPE CHECKING
existing_types = set(self.elements.type.argiope.values.flatten())
allowed_types = set(ELEMENTS.keys())
if (existing_types <= allowed_types) == False:
raise ValueError("Element types {0} not in know el... | def check_elements(self):
"""
Checks element definitions.
"""
# ELEMENT TYPE CHECKING
existing_types = set(self.elements.type.argiope.values.flatten())
allowed_types = set(ELEMENTS.keys())
if (existing_types <= allowed_types) == False:
raise ValueError("Element types {0} not in know el... | [
"Checks",
"element",
"definitions",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L307-L317 | [
"def",
"check_elements",
"(",
"self",
")",
":",
"# ELEMENT TYPE CHECKING",
"existing_types",
"=",
"set",
"(",
"self",
".",
"elements",
".",
"type",
".",
"argiope",
".",
"values",
".",
"flatten",
"(",
")",
")",
"allowed_types",
"=",
"set",
"(",
"ELEMENTS",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.space | Returns the dimension of the embedded space of each element. | argiope/mesh.py | def space(self):
"""
Returns the dimension of the embedded space of each element.
"""
return self.elements.type.argiope.map(
lambda t: ELEMENTS[t].space) | def space(self):
"""
Returns the dimension of the embedded space of each element.
"""
return self.elements.type.argiope.map(
lambda t: ELEMENTS[t].space) | [
"Returns",
"the",
"dimension",
"of",
"the",
"embedded",
"space",
"of",
"each",
"element",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L320-L325 | [
"def",
"space",
"(",
"self",
")",
":",
"return",
"self",
".",
"elements",
".",
"type",
".",
"argiope",
".",
"map",
"(",
"lambda",
"t",
":",
"ELEMENTS",
"[",
"t",
"]",
".",
"space",
")"
] | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.nvert | Returns the number of vertices of eache element according to its type/ | argiope/mesh.py | def nvert(self):
"""
Returns the number of vertices of eache element according to its type/
"""
return self.elements.type.argiope.map(
lambda t: ELEMENTS[t].nvert) | def nvert(self):
"""
Returns the number of vertices of eache element according to its type/
"""
return self.elements.type.argiope.map(
lambda t: ELEMENTS[t].nvert) | [
"Returns",
"the",
"number",
"of",
"vertices",
"of",
"eache",
"element",
"according",
"to",
"its",
"type",
"/"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L327-L332 | [
"def",
"nvert",
"(",
"self",
")",
":",
"return",
"self",
".",
"elements",
".",
"type",
".",
"argiope",
".",
"map",
"(",
"lambda",
"t",
":",
"ELEMENTS",
"[",
"t",
"]",
".",
"nvert",
")"
] | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.split | Returns the decomposition of the elements.
Inputs:
* into: must be in ['edges', 'faces', 'simplices', 'angles']
* loc: None or labels of the chosen elements.
* at: must be in ['labels', 'coords'] | argiope/mesh.py | def split(self, into = "edges", loc = None,
at = "labels", sort_index = True):
"""
Returns the decomposition of the elements.
Inputs:
* into: must be in ['edges', 'faces', 'simplices', 'angles']
* loc: None or labels of the chosen elements.
* at: must be in ['labels', 'coords']... | def split(self, into = "edges", loc = None,
at = "labels", sort_index = True):
"""
Returns the decomposition of the elements.
Inputs:
* into: must be in ['edges', 'faces', 'simplices', 'angles']
* loc: None or labels of the chosen elements.
* at: must be in ['labels', 'coords']... | [
"Returns",
"the",
"decomposition",
"of",
"the",
"elements",
".",
"Inputs",
":",
"*",
"into",
":",
"must",
"be",
"in",
"[",
"edges",
"faces",
"simplices",
"angles",
"]",
"*",
"loc",
":",
"None",
"or",
"labels",
"of",
"the",
"chosen",
"elements",
".",
"*... | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L334-L371 | [
"def",
"split",
"(",
"self",
",",
"into",
"=",
"\"edges\"",
",",
"loc",
"=",
"None",
",",
"at",
"=",
"\"labels\"",
",",
"sort_index",
"=",
"True",
")",
":",
"if",
"type",
"(",
"loc",
")",
"==",
"type",
"(",
"None",
")",
":",
"elements",
"=",
"sel... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.centroids_and_volumes | Returns a dataframe containing volume and centroids of all the elements. | argiope/mesh.py | def centroids_and_volumes(self, sort_index = True):
"""
Returns a dataframe containing volume and centroids of all the elements.
"""
elements = self.elements
out = []
for etype, group in self.elements.groupby([("type", "argiope", "")]):
etype_info = ELEMENTS[etype]
simplices_info = e... | def centroids_and_volumes(self, sort_index = True):
"""
Returns a dataframe containing volume and centroids of all the elements.
"""
elements = self.elements
out = []
for etype, group in self.elements.groupby([("type", "argiope", "")]):
etype_info = ELEMENTS[etype]
simplices_info = e... | [
"Returns",
"a",
"dataframe",
"containing",
"volume",
"and",
"centroids",
"of",
"all",
"the",
"elements",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L373-L418 | [
"def",
"centroids_and_volumes",
"(",
"self",
",",
"sort_index",
"=",
"True",
")",
":",
"elements",
"=",
"self",
".",
"elements",
"out",
"=",
"[",
"]",
"for",
"etype",
",",
"group",
"in",
"self",
".",
"elements",
".",
"groupby",
"(",
"[",
"(",
"\"type\"... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.angles | Returns the internal angles of all elements and the associated statistics | argiope/mesh.py | def angles(self, zfill = 3):
"""
Returns the internal angles of all elements and the associated statistics
"""
elements = self.elements.sort_index(axis = 1)
etypes = elements[("type", "argiope")].unique()
out = []
for etype in etypes:
etype_info = ELEMENTS[etype]
angles_info = e... | def angles(self, zfill = 3):
"""
Returns the internal angles of all elements and the associated statistics
"""
elements = self.elements.sort_index(axis = 1)
etypes = elements[("type", "argiope")].unique()
out = []
for etype in etypes:
etype_info = ELEMENTS[etype]
angles_info = e... | [
"Returns",
"the",
"internal",
"angles",
"of",
"all",
"elements",
"and",
"the",
"associated",
"statistics"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L420-L467 | [
"def",
"angles",
"(",
"self",
",",
"zfill",
"=",
"3",
")",
":",
"elements",
"=",
"self",
".",
"elements",
".",
"sort_index",
"(",
"axis",
"=",
"1",
")",
"etypes",
"=",
"elements",
"[",
"(",
"\"type\"",
",",
"\"argiope\"",
")",
"]",
".",
"unique",
"... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.edges | Returns the aspect ratio of all elements. | argiope/mesh.py | def edges(self, zfill = 3):
"""
Returns the aspect ratio of all elements.
"""
edges = self.split("edges", at = "coords").unstack()
edges["lx"] = edges.x[1]-edges.x[0]
edges["ly"] = edges.y[1]-edges.y[0]
edges["lz"] = edges.z[1]-edges.z[0]
edges["l"] = np.linalg.norm(edges[["lx", "ly", "l... | def edges(self, zfill = 3):
"""
Returns the aspect ratio of all elements.
"""
edges = self.split("edges", at = "coords").unstack()
edges["lx"] = edges.x[1]-edges.x[0]
edges["ly"] = edges.y[1]-edges.y[0]
edges["lz"] = edges.z[1]-edges.z[0]
edges["l"] = np.linalg.norm(edges[["lx", "ly", "l... | [
"Returns",
"the",
"aspect",
"ratio",
"of",
"all",
"elements",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L469-L485 | [
"def",
"edges",
"(",
"self",
",",
"zfill",
"=",
"3",
")",
":",
"edges",
"=",
"self",
".",
"split",
"(",
"\"edges\"",
",",
"at",
"=",
"\"coords\"",
")",
".",
"unstack",
"(",
")",
"edges",
"[",
"\"lx\"",
"]",
"=",
"edges",
".",
"x",
"[",
"1",
"]"... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.stats | Returns mesh quality and geometric stats. | argiope/mesh.py | def stats(self):
"""
Returns mesh quality and geometric stats.
"""
cv = self.centroids_and_volumes()
angles = self.angles()
edges = self.edges()
return pd.concat([cv , angles[["stats"]], edges[["stats"]] ],
axis = 1).sort_index(axis = 1) | def stats(self):
"""
Returns mesh quality and geometric stats.
"""
cv = self.centroids_and_volumes()
angles = self.angles()
edges = self.edges()
return pd.concat([cv , angles[["stats"]], edges[["stats"]] ],
axis = 1).sort_index(axis = 1) | [
"Returns",
"mesh",
"quality",
"and",
"geometric",
"stats",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L487-L495 | [
"def",
"stats",
"(",
"self",
")",
":",
"cv",
"=",
"self",
".",
"centroids_and_volumes",
"(",
")",
"angles",
"=",
"self",
".",
"angles",
"(",
")",
"edges",
"=",
"self",
".",
"edges",
"(",
")",
"return",
"pd",
".",
"concat",
"(",
"[",
"cv",
",",
"a... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.element_set_to_node_set | Makes a node set from an element set. | argiope/mesh.py | def element_set_to_node_set(self, tag):
"""
Makes a node set from an element set.
"""
nodes, elements = self.nodes, self.elements
loc = (elements.conn[elements[("sets", tag, "")]]
.stack().stack().unique())
loc = loc[loc != 0]
nodes[("sets", tag)] = False
nodes.loc[loc, ("sets... | def element_set_to_node_set(self, tag):
"""
Makes a node set from an element set.
"""
nodes, elements = self.nodes, self.elements
loc = (elements.conn[elements[("sets", tag, "")]]
.stack().stack().unique())
loc = loc[loc != 0]
nodes[("sets", tag)] = False
nodes.loc[loc, ("sets... | [
"Makes",
"a",
"node",
"set",
"from",
"an",
"element",
"set",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L497-L506 | [
"def",
"element_set_to_node_set",
"(",
"self",
",",
"tag",
")",
":",
"nodes",
",",
"elements",
"=",
"self",
".",
"nodes",
",",
"self",
".",
"elements",
"loc",
"=",
"(",
"elements",
".",
"conn",
"[",
"elements",
"[",
"(",
"\"sets\"",
",",
"tag",
",",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.node_set_to_surface | Converts a node set to surface. | argiope/mesh.py | def node_set_to_surface(self, tag):
"""
Converts a node set to surface.
"""
# Create a dummy node with label 0
nodes = self.nodes.copy()
dummy = nodes.iloc[0].copy()
dummy["coords"] *= np.nan
dummy["sets"] = True
nodes.loc[0] = dummy
# Getting element surfaces
element_surface... | def node_set_to_surface(self, tag):
"""
Converts a node set to surface.
"""
# Create a dummy node with label 0
nodes = self.nodes.copy()
dummy = nodes.iloc[0].copy()
dummy["coords"] *= np.nan
dummy["sets"] = True
nodes.loc[0] = dummy
# Getting element surfaces
element_surface... | [
"Converts",
"a",
"node",
"set",
"to",
"surface",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L508-L528 | [
"def",
"node_set_to_surface",
"(",
"self",
",",
"tag",
")",
":",
"# Create a dummy node with label 0",
"nodes",
"=",
"self",
".",
"nodes",
".",
"copy",
"(",
")",
"dummy",
"=",
"nodes",
".",
"iloc",
"[",
"0",
"]",
".",
"copy",
"(",
")",
"dummy",
"[",
"\... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.surface_to_element_sets | Creates elements sets corresponding to a surface. | argiope/mesh.py | def surface_to_element_sets(self, tag):
"""
Creates elements sets corresponding to a surface.
"""
surface = self.elements.surfaces[tag]
for findex in surface.keys():
if surface[findex].sum() != 0:
self.elements[("sets", "_SURF_{0}_FACE{1}"
.format(tag, findex[1:]),... | def surface_to_element_sets(self, tag):
"""
Creates elements sets corresponding to a surface.
"""
surface = self.elements.surfaces[tag]
for findex in surface.keys():
if surface[findex].sum() != 0:
self.elements[("sets", "_SURF_{0}_FACE{1}"
.format(tag, findex[1:]),... | [
"Creates",
"elements",
"sets",
"corresponding",
"to",
"a",
"surface",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L531-L539 | [
"def",
"surface_to_element_sets",
"(",
"self",
",",
"tag",
")",
":",
"surface",
"=",
"self",
".",
"elements",
".",
"surfaces",
"[",
"tag",
"]",
"for",
"findex",
"in",
"surface",
".",
"keys",
"(",
")",
":",
"if",
"surface",
"[",
"findex",
"]",
".",
"s... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.to_polycollection | Returns the mesh as matplotlib polygon collection. (tested only for 2D meshes) | argiope/mesh.py | def to_polycollection(self, *args, **kwargs):
"""
Returns the mesh as matplotlib polygon collection. (tested only for 2D meshes)
"""
from matplotlib import collections
nodes, elements = self.nodes, self.elements.reset_index()
verts = []
index = []
for etype, gro... | def to_polycollection(self, *args, **kwargs):
"""
Returns the mesh as matplotlib polygon collection. (tested only for 2D meshes)
"""
from matplotlib import collections
nodes, elements = self.nodes, self.elements.reset_index()
verts = []
index = []
for etype, gro... | [
"Returns",
"the",
"mesh",
"as",
"matplotlib",
"polygon",
"collection",
".",
"(",
"tested",
"only",
"for",
"2D",
"meshes",
")"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L541-L558 | [
"def",
"to_polycollection",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"matplotlib",
"import",
"collections",
"nodes",
",",
"elements",
"=",
"self",
".",
"nodes",
",",
"self",
".",
"elements",
".",
"reset_index",
"(",
")",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.to_triangulation | Returns the mesh as a matplotlib.tri.Triangulation instance. (2D only) | argiope/mesh.py | def to_triangulation(self):
"""
Returns the mesh as a matplotlib.tri.Triangulation instance. (2D only)
"""
from matplotlib.tri import Triangulation
conn = self.split("simplices").unstack()
coords = self.nodes.coords.copy()
node_map = pd.Series(data = np.arange(len(coords)), index = coords.i... | def to_triangulation(self):
"""
Returns the mesh as a matplotlib.tri.Triangulation instance. (2D only)
"""
from matplotlib.tri import Triangulation
conn = self.split("simplices").unstack()
coords = self.nodes.coords.copy()
node_map = pd.Series(data = np.arange(len(coords)), index = coords.i... | [
"Returns",
"the",
"mesh",
"as",
"a",
"matplotlib",
".",
"tri",
".",
"Triangulation",
"instance",
".",
"(",
"2D",
"only",
")"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L560-L569 | [
"def",
"to_triangulation",
"(",
"self",
")",
":",
"from",
"matplotlib",
".",
"tri",
"import",
"Triangulation",
"conn",
"=",
"self",
".",
"split",
"(",
"\"simplices\"",
")",
".",
"unstack",
"(",
")",
"coords",
"=",
"self",
".",
"nodes",
".",
"coords",
"."... | 8170e431362dc760589f7d141090fd133dece259 |
test | Mesh.fields_metadata | Returns fields metadata as a dataframe. | argiope/mesh.py | def fields_metadata(self):
"""
Returns fields metadata as a dataframe.
"""
return (pd.concat([f.metadata() for f in self.fields], axis = 1)
.transpose()
.sort_values(["step_num", "frame", "label", "position"])) | def fields_metadata(self):
"""
Returns fields metadata as a dataframe.
"""
return (pd.concat([f.metadata() for f in self.fields], axis = 1)
.transpose()
.sort_values(["step_num", "frame", "label", "position"])) | [
"Returns",
"fields",
"metadata",
"as",
"a",
"dataframe",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L577-L583 | [
"def",
"fields_metadata",
"(",
"self",
")",
":",
"return",
"(",
"pd",
".",
"concat",
"(",
"[",
"f",
".",
"metadata",
"(",
")",
"for",
"f",
"in",
"self",
".",
"fields",
"]",
",",
"axis",
"=",
"1",
")",
".",
"transpose",
"(",
")",
".",
"sort_values... | 8170e431362dc760589f7d141090fd133dece259 |
test | MetaField.metadata | Returns metadata as a dataframe. | argiope/mesh.py | def metadata(self):
"""
Returns metadata as a dataframe.
"""
return pd.Series({
"part": self.part,
"step_num": self.step_num,
"step_label": self.step_label,
"frame": self.frame,
"frame_value": self.frame_value,
"label": self.label,
... | def metadata(self):
"""
Returns metadata as a dataframe.
"""
return pd.Series({
"part": self.part,
"step_num": self.step_num,
"step_label": self.step_label,
"frame": self.frame,
"frame_value": self.frame_value,
"label": self.label,
... | [
"Returns",
"metadata",
"as",
"a",
"dataframe",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/mesh.py#L625-L637 | [
"def",
"metadata",
"(",
"self",
")",
":",
"return",
"pd",
".",
"Series",
"(",
"{",
"\"part\"",
":",
"self",
".",
"part",
",",
"\"step_num\"",
":",
"self",
".",
"step_num",
",",
"\"step_label\"",
":",
"self",
".",
"step_label",
",",
"\"frame\"",
":",
"s... | 8170e431362dc760589f7d141090fd133dece259 |
test | Model.make_directories | Checks if required directories exist and creates them if needed. | argiope/models.py | def make_directories(self):
"""
Checks if required directories exist and creates them if needed.
"""
if os.path.isdir(self.workdir) == False: os.mkdir(self.workdir) | def make_directories(self):
"""
Checks if required directories exist and creates them if needed.
"""
if os.path.isdir(self.workdir) == False: os.mkdir(self.workdir) | [
"Checks",
"if",
"required",
"directories",
"exist",
"and",
"creates",
"them",
"if",
"needed",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/models.py#L36-L40 | [
"def",
"make_directories",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"workdir",
")",
"==",
"False",
":",
"os",
".",
"mkdir",
"(",
"self",
".",
"workdir",
")"
] | 8170e431362dc760589f7d141090fd133dece259 |
test | Model.run_postproc | Runs the post-proc script. | argiope/models.py | def run_postproc(self):
"""
Runs the post-proc script.
"""
t0 = time.time()
if self.verbose:
print('#### POST-PROCESSING "{0}" USING POST-PROCESSOR "{1}"'.format(self.label,
self.solver.upper()))
if self.solver == "abaqus":
command =... | def run_postproc(self):
"""
Runs the post-proc script.
"""
t0 = time.time()
if self.verbose:
print('#### POST-PROCESSING "{0}" USING POST-PROCESSOR "{1}"'.format(self.label,
self.solver.upper()))
if self.solver == "abaqus":
command =... | [
"Runs",
"the",
"post",
"-",
"proc",
"script",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/models.py#L69-L92 | [
"def",
"run_postproc",
"(",
"self",
")",
":",
"t0",
"=",
"time",
".",
"time",
"(",
")",
"if",
"self",
".",
"verbose",
":",
"print",
"(",
"'#### POST-PROCESSING \"{0}\" USING POST-PROCESSOR \"{1}\"'.",
"f",
"ormat(",
"s",
"elf.",
"l",
"abel,",
" ",
"self",
".... | 8170e431362dc760589f7d141090fd133dece259 |
test | Part.run_gmsh | Makes the mesh using gmsh. | argiope/models.py | def run_gmsh(self):
"""
Makes the mesh using gmsh.
"""
argiope.utils.run_gmsh(gmsh_path = self.gmsh_path,
gmsh_space = self.gmsh_space,
gmsh_options = self.gmsh_options,
name = self.file_name + ".geo",
... | def run_gmsh(self):
"""
Makes the mesh using gmsh.
"""
argiope.utils.run_gmsh(gmsh_path = self.gmsh_path,
gmsh_space = self.gmsh_space,
gmsh_options = self.gmsh_options,
name = self.file_name + ".geo",
... | [
"Makes",
"the",
"mesh",
"using",
"gmsh",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/models.py#L118-L127 | [
"def",
"run_gmsh",
"(",
"self",
")",
":",
"argiope",
".",
"utils",
".",
"run_gmsh",
"(",
"gmsh_path",
"=",
"self",
".",
"gmsh_path",
",",
"gmsh_space",
"=",
"self",
".",
"gmsh_space",
",",
"gmsh_options",
"=",
"self",
".",
"gmsh_options",
",",
"name",
"=... | 8170e431362dc760589f7d141090fd133dece259 |
test | read_history_report | Reads an history output report. | argiope/abq/pypostproc.py | def read_history_report(path, steps, x_name = None):
"""
Reads an history output report.
"""
data = pd.read_csv(path, delim_whitespace = True)
if x_name != None:
data[x_name] = data.X
del data["X"]
data["step"] = 0
t = 0.
for i in range(len(steps)):
dt = steps[i].duration
loc = data... | def read_history_report(path, steps, x_name = None):
"""
Reads an history output report.
"""
data = pd.read_csv(path, delim_whitespace = True)
if x_name != None:
data[x_name] = data.X
del data["X"]
data["step"] = 0
t = 0.
for i in range(len(steps)):
dt = steps[i].duration
loc = data... | [
"Reads",
"an",
"history",
"output",
"report",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/abq/pypostproc.py#L4-L21 | [
"def",
"read_history_report",
"(",
"path",
",",
"steps",
",",
"x_name",
"=",
"None",
")",
":",
"data",
"=",
"pd",
".",
"read_csv",
"(",
"path",
",",
"delim_whitespace",
"=",
"True",
")",
"if",
"x_name",
"!=",
"None",
":",
"data",
"[",
"x_name",
"]",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | read_field_report | Reads a field output report. | argiope/abq/pypostproc.py | def read_field_report(path, data_flag = "*DATA", meta_data_flag = "*METADATA"):
"""
Reads a field output report.
"""
text = open(path).read()
mdpos = text.find(meta_data_flag)
dpos = text.find(data_flag)
mdata = io.StringIO( "\n".join(text[mdpos:dpos].split("\n")[1:]))
data = io.StringIO( "\n".join(text... | def read_field_report(path, data_flag = "*DATA", meta_data_flag = "*METADATA"):
"""
Reads a field output report.
"""
text = open(path).read()
mdpos = text.find(meta_data_flag)
dpos = text.find(data_flag)
mdata = io.StringIO( "\n".join(text[mdpos:dpos].split("\n")[1:]))
data = io.StringIO( "\n".join(text... | [
"Reads",
"a",
"field",
"output",
"report",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/abq/pypostproc.py#L23-L49 | [
"def",
"read_field_report",
"(",
"path",
",",
"data_flag",
"=",
"\"*DATA\"",
",",
"meta_data_flag",
"=",
"\"*METADATA\"",
")",
":",
"text",
"=",
"open",
"(",
"path",
")",
".",
"read",
"(",
")",
"mdpos",
"=",
"text",
".",
"find",
"(",
"meta_data_flag",
")... | 8170e431362dc760589f7d141090fd133dece259 |
test | list_to_string | Converts a list-like to string with given line width. | argiope/utils.py | def list_to_string(l = range(200), width = 40, indent = " "):
"""
Converts a list-like to string with given line width.
"""
l = [str(v) + "," for v in l]
counter = 0
out = "" + indent
for w in l:
s = len(w)
if counter + s > width:
out += "\n" + indent
... | def list_to_string(l = range(200), width = 40, indent = " "):
"""
Converts a list-like to string with given line width.
"""
l = [str(v) + "," for v in l]
counter = 0
out = "" + indent
for w in l:
s = len(w)
if counter + s > width:
out += "\n" + indent
... | [
"Converts",
"a",
"list",
"-",
"like",
"to",
"string",
"with",
"given",
"line",
"width",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/utils.py#L52-L66 | [
"def",
"list_to_string",
"(",
"l",
"=",
"range",
"(",
"200",
")",
",",
"width",
"=",
"40",
",",
"indent",
"=",
"\" \"",
")",
":",
"l",
"=",
"[",
"str",
"(",
"v",
")",
"+",
"\",\"",
"for",
"v",
"in",
"l",
"]",
"counter",
"=",
"0",
"out",
"=",... | 8170e431362dc760589f7d141090fd133dece259 |
test | _equation | Returns an Abaqus INP formated string for a given linear equation. | argiope/utils.py | def _equation(nodes = (1, 2), dofs = (1, 1), coefficients = (1., 1.),
comment = None):
"""
Returns an Abaqus INP formated string for a given linear equation.
"""
N = len(nodes)
if comment == None:
out = ""
else:
out = "**EQUATION: {0}\n".format(comment)
out+= "*E... | def _equation(nodes = (1, 2), dofs = (1, 1), coefficients = (1., 1.),
comment = None):
"""
Returns an Abaqus INP formated string for a given linear equation.
"""
N = len(nodes)
if comment == None:
out = ""
else:
out = "**EQUATION: {0}\n".format(comment)
out+= "*E... | [
"Returns",
"an",
"Abaqus",
"INP",
"formated",
"string",
"for",
"a",
"given",
"linear",
"equation",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/utils.py#L68-L82 | [
"def",
"_equation",
"(",
"nodes",
"=",
"(",
"1",
",",
"2",
")",
",",
"dofs",
"=",
"(",
"1",
",",
"1",
")",
",",
"coefficients",
"=",
"(",
"1.",
",",
"1.",
")",
",",
"comment",
"=",
"None",
")",
":",
"N",
"=",
"len",
"(",
"nodes",
")",
"if",... | 8170e431362dc760589f7d141090fd133dece259 |
test | _unsorted_set | Returns a set as inp string with unsorted option. | argiope/utils.py | def _unsorted_set(df, label, **kwargs):
"""
Returns a set as inp string with unsorted option.
"""
out = "*NSET, NSET={0}, UNSORTED\n".format(label)
labels = df.index.values
return out + argiope.utils.list_to_string(labels, **kwargs) | def _unsorted_set(df, label, **kwargs):
"""
Returns a set as inp string with unsorted option.
"""
out = "*NSET, NSET={0}, UNSORTED\n".format(label)
labels = df.index.values
return out + argiope.utils.list_to_string(labels, **kwargs) | [
"Returns",
"a",
"set",
"as",
"inp",
"string",
"with",
"unsorted",
"option",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/utils.py#L84-L90 | [
"def",
"_unsorted_set",
"(",
"df",
",",
"label",
",",
"*",
"*",
"kwargs",
")",
":",
"out",
"=",
"\"*NSET, NSET={0}, UNSORTED\\n\"",
".",
"format",
"(",
"label",
")",
"labels",
"=",
"df",
".",
"index",
".",
"values",
"return",
"out",
"+",
"argiope",
".",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | PhaxioApi.parse_response | Parses the API response and raises appropriate
errors if raise_errors was set to True
:param response: response from requests http call
:returns: dictionary of response
:rtype: dict | phaxio/api.py | def parse_response(self, response):
"""Parses the API response and raises appropriate
errors if raise_errors was set to True
:param response: response from requests http call
:returns: dictionary of response
:rtype: dict
"""
payload = None
try:
... | def parse_response(self, response):
"""Parses the API response and raises appropriate
errors if raise_errors was set to True
:param response: response from requests http call
:returns: dictionary of response
:rtype: dict
"""
payload = None
try:
... | [
"Parses",
"the",
"API",
"response",
"and",
"raises",
"appropriate",
"errors",
"if",
"raise_errors",
"was",
"set",
"to",
"True"
] | jfialkoff/pyphaxio | python | https://github.com/jfialkoff/pyphaxio/blob/d8fb6b9fc7a4057bb826d94ab974237f8417846d/phaxio/api.py#L38-L67 | [
"def",
"parse_response",
"(",
"self",
",",
"response",
")",
":",
"payload",
"=",
"None",
"try",
":",
"if",
"isinstance",
"(",
"response",
".",
"json",
",",
"collections",
".",
"Callable",
")",
":",
"payload",
"=",
"response",
".",
"json",
"(",
")",
"el... | d8fb6b9fc7a4057bb826d94ab974237f8417846d |
test | PhaxioApi._get | Builds the url for the specified method and arguments and returns
the response as a dictionary. | phaxio/api.py | def _get(self, method, **kwargs):
"""Builds the url for the specified method and arguments and returns
the response as a dictionary.
"""
payload = kwargs.copy()
payload['api_key'] = self.api_key
payload['api_secret'] = self.api_secret
to = payload.pop('to', None... | def _get(self, method, **kwargs):
"""Builds the url for the specified method and arguments and returns
the response as a dictionary.
"""
payload = kwargs.copy()
payload['api_key'] = self.api_key
payload['api_secret'] = self.api_secret
to = payload.pop('to', None... | [
"Builds",
"the",
"url",
"for",
"the",
"specified",
"method",
"and",
"arguments",
"and",
"returns",
"the",
"response",
"as",
"a",
"dictionary",
"."
] | jfialkoff/pyphaxio | python | https://github.com/jfialkoff/pyphaxio/blob/d8fb6b9fc7a4057bb826d94ab974237f8417846d/phaxio/api.py#L69-L102 | [
"def",
"_get",
"(",
"self",
",",
"method",
",",
"*",
"*",
"kwargs",
")",
":",
"payload",
"=",
"kwargs",
".",
"copy",
"(",
")",
"payload",
"[",
"'api_key'",
"]",
"=",
"self",
".",
"api_key",
"payload",
"[",
"'api_secret'",
"]",
"=",
"self",
".",
"ap... | d8fb6b9fc7a4057bb826d94ab974237f8417846d |
test | Material.write_inp | Returns the material definition as a string in Abaqus INP format. | argiope/materials.py | def write_inp(self):
"""
Returns the material definition as a string in Abaqus INP format.
"""
template = self.get_template()
return template.substitute({"class": self.__class__.__name__,
"label": self.label}).strip() | def write_inp(self):
"""
Returns the material definition as a string in Abaqus INP format.
"""
template = self.get_template()
return template.substitute({"class": self.__class__.__name__,
"label": self.label}).strip() | [
"Returns",
"the",
"material",
"definition",
"as",
"a",
"string",
"in",
"Abaqus",
"INP",
"format",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/materials.py#L21-L27 | [
"def",
"write_inp",
"(",
"self",
")",
":",
"template",
"=",
"self",
".",
"get_template",
"(",
")",
"return",
"template",
".",
"substitute",
"(",
"{",
"\"class\"",
":",
"self",
".",
"__class__",
".",
"__name__",
",",
"\"label\"",
":",
"self",
".",
"label"... | 8170e431362dc760589f7d141090fd133dece259 |
test | _ElasticPlastic.write_inp | Returns the material definition as a string in Abaqus INP format. | argiope/materials.py | def write_inp(self):
"""
Returns the material definition as a string in Abaqus INP format.
"""
template = self.get_template()
plastic_table = self.get_plastic_table()
return template.substitute({
"class": self.__class__.__name__,
"label": self.label,
"young_modulus": self... | def write_inp(self):
"""
Returns the material definition as a string in Abaqus INP format.
"""
template = self.get_template()
plastic_table = self.get_plastic_table()
return template.substitute({
"class": self.__class__.__name__,
"label": self.label,
"young_modulus": self... | [
"Returns",
"the",
"material",
"definition",
"as",
"a",
"string",
"in",
"Abaqus",
"INP",
"format",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/materials.py#L57-L71 | [
"def",
"write_inp",
"(",
"self",
")",
":",
"template",
"=",
"self",
".",
"get_template",
"(",
")",
"plastic_table",
"=",
"self",
".",
"get_plastic_table",
"(",
")",
"return",
"template",
".",
"substitute",
"(",
"{",
"\"class\"",
":",
"self",
".",
"__class_... | 8170e431362dc760589f7d141090fd133dece259 |
test | Hollomon.get_plastic_table | Calculates the plastic data | argiope/materials.py | def get_plastic_table(self):
"""
Calculates the plastic data
"""
E = self.young_modulus
sy = self.yield_stress
n = self.hardening_exponent
eps_max = self.max_strain
Np = self.strain_data_points
ey = sy/E
s = 10.**np.linspace(0., np.log10(eps_max/ey), Np)
strain = e... | def get_plastic_table(self):
"""
Calculates the plastic data
"""
E = self.young_modulus
sy = self.yield_stress
n = self.hardening_exponent
eps_max = self.max_strain
Np = self.strain_data_points
ey = sy/E
s = 10.**np.linspace(0., np.log10(eps_max/ey), Np)
strain = e... | [
"Calculates",
"the",
"plastic",
"data"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/materials.py#L148-L164 | [
"def",
"get_plastic_table",
"(",
"self",
")",
":",
"E",
"=",
"self",
".",
"young_modulus",
"sy",
"=",
"self",
".",
"yield_stress",
"n",
"=",
"self",
".",
"hardening_exponent",
"eps_max",
"=",
"self",
".",
"max_strain",
"Np",
"=",
"self",
".",
"strain_data_... | 8170e431362dc760589f7d141090fd133dece259 |
test | PowerLin.get_plastic_table | Calculates the plastic data | argiope/materials.py | def get_plastic_table(self):
"""
Calculates the plastic data
"""
K = self.consistency
sy = self.yield_stress
n = self.hardening_exponent
eps_max = self.max_strain
Np = self.strain_data_points
plastic_strain = np.linspace(0., eps_max, Np)
stress = sy + K * plastic_strain... | def get_plastic_table(self):
"""
Calculates the plastic data
"""
K = self.consistency
sy = self.yield_stress
n = self.hardening_exponent
eps_max = self.max_strain
Np = self.strain_data_points
plastic_strain = np.linspace(0., eps_max, Np)
stress = sy + K * plastic_strain... | [
"Calculates",
"the",
"plastic",
"data"
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/materials.py#L181-L193 | [
"def",
"get_plastic_table",
"(",
"self",
")",
":",
"K",
"=",
"self",
".",
"consistency",
"sy",
"=",
"self",
".",
"yield_stress",
"n",
"=",
"self",
".",
"hardening_exponent",
"eps_max",
"=",
"self",
".",
"max_strain",
"Np",
"=",
"self",
".",
"strain_data_po... | 8170e431362dc760589f7d141090fd133dece259 |
test | temp | Returns the DNA/DNA melting temp using nearest-neighbor thermodynamics.
This function returns better results than EMBOSS DAN because it uses updated
thermodynamics values and takes into account initialization parameters from
the work of SantaLucia (1998).
Corrects for mono- and divalent cation concent... | melting.py | def temp(s, DNA_c=5000.0, Na_c=10.0, Mg_c=20.0, dNTPs_c=10.0, uncorrected=False):
'''
Returns the DNA/DNA melting temp using nearest-neighbor thermodynamics.
This function returns better results than EMBOSS DAN because it uses updated
thermodynamics values and takes into account initialization paramete... | def temp(s, DNA_c=5000.0, Na_c=10.0, Mg_c=20.0, dNTPs_c=10.0, uncorrected=False):
'''
Returns the DNA/DNA melting temp using nearest-neighbor thermodynamics.
This function returns better results than EMBOSS DAN because it uses updated
thermodynamics values and takes into account initialization paramete... | [
"Returns",
"the",
"DNA",
"/",
"DNA",
"melting",
"temp",
"using",
"nearest",
"-",
"neighbor",
"thermodynamics",
"."
] | eclarke/melt | python | https://github.com/eclarke/melt/blob/31520349be0296c7a6aab0010016f093f866b999/melting.py#L72-L166 | [
"def",
"temp",
"(",
"s",
",",
"DNA_c",
"=",
"5000.0",
",",
"Na_c",
"=",
"10.0",
",",
"Mg_c",
"=",
"20.0",
",",
"dNTPs_c",
"=",
"10.0",
",",
"uncorrected",
"=",
"False",
")",
":",
"R",
"=",
"1.987",
"# Universal gas constant (cal/(K*mol))",
"s",
"=",
"s... | 31520349be0296c7a6aab0010016f093f866b999 |
test | write_xy_report | Writes a xy_report based on xy data. | argiope/abq/abqpostproc.py | def write_xy_report(odb, path, tags, columns, steps):
"""
Writes a xy_report based on xy data.
"""
xyData = [session.XYDataFromHistory(name = columns[i],
odb = odb,
outputVariableName = tags[i],
steps = steps)
for i in xrange(len(tags))]... | def write_xy_report(odb, path, tags, columns, steps):
"""
Writes a xy_report based on xy data.
"""
xyData = [session.XYDataFromHistory(name = columns[i],
odb = odb,
outputVariableName = tags[i],
steps = steps)
for i in xrange(len(tags))]... | [
"Writes",
"a",
"xy_report",
"based",
"on",
"xy",
"data",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/abq/abqpostproc.py#L19-L29 | [
"def",
"write_xy_report",
"(",
"odb",
",",
"path",
",",
"tags",
",",
"columns",
",",
"steps",
")",
":",
"xyData",
"=",
"[",
"session",
".",
"XYDataFromHistory",
"(",
"name",
"=",
"columns",
"[",
"i",
"]",
",",
"odb",
"=",
"odb",
",",
"outputVariableNam... | 8170e431362dc760589f7d141090fd133dece259 |
test | write_field_report | Writes a field report and rewrites it in a cleaner format. | argiope/abq/abqpostproc.py | def write_field_report(odb, path, label, argiope_class, variable, instance, output_position,
step = -1, frame = -1, sortItem='Node Label'):
"""
Writes a field report and rewrites it in a cleaner format.
"""
stepKeys = get_steps(odb)
step = xrange(len(stepKeys))[step]
frame = xrange(g... | def write_field_report(odb, path, label, argiope_class, variable, instance, output_position,
step = -1, frame = -1, sortItem='Node Label'):
"""
Writes a field report and rewrites it in a cleaner format.
"""
stepKeys = get_steps(odb)
step = xrange(len(stepKeys))[step]
frame = xrange(g... | [
"Writes",
"a",
"field",
"report",
"and",
"rewrites",
"it",
"in",
"a",
"cleaner",
"format",
"."
] | lcharleux/argiope | python | https://github.com/lcharleux/argiope/blob/8170e431362dc760589f7d141090fd133dece259/argiope/abq/abqpostproc.py#L32-L90 | [
"def",
"write_field_report",
"(",
"odb",
",",
"path",
",",
"label",
",",
"argiope_class",
",",
"variable",
",",
"instance",
",",
"output_position",
",",
"step",
"=",
"-",
"1",
",",
"frame",
"=",
"-",
"1",
",",
"sortItem",
"=",
"'Node Label'",
")",
":",
... | 8170e431362dc760589f7d141090fd133dece259 |
test | start | Display a dashboard from the dashboard file(s) provided in the DASHBOARDS
Paths and/or URLs for dashboards (URLs must secrets with http or https) | doodledashboard/cli.py | def start(dashboards, once, secrets):
"""Display a dashboard from the dashboard file(s) provided in the DASHBOARDS
Paths and/or URLs for dashboards (URLs must secrets with http or https)
"""
if secrets is None:
secrets = os.path.join(os.path.expanduser("~"), "/.doodledashboard/secrets")
... | def start(dashboards, once, secrets):
"""Display a dashboard from the dashboard file(s) provided in the DASHBOARDS
Paths and/or URLs for dashboards (URLs must secrets with http or https)
"""
if secrets is None:
secrets = os.path.join(os.path.expanduser("~"), "/.doodledashboard/secrets")
... | [
"Display",
"a",
"dashboard",
"from",
"the",
"dashboard",
"file",
"(",
"s",
")",
"provided",
"in",
"the",
"DASHBOARDS",
"Paths",
"and",
"/",
"or",
"URLs",
"for",
"dashboards",
"(",
"URLs",
"must",
"secrets",
"with",
"http",
"or",
"https",
")"
] | SketchingDev/Doodle-Dashboard | python | https://github.com/SketchingDev/Doodle-Dashboard/blob/4d7f4c248875f82a962c275009aac4aa76bd0320/doodledashboard/cli.py#L59-L107 | [
"def",
"start",
"(",
"dashboards",
",",
"once",
",",
"secrets",
")",
":",
"if",
"secrets",
"is",
"None",
":",
"secrets",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~\"",
")",
",",
"\"/.doodledashboard/secret... | 4d7f4c248875f82a962c275009aac4aa76bd0320 |
test | view | View the output of the datafeeds and/or notifications used in your DASHBOARDS | doodledashboard/cli.py | def view(action, dashboards, secrets):
"""View the output of the datafeeds and/or notifications used in your DASHBOARDS"""
if secrets is None:
secrets = os.path.join(os.path.expanduser("~"), "/.doodledashboard/secrets")
try:
loaded_secrets = try_read_secrets_file(secrets)
except Invali... | def view(action, dashboards, secrets):
"""View the output of the datafeeds and/or notifications used in your DASHBOARDS"""
if secrets is None:
secrets = os.path.join(os.path.expanduser("~"), "/.doodledashboard/secrets")
try:
loaded_secrets = try_read_secrets_file(secrets)
except Invali... | [
"View",
"the",
"output",
"of",
"the",
"datafeeds",
"and",
"/",
"or",
"notifications",
"used",
"in",
"your",
"DASHBOARDS"
] | SketchingDev/Doodle-Dashboard | python | https://github.com/SketchingDev/Doodle-Dashboard/blob/4d7f4c248875f82a962c275009aac4aa76bd0320/doodledashboard/cli.py#L115-L156 | [
"def",
"view",
"(",
"action",
",",
"dashboards",
",",
"secrets",
")",
":",
"if",
"secrets",
"is",
"None",
":",
"secrets",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~\"",
")",
",",
"\"/.doodledashboard/secre... | 4d7f4c248875f82a962c275009aac4aa76bd0320 |
test | list | List components that are available on your machine | doodledashboard/cli.py | def list(component_type):
"""List components that are available on your machine"""
config_loader = initialise_component_loader()
component_types = sorted({
"displays": lambda: config_loader.load_by_type(ComponentType.DISPLAY),
"datafeeds": lambda: config_loader.load_by_type(ComponentType.D... | def list(component_type):
"""List components that are available on your machine"""
config_loader = initialise_component_loader()
component_types = sorted({
"displays": lambda: config_loader.load_by_type(ComponentType.DISPLAY),
"datafeeds": lambda: config_loader.load_by_type(ComponentType.D... | [
"List",
"components",
"that",
"are",
"available",
"on",
"your",
"machine"
] | SketchingDev/Doodle-Dashboard | python | https://github.com/SketchingDev/Doodle-Dashboard/blob/4d7f4c248875f82a962c275009aac4aa76bd0320/doodledashboard/cli.py#L163-L184 | [
"def",
"list",
"(",
"component_type",
")",
":",
"config_loader",
"=",
"initialise_component_loader",
"(",
")",
"component_types",
"=",
"sorted",
"(",
"{",
"\"displays\"",
":",
"lambda",
":",
"config_loader",
".",
"load_by_type",
"(",
"ComponentType",
".",
"DISPLAY... | 4d7f4c248875f82a962c275009aac4aa76bd0320 |
test | ComponentConfigParser.parse | Parses the section of configuration pertaining to a component
:param config: dict of specific config section
:return: | doodledashboard/configuration.py | def parse(self, config):
"""
Parses the section of configuration pertaining to a component
:param config: dict of specific config section
:return:
"""
if "type" not in config:
raise InvalidConfigurationException("The dashboard configuration has no... | def parse(self, config):
"""
Parses the section of configuration pertaining to a component
:param config: dict of specific config section
:return:
"""
if "type" not in config:
raise InvalidConfigurationException("The dashboard configuration has no... | [
"Parses",
"the",
"section",
"of",
"configuration",
"pertaining",
"to",
"a",
"component",
":",
"param",
"config",
":",
"dict",
"of",
"specific",
"config",
"section",
":",
"return",
":"
] | SketchingDev/Doodle-Dashboard | python | https://github.com/SketchingDev/Doodle-Dashboard/blob/4d7f4c248875f82a962c275009aac4aa76bd0320/doodledashboard/configuration.py#L43-L62 | [
"def",
"parse",
"(",
"self",
",",
"config",
")",
":",
"if",
"\"type\"",
"not",
"in",
"config",
":",
"raise",
"InvalidConfigurationException",
"(",
"\"The dashboard configuration has not defined a 'type'. %s\"",
"%",
"config",
")",
"component_type",
"=",
"config",
"[",... | 4d7f4c248875f82a962c275009aac4aa76bd0320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.