repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.node_stat_copy | def node_stat_copy(self, node_or_char, node=None):
"""Return a node's stats, prepared for pickling, in a dictionary."""
if node is None:
node = node_or_char
else:
node = self._real.character[node_or_char].node[node]
return {
k: v.unwrap() if hasattr(v,... | python | def node_stat_copy(self, node_or_char, node=None):
"""Return a node's stats, prepared for pickling, in a dictionary."""
if node is None:
node = node_or_char
else:
node = self._real.character[node_or_char].node[node]
return {
k: v.unwrap() if hasattr(v,... | [
"def",
"node_stat_copy",
"(",
"self",
",",
"node_or_char",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"node_or_char",
"else",
":",
"node",
"=",
"self",
".",
"_real",
".",
"character",
"[",
"node_or_char",
"]",
"."... | Return a node's stats, prepared for pickling, in a dictionary. | [
"Return",
"a",
"node",
"s",
"stats",
"prepared",
"for",
"pickling",
"in",
"a",
"dictionary",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L691-L705 | train |
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.node_stat_delta | def node_stat_delta(self, char, node, *, store=True):
"""Return a dictionary describing changes to a node's stats since the
last time you looked at it.
Deleted keys have the value ``None``. If the node's been deleted, this
returns ``None``.
"""
try:
old = se... | python | def node_stat_delta(self, char, node, *, store=True):
"""Return a dictionary describing changes to a node's stats since the
last time you looked at it.
Deleted keys have the value ``None``. If the node's been deleted, this
returns ``None``.
"""
try:
old = se... | [
"def",
"node_stat_delta",
"(",
"self",
",",
"char",
",",
"node",
",",
"*",
",",
"store",
"=",
"True",
")",
":",
"try",
":",
"old",
"=",
"self",
".",
"_node_stat_cache",
"[",
"char",
"]",
".",
"get",
"(",
"node",
",",
"{",
"}",
")",
"new",
"=",
... | Return a dictionary describing changes to a node's stats since the
last time you looked at it.
Deleted keys have the value ``None``. If the node's been deleted, this
returns ``None``. | [
"Return",
"a",
"dictionary",
"describing",
"changes",
"to",
"a",
"node",
"s",
"stats",
"since",
"the",
"last",
"time",
"you",
"looked",
"at",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L707-L723 | train |
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.character_nodes_stat_delta | def character_nodes_stat_delta(self, char, *, store=True):
"""Return a dictionary of ``node_stat_delta`` output for each node in a
character.
"""
r = {}
nodes = set(self._real.character[char].node.keys())
for node in nodes:
delta = self.node_stat_delta(char, ... | python | def character_nodes_stat_delta(self, char, *, store=True):
"""Return a dictionary of ``node_stat_delta`` output for each node in a
character.
"""
r = {}
nodes = set(self._real.character[char].node.keys())
for node in nodes:
delta = self.node_stat_delta(char, ... | [
"def",
"character_nodes_stat_delta",
"(",
"self",
",",
"char",
",",
"*",
",",
"store",
"=",
"True",
")",
":",
"r",
"=",
"{",
"}",
"nodes",
"=",
"set",
"(",
"self",
".",
"_real",
".",
"character",
"[",
"char",
"]",
".",
"node",
".",
"keys",
"(",
"... | Return a dictionary of ``node_stat_delta`` output for each node in a
character. | [
"Return",
"a",
"dictionary",
"of",
"node_stat_delta",
"output",
"for",
"each",
"node",
"in",
"a",
"character",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L725-L740 | train |
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.update_node | def update_node(self, char, node, patch):
"""Change a node's stats according to a dictionary.
The ``patch`` dictionary should hold the new values of stats,
keyed by the stats' names; a value of ``None`` deletes the
stat.
"""
character = self._real.character[char]
... | python | def update_node(self, char, node, patch):
"""Change a node's stats according to a dictionary.
The ``patch`` dictionary should hold the new values of stats,
keyed by the stats' names; a value of ``None`` deletes the
stat.
"""
character = self._real.character[char]
... | [
"def",
"update_node",
"(",
"self",
",",
"char",
",",
"node",
",",
"patch",
")",
":",
"character",
"=",
"self",
".",
"_real",
".",
"character",
"[",
"char",
"]",
"if",
"patch",
"is",
"None",
":",
"del",
"character",
".",
"node",
"[",
"node",
"]",
"e... | Change a node's stats according to a dictionary.
The ``patch`` dictionary should hold the new values of stats,
keyed by the stats' names; a value of ``None`` deletes the
stat. | [
"Change",
"a",
"node",
"s",
"stats",
"according",
"to",
"a",
"dictionary",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L746-L761 | train |
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.update_nodes | def update_nodes(self, char, patch, backdate=False):
"""Change the stats of nodes in a character according to a
dictionary.
"""
if backdate:
parbranch, parrev = self._real._parentbranch_rev.get(
self._real.branch, ('trunk', 0)
)
tick_n... | python | def update_nodes(self, char, patch, backdate=False):
"""Change the stats of nodes in a character according to a
dictionary.
"""
if backdate:
parbranch, parrev = self._real._parentbranch_rev.get(
self._real.branch, ('trunk', 0)
)
tick_n... | [
"def",
"update_nodes",
"(",
"self",
",",
"char",
",",
"patch",
",",
"backdate",
"=",
"False",
")",
":",
"if",
"backdate",
":",
"parbranch",
",",
"parrev",
"=",
"self",
".",
"_real",
".",
"_parentbranch_rev",
".",
"get",
"(",
"self",
".",
"_real",
".",
... | Change the stats of nodes in a character according to a
dictionary. | [
"Change",
"the",
"stats",
"of",
"nodes",
"in",
"a",
"character",
"according",
"to",
"a",
"dictionary",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L764-L778 | train |
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.del_node | def del_node(self, char, node):
"""Remove a node from a character."""
del self._real.character[char].node[node]
for cache in (
self._char_nodes_rulebooks_cache,
self._node_stat_cache,
self._node_successors_cache
):
try:
... | python | def del_node(self, char, node):
"""Remove a node from a character."""
del self._real.character[char].node[node]
for cache in (
self._char_nodes_rulebooks_cache,
self._node_stat_cache,
self._node_successors_cache
):
try:
... | [
"def",
"del_node",
"(",
"self",
",",
"char",
",",
"node",
")",
":",
"del",
"self",
".",
"_real",
".",
"character",
"[",
"char",
"]",
".",
"node",
"[",
"node",
"]",
"for",
"cache",
"in",
"(",
"self",
".",
"_char_nodes_rulebooks_cache",
",",
"self",
".... | Remove a node from a character. | [
"Remove",
"a",
"node",
"from",
"a",
"character",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L781-L808 | train |
LogicalDash/LiSE | LiSE/LiSE/handle.py | EngineHandle.thing_travel_to | def thing_travel_to(self, char, thing, dest, weight=None, graph=None):
"""Make something find a path to ``dest`` and follow it.
Optional argument ``weight`` is the portal stat to use to schedule movement times.
Optional argument ``graph`` is an alternative graph to use for pathfinding.
... | python | def thing_travel_to(self, char, thing, dest, weight=None, graph=None):
"""Make something find a path to ``dest`` and follow it.
Optional argument ``weight`` is the portal stat to use to schedule movement times.
Optional argument ``graph`` is an alternative graph to use for pathfinding.
... | [
"def",
"thing_travel_to",
"(",
"self",
",",
"char",
",",
"thing",
",",
"dest",
",",
"weight",
"=",
"None",
",",
"graph",
"=",
"None",
")",
":",
"return",
"self",
".",
"_real",
".",
"character",
"[",
"char",
"]",
".",
"thing",
"[",
"thing",
"]",
"."... | Make something find a path to ``dest`` and follow it.
Optional argument ``weight`` is the portal stat to use to schedule movement times.
Optional argument ``graph`` is an alternative graph to use for pathfinding.
Should resemble a networkx DiGraph. | [
"Make",
"something",
"find",
"a",
"path",
"to",
"dest",
"and",
"follow",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/handle.py#L917-L926 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | StatRowListItemContainer.remake | def remake(self, *args):
"""Replace any existing child widget with the one described by my ``config``.
This doesn't need arguments, but accepts any positional arguments provided,
so that you can use this in kvlang
"""
if not self.config:
return
if not all((s... | python | def remake(self, *args):
"""Replace any existing child widget with the one described by my ``config``.
This doesn't need arguments, but accepts any positional arguments provided,
so that you can use this in kvlang
"""
if not self.config:
return
if not all((s... | [
"def",
"remake",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"self",
".",
"config",
":",
"return",
"if",
"not",
"all",
"(",
"(",
"self",
".",
"key",
",",
"self",
".",
"gett",
",",
"self",
".",
"sett",
",",
"self",
".",
"listen",
",",
... | Replace any existing child widget with the one described by my ``config``.
This doesn't need arguments, but accepts any positional arguments provided,
so that you can use this in kvlang | [
"Replace",
"any",
"existing",
"child",
"widget",
"with",
"the",
"one",
"described",
"by",
"my",
"config",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L234-L300 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.del_key | def del_key(self, k):
"""Delete the key and any configuration for it"""
if k not in self.mirror:
raise KeyError
del self.proxy[k]
if '_config' in self.proxy and k in self.proxy['_config']:
del self.proxy['_config'][k] | python | def del_key(self, k):
"""Delete the key and any configuration for it"""
if k not in self.mirror:
raise KeyError
del self.proxy[k]
if '_config' in self.proxy and k in self.proxy['_config']:
del self.proxy['_config'][k] | [
"def",
"del_key",
"(",
"self",
",",
"k",
")",
":",
"if",
"k",
"not",
"in",
"self",
".",
"mirror",
":",
"raise",
"KeyError",
"del",
"self",
".",
"proxy",
"[",
"k",
"]",
"if",
"'_config'",
"in",
"self",
".",
"proxy",
"and",
"k",
"in",
"self",
".",
... | Delete the key and any configuration for it | [
"Delete",
"the",
"key",
"and",
"any",
"configuration",
"for",
"it"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L339-L345 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.set_value | def set_value(self, k, v):
"""Set a value on the proxy, parsing it to a useful datatype if possible"""
from ast import literal_eval
if self.engine is None or self.proxy is None:
self._trigger_set_value(k, v)
return
if v is None:
del self.proxy[k]
... | python | def set_value(self, k, v):
"""Set a value on the proxy, parsing it to a useful datatype if possible"""
from ast import literal_eval
if self.engine is None or self.proxy is None:
self._trigger_set_value(k, v)
return
if v is None:
del self.proxy[k]
... | [
"def",
"set_value",
"(",
"self",
",",
"k",
",",
"v",
")",
":",
"from",
"ast",
"import",
"literal_eval",
"if",
"self",
".",
"engine",
"is",
"None",
"or",
"self",
".",
"proxy",
"is",
"None",
":",
"self",
".",
"_trigger_set_value",
"(",
"k",
",",
"v",
... | Set a value on the proxy, parsing it to a useful datatype if possible | [
"Set",
"a",
"value",
"on",
"the",
"proxy",
"parsing",
"it",
"to",
"a",
"useful",
"datatype",
"if",
"possible"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L347-L360 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.set_config | def set_config(self, key, option, value):
"""Set a configuration option for a key"""
if '_config' not in self.proxy:
newopt = dict(default_cfg)
newopt[option] = value
self.proxy['_config'] = {key: newopt}
else:
if key in self.proxy['_config']:
... | python | def set_config(self, key, option, value):
"""Set a configuration option for a key"""
if '_config' not in self.proxy:
newopt = dict(default_cfg)
newopt[option] = value
self.proxy['_config'] = {key: newopt}
else:
if key in self.proxy['_config']:
... | [
"def",
"set_config",
"(",
"self",
",",
"key",
",",
"option",
",",
"value",
")",
":",
"if",
"'_config'",
"not",
"in",
"self",
".",
"proxy",
":",
"newopt",
"=",
"dict",
"(",
"default_cfg",
")",
"newopt",
"[",
"option",
"]",
"=",
"value",
"self",
".",
... | Set a configuration option for a key | [
"Set",
"a",
"configuration",
"option",
"for",
"a",
"key"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L371-L383 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.set_configs | def set_configs(self, key, d):
"""Set the whole configuration for a key"""
if '_config' in self.proxy:
self.proxy['_config'][key] = d
else:
self.proxy['_config'] = {key: d} | python | def set_configs(self, key, d):
"""Set the whole configuration for a key"""
if '_config' in self.proxy:
self.proxy['_config'][key] = d
else:
self.proxy['_config'] = {key: d} | [
"def",
"set_configs",
"(",
"self",
",",
"key",
",",
"d",
")",
":",
"if",
"'_config'",
"in",
"self",
".",
"proxy",
":",
"self",
".",
"proxy",
"[",
"'_config'",
"]",
"[",
"key",
"]",
"=",
"d",
"else",
":",
"self",
".",
"proxy",
"[",
"'_config'",
"]... | Set the whole configuration for a key | [
"Set",
"the",
"whole",
"configuration",
"for",
"a",
"key"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L385-L390 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.iter_data | def iter_data(self):
"""Iterate over key-value pairs that are really meant to be displayed"""
for (k, v) in self.proxy.items():
if (
not (isinstance(k, str) and k[0] == '_') and
k not in (
'character',
'name',
... | python | def iter_data(self):
"""Iterate over key-value pairs that are really meant to be displayed"""
for (k, v) in self.proxy.items():
if (
not (isinstance(k, str) and k[0] == '_') and
k not in (
'character',
'name',
... | [
"def",
"iter_data",
"(",
"self",
")",
":",
"for",
"(",
"k",
",",
"v",
")",
"in",
"self",
".",
"proxy",
".",
"items",
"(",
")",
":",
"if",
"(",
"not",
"(",
"isinstance",
"(",
"k",
",",
"str",
")",
"and",
"k",
"[",
"0",
"]",
"==",
"'_'",
")",... | Iterate over key-value pairs that are really meant to be displayed | [
"Iterate",
"over",
"key",
"-",
"value",
"pairs",
"that",
"are",
"really",
"meant",
"to",
"be",
"displayed"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L392-L403 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.munge | def munge(self, k, v):
"""Turn a key and value into a dictionary describing a widget to show"""
if '_config' in self.proxy and k in self.proxy['_config']:
config = self.proxy['_config'][k].unwrap()
else:
config = default_cfg
return {
'key': k,
... | python | def munge(self, k, v):
"""Turn a key and value into a dictionary describing a widget to show"""
if '_config' in self.proxy and k in self.proxy['_config']:
config = self.proxy['_config'][k].unwrap()
else:
config = default_cfg
return {
'key': k,
... | [
"def",
"munge",
"(",
"self",
",",
"k",
",",
"v",
")",
":",
"if",
"'_config'",
"in",
"self",
".",
"proxy",
"and",
"k",
"in",
"self",
".",
"proxy",
"[",
"'_config'",
"]",
":",
"config",
"=",
"self",
".",
"proxy",
"[",
"'_config'",
"]",
"[",
"k",
... | Turn a key and value into a dictionary describing a widget to show | [
"Turn",
"a",
"key",
"and",
"value",
"into",
"a",
"dictionary",
"describing",
"a",
"widget",
"to",
"show"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L405-L420 | train |
LogicalDash/LiSE | ELiDE/ELiDE/statlist.py | BaseStatListView.upd_data | def upd_data(self, *args):
"""Update to match new entity data"""
data = [self.munge(k, v) for k, v in self.iter_data()]
self.data = sorted(data, key=lambda d: d['key']) | python | def upd_data(self, *args):
"""Update to match new entity data"""
data = [self.munge(k, v) for k, v in self.iter_data()]
self.data = sorted(data, key=lambda d: d['key']) | [
"def",
"upd_data",
"(",
"self",
",",
"*",
"args",
")",
":",
"data",
"=",
"[",
"self",
".",
"munge",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"iter_data",
"(",
")",
"]",
"self",
".",
"data",
"=",
"sorted",
"(",
"data",... | Update to match new entity data | [
"Update",
"to",
"match",
"new",
"entity",
"data"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/statlist.py#L422-L425 | train |
LogicalDash/LiSE | ELiDE/ELiDE/game.py | GameScreen.wait_travel | def wait_travel(self, character, thing, dest, cb=None):
"""Schedule a thing to travel someplace, then wait for it to finish.
:param character: name of the character
:param thing: name of the thing that will travel
:param dest: name of the place it will travel to
:param cb: callb... | python | def wait_travel(self, character, thing, dest, cb=None):
"""Schedule a thing to travel someplace, then wait for it to finish.
:param character: name of the character
:param thing: name of the thing that will travel
:param dest: name of the place it will travel to
:param cb: callb... | [
"def",
"wait_travel",
"(",
"self",
",",
"character",
",",
"thing",
",",
"dest",
",",
"cb",
"=",
"None",
")",
":",
"self",
".",
"disable_input",
"(",
")",
"self",
".",
"app",
".",
"wait_travel",
"(",
"character",
",",
"thing",
",",
"dest",
",",
"cb",
... | Schedule a thing to travel someplace, then wait for it to finish.
:param character: name of the character
:param thing: name of the thing that will travel
:param dest: name of the place it will travel to
:param cb: callback function for when it's done, optional
:return: ``None`` | [
"Schedule",
"a",
"thing",
"to",
"travel",
"someplace",
"then",
"wait",
"for",
"it",
"to",
"finish",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/game.py#L78-L89 | train |
LogicalDash/LiSE | ELiDE/ELiDE/game.py | GameScreen.wait_command | def wait_command(self, start_func, turns=1, end_func=None):
"""Call ``start_func``, wait ``turns``, and then call ``end_func`` if provided
Disables input for the duration.
:param start_func: function to call just after disabling input
:param turns: number of turns to wait
:para... | python | def wait_command(self, start_func, turns=1, end_func=None):
"""Call ``start_func``, wait ``turns``, and then call ``end_func`` if provided
Disables input for the duration.
:param start_func: function to call just after disabling input
:param turns: number of turns to wait
:para... | [
"def",
"wait_command",
"(",
"self",
",",
"start_func",
",",
"turns",
"=",
"1",
",",
"end_func",
"=",
"None",
")",
":",
"self",
".",
"disable_input",
"(",
")",
"start_func",
"(",
")",
"self",
".",
"app",
".",
"wait_turns",
"(",
"turns",
",",
"cb",
"="... | Call ``start_func``, wait ``turns``, and then call ``end_func`` if provided
Disables input for the duration.
:param start_func: function to call just after disabling input
:param turns: number of turns to wait
:param end_func: function to call just before re-enabling input
:ret... | [
"Call",
"start_func",
"wait",
"turns",
"and",
"then",
"call",
"end_func",
"if",
"provided"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/game.py#L104-L117 | train |
LogicalDash/LiSE | ELiDE/ELiDE/game.py | GameApp.wait_travel | def wait_travel(self, character, thing, dest, cb=None):
"""Schedule a thing to travel someplace, then wait for it to finish, and call ``cb`` if provided
:param character: name of the character
:param thing: name of the thing
:param dest: name of the destination (a place)
:param ... | python | def wait_travel(self, character, thing, dest, cb=None):
"""Schedule a thing to travel someplace, then wait for it to finish, and call ``cb`` if provided
:param character: name of the character
:param thing: name of the thing
:param dest: name of the destination (a place)
:param ... | [
"def",
"wait_travel",
"(",
"self",
",",
"character",
",",
"thing",
",",
"dest",
",",
"cb",
"=",
"None",
")",
":",
"self",
".",
"wait_turns",
"(",
"self",
".",
"engine",
".",
"character",
"[",
"character",
"]",
".",
"thing",
"[",
"thing",
"]",
".",
... | Schedule a thing to travel someplace, then wait for it to finish, and call ``cb`` if provided
:param character: name of the character
:param thing: name of the thing
:param dest: name of the destination (a place)
:param cb: function to be called when I'm done
:return: ``None`` | [
"Schedule",
"a",
"thing",
"to",
"travel",
"someplace",
"then",
"wait",
"for",
"it",
"to",
"finish",
"and",
"call",
"cb",
"if",
"provided"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/game.py#L177-L187 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RuleButton.on_state | def on_state(self, *args):
"""If I'm pressed, unpress all other buttons in the ruleslist"""
# This really ought to be done with the selection behavior
if self.state == 'down':
self.rulesview.rule = self.rule
for button in self.ruleslist.children[0].children:
... | python | def on_state(self, *args):
"""If I'm pressed, unpress all other buttons in the ruleslist"""
# This really ought to be done with the selection behavior
if self.state == 'down':
self.rulesview.rule = self.rule
for button in self.ruleslist.children[0].children:
... | [
"def",
"on_state",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"state",
"==",
"'down'",
":",
"self",
".",
"rulesview",
".",
"rule",
"=",
"self",
".",
"rule",
"for",
"button",
"in",
"self",
".",
"ruleslist",
".",
"children",
"[",
"0"... | If I'm pressed, unpress all other buttons in the ruleslist | [
"If",
"I",
"m",
"pressed",
"unpress",
"all",
"other",
"buttons",
"in",
"the",
"ruleslist"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L52-L59 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesList.on_rulebook | def on_rulebook(self, *args):
"""Make sure to update when the rulebook changes"""
if self.rulebook is None:
return
self.rulebook.connect(self._trigger_redata, weak=False)
self.redata() | python | def on_rulebook(self, *args):
"""Make sure to update when the rulebook changes"""
if self.rulebook is None:
return
self.rulebook.connect(self._trigger_redata, weak=False)
self.redata() | [
"def",
"on_rulebook",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"rulebook",
"is",
"None",
":",
"return",
"self",
".",
"rulebook",
".",
"connect",
"(",
"self",
".",
"_trigger_redata",
",",
"weak",
"=",
"False",
")",
"self",
".",
"red... | Make sure to update when the rulebook changes | [
"Make",
"sure",
"to",
"update",
"when",
"the",
"rulebook",
"changes"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L71-L76 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesList.redata | def redata(self, *args):
"""Make my data represent what's in my rulebook right now"""
if self.rulesview is None:
Clock.schedule_once(self.redata, 0)
return
data = [
{'rulesview': self.rulesview, 'rule': rule, 'index': i, 'ruleslist': self}
for i, r... | python | def redata(self, *args):
"""Make my data represent what's in my rulebook right now"""
if self.rulesview is None:
Clock.schedule_once(self.redata, 0)
return
data = [
{'rulesview': self.rulesview, 'rule': rule, 'index': i, 'ruleslist': self}
for i, r... | [
"def",
"redata",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"rulesview",
"is",
"None",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"redata",
",",
"0",
")",
"return",
"data",
"=",
"[",
"{",
"'rulesview'",
":",
"self",
".",... | Make my data represent what's in my rulebook right now | [
"Make",
"my",
"data",
"represent",
"what",
"s",
"in",
"my",
"rulebook",
"right",
"now"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L78-L87 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesView.on_rule | def on_rule(self, *args):
"""Make sure to update when the rule changes"""
if self.rule is None:
return
self.rule.connect(self._listen_to_rule) | python | def on_rule(self, *args):
"""Make sure to update when the rule changes"""
if self.rule is None:
return
self.rule.connect(self._listen_to_rule) | [
"def",
"on_rule",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"rule",
"is",
"None",
":",
"return",
"self",
".",
"rule",
".",
"connect",
"(",
"self",
".",
"_listen_to_rule",
")"
] | Make sure to update when the rule changes | [
"Make",
"sure",
"to",
"update",
"when",
"the",
"rule",
"changes"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L106-L110 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesView.finalize | def finalize(self, *args):
"""Add my tabs"""
if not self.canvas:
Clock.schedule_once(self.finalize, 0)
return
deck_builder_kwargs = {
'pos_hint': {'x': 0, 'y': 0},
'starting_pos_hint': {'x': 0.05, 'top': 0.95},
'card_size_hint': (0.3, ... | python | def finalize(self, *args):
"""Add my tabs"""
if not self.canvas:
Clock.schedule_once(self.finalize, 0)
return
deck_builder_kwargs = {
'pos_hint': {'x': 0, 'y': 0},
'starting_pos_hint': {'x': 0.05, 'top': 0.95},
'card_size_hint': (0.3, ... | [
"def",
"finalize",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"self",
".",
"canvas",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"finalize",
",",
"0",
")",
"return",
"deck_builder_kwargs",
"=",
"{",
"'pos_hint'",
":",
"{",
"'x'",
... | Add my tabs | [
"Add",
"my",
"tabs"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L127-L195 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesView.get_functions_cards | def get_functions_cards(self, what, allfuncs):
"""Return a pair of lists of Card widgets for used and unused functions.
:param what: a string: 'trigger', 'prereq', or 'action'
:param allfuncs: a sequence of functions' (name, sourcecode, signature)
"""
if not self.rule:
... | python | def get_functions_cards(self, what, allfuncs):
"""Return a pair of lists of Card widgets for used and unused functions.
:param what: a string: 'trigger', 'prereq', or 'action'
:param allfuncs: a sequence of functions' (name, sourcecode, signature)
"""
if not self.rule:
... | [
"def",
"get_functions_cards",
"(",
"self",
",",
"what",
",",
"allfuncs",
")",
":",
"if",
"not",
"self",
".",
"rule",
":",
"return",
"[",
"]",
",",
"[",
"]",
"rulefuncnames",
"=",
"getattr",
"(",
"self",
".",
"rule",
",",
"what",
"+",
"'s'",
")",
"u... | Return a pair of lists of Card widgets for used and unused functions.
:param what: a string: 'trigger', 'prereq', or 'action'
:param allfuncs: a sequence of functions' (name, sourcecode, signature) | [
"Return",
"a",
"pair",
"of",
"lists",
"of",
"Card",
"widgets",
"for",
"used",
"and",
"unused",
"functions",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L197-L234 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesView.set_functions | def set_functions(self, what, allfuncs):
"""Set the cards in the ``what`` builder to ``allfuncs``
:param what: a string, 'trigger', 'prereq', or 'action'
:param allfuncs: a sequence of triples of (name, sourcecode, signature) as taken by my
``get_function_cards`` method.
"""
... | python | def set_functions(self, what, allfuncs):
"""Set the cards in the ``what`` builder to ``allfuncs``
:param what: a string, 'trigger', 'prereq', or 'action'
:param allfuncs: a sequence of triples of (name, sourcecode, signature) as taken by my
``get_function_cards`` method.
"""
... | [
"def",
"set_functions",
"(",
"self",
",",
"what",
",",
"allfuncs",
")",
":",
"setattr",
"(",
"getattr",
"(",
"self",
",",
"'_{}_builder'",
".",
"format",
"(",
"what",
")",
")",
",",
"'decks'",
",",
"self",
".",
"get_functions_cards",
"(",
"what",
",",
... | Set the cards in the ``what`` builder to ``allfuncs``
:param what: a string, 'trigger', 'prereq', or 'action'
:param allfuncs: a sequence of triples of (name, sourcecode, signature) as taken by my
``get_function_cards`` method. | [
"Set",
"the",
"cards",
"in",
"the",
"what",
"builder",
"to",
"allfuncs"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L236-L244 | train |
LogicalDash/LiSE | ELiDE/ELiDE/rulesview.py | RulesView._upd_unused | def _upd_unused(self, what):
"""Make sure to have exactly one copy of every valid function in the
"unused" pile on the right.
Doesn't read from the database.
:param what: a string, 'trigger', 'prereq', or 'action'
"""
builder = getattr(self, '_{}_builder'.format(what))... | python | def _upd_unused(self, what):
"""Make sure to have exactly one copy of every valid function in the
"unused" pile on the right.
Doesn't read from the database.
:param what: a string, 'trigger', 'prereq', or 'action'
"""
builder = getattr(self, '_{}_builder'.format(what))... | [
"def",
"_upd_unused",
"(",
"self",
",",
"what",
")",
":",
"builder",
"=",
"getattr",
"(",
"self",
",",
"'_{}_builder'",
".",
"format",
"(",
"what",
")",
")",
"updtrig",
"=",
"getattr",
"(",
"self",
",",
"'_trigger_upd_unused_{}s'",
".",
"format",
"(",
"w... | Make sure to have exactly one copy of every valid function in the
"unused" pile on the right.
Doesn't read from the database.
:param what: a string, 'trigger', 'prereq', or 'action' | [
"Make",
"sure",
"to",
"have",
"exactly",
"one",
"copy",
"of",
"every",
"valid",
"function",
"in",
"the",
"unused",
"pile",
"on",
"the",
"right",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/rulesview.py#L293-L316 | train |
LogicalDash/LiSE | LiSE/LiSE/rule.py | Rule._fun_names_iter | def _fun_names_iter(self, functyp, val):
"""Iterate over the names of the functions in ``val``,
adding them to ``funcstore`` if they are missing;
or if the items in ``val`` are already the names of functions
in ``funcstore``, iterate over those.
"""
funcstore = getattr(s... | python | def _fun_names_iter(self, functyp, val):
"""Iterate over the names of the functions in ``val``,
adding them to ``funcstore`` if they are missing;
or if the items in ``val`` are already the names of functions
in ``funcstore``, iterate over those.
"""
funcstore = getattr(s... | [
"def",
"_fun_names_iter",
"(",
"self",
",",
"functyp",
",",
"val",
")",
":",
"funcstore",
"=",
"getattr",
"(",
"self",
".",
"engine",
",",
"functyp",
")",
"for",
"v",
"in",
"val",
":",
"if",
"callable",
"(",
"v",
")",
":",
"setattr",
"(",
"funcstore"... | Iterate over the names of the functions in ``val``,
adding them to ``funcstore`` if they are missing;
or if the items in ``val`` are already the names of functions
in ``funcstore``, iterate over those. | [
"Iterate",
"over",
"the",
"names",
"of",
"the",
"functions",
"in",
"val",
"adding",
"them",
"to",
"funcstore",
"if",
"they",
"are",
"missing",
";",
"or",
"if",
"the",
"items",
"in",
"val",
"are",
"already",
"the",
"names",
"of",
"functions",
"in",
"funcs... | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/rule.py#L260-L278 | train |
LogicalDash/LiSE | LiSE/LiSE/rule.py | Rule.duplicate | def duplicate(self, newname):
"""Return a new rule that's just like this one, but under a new
name.
"""
if self.engine.rule.query.haverule(newname):
raise KeyError("Already have a rule called {}".format(newname))
return Rule(
self.engine,
newn... | python | def duplicate(self, newname):
"""Return a new rule that's just like this one, but under a new
name.
"""
if self.engine.rule.query.haverule(newname):
raise KeyError("Already have a rule called {}".format(newname))
return Rule(
self.engine,
newn... | [
"def",
"duplicate",
"(",
"self",
",",
"newname",
")",
":",
"if",
"self",
".",
"engine",
".",
"rule",
".",
"query",
".",
"haverule",
"(",
"newname",
")",
":",
"raise",
"KeyError",
"(",
"\"Already have a rule called {}\"",
".",
"format",
"(",
"newname",
")",... | Return a new rule that's just like this one, but under a new
name. | [
"Return",
"a",
"new",
"rule",
"that",
"s",
"just",
"like",
"this",
"one",
"but",
"under",
"a",
"new",
"name",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/rule.py#L298-L311 | train |
LogicalDash/LiSE | LiSE/LiSE/rule.py | AllRules.new_empty | def new_empty(self, name):
"""Make a new rule with no actions or anything, and return it."""
if name in self:
raise KeyError("Already have rule {}".format(name))
new = Rule(self.engine, name)
self._cache[name] = new
self.send(self, rule=new, active=True)
retur... | python | def new_empty(self, name):
"""Make a new rule with no actions or anything, and return it."""
if name in self:
raise KeyError("Already have rule {}".format(name))
new = Rule(self.engine, name)
self._cache[name] = new
self.send(self, rule=new, active=True)
retur... | [
"def",
"new_empty",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
":",
"raise",
"KeyError",
"(",
"\"Already have rule {}\"",
".",
"format",
"(",
"name",
")",
")",
"new",
"=",
"Rule",
"(",
"self",
".",
"engine",
",",
"name",
")",
"se... | Make a new rule with no actions or anything, and return it. | [
"Make",
"a",
"new",
"rule",
"with",
"no",
"actions",
"or",
"anything",
"and",
"return",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/rule.py#L693-L700 | train |
LogicalDash/LiSE | LiSE/LiSE/query.py | slow_iter_turns_eval_cmp | def slow_iter_turns_eval_cmp(qry, oper, start_branch=None, engine=None):
"""Iterate over all turns on which a comparison holds.
This is expensive. It evaluates the query for every turn in history.
"""
def mungeside(side):
if isinstance(side, Query):
return side.iter_turns
e... | python | def slow_iter_turns_eval_cmp(qry, oper, start_branch=None, engine=None):
"""Iterate over all turns on which a comparison holds.
This is expensive. It evaluates the query for every turn in history.
"""
def mungeside(side):
if isinstance(side, Query):
return side.iter_turns
e... | [
"def",
"slow_iter_turns_eval_cmp",
"(",
"qry",
",",
"oper",
",",
"start_branch",
"=",
"None",
",",
"engine",
"=",
"None",
")",
":",
"def",
"mungeside",
"(",
"side",
")",
":",
"if",
"isinstance",
"(",
"side",
",",
"Query",
")",
":",
"return",
"side",
".... | Iterate over all turns on which a comparison holds.
This is expensive. It evaluates the query for every turn in history. | [
"Iterate",
"over",
"all",
"turns",
"on",
"which",
"a",
"comparison",
"holds",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/query.py#L312-L340 | train |
LogicalDash/LiSE | ELiDE/ELiDE/menu.py | MenuTextInput.on_enter | def on_enter(self, *args):
"""Call the setter and blank myself out so that my hint text shows
up. It will be the same you just entered if everything's
working.
"""
if self.text == '':
return
self.setter(self.text)
self.text = ''
self.focus = F... | python | def on_enter(self, *args):
"""Call the setter and blank myself out so that my hint text shows
up. It will be the same you just entered if everything's
working.
"""
if self.text == '':
return
self.setter(self.text)
self.text = ''
self.focus = F... | [
"def",
"on_enter",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"text",
"==",
"''",
":",
"return",
"self",
".",
"setter",
"(",
"self",
".",
"text",
")",
"self",
".",
"text",
"=",
"''",
"self",
".",
"focus",
"=",
"False"
] | Call the setter and blank myself out so that my hint text shows
up. It will be the same you just entered if everything's
working. | [
"Call",
"the",
"setter",
"and",
"blank",
"myself",
"out",
"so",
"that",
"my",
"hint",
"text",
"shows",
"up",
".",
"It",
"will",
"be",
"the",
"same",
"you",
"just",
"entered",
"if",
"everything",
"s",
"working",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/menu.py#L30-L40 | train |
LogicalDash/LiSE | ELiDE/ELiDE/menu.py | MenuIntInput.insert_text | def insert_text(self, s, from_undo=False):
"""Natural numbers only."""
return super().insert_text(
''.join(c for c in s if c in '0123456789'),
from_undo
) | python | def insert_text(self, s, from_undo=False):
"""Natural numbers only."""
return super().insert_text(
''.join(c for c in s if c in '0123456789'),
from_undo
) | [
"def",
"insert_text",
"(",
"self",
",",
"s",
",",
"from_undo",
"=",
"False",
")",
":",
"return",
"super",
"(",
")",
".",
"insert_text",
"(",
"''",
".",
"join",
"(",
"c",
"for",
"c",
"in",
"s",
"if",
"c",
"in",
"'0123456789'",
")",
",",
"from_undo",... | Natural numbers only. | [
"Natural",
"numbers",
"only",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/menu.py#L54-L59 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | AbstractCharacter.do | def do(self, func, *args, **kwargs):
"""Apply the function to myself, and return myself.
Look up the function in the database if needed. Pass it any
arguments given, keyword or positional.
Useful chiefly when chaining.
"""
if not callable(func):
func = geta... | python | def do(self, func, *args, **kwargs):
"""Apply the function to myself, and return myself.
Look up the function in the database if needed. Pass it any
arguments given, keyword or positional.
Useful chiefly when chaining.
"""
if not callable(func):
func = geta... | [
"def",
"do",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"callable",
"(",
"func",
")",
":",
"func",
"=",
"getattr",
"(",
"self",
".",
"engine",
".",
"function",
",",
"func",
")",
"func",
"(",
"self",
... | Apply the function to myself, and return myself.
Look up the function in the database if needed. Pass it any
arguments given, keyword or positional.
Useful chiefly when chaining. | [
"Apply",
"the",
"function",
"to",
"myself",
"and",
"return",
"myself",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L221-L233 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | AbstractCharacter.copy_from | def copy_from(self, g):
"""Copy all nodes and edges from the given graph into this.
Return myself.
"""
renamed = {}
for k, v in g.node.items():
ok = k
if k in self.place:
n = 0
while k in self.place:
k ... | python | def copy_from(self, g):
"""Copy all nodes and edges from the given graph into this.
Return myself.
"""
renamed = {}
for k, v in g.node.items():
ok = k
if k in self.place:
n = 0
while k in self.place:
k ... | [
"def",
"copy_from",
"(",
"self",
",",
"g",
")",
":",
"renamed",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"g",
".",
"node",
".",
"items",
"(",
")",
":",
"ok",
"=",
"k",
"if",
"k",
"in",
"self",
".",
"place",
":",
"n",
"=",
"0",
"while",
... | Copy all nodes and edges from the given graph into this.
Return myself. | [
"Copy",
"all",
"nodes",
"and",
"edges",
"from",
"the",
"given",
"graph",
"into",
"this",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L352-L379 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | AbstractCharacter.grid_2d_8graph | def grid_2d_8graph(self, m, n):
"""Make a 2d graph that's connected 8 ways, enabling diagonal movement"""
me = nx.Graph()
node = me.node
add_node = me.add_node
add_edge = me.add_edge
for i in range(m):
for j in range(n):
add_node((i, j))
... | python | def grid_2d_8graph(self, m, n):
"""Make a 2d graph that's connected 8 ways, enabling diagonal movement"""
me = nx.Graph()
node = me.node
add_node = me.add_node
add_edge = me.add_edge
for i in range(m):
for j in range(n):
add_node((i, j))
... | [
"def",
"grid_2d_8graph",
"(",
"self",
",",
"m",
",",
"n",
")",
":",
"me",
"=",
"nx",
".",
"Graph",
"(",
")",
"node",
"=",
"me",
".",
"node",
"add_node",
"=",
"me",
".",
"add_node",
"add_edge",
"=",
"me",
".",
"add_edge",
"for",
"i",
"in",
"range"... | Make a 2d graph that's connected 8 ways, enabling diagonal movement | [
"Make",
"a",
"2d",
"graph",
"that",
"s",
"connected",
"8",
"ways",
"enabling",
"diagonal",
"movement"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L413-L430 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | CharacterSense.func | def func(self):
"""Return the function most recently associated with this sense."""
fn = self.engine.query.sense_func_get(
self.observer.name,
self.sensename,
*self.engine._btt()
)
if fn is not None:
return SenseFuncWrap(self.observer, fn) | python | def func(self):
"""Return the function most recently associated with this sense."""
fn = self.engine.query.sense_func_get(
self.observer.name,
self.sensename,
*self.engine._btt()
)
if fn is not None:
return SenseFuncWrap(self.observer, fn) | [
"def",
"func",
"(",
"self",
")",
":",
"fn",
"=",
"self",
".",
"engine",
".",
"query",
".",
"sense_func_get",
"(",
"self",
".",
"observer",
".",
"name",
",",
"self",
".",
"sensename",
",",
"*",
"self",
".",
"engine",
".",
"_btt",
"(",
")",
")",
"i... | Return the function most recently associated with this sense. | [
"Return",
"the",
"function",
"most",
"recently",
"associated",
"with",
"this",
"sense",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L838-L846 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | Character.place2thing | def place2thing(self, name, location):
"""Turn a Place into a Thing with the given location.
It will keep all its attached Portals.
"""
self.engine._set_thing_loc(
self.name, name, location
)
if (self.name, name) in self.engine._node_objs:
... | python | def place2thing(self, name, location):
"""Turn a Place into a Thing with the given location.
It will keep all its attached Portals.
"""
self.engine._set_thing_loc(
self.name, name, location
)
if (self.name, name) in self.engine._node_objs:
... | [
"def",
"place2thing",
"(",
"self",
",",
"name",
",",
"location",
")",
":",
"self",
".",
"engine",
".",
"_set_thing_loc",
"(",
"self",
".",
"name",
",",
"name",
",",
"location",
")",
"if",
"(",
"self",
".",
"name",
",",
"name",
")",
"in",
"self",
".... | Turn a Place into a Thing with the given location.
It will keep all its attached Portals. | [
"Turn",
"a",
"Place",
"into",
"a",
"Thing",
"with",
"the",
"given",
"location",
".",
"It",
"will",
"keep",
"all",
"its",
"attached",
"Portals",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L2010-L2026 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | Character.thing2place | def thing2place(self, name):
"""Unset a Thing's location, and thus turn it into a Place."""
self.engine._set_thing_loc(
self.name, name, None
)
if (self.name, name) in self.engine._node_objs:
thing = self.engine._node_objs[self.name, name]
place = Plac... | python | def thing2place(self, name):
"""Unset a Thing's location, and thus turn it into a Place."""
self.engine._set_thing_loc(
self.name, name, None
)
if (self.name, name) in self.engine._node_objs:
thing = self.engine._node_objs[self.name, name]
place = Plac... | [
"def",
"thing2place",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"engine",
".",
"_set_thing_loc",
"(",
"self",
".",
"name",
",",
"name",
",",
"None",
")",
"if",
"(",
"self",
".",
"name",
",",
"name",
")",
"in",
"self",
".",
"engine",
".",
"... | Unset a Thing's location, and thus turn it into a Place. | [
"Unset",
"a",
"Thing",
"s",
"location",
"and",
"thus",
"turn",
"it",
"into",
"a",
"Place",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L2028-L2040 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | Character.del_avatar | def del_avatar(self, a, b=None):
"""This is no longer my avatar, though it still exists on its own."""
if self.engine._planning:
raise NotImplementedError("Currently can't remove avatars within a plan")
if b is None:
if not isinstance(a, Node):
raise TypeE... | python | def del_avatar(self, a, b=None):
"""This is no longer my avatar, though it still exists on its own."""
if self.engine._planning:
raise NotImplementedError("Currently can't remove avatars within a plan")
if b is None:
if not isinstance(a, Node):
raise TypeE... | [
"def",
"del_avatar",
"(",
"self",
",",
"a",
",",
"b",
"=",
"None",
")",
":",
"if",
"self",
".",
"engine",
".",
"_planning",
":",
"raise",
"NotImplementedError",
"(",
"\"Currently can't remove avatars within a plan\"",
")",
"if",
"b",
"is",
"None",
":",
"if",... | This is no longer my avatar, though it still exists on its own. | [
"This",
"is",
"no",
"longer",
"my",
"avatar",
"though",
"it",
"still",
"exists",
"on",
"its",
"own",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L2135-L2153 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | Character.portals | def portals(self):
"""Iterate over all portals."""
char = self.character
make_edge = self.engine._get_edge
for (o, d) in self.engine._edges_cache.iter_keys(
self.character.name, *self.engine._btt()
):
yield make_edge(char, o, d) | python | def portals(self):
"""Iterate over all portals."""
char = self.character
make_edge = self.engine._get_edge
for (o, d) in self.engine._edges_cache.iter_keys(
self.character.name, *self.engine._btt()
):
yield make_edge(char, o, d) | [
"def",
"portals",
"(",
"self",
")",
":",
"char",
"=",
"self",
".",
"character",
"make_edge",
"=",
"self",
".",
"engine",
".",
"_get_edge",
"for",
"(",
"o",
",",
"d",
")",
"in",
"self",
".",
"engine",
".",
"_edges_cache",
".",
"iter_keys",
"(",
"self"... | Iterate over all portals. | [
"Iterate",
"over",
"all",
"portals",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L2155-L2162 | train |
LogicalDash/LiSE | LiSE/LiSE/character.py | Character.avatars | def avatars(self):
"""Iterate over all my avatars, regardless of what character they are
in.
"""
charname = self.character.name
branch, turn, tick = self.engine._btt()
charmap = self.engine.character
avit = self.engine._avatarness_cache.iter_entities
make... | python | def avatars(self):
"""Iterate over all my avatars, regardless of what character they are
in.
"""
charname = self.character.name
branch, turn, tick = self.engine._btt()
charmap = self.engine.character
avit = self.engine._avatarness_cache.iter_entities
make... | [
"def",
"avatars",
"(",
"self",
")",
":",
"charname",
"=",
"self",
".",
"character",
".",
"name",
"branch",
",",
"turn",
",",
"tick",
"=",
"self",
".",
"engine",
".",
"_btt",
"(",
")",
"charmap",
"=",
"self",
".",
"engine",
".",
"character",
"avit",
... | Iterate over all my avatars, regardless of what character they are
in. | [
"Iterate",
"over",
"all",
"my",
"avatars",
"regardless",
"of",
"what",
"character",
"they",
"are",
"in",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/character.py#L2164-L2183 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.sql | def sql(self, stringname, *args, **kwargs):
"""Wrapper for the various prewritten or compiled SQL calls.
First argument is the name of the query, either a key in
``sqlite.json`` or a method name in
``allegedb.alchemy.Alchemist``. The rest of the arguments are
parameters to the q... | python | def sql(self, stringname, *args, **kwargs):
"""Wrapper for the various prewritten or compiled SQL calls.
First argument is the name of the query, either a key in
``sqlite.json`` or a method name in
``allegedb.alchemy.Alchemist``. The rest of the arguments are
parameters to the q... | [
"def",
"sql",
"(",
"self",
",",
"stringname",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'alchemist'",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"alchemist",
",",
"stringname",
")",
"(",
"*",
"args",
... | Wrapper for the various prewritten or compiled SQL calls.
First argument is the name of the query, either a key in
``sqlite.json`` or a method name in
``allegedb.alchemy.Alchemist``. The rest of the arguments are
parameters to the query. | [
"Wrapper",
"for",
"the",
"various",
"prewritten",
"or",
"compiled",
"SQL",
"calls",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L155-L170 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.sqlmany | def sqlmany(self, stringname, *args):
"""Wrapper for executing many SQL calls on my connection.
First arg is the name of a query, either a key in the
precompiled JSON or a method name in
``allegedb.alchemy.Alchemist``. Remaining arguments should be
tuples of argument sequences t... | python | def sqlmany(self, stringname, *args):
"""Wrapper for executing many SQL calls on my connection.
First arg is the name of a query, either a key in the
precompiled JSON or a method name in
``allegedb.alchemy.Alchemist``. Remaining arguments should be
tuples of argument sequences t... | [
"def",
"sqlmany",
"(",
"self",
",",
"stringname",
",",
"*",
"args",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'alchemist'",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"alchemist",
".",
"many",
",",
"stringname",
")",
"(",
"*",
"args",
")",
... | Wrapper for executing many SQL calls on my connection.
First arg is the name of a query, either a key in the
precompiled JSON or a method name in
``allegedb.alchemy.Alchemist``. Remaining arguments should be
tuples of argument sequences to be passed to the query. | [
"Wrapper",
"for",
"executing",
"many",
"SQL",
"calls",
"on",
"my",
"connection",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L172-L184 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.have_graph | def have_graph(self, graph):
"""Return whether I have a graph by this name."""
graph = self.pack(graph)
return bool(self.sql('graphs_named', graph).fetchone()[0]) | python | def have_graph(self, graph):
"""Return whether I have a graph by this name."""
graph = self.pack(graph)
return bool(self.sql('graphs_named', graph).fetchone()[0]) | [
"def",
"have_graph",
"(",
"self",
",",
"graph",
")",
":",
"graph",
"=",
"self",
".",
"pack",
"(",
"graph",
")",
"return",
"bool",
"(",
"self",
".",
"sql",
"(",
"'graphs_named'",
",",
"graph",
")",
".",
"fetchone",
"(",
")",
"[",
"0",
"]",
")"
] | Return whether I have a graph by this name. | [
"Return",
"whether",
"I",
"have",
"a",
"graph",
"by",
"this",
"name",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L186-L189 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.new_graph | def new_graph(self, graph, typ):
"""Declare a new graph by this name of this type."""
graph = self.pack(graph)
return self.sql('new_graph', graph, typ) | python | def new_graph(self, graph, typ):
"""Declare a new graph by this name of this type."""
graph = self.pack(graph)
return self.sql('new_graph', graph, typ) | [
"def",
"new_graph",
"(",
"self",
",",
"graph",
",",
"typ",
")",
":",
"graph",
"=",
"self",
".",
"pack",
"(",
"graph",
")",
"return",
"self",
".",
"sql",
"(",
"'new_graph'",
",",
"graph",
",",
"typ",
")"
] | Declare a new graph by this name of this type. | [
"Declare",
"a",
"new",
"graph",
"by",
"this",
"name",
"of",
"this",
"type",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L191-L194 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.del_graph | def del_graph(self, graph):
"""Delete all records to do with the graph"""
g = self.pack(graph)
self.sql('del_edge_val_graph', g)
self.sql('del_node_val_graph', g)
self.sql('del_edge_val_graph', g)
self.sql('del_edges_graph', g)
self.sql('del_nodes_graph', g)
... | python | def del_graph(self, graph):
"""Delete all records to do with the graph"""
g = self.pack(graph)
self.sql('del_edge_val_graph', g)
self.sql('del_node_val_graph', g)
self.sql('del_edge_val_graph', g)
self.sql('del_edges_graph', g)
self.sql('del_nodes_graph', g)
... | [
"def",
"del_graph",
"(",
"self",
",",
"graph",
")",
":",
"g",
"=",
"self",
".",
"pack",
"(",
"graph",
")",
"self",
".",
"sql",
"(",
"'del_edge_val_graph'",
",",
"g",
")",
"self",
".",
"sql",
"(",
"'del_node_val_graph'",
",",
"g",
")",
"self",
".",
... | Delete all records to do with the graph | [
"Delete",
"all",
"records",
"to",
"do",
"with",
"the",
"graph"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L196-L204 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.graph_type | def graph_type(self, graph):
"""What type of graph is this?"""
graph = self.pack(graph)
return self.sql('graph_type', graph).fetchone()[0] | python | def graph_type(self, graph):
"""What type of graph is this?"""
graph = self.pack(graph)
return self.sql('graph_type', graph).fetchone()[0] | [
"def",
"graph_type",
"(",
"self",
",",
"graph",
")",
":",
"graph",
"=",
"self",
".",
"pack",
"(",
"graph",
")",
"return",
"self",
".",
"sql",
"(",
"'graph_type'",
",",
"graph",
")",
".",
"fetchone",
"(",
")",
"[",
"0",
"]"
] | What type of graph is this? | [
"What",
"type",
"of",
"graph",
"is",
"this?"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L206-L209 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.global_get | def global_get(self, key):
"""Return the value for the given key in the ``globals`` table."""
key = self.pack(key)
r = self.sql('global_get', key).fetchone()
if r is None:
raise KeyError("Not set")
return self.unpack(r[0]) | python | def global_get(self, key):
"""Return the value for the given key in the ``globals`` table."""
key = self.pack(key)
r = self.sql('global_get', key).fetchone()
if r is None:
raise KeyError("Not set")
return self.unpack(r[0]) | [
"def",
"global_get",
"(",
"self",
",",
"key",
")",
":",
"key",
"=",
"self",
".",
"pack",
"(",
"key",
")",
"r",
"=",
"self",
".",
"sql",
"(",
"'global_get'",
",",
"key",
")",
".",
"fetchone",
"(",
")",
"if",
"r",
"is",
"None",
":",
"raise",
"Key... | Return the value for the given key in the ``globals`` table. | [
"Return",
"the",
"value",
"for",
"the",
"given",
"key",
"in",
"the",
"globals",
"table",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L222-L228 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.global_del | def global_del(self, key):
"""Delete the global record for the key."""
key = self.pack(key)
return self.sql('global_del', key) | python | def global_del(self, key):
"""Delete the global record for the key."""
key = self.pack(key)
return self.sql('global_del', key) | [
"def",
"global_del",
"(",
"self",
",",
"key",
")",
":",
"key",
"=",
"self",
".",
"pack",
"(",
"key",
")",
"return",
"self",
".",
"sql",
"(",
"'global_del'",
",",
"key",
")"
] | Delete the global record for the key. | [
"Delete",
"the",
"global",
"record",
"for",
"the",
"key",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L246-L249 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.new_branch | def new_branch(self, branch, parent, parent_turn, parent_tick):
"""Declare that the ``branch`` is descended from ``parent`` at
``parent_turn``, ``parent_tick``
"""
return self.sql('branches_insert', branch, parent, parent_turn, parent_tick, parent_turn, parent_tick) | python | def new_branch(self, branch, parent, parent_turn, parent_tick):
"""Declare that the ``branch`` is descended from ``parent`` at
``parent_turn``, ``parent_tick``
"""
return self.sql('branches_insert', branch, parent, parent_turn, parent_tick, parent_turn, parent_tick) | [
"def",
"new_branch",
"(",
"self",
",",
"branch",
",",
"parent",
",",
"parent_turn",
",",
"parent_tick",
")",
":",
"return",
"self",
".",
"sql",
"(",
"'branches_insert'",
",",
"branch",
",",
"parent",
",",
"parent_turn",
",",
"parent_tick",
",",
"parent_turn"... | Declare that the ``branch`` is descended from ``parent`` at
``parent_turn``, ``parent_tick`` | [
"Declare",
"that",
"the",
"branch",
"is",
"descended",
"from",
"parent",
"at",
"parent_turn",
"parent_tick"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L251-L256 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.graph_val_dump | def graph_val_dump(self):
"""Yield the entire contents of the graph_val table."""
self._flush_graph_val()
for (graph, key, branch, turn, tick, value) in self.sql('graph_val_dump'):
yield (
self.unpack(graph),
self.unpack(key),
branch,
... | python | def graph_val_dump(self):
"""Yield the entire contents of the graph_val table."""
self._flush_graph_val()
for (graph, key, branch, turn, tick, value) in self.sql('graph_val_dump'):
yield (
self.unpack(graph),
self.unpack(key),
branch,
... | [
"def",
"graph_val_dump",
"(",
"self",
")",
":",
"self",
".",
"_flush_graph_val",
"(",
")",
"for",
"(",
"graph",
",",
"key",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"value",
")",
"in",
"self",
".",
"sql",
"(",
"'graph_val_dump'",
")",
":",
"yiel... | Yield the entire contents of the graph_val table. | [
"Yield",
"the",
"entire",
"contents",
"of",
"the",
"graph_val",
"table",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L282-L293 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine._flush_graph_val | def _flush_graph_val(self):
"""Send all new and changed graph values to the database."""
if not self._graphvals2set:
return
delafter = {}
for graph, key, branch, turn, tick, value in self._graphvals2set:
if (graph, key, branch) in delafter:
delafte... | python | def _flush_graph_val(self):
"""Send all new and changed graph values to the database."""
if not self._graphvals2set:
return
delafter = {}
for graph, key, branch, turn, tick, value in self._graphvals2set:
if (graph, key, branch) in delafter:
delafte... | [
"def",
"_flush_graph_val",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_graphvals2set",
":",
"return",
"delafter",
"=",
"{",
"}",
"for",
"graph",
",",
"key",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"value",
"in",
"self",
".",
"_graphvals2se... | Send all new and changed graph values to the database. | [
"Send",
"all",
"new",
"and",
"changed",
"graph",
"values",
"to",
"the",
"database",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L295-L314 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.exist_node | def exist_node(self, graph, node, branch, turn, tick, extant):
"""Declare that the node exists or doesn't.
Inserts a new record or updates an old one, as needed.
"""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
... | python | def exist_node(self, graph, node, branch, turn, tick, extant):
"""Declare that the node exists or doesn't.
Inserts a new record or updates an old one, as needed.
"""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
... | [
"def",
"exist_node",
"(",
"self",
",",
"graph",
",",
"node",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"extant",
")",
":",
"if",
"(",
"branch",
",",
"turn",
",",
"tick",
")",
"in",
"self",
".",
"_btts",
":",
"raise",
"TimeError",
"self",
".",
... | Declare that the node exists or doesn't.
Inserts a new record or updates an old one, as needed. | [
"Declare",
"that",
"the",
"node",
"exists",
"or",
"doesn",
"t",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L348-L357 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.nodes_dump | def nodes_dump(self):
"""Dump the entire contents of the nodes table."""
self._flush_nodes()
for (graph, node, branch, turn,tick, extant) in self.sql('nodes_dump'):
yield (
self.unpack(graph),
self.unpack(node),
branch,
... | python | def nodes_dump(self):
"""Dump the entire contents of the nodes table."""
self._flush_nodes()
for (graph, node, branch, turn,tick, extant) in self.sql('nodes_dump'):
yield (
self.unpack(graph),
self.unpack(node),
branch,
... | [
"def",
"nodes_dump",
"(",
"self",
")",
":",
"self",
".",
"_flush_nodes",
"(",
")",
"for",
"(",
"graph",
",",
"node",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"extant",
")",
"in",
"self",
".",
"sql",
"(",
"'nodes_dump'",
")",
":",
"yield",
"(",... | Dump the entire contents of the nodes table. | [
"Dump",
"the",
"entire",
"contents",
"of",
"the",
"nodes",
"table",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L364-L375 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.node_val_dump | def node_val_dump(self):
"""Yield the entire contents of the node_val table."""
self._flush_node_val()
for (
graph, node, key, branch, turn, tick, value
) in self.sql('node_val_dump'):
yield (
self.unpack(graph),
self.unpack(nod... | python | def node_val_dump(self):
"""Yield the entire contents of the node_val table."""
self._flush_node_val()
for (
graph, node, key, branch, turn, tick, value
) in self.sql('node_val_dump'):
yield (
self.unpack(graph),
self.unpack(nod... | [
"def",
"node_val_dump",
"(",
"self",
")",
":",
"self",
".",
"_flush_node_val",
"(",
")",
"for",
"(",
"graph",
",",
"node",
",",
"key",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"value",
")",
"in",
"self",
".",
"sql",
"(",
"'node_val_dump'",
")",
... | Yield the entire contents of the node_val table. | [
"Yield",
"the",
"entire",
"contents",
"of",
"the",
"node_val",
"table",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L377-L391 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.node_val_set | def node_val_set(self, graph, node, key, branch, turn, tick, value):
"""Set a key-value pair on a node at a specific branch and revision"""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
graph, node, key, value = map(self.pack, (gr... | python | def node_val_set(self, graph, node, key, branch, turn, tick, value):
"""Set a key-value pair on a node at a specific branch and revision"""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
graph, node, key, value = map(self.pack, (gr... | [
"def",
"node_val_set",
"(",
"self",
",",
"graph",
",",
"node",
",",
"key",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"value",
")",
":",
"if",
"(",
"branch",
",",
"turn",
",",
"tick",
")",
"in",
"self",
".",
"_btts",
":",
"raise",
"TimeError",
... | Set a key-value pair on a node at a specific branch and revision | [
"Set",
"a",
"key",
"-",
"value",
"pair",
"on",
"a",
"node",
"at",
"a",
"specific",
"branch",
"and",
"revision"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L415-L421 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.edges_dump | def edges_dump(self):
"""Dump the entire contents of the edges table."""
self._flush_edges()
for (
graph, orig, dest, idx, branch, turn, tick, extant
) in self.sql('edges_dump'):
yield (
self.unpack(graph),
self.unpack(orig),
... | python | def edges_dump(self):
"""Dump the entire contents of the edges table."""
self._flush_edges()
for (
graph, orig, dest, idx, branch, turn, tick, extant
) in self.sql('edges_dump'):
yield (
self.unpack(graph),
self.unpack(orig),
... | [
"def",
"edges_dump",
"(",
"self",
")",
":",
"self",
".",
"_flush_edges",
"(",
")",
"for",
"(",
"graph",
",",
"orig",
",",
"dest",
",",
"idx",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"extant",
")",
"in",
"self",
".",
"sql",
"(",
"'edges_dump'"... | Dump the entire contents of the edges table. | [
"Dump",
"the",
"entire",
"contents",
"of",
"the",
"edges",
"table",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L428-L443 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.exist_edge | def exist_edge(self, graph, orig, dest, idx, branch, turn, tick, extant):
"""Declare whether or not this edge exists."""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
graph, orig, dest = map(self.pack, (graph, orig, dest))
... | python | def exist_edge(self, graph, orig, dest, idx, branch, turn, tick, extant):
"""Declare whether or not this edge exists."""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
graph, orig, dest = map(self.pack, (graph, orig, dest))
... | [
"def",
"exist_edge",
"(",
"self",
",",
"graph",
",",
"orig",
",",
"dest",
",",
"idx",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"extant",
")",
":",
"if",
"(",
"branch",
",",
"turn",
",",
"tick",
")",
"in",
"self",
".",
"_btts",
":",
"raise",
... | Declare whether or not this edge exists. | [
"Declare",
"whether",
"or",
"not",
"this",
"edge",
"exists",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L468-L474 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.edge_val_dump | def edge_val_dump(self):
"""Yield the entire contents of the edge_val table."""
self._flush_edge_val()
for (
graph, orig, dest, idx, key, branch, turn, tick, value
) in self.sql('edge_val_dump'):
yield (
self.unpack(graph),
self... | python | def edge_val_dump(self):
"""Yield the entire contents of the edge_val table."""
self._flush_edge_val()
for (
graph, orig, dest, idx, key, branch, turn, tick, value
) in self.sql('edge_val_dump'):
yield (
self.unpack(graph),
self... | [
"def",
"edge_val_dump",
"(",
"self",
")",
":",
"self",
".",
"_flush_edge_val",
"(",
")",
"for",
"(",
"graph",
",",
"orig",
",",
"dest",
",",
"idx",
",",
"key",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"value",
")",
"in",
"self",
".",
"sql",
... | Yield the entire contents of the edge_val table. | [
"Yield",
"the",
"entire",
"contents",
"of",
"the",
"edge_val",
"table",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L481-L497 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.edge_val_set | def edge_val_set(self, graph, orig, dest, idx, key, branch, turn, tick, value):
"""Set this key of this edge to this value."""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
graph, orig, dest, key, value = map(self.pack, (graph, or... | python | def edge_val_set(self, graph, orig, dest, idx, key, branch, turn, tick, value):
"""Set this key of this edge to this value."""
if (branch, turn, tick) in self._btts:
raise TimeError
self._btts.add((branch, turn, tick))
graph, orig, dest, key, value = map(self.pack, (graph, or... | [
"def",
"edge_val_set",
"(",
"self",
",",
"graph",
",",
"orig",
",",
"dest",
",",
"idx",
",",
"key",
",",
"branch",
",",
"turn",
",",
"tick",
",",
"value",
")",
":",
"if",
"(",
"branch",
",",
"turn",
",",
"tick",
")",
"in",
"self",
".",
"_btts",
... | Set this key of this edge to this value. | [
"Set",
"this",
"key",
"of",
"this",
"edge",
"to",
"this",
"value",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L520-L528 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.initdb | def initdb(self):
"""Create tables and indices as needed."""
if hasattr(self, 'alchemist'):
self.alchemist.meta.create_all(self.engine)
if 'branch' not in self.globl:
self.globl['branch'] = 'trunk'
if 'rev' not in self.globl:
self.globl... | python | def initdb(self):
"""Create tables and indices as needed."""
if hasattr(self, 'alchemist'):
self.alchemist.meta.create_all(self.engine)
if 'branch' not in self.globl:
self.globl['branch'] = 'trunk'
if 'rev' not in self.globl:
self.globl... | [
"def",
"initdb",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'alchemist'",
")",
":",
"self",
".",
"alchemist",
".",
"meta",
".",
"create_all",
"(",
"self",
".",
"engine",
")",
"if",
"'branch'",
"not",
"in",
"self",
".",
"globl",
":",
... | Create tables and indices as needed. | [
"Create",
"tables",
"and",
"indices",
"as",
"needed",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L553-L589 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.flush | def flush(self):
"""Put all pending changes into the SQL transaction."""
self._flush_nodes()
self._flush_edges()
self._flush_graph_val()
self._flush_node_val()
self._flush_edge_val() | python | def flush(self):
"""Put all pending changes into the SQL transaction."""
self._flush_nodes()
self._flush_edges()
self._flush_graph_val()
self._flush_node_val()
self._flush_edge_val() | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"_flush_nodes",
"(",
")",
"self",
".",
"_flush_edges",
"(",
")",
"self",
".",
"_flush_graph_val",
"(",
")",
"self",
".",
"_flush_node_val",
"(",
")",
"self",
".",
"_flush_edge_val",
"(",
")"
] | Put all pending changes into the SQL transaction. | [
"Put",
"all",
"pending",
"changes",
"into",
"the",
"SQL",
"transaction",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L591-L597 | train |
LogicalDash/LiSE | allegedb/allegedb/query.py | QueryEngine.commit | def commit(self):
"""Commit the transaction"""
self.flush()
if hasattr(self, 'transaction') and self.transaction.is_active:
self.transaction.commit()
elif hasattr(self, 'connection'):
self.connection.commit() | python | def commit(self):
"""Commit the transaction"""
self.flush()
if hasattr(self, 'transaction') and self.transaction.is_active:
self.transaction.commit()
elif hasattr(self, 'connection'):
self.connection.commit() | [
"def",
"commit",
"(",
"self",
")",
":",
"self",
".",
"flush",
"(",
")",
"if",
"hasattr",
"(",
"self",
",",
"'transaction'",
")",
"and",
"self",
".",
"transaction",
".",
"is_active",
":",
"self",
".",
"transaction",
".",
"commit",
"(",
")",
"elif",
"h... | Commit the transaction | [
"Commit",
"the",
"transaction"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L599-L605 | train |
LogicalDash/LiSE | LiSE/LiSE/node.py | Node.path_exists | def path_exists(self, dest, weight=None):
"""Return whether there is a path leading from me to ``dest``.
With ``weight``, only consider edges that have a stat by the
given name.
Raise ``ValueError`` if ``dest`` is not a node in my character
or the name of one.
"""
... | python | def path_exists(self, dest, weight=None):
"""Return whether there is a path leading from me to ``dest``.
With ``weight``, only consider edges that have a stat by the
given name.
Raise ``ValueError`` if ``dest`` is not a node in my character
or the name of one.
"""
... | [
"def",
"path_exists",
"(",
"self",
",",
"dest",
",",
"weight",
"=",
"None",
")",
":",
"try",
":",
"return",
"bool",
"(",
"self",
".",
"shortest_path_length",
"(",
"dest",
",",
"weight",
")",
")",
"except",
"KeyError",
":",
"return",
"False"
] | Return whether there is a path leading from me to ``dest``.
With ``weight``, only consider edges that have a stat by the
given name.
Raise ``ValueError`` if ``dest`` is not a node in my character
or the name of one. | [
"Return",
"whether",
"there",
"is",
"a",
"path",
"leading",
"from",
"me",
"to",
"dest",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/node.py#L439-L452 | train |
LogicalDash/LiSE | LiSE/LiSE/node.py | Node.delete | def delete(self):
"""Get rid of this, starting now.
Apart from deleting the node, this also informs all its users
that it doesn't exist and therefore can't be their avatar
anymore.
"""
if self.name in self.character.portal:
del self.character.portal[self.nam... | python | def delete(self):
"""Get rid of this, starting now.
Apart from deleting the node, this also informs all its users
that it doesn't exist and therefore can't be their avatar
anymore.
"""
if self.name in self.character.portal:
del self.character.portal[self.nam... | [
"def",
"delete",
"(",
"self",
")",
":",
"if",
"self",
".",
"name",
"in",
"self",
".",
"character",
".",
"portal",
":",
"del",
"self",
".",
"character",
".",
"portal",
"[",
"self",
".",
"name",
"]",
"if",
"self",
".",
"name",
"in",
"self",
".",
"c... | Get rid of this, starting now.
Apart from deleting the node, this also informs all its users
that it doesn't exist and therefore can't be their avatar
anymore. | [
"Get",
"rid",
"of",
"this",
"starting",
"now",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/node.py#L461-L486 | train |
LogicalDash/LiSE | LiSE/LiSE/node.py | Node.one_way_portal | def one_way_portal(self, other, **stats):
"""Connect a portal from here to another node, and return it."""
return self.character.new_portal(
self, other, symmetrical=False, **stats
) | python | def one_way_portal(self, other, **stats):
"""Connect a portal from here to another node, and return it."""
return self.character.new_portal(
self, other, symmetrical=False, **stats
) | [
"def",
"one_way_portal",
"(",
"self",
",",
"other",
",",
"**",
"stats",
")",
":",
"return",
"self",
".",
"character",
".",
"new_portal",
"(",
"self",
",",
"other",
",",
"symmetrical",
"=",
"False",
",",
"**",
"stats",
")"
] | Connect a portal from here to another node, and return it. | [
"Connect",
"a",
"portal",
"from",
"here",
"to",
"another",
"node",
"and",
"return",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/node.py#L488-L492 | train |
LogicalDash/LiSE | LiSE/LiSE/node.py | Node.two_way_portal | def two_way_portal(self, other, **stats):
"""Connect these nodes with a two-way portal and return it."""
return self.character.new_portal(
self, other, symmetrical=True, **stats
) | python | def two_way_portal(self, other, **stats):
"""Connect these nodes with a two-way portal and return it."""
return self.character.new_portal(
self, other, symmetrical=True, **stats
) | [
"def",
"two_way_portal",
"(",
"self",
",",
"other",
",",
"**",
"stats",
")",
":",
"return",
"self",
".",
"character",
".",
"new_portal",
"(",
"self",
",",
"other",
",",
"symmetrical",
"=",
"True",
",",
"**",
"stats",
")"
] | Connect these nodes with a two-way portal and return it. | [
"Connect",
"these",
"nodes",
"with",
"a",
"two",
"-",
"way",
"portal",
"and",
"return",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/node.py#L498-L502 | train |
LogicalDash/LiSE | LiSE/LiSE/node.py | Node.new_thing | def new_thing(self, name, **stats):
"""Create a new thing, located here, and return it."""
return self.character.new_thing(
name, self.name, **stats
) | python | def new_thing(self, name, **stats):
"""Create a new thing, located here, and return it."""
return self.character.new_thing(
name, self.name, **stats
) | [
"def",
"new_thing",
"(",
"self",
",",
"name",
",",
"**",
"stats",
")",
":",
"return",
"self",
".",
"character",
".",
"new_thing",
"(",
"name",
",",
"self",
".",
"name",
",",
"**",
"stats",
")"
] | Create a new thing, located here, and return it. | [
"Create",
"a",
"new",
"thing",
"located",
"here",
"and",
"return",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/LiSE/LiSE/node.py#L508-L512 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Card.on_background_image | def on_background_image(self, *args):
"""When I get a new ``background_image``, store its texture in
``background_texture``.
"""
if self.background_image is not None:
self.background_texture = self.background_image.texture | python | def on_background_image(self, *args):
"""When I get a new ``background_image``, store its texture in
``background_texture``.
"""
if self.background_image is not None:
self.background_texture = self.background_image.texture | [
"def",
"on_background_image",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"background_image",
"is",
"not",
"None",
":",
"self",
".",
"background_texture",
"=",
"self",
".",
"background_image",
".",
"texture"
] | When I get a new ``background_image``, store its texture in
``background_texture``. | [
"When",
"I",
"get",
"a",
"new",
"background_image",
"store",
"its",
"texture",
"in",
"background_texture",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L209-L215 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Card.on_foreground_image | def on_foreground_image(self, *args):
"""When I get a new ``foreground_image``, store its texture in my
``foreground_texture``.
"""
if self.foreground_image is not None:
self.foreground_texture = self.foreground_image.texture | python | def on_foreground_image(self, *args):
"""When I get a new ``foreground_image``, store its texture in my
``foreground_texture``.
"""
if self.foreground_image is not None:
self.foreground_texture = self.foreground_image.texture | [
"def",
"on_foreground_image",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"foreground_image",
"is",
"not",
"None",
":",
"self",
".",
"foreground_texture",
"=",
"self",
".",
"foreground_image",
".",
"texture"
] | When I get a new ``foreground_image``, store its texture in my
``foreground_texture``. | [
"When",
"I",
"get",
"a",
"new",
"foreground_image",
"store",
"its",
"texture",
"in",
"my",
"foreground_texture",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L225-L231 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Card.on_art_image | def on_art_image(self, *args):
"""When I get a new ``art_image``, store its texture in
``art_texture``.
"""
if self.art_image is not None:
self.art_texture = self.art_image.texture | python | def on_art_image(self, *args):
"""When I get a new ``art_image``, store its texture in
``art_texture``.
"""
if self.art_image is not None:
self.art_texture = self.art_image.texture | [
"def",
"on_art_image",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"art_image",
"is",
"not",
"None",
":",
"self",
".",
"art_texture",
"=",
"self",
".",
"art_image",
".",
"texture"
] | When I get a new ``art_image``, store its texture in
``art_texture``. | [
"When",
"I",
"get",
"a",
"new",
"art_image",
"store",
"its",
"texture",
"in",
"art_texture",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L241-L247 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Card.on_touch_down | def on_touch_down(self, touch):
"""If I'm the first card to collide this touch, grab it, store my
metadata in its userdict, and store the relative coords upon
me where the collision happened.
"""
if not self.collide_point(*touch.pos):
return
if 'card' in touc... | python | def on_touch_down(self, touch):
"""If I'm the first card to collide this touch, grab it, store my
metadata in its userdict, and store the relative coords upon
me where the collision happened.
"""
if not self.collide_point(*touch.pos):
return
if 'card' in touc... | [
"def",
"on_touch_down",
"(",
"self",
",",
"touch",
")",
":",
"if",
"not",
"self",
".",
"collide_point",
"(",
"*",
"touch",
".",
"pos",
")",
":",
"return",
"if",
"'card'",
"in",
"touch",
".",
"ud",
":",
"return",
"touch",
".",
"grab",
"(",
"self",
"... | If I'm the first card to collide this touch, grab it, store my
metadata in its userdict, and store the relative coords upon
me where the collision happened. | [
"If",
"I",
"m",
"the",
"first",
"card",
"to",
"collide",
"this",
"touch",
"grab",
"it",
"store",
"my",
"metadata",
"in",
"its",
"userdict",
"and",
"store",
"the",
"relative",
"coords",
"upon",
"me",
"where",
"the",
"collision",
"happened",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L249-L266 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Card.on_touch_move | def on_touch_move(self, touch):
"""If I'm being dragged, move so as to be always positioned the same
relative to the touch.
"""
if not self.dragging:
touch.ungrab(self)
return
self.pos = (
touch.x - self.collide_x,
touch.y - self.c... | python | def on_touch_move(self, touch):
"""If I'm being dragged, move so as to be always positioned the same
relative to the touch.
"""
if not self.dragging:
touch.ungrab(self)
return
self.pos = (
touch.x - self.collide_x,
touch.y - self.c... | [
"def",
"on_touch_move",
"(",
"self",
",",
"touch",
")",
":",
"if",
"not",
"self",
".",
"dragging",
":",
"touch",
".",
"ungrab",
"(",
"self",
")",
"return",
"self",
".",
"pos",
"=",
"(",
"touch",
".",
"x",
"-",
"self",
".",
"collide_x",
",",
"touch"... | If I'm being dragged, move so as to be always positioned the same
relative to the touch. | [
"If",
"I",
"m",
"being",
"dragged",
"move",
"so",
"as",
"to",
"be",
"always",
"positioned",
"the",
"same",
"relative",
"to",
"the",
"touch",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L268-L279 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Card.on_touch_up | def on_touch_up(self, touch):
"""Stop dragging if needed."""
if not self.dragging:
return
touch.ungrab(self)
self.dragging = False | python | def on_touch_up(self, touch):
"""Stop dragging if needed."""
if not self.dragging:
return
touch.ungrab(self)
self.dragging = False | [
"def",
"on_touch_up",
"(",
"self",
",",
"touch",
")",
":",
"if",
"not",
"self",
".",
"dragging",
":",
"return",
"touch",
".",
"ungrab",
"(",
"self",
")",
"self",
".",
"dragging",
"=",
"False"
] | Stop dragging if needed. | [
"Stop",
"dragging",
"if",
"needed",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L281-L286 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | Foundation.upd_pos | def upd_pos(self, *args):
"""Ask the foundation where I should be, based on what deck I'm
for.
"""
self.pos = self.parent._get_foundation_pos(self.deck) | python | def upd_pos(self, *args):
"""Ask the foundation where I should be, based on what deck I'm
for.
"""
self.pos = self.parent._get_foundation_pos(self.deck) | [
"def",
"upd_pos",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"pos",
"=",
"self",
".",
"parent",
".",
"_get_foundation_pos",
"(",
"self",
".",
"deck",
")"
] | Ask the foundation where I should be, based on what deck I'm
for. | [
"Ask",
"the",
"foundation",
"where",
"I",
"should",
"be",
"based",
"on",
"what",
"deck",
"I",
"m",
"for",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L349-L354 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.scroll_deck_x | def scroll_deck_x(self, decknum, scroll_x):
"""Move a deck left or right."""
if decknum >= len(self.decks):
raise IndexError("I have no deck at {}".format(decknum))
if decknum >= len(self.deck_x_hint_offsets):
self.deck_x_hint_offsets = list(self.deck_x_hint_offsets) + [0... | python | def scroll_deck_x(self, decknum, scroll_x):
"""Move a deck left or right."""
if decknum >= len(self.decks):
raise IndexError("I have no deck at {}".format(decknum))
if decknum >= len(self.deck_x_hint_offsets):
self.deck_x_hint_offsets = list(self.deck_x_hint_offsets) + [0... | [
"def",
"scroll_deck_x",
"(",
"self",
",",
"decknum",
",",
"scroll_x",
")",
":",
"if",
"decknum",
">=",
"len",
"(",
"self",
".",
"decks",
")",
":",
"raise",
"IndexError",
"(",
"\"I have no deck at {}\"",
".",
"format",
"(",
"decknum",
")",
")",
"if",
"dec... | Move a deck left or right. | [
"Move",
"a",
"deck",
"left",
"or",
"right",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L451-L460 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.scroll_deck_y | def scroll_deck_y(self, decknum, scroll_y):
"""Move a deck up or down."""
if decknum >= len(self.decks):
raise IndexError("I have no deck at {}".format(decknum))
if decknum >= len(self.deck_y_hint_offsets):
self.deck_y_hint_offsets = list(self.deck_y_hint_offsets) + [0] *... | python | def scroll_deck_y(self, decknum, scroll_y):
"""Move a deck up or down."""
if decknum >= len(self.decks):
raise IndexError("I have no deck at {}".format(decknum))
if decknum >= len(self.deck_y_hint_offsets):
self.deck_y_hint_offsets = list(self.deck_y_hint_offsets) + [0] *... | [
"def",
"scroll_deck_y",
"(",
"self",
",",
"decknum",
",",
"scroll_y",
")",
":",
"if",
"decknum",
">=",
"len",
"(",
"self",
".",
"decks",
")",
":",
"raise",
"IndexError",
"(",
"\"I have no deck at {}\"",
".",
"format",
"(",
"decknum",
")",
")",
"if",
"dec... | Move a deck up or down. | [
"Move",
"a",
"deck",
"up",
"or",
"down",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L462-L471 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.scroll_deck | def scroll_deck(self, decknum, scroll_x, scroll_y):
"""Move a deck."""
self.scroll_deck_x(decknum, scroll_x)
self.scroll_deck_y(decknum, scroll_y) | python | def scroll_deck(self, decknum, scroll_x, scroll_y):
"""Move a deck."""
self.scroll_deck_x(decknum, scroll_x)
self.scroll_deck_y(decknum, scroll_y) | [
"def",
"scroll_deck",
"(",
"self",
",",
"decknum",
",",
"scroll_x",
",",
"scroll_y",
")",
":",
"self",
".",
"scroll_deck_x",
"(",
"decknum",
",",
"scroll_x",
")",
"self",
".",
"scroll_deck_y",
"(",
"decknum",
",",
"scroll_y",
")"
] | Move a deck. | [
"Move",
"a",
"deck",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L473-L476 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout._get_foundation_pos | def _get_foundation_pos(self, i):
"""Private. Get the absolute coordinates to use for a deck's
foundation, based on the ``starting_pos_hint``, the
``deck_hint_step``, ``deck_x_hint_offsets``, and
``deck_y_hint_offsets``.
"""
(phx, phy) = get_pos_hint(
self.st... | python | def _get_foundation_pos(self, i):
"""Private. Get the absolute coordinates to use for a deck's
foundation, based on the ``starting_pos_hint``, the
``deck_hint_step``, ``deck_x_hint_offsets``, and
``deck_y_hint_offsets``.
"""
(phx, phy) = get_pos_hint(
self.st... | [
"def",
"_get_foundation_pos",
"(",
"self",
",",
"i",
")",
":",
"(",
"phx",
",",
"phy",
")",
"=",
"get_pos_hint",
"(",
"self",
".",
"starting_pos_hint",
",",
"*",
"self",
".",
"card_size_hint",
")",
"phx",
"+=",
"self",
".",
"deck_x_hint_step",
"*",
"i",
... | Private. Get the absolute coordinates to use for a deck's
foundation, based on the ``starting_pos_hint``, the
``deck_hint_step``, ``deck_x_hint_offsets``, and
``deck_y_hint_offsets``. | [
"Private",
".",
"Get",
"the",
"absolute",
"coordinates",
"to",
"use",
"for",
"a",
"deck",
"s",
"foundation",
"based",
"on",
"the",
"starting_pos_hint",
"the",
"deck_hint_step",
"deck_x_hint_offsets",
"and",
"deck_y_hint_offsets",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L478-L492 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.on_decks | def on_decks(self, *args):
"""Inform the cards of their deck and their index within the deck;
extend the ``_hint_offsets`` properties as needed; and trigger
a layout.
"""
if None in (
self.canvas,
self.decks,
self.deck_x_hint_offse... | python | def on_decks(self, *args):
"""Inform the cards of their deck and their index within the deck;
extend the ``_hint_offsets`` properties as needed; and trigger
a layout.
"""
if None in (
self.canvas,
self.decks,
self.deck_x_hint_offse... | [
"def",
"on_decks",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"None",
"in",
"(",
"self",
".",
"canvas",
",",
"self",
".",
"decks",
",",
"self",
".",
"deck_x_hint_offsets",
",",
"self",
".",
"deck_y_hint_offsets",
")",
":",
"Clock",
".",
"schedule_o... | Inform the cards of their deck and their index within the deck;
extend the ``_hint_offsets`` properties as needed; and trigger
a layout. | [
"Inform",
"the",
"cards",
"of",
"their",
"deck",
"and",
"their",
"index",
"within",
"the",
"deck",
";",
"extend",
"the",
"_hint_offsets",
"properties",
"as",
"needed",
";",
"and",
"trigger",
"a",
"layout",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L525-L562 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.on_touch_move | def on_touch_move(self, touch):
"""If a card is being dragged, move other cards out of the way to show
where the dragged card will go if you drop it.
"""
if (
'card' not in touch.ud or
'layout' not in touch.ud or
touch.ud['layout'] != self... | python | def on_touch_move(self, touch):
"""If a card is being dragged, move other cards out of the way to show
where the dragged card will go if you drop it.
"""
if (
'card' not in touch.ud or
'layout' not in touch.ud or
touch.ud['layout'] != self... | [
"def",
"on_touch_move",
"(",
"self",
",",
"touch",
")",
":",
"if",
"(",
"'card'",
"not",
"in",
"touch",
".",
"ud",
"or",
"'layout'",
"not",
"in",
"touch",
".",
"ud",
"or",
"touch",
".",
"ud",
"[",
"'layout'",
"]",
"!=",
"self",
")",
":",
"return",
... | If a card is being dragged, move other cards out of the way to show
where the dragged card will go if you drop it. | [
"If",
"a",
"card",
"is",
"being",
"dragged",
"move",
"other",
"cards",
"out",
"of",
"the",
"way",
"to",
"show",
"where",
"the",
"dragged",
"card",
"will",
"go",
"if",
"you",
"drop",
"it",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L626-L695 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.on_touch_up | def on_touch_up(self, touch):
"""If a card is being dragged, put it in the place it was just dropped
and trigger a layout.
"""
if (
'card' not in touch.ud or
'layout' not in touch.ud or
touch.ud['layout'] != self
):
ret... | python | def on_touch_up(self, touch):
"""If a card is being dragged, put it in the place it was just dropped
and trigger a layout.
"""
if (
'card' not in touch.ud or
'layout' not in touch.ud or
touch.ud['layout'] != self
):
ret... | [
"def",
"on_touch_up",
"(",
"self",
",",
"touch",
")",
":",
"if",
"(",
"'card'",
"not",
"in",
"touch",
".",
"ud",
"or",
"'layout'",
"not",
"in",
"touch",
".",
"ud",
"or",
"touch",
".",
"ud",
"[",
"'layout'",
"]",
"!=",
"self",
")",
":",
"return",
... | If a card is being dragged, put it in the place it was just dropped
and trigger a layout. | [
"If",
"a",
"card",
"is",
"being",
"dragged",
"put",
"it",
"in",
"the",
"place",
"it",
"was",
"just",
"dropped",
"and",
"trigger",
"a",
"layout",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L697-L726 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.do_layout | def do_layout(self, *args):
"""Layout each of my decks"""
if self.size == [1, 1]:
return
for i in range(0, len(self.decks)):
self.layout_deck(i) | python | def do_layout(self, *args):
"""Layout each of my decks"""
if self.size == [1, 1]:
return
for i in range(0, len(self.decks)):
self.layout_deck(i) | [
"def",
"do_layout",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"size",
"==",
"[",
"1",
",",
"1",
"]",
":",
"return",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"decks",
")",
")",
":",
"self",
".",
"l... | Layout each of my decks | [
"Layout",
"each",
"of",
"my",
"decks"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L733-L738 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderLayout.layout_deck | def layout_deck(self, i):
"""Stack the cards, starting at my deck's foundation, and proceeding
by ``card_pos_hint``
"""
def get_dragidx(cards):
j = 0
for card in cards:
if card.dragging:
return j
j += 1
... | python | def layout_deck(self, i):
"""Stack the cards, starting at my deck's foundation, and proceeding
by ``card_pos_hint``
"""
def get_dragidx(cards):
j = 0
for card in cards:
if card.dragging:
return j
j += 1
... | [
"def",
"layout_deck",
"(",
"self",
",",
"i",
")",
":",
"def",
"get_dragidx",
"(",
"cards",
")",
":",
"j",
"=",
"0",
"for",
"card",
"in",
"cards",
":",
"if",
"card",
".",
"dragging",
":",
"return",
"j",
"j",
"+=",
"1",
"cards",
"=",
"list",
"(",
... | Stack the cards, starting at my deck's foundation, and proceeding
by ``card_pos_hint`` | [
"Stack",
"the",
"cards",
"starting",
"at",
"my",
"deck",
"s",
"foundation",
"and",
"proceeding",
"by",
"card_pos_hint"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L740-L789 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | ScrollBarBar.on_touch_down | def on_touch_down(self, touch):
"""Tell my parent if I've been touched"""
if self.parent is None:
return
if self.collide_point(*touch.pos):
self.parent.bar_touched(self, touch) | python | def on_touch_down(self, touch):
"""Tell my parent if I've been touched"""
if self.parent is None:
return
if self.collide_point(*touch.pos):
self.parent.bar_touched(self, touch) | [
"def",
"on_touch_down",
"(",
"self",
",",
"touch",
")",
":",
"if",
"self",
".",
"parent",
"is",
"None",
":",
"return",
"if",
"self",
".",
"collide_point",
"(",
"*",
"touch",
".",
"pos",
")",
":",
"self",
".",
"parent",
".",
"bar_touched",
"(",
"self"... | Tell my parent if I've been touched | [
"Tell",
"my",
"parent",
"if",
"I",
"ve",
"been",
"touched"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L805-L810 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderScrollBar.do_layout | def do_layout(self, *args):
"""Put the bar where it's supposed to be, and size it in proportion to
the size of the scrollable area.
"""
if 'bar' not in self.ids:
Clock.schedule_once(self.do_layout)
return
if self.orientation == 'horizontal':
s... | python | def do_layout(self, *args):
"""Put the bar where it's supposed to be, and size it in proportion to
the size of the scrollable area.
"""
if 'bar' not in self.ids:
Clock.schedule_once(self.do_layout)
return
if self.orientation == 'horizontal':
s... | [
"def",
"do_layout",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"'bar'",
"not",
"in",
"self",
".",
"ids",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"do_layout",
")",
"return",
"if",
"self",
".",
"orientation",
"==",
"'horizontal'",
":",
... | Put the bar where it's supposed to be, and size it in proportion to
the size of the scrollable area. | [
"Put",
"the",
"bar",
"where",
"it",
"s",
"supposed",
"to",
"be",
"and",
"size",
"it",
"in",
"proportion",
"to",
"the",
"size",
"of",
"the",
"scrollable",
"area",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L935-L949 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderScrollBar.upd_scroll | def upd_scroll(self, *args):
"""Update my own ``scroll`` property to where my deck is actually
scrolled.
"""
att = 'deck_{}_hint_offsets'.format(
'x' if self.orientation == 'horizontal' else 'y'
)
self._scroll = getattr(self.deckbuilder, att)[self.deckidx] | python | def upd_scroll(self, *args):
"""Update my own ``scroll`` property to where my deck is actually
scrolled.
"""
att = 'deck_{}_hint_offsets'.format(
'x' if self.orientation == 'horizontal' else 'y'
)
self._scroll = getattr(self.deckbuilder, att)[self.deckidx] | [
"def",
"upd_scroll",
"(",
"self",
",",
"*",
"args",
")",
":",
"att",
"=",
"'deck_{}_hint_offsets'",
".",
"format",
"(",
"'x'",
"if",
"self",
".",
"orientation",
"==",
"'horizontal'",
"else",
"'y'",
")",
"self",
".",
"_scroll",
"=",
"getattr",
"(",
"self"... | Update my own ``scroll`` property to where my deck is actually
scrolled. | [
"Update",
"my",
"own",
"scroll",
"property",
"to",
"where",
"my",
"deck",
"is",
"actually",
"scrolled",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L951-L959 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderScrollBar.on_deckbuilder | def on_deckbuilder(self, *args):
"""Bind my deckbuilder to update my ``scroll``, and my ``scroll`` to
update my deckbuilder.
"""
if self.deckbuilder is None:
return
att = 'deck_{}_hint_offsets'.format(
'x' if self.orientation == 'horizontal' else 'y'
... | python | def on_deckbuilder(self, *args):
"""Bind my deckbuilder to update my ``scroll``, and my ``scroll`` to
update my deckbuilder.
"""
if self.deckbuilder is None:
return
att = 'deck_{}_hint_offsets'.format(
'x' if self.orientation == 'horizontal' else 'y'
... | [
"def",
"on_deckbuilder",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"deckbuilder",
"is",
"None",
":",
"return",
"att",
"=",
"'deck_{}_hint_offsets'",
".",
"format",
"(",
"'x'",
"if",
"self",
".",
"orientation",
"==",
"'horizontal'",
"else"... | Bind my deckbuilder to update my ``scroll``, and my ``scroll`` to
update my deckbuilder. | [
"Bind",
"my",
"deckbuilder",
"to",
"update",
"my",
"scroll",
"and",
"my",
"scroll",
"to",
"update",
"my",
"deckbuilder",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L961-L978 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderScrollBar.handle_scroll | def handle_scroll(self, *args):
"""When my ``scroll`` changes, tell my deckbuilder how it's scrolled
now.
"""
if 'bar' not in self.ids:
Clock.schedule_once(self.handle_scroll, 0)
return
att = 'deck_{}_hint_offsets'.format(
'x' if self.orientat... | python | def handle_scroll(self, *args):
"""When my ``scroll`` changes, tell my deckbuilder how it's scrolled
now.
"""
if 'bar' not in self.ids:
Clock.schedule_once(self.handle_scroll, 0)
return
att = 'deck_{}_hint_offsets'.format(
'x' if self.orientat... | [
"def",
"handle_scroll",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"'bar'",
"not",
"in",
"self",
".",
"ids",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"handle_scroll",
",",
"0",
")",
"return",
"att",
"=",
"'deck_{}_hint_offsets'",
".",
... | When my ``scroll`` changes, tell my deckbuilder how it's scrolled
now. | [
"When",
"my",
"scroll",
"changes",
"tell",
"my",
"deckbuilder",
"how",
"it",
"s",
"scrolled",
"now",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L980-L997 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderScrollBar.bar_touched | def bar_touched(self, bar, touch):
"""Start scrolling, and record where I started scrolling."""
self.scrolling = True
self._start_bar_pos_hint = get_pos_hint(bar.pos_hint, *bar.size_hint)
self._start_touch_pos_hint = (
touch.x / self.width,
touch.y / self.height
... | python | def bar_touched(self, bar, touch):
"""Start scrolling, and record where I started scrolling."""
self.scrolling = True
self._start_bar_pos_hint = get_pos_hint(bar.pos_hint, *bar.size_hint)
self._start_touch_pos_hint = (
touch.x / self.width,
touch.y / self.height
... | [
"def",
"bar_touched",
"(",
"self",
",",
"bar",
",",
"touch",
")",
":",
"self",
".",
"scrolling",
"=",
"True",
"self",
".",
"_start_bar_pos_hint",
"=",
"get_pos_hint",
"(",
"bar",
".",
"pos_hint",
",",
"*",
"bar",
".",
"size_hint",
")",
"self",
".",
"_s... | Start scrolling, and record where I started scrolling. | [
"Start",
"scrolling",
"and",
"record",
"where",
"I",
"started",
"scrolling",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L999-L1011 | train |
LogicalDash/LiSE | ELiDE/ELiDE/card.py | DeckBuilderScrollBar.on_touch_move | def on_touch_move(self, touch):
"""Move the scrollbar to the touch, and update my ``scroll``
accordingly.
"""
if not self.scrolling or 'bar' not in self.ids:
touch.ungrab(self)
return
touch.push()
touch.apply_transform_2d(self.parent.to_local)
... | python | def on_touch_move(self, touch):
"""Move the scrollbar to the touch, and update my ``scroll``
accordingly.
"""
if not self.scrolling or 'bar' not in self.ids:
touch.ungrab(self)
return
touch.push()
touch.apply_transform_2d(self.parent.to_local)
... | [
"def",
"on_touch_move",
"(",
"self",
",",
"touch",
")",
":",
"if",
"not",
"self",
".",
"scrolling",
"or",
"'bar'",
"not",
"in",
"self",
".",
"ids",
":",
"touch",
".",
"ungrab",
"(",
"self",
")",
"return",
"touch",
".",
"push",
"(",
")",
"touch",
".... | Move the scrollbar to the touch, and update my ``scroll``
accordingly. | [
"Move",
"the",
"scrollbar",
"to",
"the",
"touch",
"and",
"update",
"my",
"scroll",
"accordingly",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L1013-L1032 | train |
LogicalDash/LiSE | allegedb/allegedb/wrap.py | ListWrapper.unwrap | def unwrap(self):
"""Return a deep copy of myself as a list, and unwrap any wrapper objects in me."""
return [v.unwrap() if hasattr(v, 'unwrap') and not hasattr(v, 'no_unwrap') else v for v in self] | python | def unwrap(self):
"""Return a deep copy of myself as a list, and unwrap any wrapper objects in me."""
return [v.unwrap() if hasattr(v, 'unwrap') and not hasattr(v, 'no_unwrap') else v for v in self] | [
"def",
"unwrap",
"(",
"self",
")",
":",
"return",
"[",
"v",
".",
"unwrap",
"(",
")",
"if",
"hasattr",
"(",
"v",
",",
"'unwrap'",
")",
"and",
"not",
"hasattr",
"(",
"v",
",",
"'no_unwrap'",
")",
"else",
"v",
"for",
"v",
"in",
"self",
"]"
] | Return a deep copy of myself as a list, and unwrap any wrapper objects in me. | [
"Return",
"a",
"deep",
"copy",
"of",
"myself",
"as",
"a",
"list",
"and",
"unwrap",
"any",
"wrapper",
"objects",
"in",
"me",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/wrap.py#L307-L309 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget.on_portal | def on_portal(self, *args):
"""Set my ``name`` and instantiate my ``mirrormap`` as soon as I have
the properties I need to do so.
"""
if not (
self.board and
self.origin and
self.destination and
self.origin.name in self.boa... | python | def on_portal(self, *args):
"""Set my ``name`` and instantiate my ``mirrormap`` as soon as I have
the properties I need to do so.
"""
if not (
self.board and
self.origin and
self.destination and
self.origin.name in self.boa... | [
"def",
"on_portal",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"(",
"self",
".",
"board",
"and",
"self",
".",
"origin",
"and",
"self",
".",
"destination",
"and",
"self",
".",
"origin",
".",
"name",
"in",
"self",
".",
"board",
".",
"chara... | Set my ``name`` and instantiate my ``mirrormap`` as soon as I have
the properties I need to do so. | [
"Set",
"my",
"name",
"and",
"instantiate",
"my",
"mirrormap",
"as",
"soon",
"as",
"I",
"have",
"the",
"properties",
"I",
"need",
"to",
"do",
"so",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L296-L310 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget.collide_point | def collide_point(self, x, y):
"""Delegate to my ``collider``, or return ``False`` if I don't have
one.
"""
if not self.collider:
return False
return (x, y) in self.collider | python | def collide_point(self, x, y):
"""Delegate to my ``collider``, or return ``False`` if I don't have
one.
"""
if not self.collider:
return False
return (x, y) in self.collider | [
"def",
"collide_point",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"if",
"not",
"self",
".",
"collider",
":",
"return",
"False",
"return",
"(",
"x",
",",
"y",
")",
"in",
"self",
".",
"collider"
] | Delegate to my ``collider``, or return ``False`` if I don't have
one. | [
"Delegate",
"to",
"my",
"collider",
"or",
"return",
"False",
"if",
"I",
"don",
"t",
"have",
"one",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L312-L319 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget.on_origin | def on_origin(self, *args):
"""Make sure to redraw whenever the origin moves."""
if self.origin is None:
Clock.schedule_once(self.on_origin, 0)
return
self.origin.bind(
pos=self._trigger_repoint,
size=self._trigger_repoint
) | python | def on_origin(self, *args):
"""Make sure to redraw whenever the origin moves."""
if self.origin is None:
Clock.schedule_once(self.on_origin, 0)
return
self.origin.bind(
pos=self._trigger_repoint,
size=self._trigger_repoint
) | [
"def",
"on_origin",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"origin",
"is",
"None",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"on_origin",
",",
"0",
")",
"return",
"self",
".",
"origin",
".",
"bind",
"(",
"pos",
"=",... | Make sure to redraw whenever the origin moves. | [
"Make",
"sure",
"to",
"redraw",
"whenever",
"the",
"origin",
"moves",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L332-L340 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget.on_destination | def on_destination(self, *args):
"""Make sure to redraw whenever the destination moves."""
if self.destination is None:
Clock.schedule_once(self.on_destination, 0)
return
self.destination.bind(
pos=self._trigger_repoint,
size=self._trigger_repoint
... | python | def on_destination(self, *args):
"""Make sure to redraw whenever the destination moves."""
if self.destination is None:
Clock.schedule_once(self.on_destination, 0)
return
self.destination.bind(
pos=self._trigger_repoint,
size=self._trigger_repoint
... | [
"def",
"on_destination",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"destination",
"is",
"None",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"on_destination",
",",
"0",
")",
"return",
"self",
".",
"destination",
".",
"bind",
... | Make sure to redraw whenever the destination moves. | [
"Make",
"sure",
"to",
"redraw",
"whenever",
"the",
"destination",
"moves",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L342-L350 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget.on_board | def on_board(self, *args):
"""Draw myself for the first time as soon as I have the properties I
need to do so.
"""
if None in (
self.board,
self.origin,
self.destination
):
Clock.schedule_once(self.on_board, 0)
... | python | def on_board(self, *args):
"""Draw myself for the first time as soon as I have the properties I
need to do so.
"""
if None in (
self.board,
self.origin,
self.destination
):
Clock.schedule_once(self.on_board, 0)
... | [
"def",
"on_board",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"None",
"in",
"(",
"self",
".",
"board",
",",
"self",
".",
"origin",
",",
"self",
".",
"destination",
")",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"on_board",
",",
"0",... | Draw myself for the first time as soon as I have the properties I
need to do so. | [
"Draw",
"myself",
"for",
"the",
"first",
"time",
"as",
"soon",
"as",
"I",
"have",
"the",
"properties",
"I",
"need",
"to",
"do",
"so",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L352-L364 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget._get_slope | def _get_slope(self):
"""Return a float of the increase in y divided by the increase in x,
both from left to right."""
orig = self.origin
dest = self.destination
ox = orig.x
oy = orig.y
dx = dest.x
dy = dest.y
if oy == dy:
return 0
... | python | def _get_slope(self):
"""Return a float of the increase in y divided by the increase in x,
both from left to right."""
orig = self.origin
dest = self.destination
ox = orig.x
oy = orig.y
dx = dest.x
dy = dest.y
if oy == dy:
return 0
... | [
"def",
"_get_slope",
"(",
"self",
")",
":",
"orig",
"=",
"self",
".",
"origin",
"dest",
"=",
"self",
".",
"destination",
"ox",
"=",
"orig",
".",
"x",
"oy",
"=",
"orig",
".",
"y",
"dx",
"=",
"dest",
".",
"x",
"dy",
"=",
"dest",
".",
"y",
"if",
... | Return a float of the increase in y divided by the increase in x,
both from left to right. | [
"Return",
"a",
"float",
"of",
"the",
"increase",
"in",
"y",
"divided",
"by",
"the",
"increase",
"in",
"x",
"both",
"from",
"left",
"to",
"right",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L457-L473 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget._get_b | def _get_b(self):
"""Return my Y-intercept.
I probably don't really hit the left edge of the window, but
this is where I would, if I were long enough.
"""
orig = self.origin
dest = self.destination
(ox, oy) = orig.pos
(dx, dy) = dest.pos
denomina... | python | def _get_b(self):
"""Return my Y-intercept.
I probably don't really hit the left edge of the window, but
this is where I would, if I were long enough.
"""
orig = self.origin
dest = self.destination
(ox, oy) = orig.pos
(dx, dy) = dest.pos
denomina... | [
"def",
"_get_b",
"(",
"self",
")",
":",
"orig",
"=",
"self",
".",
"origin",
"dest",
"=",
"self",
".",
"destination",
"(",
"ox",
",",
"oy",
")",
"=",
"orig",
".",
"pos",
"(",
"dx",
",",
"dy",
")",
"=",
"dest",
".",
"pos",
"denominator",
"=",
"dx... | Return my Y-intercept.
I probably don't really hit the left edge of the window, but
this is where I would, if I were long enough. | [
"Return",
"my",
"Y",
"-",
"intercept",
"."
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L475-L489 | train |
LogicalDash/LiSE | ELiDE/ELiDE/board/arrow.py | ArrowWidget._repoint | def _repoint(self, *args):
"""Recalculate points, y-intercept, and slope"""
if None in (self.origin, self.destination):
Clock.schedule_once(self._repoint, 0)
return
try:
(self.trunk_points, self.head_points) = self._get_points()
except ValueError:
... | python | def _repoint(self, *args):
"""Recalculate points, y-intercept, and slope"""
if None in (self.origin, self.destination):
Clock.schedule_once(self._repoint, 0)
return
try:
(self.trunk_points, self.head_points) = self._get_points()
except ValueError:
... | [
"def",
"_repoint",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"None",
"in",
"(",
"self",
".",
"origin",
",",
"self",
".",
"destination",
")",
":",
"Clock",
".",
"schedule_once",
"(",
"self",
".",
"_repoint",
",",
"0",
")",
"return",
"try",
":",... | Recalculate points, y-intercept, and slope | [
"Recalculate",
"points",
"y",
"-",
"intercept",
"and",
"slope"
] | fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84 | https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/board/arrow.py#L491-L525 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.