id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
13,900 | persephone-tools/persephone | persephone/datasets/na.py | get_story_prefixes | def get_story_prefixes(label_type, label_dir=LABEL_DIR):
""" Gets the Na text prefixes. """
prefixes = [prefix for prefix in os.listdir(os.path.join(label_dir, "TEXT"))
if prefix.endswith(".%s" % label_type)]
prefixes = [os.path.splitext(os.path.join("TEXT", prefix))[0]
for p... | python | def get_story_prefixes(label_type, label_dir=LABEL_DIR):
""" Gets the Na text prefixes. """
prefixes = [prefix for prefix in os.listdir(os.path.join(label_dir, "TEXT"))
if prefix.endswith(".%s" % label_type)]
prefixes = [os.path.splitext(os.path.join("TEXT", prefix))[0]
for p... | [
"def",
"get_story_prefixes",
"(",
"label_type",
",",
"label_dir",
"=",
"LABEL_DIR",
")",
":",
"prefixes",
"=",
"[",
"prefix",
"for",
"prefix",
"in",
"os",
".",
"listdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"label_dir",
",",
"\"TEXT\"",
")",
")",
... | Gets the Na text prefixes. | [
"Gets",
"the",
"Na",
"text",
"prefixes",
"."
] | f94c63e4d5fe719fb1deba449b177bb299d225fb | https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/datasets/na.py#L404-L410 |
13,901 | persephone-tools/persephone | persephone/datasets/na.py | get_stories | def get_stories(label_type):
""" Returns a list of the stories in the Na corpus. """
prefixes = get_story_prefixes(label_type)
texts = list(set([prefix.split(".")[0].split("/")[1] for prefix in prefixes]))
return texts | python | def get_stories(label_type):
""" Returns a list of the stories in the Na corpus. """
prefixes = get_story_prefixes(label_type)
texts = list(set([prefix.split(".")[0].split("/")[1] for prefix in prefixes]))
return texts | [
"def",
"get_stories",
"(",
"label_type",
")",
":",
"prefixes",
"=",
"get_story_prefixes",
"(",
"label_type",
")",
"texts",
"=",
"list",
"(",
"set",
"(",
"[",
"prefix",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
"]",
".",
"split",
"(",
"\"/\"",
")",
"... | Returns a list of the stories in the Na corpus. | [
"Returns",
"a",
"list",
"of",
"the",
"stories",
"in",
"the",
"Na",
"corpus",
"."
] | f94c63e4d5fe719fb1deba449b177bb299d225fb | https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/datasets/na.py#L456-L461 |
13,902 | persephone-tools/persephone | persephone/datasets/na.py | Corpus.make_data_splits | def make_data_splits(self, max_samples, valid_story=None, test_story=None):
"""Split data into train, valid and test groups"""
# TODO Make this also work with wordlists.
if valid_story or test_story:
if not (valid_story and test_story):
raise PersephoneException(
... | python | def make_data_splits(self, max_samples, valid_story=None, test_story=None):
"""Split data into train, valid and test groups"""
# TODO Make this also work with wordlists.
if valid_story or test_story:
if not (valid_story and test_story):
raise PersephoneException(
... | [
"def",
"make_data_splits",
"(",
"self",
",",
"max_samples",
",",
"valid_story",
"=",
"None",
",",
"test_story",
"=",
"None",
")",
":",
"# TODO Make this also work with wordlists.",
"if",
"valid_story",
"or",
"test_story",
":",
"if",
"not",
"(",
"valid_story",
"and... | Split data into train, valid and test groups | [
"Split",
"data",
"into",
"train",
"valid",
"and",
"test",
"groups"
] | f94c63e4d5fe719fb1deba449b177bb299d225fb | https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/datasets/na.py#L537-L558 |
13,903 | persephone-tools/persephone | persephone/datasets/na.py | Corpus.output_story_prefixes | def output_story_prefixes(self):
""" Writes the set of prefixes to a file this is useful for pretty
printing in results.latex_output. """
if not self.test_story:
raise NotImplementedError(
"I want to write the prefixes to a file"
"called <test_story>_... | python | def output_story_prefixes(self):
""" Writes the set of prefixes to a file this is useful for pretty
printing in results.latex_output. """
if not self.test_story:
raise NotImplementedError(
"I want to write the prefixes to a file"
"called <test_story>_... | [
"def",
"output_story_prefixes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"test_story",
":",
"raise",
"NotImplementedError",
"(",
"\"I want to write the prefixes to a file\"",
"\"called <test_story>_prefixes.txt, but there's no test_story.\"",
")",
"fn",
"=",
"os",
"... | Writes the set of prefixes to a file this is useful for pretty
printing in results.latex_output. | [
"Writes",
"the",
"set",
"of",
"prefixes",
"to",
"a",
"file",
"this",
"is",
"useful",
"for",
"pretty",
"printing",
"in",
"results",
".",
"latex_output",
"."
] | f94c63e4d5fe719fb1deba449b177bb299d225fb | https://github.com/persephone-tools/persephone/blob/f94c63e4d5fe719fb1deba449b177bb299d225fb/persephone/datasets/na.py#L560-L572 |
13,904 | KxSystems/pyq | setup.py | add_data_file | def add_data_file(data_files, target, source):
"""Add an entry to data_files"""
for t, f in data_files:
if t == target:
break
else:
data_files.append((target, []))
f = data_files[-1][1]
if source not in f:
f.append(source) | python | def add_data_file(data_files, target, source):
"""Add an entry to data_files"""
for t, f in data_files:
if t == target:
break
else:
data_files.append((target, []))
f = data_files[-1][1]
if source not in f:
f.append(source) | [
"def",
"add_data_file",
"(",
"data_files",
",",
"target",
",",
"source",
")",
":",
"for",
"t",
",",
"f",
"in",
"data_files",
":",
"if",
"t",
"==",
"target",
":",
"break",
"else",
":",
"data_files",
".",
"append",
"(",
"(",
"target",
",",
"[",
"]",
... | Add an entry to data_files | [
"Add",
"an",
"entry",
"to",
"data_files"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/setup.py#L145-L154 |
13,905 | KxSystems/pyq | setup.py | get_q_home | def get_q_home(env):
"""Derive q home from the environment"""
q_home = env.get('QHOME')
if q_home:
return q_home
for v in ['VIRTUAL_ENV', 'HOME']:
prefix = env.get(v)
if prefix:
q_home = os.path.join(prefix, 'q')
if os.path.isdir(q_home):
r... | python | def get_q_home(env):
"""Derive q home from the environment"""
q_home = env.get('QHOME')
if q_home:
return q_home
for v in ['VIRTUAL_ENV', 'HOME']:
prefix = env.get(v)
if prefix:
q_home = os.path.join(prefix, 'q')
if os.path.isdir(q_home):
r... | [
"def",
"get_q_home",
"(",
"env",
")",
":",
"q_home",
"=",
"env",
".",
"get",
"(",
"'QHOME'",
")",
"if",
"q_home",
":",
"return",
"q_home",
"for",
"v",
"in",
"[",
"'VIRTUAL_ENV'",
",",
"'HOME'",
"]",
":",
"prefix",
"=",
"env",
".",
"get",
"(",
"v",
... | Derive q home from the environment | [
"Derive",
"q",
"home",
"from",
"the",
"environment"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/setup.py#L185-L200 |
13,906 | KxSystems/pyq | setup.py | get_q_version | def get_q_version(q_home):
"""Return version of q installed at q_home"""
with open(os.path.join(q_home, 'q.k')) as f:
for line in f:
if line.startswith('k:'):
return line[2:5]
return '2.2' | python | def get_q_version(q_home):
"""Return version of q installed at q_home"""
with open(os.path.join(q_home, 'q.k')) as f:
for line in f:
if line.startswith('k:'):
return line[2:5]
return '2.2' | [
"def",
"get_q_version",
"(",
"q_home",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"q_home",
",",
"'q.k'",
")",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"line",
".",
"startswith",
"(",
"'k:'",
")",
":",
... | Return version of q installed at q_home | [
"Return",
"version",
"of",
"q",
"installed",
"at",
"q_home"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/setup.py#L230-L236 |
13,907 | KxSystems/pyq | src/pyq/cmd.py | Cmd.precmd | def precmd(self, line):
"""Support for help"""
if line.startswith('help'):
if not q("`help in key`.q"):
try:
q("\\l help.q")
except kerr:
return '-1"no help available - install help.q"'
if line == 'help':
... | python | def precmd(self, line):
"""Support for help"""
if line.startswith('help'):
if not q("`help in key`.q"):
try:
q("\\l help.q")
except kerr:
return '-1"no help available - install help.q"'
if line == 'help':
... | [
"def",
"precmd",
"(",
"self",
",",
"line",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"'help'",
")",
":",
"if",
"not",
"q",
"(",
"\"`help in key`.q\"",
")",
":",
"try",
":",
"q",
"(",
"\"\\\\l help.q\"",
")",
"except",
"kerr",
":",
"return",
"'-... | Support for help | [
"Support",
"for",
"help"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/cmd.py#L35-L45 |
13,908 | KxSystems/pyq | src/pyq/cmd.py | Cmd.onecmd | def onecmd(self, line):
"""Interpret the line"""
if line == '\\':
return True
elif line == 'EOF':
print('\r', end='')
return True
else:
try:
v = q(line)
except kerr as e:
print("'%s" % e.args[0])
... | python | def onecmd(self, line):
"""Interpret the line"""
if line == '\\':
return True
elif line == 'EOF':
print('\r', end='')
return True
else:
try:
v = q(line)
except kerr as e:
print("'%s" % e.args[0])
... | [
"def",
"onecmd",
"(",
"self",
",",
"line",
")",
":",
"if",
"line",
"==",
"'\\\\'",
":",
"return",
"True",
"elif",
"line",
"==",
"'EOF'",
":",
"print",
"(",
"'\\r'",
",",
"end",
"=",
"''",
")",
"return",
"True",
"else",
":",
"try",
":",
"v",
"=",
... | Interpret the line | [
"Interpret",
"the",
"line"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/cmd.py#L47-L62 |
13,909 | KxSystems/pyq | src/pyq/_pt_run.py | run | def run(q_prompt=False):
"""Run a prompt-toolkit based REPL"""
lines, columns = console_size()
q(r'\c %d %d' % (lines, columns))
if len(sys.argv) > 1:
try:
q(r'\l %s' % sys.argv[1])
except kerr as e:
print(e)
raise SystemExit(1)
else:
... | python | def run(q_prompt=False):
"""Run a prompt-toolkit based REPL"""
lines, columns = console_size()
q(r'\c %d %d' % (lines, columns))
if len(sys.argv) > 1:
try:
q(r'\l %s' % sys.argv[1])
except kerr as e:
print(e)
raise SystemExit(1)
else:
... | [
"def",
"run",
"(",
"q_prompt",
"=",
"False",
")",
":",
"lines",
",",
"columns",
"=",
"console_size",
"(",
")",
"q",
"(",
"r'\\c %d %d'",
"%",
"(",
"lines",
",",
"columns",
")",
")",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
">",
"1",
":",
"try",... | Run a prompt-toolkit based REPL | [
"Run",
"a",
"prompt",
"-",
"toolkit",
"based",
"REPL"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/_pt_run.py#L32-L46 |
13,910 | KxSystems/pyq | src/pyq/_n.py | get_unit | def get_unit(a):
"""Extract the time unit from array's dtype"""
typestr = a.dtype.str
i = typestr.find('[')
if i == -1:
raise TypeError("Expected a datetime64 array, not %s", a.dtype)
return typestr[i + 1: -1] | python | def get_unit(a):
"""Extract the time unit from array's dtype"""
typestr = a.dtype.str
i = typestr.find('[')
if i == -1:
raise TypeError("Expected a datetime64 array, not %s", a.dtype)
return typestr[i + 1: -1] | [
"def",
"get_unit",
"(",
"a",
")",
":",
"typestr",
"=",
"a",
".",
"dtype",
".",
"str",
"i",
"=",
"typestr",
".",
"find",
"(",
"'['",
")",
"if",
"i",
"==",
"-",
"1",
":",
"raise",
"TypeError",
"(",
"\"Expected a datetime64 array, not %s\"",
",",
"a",
"... | Extract the time unit from array's dtype | [
"Extract",
"the",
"time",
"unit",
"from",
"array",
"s",
"dtype"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/_n.py#L50-L56 |
13,911 | KxSystems/pyq | src/pyq/_n.py | k2a | def k2a(a, x):
"""Rescale data from a K object x to array a.
"""
func, scale = None, 1
t = abs(x._t)
# timestamp (12), month (13), date (14) or datetime (15)
if 12 <= t <= 15:
unit = get_unit(a)
attr, shift, func, scale = _UNIT[unit]
a[:] = getattr(x, attr).data
... | python | def k2a(a, x):
"""Rescale data from a K object x to array a.
"""
func, scale = None, 1
t = abs(x._t)
# timestamp (12), month (13), date (14) or datetime (15)
if 12 <= t <= 15:
unit = get_unit(a)
attr, shift, func, scale = _UNIT[unit]
a[:] = getattr(x, attr).data
... | [
"def",
"k2a",
"(",
"a",
",",
"x",
")",
":",
"func",
",",
"scale",
"=",
"None",
",",
"1",
"t",
"=",
"abs",
"(",
"x",
".",
"_t",
")",
"# timestamp (12), month (13), date (14) or datetime (15)",
"if",
"12",
"<=",
"t",
"<=",
"15",
":",
"unit",
"=",
"get_... | Rescale data from a K object x to array a. | [
"Rescale",
"data",
"from",
"a",
"K",
"object",
"x",
"to",
"array",
"a",
"."
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/_n.py#L118-L145 |
13,912 | KxSystems/pyq | src/pyq/__init__.py | K.show | def show(self, start=0, geometry=None, output=None):
"""pretty-print data to the console
(similar to q.show, but uses python stdout by default)
>>> x = q('([k:`x`y`z]a:1 2 3;b:10 20 30)')
>>> x.show() # doctest: +NORMALIZE_WHITESPACE
k| a b
-| ----
x| 1 10
... | python | def show(self, start=0, geometry=None, output=None):
"""pretty-print data to the console
(similar to q.show, but uses python stdout by default)
>>> x = q('([k:`x`y`z]a:1 2 3;b:10 20 30)')
>>> x.show() # doctest: +NORMALIZE_WHITESPACE
k| a b
-| ----
x| 1 10
... | [
"def",
"show",
"(",
"self",
",",
"start",
"=",
"0",
",",
"geometry",
"=",
"None",
",",
"output",
"=",
"None",
")",
":",
"if",
"output",
"is",
"None",
":",
"output",
"=",
"sys",
".",
"stdout",
"if",
"geometry",
"is",
"None",
":",
"geometry",
"=",
... | pretty-print data to the console
(similar to q.show, but uses python stdout by default)
>>> x = q('([k:`x`y`z]a:1 2 3;b:10 20 30)')
>>> x.show() # doctest: +NORMALIZE_WHITESPACE
k| a b
-| ----
x| 1 10
y| 2 20
z| 3 30
the first optional argument... | [
"pretty",
"-",
"print",
"data",
"to",
"the",
"console"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/__init__.py#L377-L435 |
13,913 | KxSystems/pyq | src/pyq/__init__.py | K.select | def select(self, columns=(), by=(), where=(), **kwds):
"""select from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.select('a', where='b > 20').show()
a
-
3
"""
return self._seu('select', columns, by, where, kwds) | python | def select(self, columns=(), by=(), where=(), **kwds):
"""select from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.select('a', where='b > 20').show()
a
-
3
"""
return self._seu('select', columns, by, where, kwds) | [
"def",
"select",
"(",
"self",
",",
"columns",
"=",
"(",
")",
",",
"by",
"=",
"(",
")",
",",
"where",
"=",
"(",
")",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"_seu",
"(",
"'select'",
",",
"columns",
",",
"by",
",",
"where",
",",... | select from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.select('a', where='b > 20').show()
a
-
3 | [
"select",
"from",
"self"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/__init__.py#L465-L474 |
13,914 | KxSystems/pyq | src/pyq/__init__.py | K.exec_ | def exec_(self, columns=(), by=(), where=(), **kwds):
"""exec from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.exec_('a', where='b > 10').show()
2 3
"""
return self._seu('exec', columns, by, where, kwds) | python | def exec_(self, columns=(), by=(), where=(), **kwds):
"""exec from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.exec_('a', where='b > 10').show()
2 3
"""
return self._seu('exec', columns, by, where, kwds) | [
"def",
"exec_",
"(",
"self",
",",
"columns",
"=",
"(",
")",
",",
"by",
"=",
"(",
")",
",",
"where",
"=",
"(",
")",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"_seu",
"(",
"'exec'",
",",
"columns",
",",
"by",
",",
"where",
",",
... | exec from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.exec_('a', where='b > 10').show()
2 3 | [
"exec",
"from",
"self"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/__init__.py#L476-L483 |
13,915 | KxSystems/pyq | src/pyq/__init__.py | K.update | def update(self, columns=(), by=(), where=(), **kwds):
"""update from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.update('a*2',
... where='b > 20').show() # doctest: +NORMALIZE_WHITESPACE
a b
----
1 10
2 20
6 30
"""
r... | python | def update(self, columns=(), by=(), where=(), **kwds):
"""update from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.update('a*2',
... where='b > 20').show() # doctest: +NORMALIZE_WHITESPACE
a b
----
1 10
2 20
6 30
"""
r... | [
"def",
"update",
"(",
"self",
",",
"columns",
"=",
"(",
")",
",",
"by",
"=",
"(",
")",
",",
"where",
"=",
"(",
")",
",",
"*",
"*",
"kwds",
")",
":",
"return",
"self",
".",
"_seu",
"(",
"'update'",
",",
"columns",
",",
"by",
",",
"where",
",",... | update from self
>>> t = q('([]a:1 2 3; b:10 20 30)')
>>> t.update('a*2',
... where='b > 20').show() # doctest: +NORMALIZE_WHITESPACE
a b
----
1 10
2 20
6 30 | [
"update",
"from",
"self"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/__init__.py#L485-L497 |
13,916 | KxSystems/pyq | src/pyq/__init__.py | K.dict | def dict(cls, *args, **kwds):
"""Construct a q dictionary
K.dict() -> new empty q dictionary (q('()!()')
K.dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
K.dict(iterable) -> new dictionary initialized from an iterable
yield... | python | def dict(cls, *args, **kwds):
"""Construct a q dictionary
K.dict() -> new empty q dictionary (q('()!()')
K.dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
K.dict(iterable) -> new dictionary initialized from an iterable
yield... | [
"def",
"dict",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"args",
":",
"if",
"len",
"(",
"args",
")",
">",
"1",
":",
"raise",
"TypeError",
"(",
"\"Too many positional arguments\"",
")",
"x",
"=",
"args",
"[",
"0",
"]",
"... | Construct a q dictionary
K.dict() -> new empty q dictionary (q('()!()')
K.dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
K.dict(iterable) -> new dictionary initialized from an iterable
yielding (key, value) pairs
K.dict(**k... | [
"Construct",
"a",
"q",
"dictionary"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/__init__.py#L558-L595 |
13,917 | KxSystems/pyq | src/pyq/magic.py | logical_lines | def logical_lines(lines):
"""Merge lines into chunks according to q rules"""
if isinstance(lines, string_types):
lines = StringIO(lines)
buf = []
for line in lines:
if buf and not line.startswith(' '):
chunk = ''.join(buf).strip()
if chunk:
yield c... | python | def logical_lines(lines):
"""Merge lines into chunks according to q rules"""
if isinstance(lines, string_types):
lines = StringIO(lines)
buf = []
for line in lines:
if buf and not line.startswith(' '):
chunk = ''.join(buf).strip()
if chunk:
yield c... | [
"def",
"logical_lines",
"(",
"lines",
")",
":",
"if",
"isinstance",
"(",
"lines",
",",
"string_types",
")",
":",
"lines",
"=",
"StringIO",
"(",
"lines",
")",
"buf",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"if",
"buf",
"and",
"not",
"line",
... | Merge lines into chunks according to q rules | [
"Merge",
"lines",
"into",
"chunks",
"according",
"to",
"q",
"rules"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/magic.py#L23-L38 |
13,918 | KxSystems/pyq | src/pyq/magic.py | q | def q(line, cell=None, _ns=None):
"""Run q code.
Options:
-l (dir|script) - pre-load database or script
-h host:port - execute on the given host
-o var - send output to a variable named var.
-i var1,..,varN - input variables
-1/-2 - redirect stdout/stderr
"""
if cell ... | python | def q(line, cell=None, _ns=None):
"""Run q code.
Options:
-l (dir|script) - pre-load database or script
-h host:port - execute on the given host
-o var - send output to a variable named var.
-i var1,..,varN - input variables
-1/-2 - redirect stdout/stderr
"""
if cell ... | [
"def",
"q",
"(",
"line",
",",
"cell",
"=",
"None",
",",
"_ns",
"=",
"None",
")",
":",
"if",
"cell",
"is",
"None",
":",
"return",
"pyq",
".",
"q",
"(",
"line",
")",
"if",
"_ns",
"is",
"None",
":",
"_ns",
"=",
"vars",
"(",
"sys",
".",
"modules"... | Run q code.
Options:
-l (dir|script) - pre-load database or script
-h host:port - execute on the given host
-o var - send output to a variable named var.
-i var1,..,varN - input variables
-1/-2 - redirect stdout/stderr | [
"Run",
"q",
"code",
"."
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/magic.py#L50-L121 |
13,919 | KxSystems/pyq | src/pyq/magic.py | load_ipython_extension | def load_ipython_extension(ipython):
"""Register %q and %%q magics and pretty display for K objects"""
ipython.register_magic_function(q, 'line_cell')
fmr = ipython.display_formatter.formatters['text/plain']
fmr.for_type(pyq.K, _q_formatter) | python | def load_ipython_extension(ipython):
"""Register %q and %%q magics and pretty display for K objects"""
ipython.register_magic_function(q, 'line_cell')
fmr = ipython.display_formatter.formatters['text/plain']
fmr.for_type(pyq.K, _q_formatter) | [
"def",
"load_ipython_extension",
"(",
"ipython",
")",
":",
"ipython",
".",
"register_magic_function",
"(",
"q",
",",
"'line_cell'",
")",
"fmr",
"=",
"ipython",
".",
"display_formatter",
".",
"formatters",
"[",
"'text/plain'",
"]",
"fmr",
".",
"for_type",
"(",
... | Register %q and %%q magics and pretty display for K objects | [
"Register",
"%q",
"and",
"%%q",
"magics",
"and",
"pretty",
"display",
"for",
"K",
"objects"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/magic.py#L129-L133 |
13,920 | KxSystems/pyq | src/pyq/ptk.py | get_prompt_tokens | def get_prompt_tokens(_):
"""Return a list of tokens for the prompt"""
namespace = q(r'\d')
if namespace == '.':
namespace = ''
return [(Token.Generic.Prompt, 'q%s)' % namespace)] | python | def get_prompt_tokens(_):
"""Return a list of tokens for the prompt"""
namespace = q(r'\d')
if namespace == '.':
namespace = ''
return [(Token.Generic.Prompt, 'q%s)' % namespace)] | [
"def",
"get_prompt_tokens",
"(",
"_",
")",
":",
"namespace",
"=",
"q",
"(",
"r'\\d'",
")",
"if",
"namespace",
"==",
"'.'",
":",
"namespace",
"=",
"''",
"return",
"[",
"(",
"Token",
".",
"Generic",
".",
"Prompt",
",",
"'q%s)'",
"%",
"namespace",
")",
... | Return a list of tokens for the prompt | [
"Return",
"a",
"list",
"of",
"tokens",
"for",
"the",
"prompt"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/ptk.py#L48-L53 |
13,921 | KxSystems/pyq | src/pyq/ptk.py | cmdloop | def cmdloop(self, intro=None):
"""A Cmd.cmdloop implementation"""
style = style_from_pygments(BasicStyle, style_dict)
self.preloop()
stop = None
while not stop:
line = prompt(get_prompt_tokens=get_prompt_tokens, lexer=lexer,
get_bottom_toolbar_tokens=get_bottom_toolbar_... | python | def cmdloop(self, intro=None):
"""A Cmd.cmdloop implementation"""
style = style_from_pygments(BasicStyle, style_dict)
self.preloop()
stop = None
while not stop:
line = prompt(get_prompt_tokens=get_prompt_tokens, lexer=lexer,
get_bottom_toolbar_tokens=get_bottom_toolbar_... | [
"def",
"cmdloop",
"(",
"self",
",",
"intro",
"=",
"None",
")",
":",
"style",
"=",
"style_from_pygments",
"(",
"BasicStyle",
",",
"style_dict",
")",
"self",
".",
"preloop",
"(",
")",
"stop",
"=",
"None",
"while",
"not",
"stop",
":",
"line",
"=",
"prompt... | A Cmd.cmdloop implementation | [
"A",
"Cmd",
".",
"cmdloop",
"implementation"
] | ad7b807abde94615a7344aaa930bb01fb1552cc5 | https://github.com/KxSystems/pyq/blob/ad7b807abde94615a7344aaa930bb01fb1552cc5/src/pyq/ptk.py#L90-L107 |
13,922 | mapbox/snuggs | snuggs/__init__.py | eval | def eval(source, kwd_dict=None, **kwds):
"""Evaluate a snuggs expression.
Parameters
----------
source : str
Expression source.
kwd_dict : dict
A dict of items that form the evaluation context. Deprecated.
kwds : dict
A dict of items that form the valuation context.
... | python | def eval(source, kwd_dict=None, **kwds):
"""Evaluate a snuggs expression.
Parameters
----------
source : str
Expression source.
kwd_dict : dict
A dict of items that form the evaluation context. Deprecated.
kwds : dict
A dict of items that form the valuation context.
... | [
"def",
"eval",
"(",
"source",
",",
"kwd_dict",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"kwd_dict",
"=",
"kwd_dict",
"or",
"kwds",
"with",
"ctx",
"(",
"kwd_dict",
")",
":",
"return",
"handleLine",
"(",
"source",
")"
] | Evaluate a snuggs expression.
Parameters
----------
source : str
Expression source.
kwd_dict : dict
A dict of items that form the evaluation context. Deprecated.
kwds : dict
A dict of items that form the valuation context.
Returns
-------
object | [
"Evaluate",
"a",
"snuggs",
"expression",
"."
] | 7517839178accf78ae9624b7186d03b77f837e02 | https://github.com/mapbox/snuggs/blob/7517839178accf78ae9624b7186d03b77f837e02/snuggs/__init__.py#L208-L227 |
13,923 | josiahcarlson/parse-crontab | crontab/_crontab.py | CronTab._make_matchers | def _make_matchers(self, crontab):
'''
This constructs the full matcher struct.
'''
crontab = _aliases.get(crontab, crontab)
ct = crontab.split()
if len(ct) == 5:
ct.insert(0, '0')
ct.append('*')
elif len(ct) == 6:
ct.insert(0, ... | python | def _make_matchers(self, crontab):
'''
This constructs the full matcher struct.
'''
crontab = _aliases.get(crontab, crontab)
ct = crontab.split()
if len(ct) == 5:
ct.insert(0, '0')
ct.append('*')
elif len(ct) == 6:
ct.insert(0, ... | [
"def",
"_make_matchers",
"(",
"self",
",",
"crontab",
")",
":",
"crontab",
"=",
"_aliases",
".",
"get",
"(",
"crontab",
",",
"crontab",
")",
"ct",
"=",
"crontab",
".",
"split",
"(",
")",
"if",
"len",
"(",
"ct",
")",
"==",
"5",
":",
"ct",
".",
"in... | This constructs the full matcher struct. | [
"This",
"constructs",
"the",
"full",
"matcher",
"struct",
"."
] | b2bd254cf14e8c83e502615851b0d4b62f73ab15 | https://github.com/josiahcarlson/parse-crontab/blob/b2bd254cf14e8c83e502615851b0d4b62f73ab15/crontab/_crontab.py#L361-L377 |
13,924 | josiahcarlson/parse-crontab | crontab/_crontab.py | CronTab.next | def next(self, now=None, increments=_increments, delta=True, default_utc=WARN_CHANGE):
'''
How long to wait in seconds before this crontab entry can next be
executed.
'''
if default_utc is WARN_CHANGE and (isinstance(now, _number_types) or (now and not now.tzinfo) or now is None)... | python | def next(self, now=None, increments=_increments, delta=True, default_utc=WARN_CHANGE):
'''
How long to wait in seconds before this crontab entry can next be
executed.
'''
if default_utc is WARN_CHANGE and (isinstance(now, _number_types) or (now and not now.tzinfo) or now is None)... | [
"def",
"next",
"(",
"self",
",",
"now",
"=",
"None",
",",
"increments",
"=",
"_increments",
",",
"delta",
"=",
"True",
",",
"default_utc",
"=",
"WARN_CHANGE",
")",
":",
"if",
"default_utc",
"is",
"WARN_CHANGE",
"and",
"(",
"isinstance",
"(",
"now",
",",
... | How long to wait in seconds before this crontab entry can next be
executed. | [
"How",
"long",
"to",
"wait",
"in",
"seconds",
"before",
"this",
"crontab",
"entry",
"can",
"next",
"be",
"executed",
"."
] | b2bd254cf14e8c83e502615851b0d4b62f73ab15 | https://github.com/josiahcarlson/parse-crontab/blob/b2bd254cf14e8c83e502615851b0d4b62f73ab15/crontab/_crontab.py#L390-L458 |
13,925 | sanand0/xmljson | xmljson/__init__.py | XMLData._tostring | def _tostring(value):
'''Convert value to XML compatible string'''
if value is True:
value = 'true'
elif value is False:
value = 'false'
elif value is None:
value = ''
return unicode(value) | python | def _tostring(value):
'''Convert value to XML compatible string'''
if value is True:
value = 'true'
elif value is False:
value = 'false'
elif value is None:
value = ''
return unicode(value) | [
"def",
"_tostring",
"(",
"value",
")",
":",
"if",
"value",
"is",
"True",
":",
"value",
"=",
"'true'",
"elif",
"value",
"is",
"False",
":",
"value",
"=",
"'false'",
"elif",
"value",
"is",
"None",
":",
"value",
"=",
"''",
"return",
"unicode",
"(",
"val... | Convert value to XML compatible string | [
"Convert",
"value",
"to",
"XML",
"compatible",
"string"
] | 2ecc2065fe7c87b3d282d362289927f13ce7f8b0 | https://github.com/sanand0/xmljson/blob/2ecc2065fe7c87b3d282d362289927f13ce7f8b0/xmljson/__init__.py#L61-L69 |
13,926 | sanand0/xmljson | xmljson/__init__.py | XMLData._fromstring | def _fromstring(value):
'''Convert XML string value to None, boolean, int or float'''
# NOTE: Is this even possible ?
if value is None:
return None
# FIXME: In XML, booleans are either 0/false or 1/true (lower-case !)
if value.lower() == 'true':
return Tr... | python | def _fromstring(value):
'''Convert XML string value to None, boolean, int or float'''
# NOTE: Is this even possible ?
if value is None:
return None
# FIXME: In XML, booleans are either 0/false or 1/true (lower-case !)
if value.lower() == 'true':
return Tr... | [
"def",
"_fromstring",
"(",
"value",
")",
":",
"# NOTE: Is this even possible ?",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"# FIXME: In XML, booleans are either 0/false or 1/true (lower-case !)",
"if",
"value",
".",
"lower",
"(",
")",
"==",
"'true'",
":",
"r... | Convert XML string value to None, boolean, int or float | [
"Convert",
"XML",
"string",
"value",
"to",
"None",
"boolean",
"int",
"or",
"float"
] | 2ecc2065fe7c87b3d282d362289927f13ce7f8b0 | https://github.com/sanand0/xmljson/blob/2ecc2065fe7c87b3d282d362289927f13ce7f8b0/xmljson/__init__.py#L72-L97 |
13,927 | pysal/esda | esda/join_counts.py | Join_Counts.by_col | def by_col(cls, df, cols, w=None, inplace=False, pvalue='sim', outvals=None, **stat_kws):
"""
Function to compute a Join_Count statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
... | python | def by_col(cls, df, cols, w=None, inplace=False, pvalue='sim', outvals=None, **stat_kws):
"""
Function to compute a Join_Count statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
... | [
"def",
"by_col",
"(",
"cls",
",",
"df",
",",
"cols",
",",
"w",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"pvalue",
"=",
"'sim'",
",",
"outvals",
"=",
"None",
",",
"*",
"*",
"stat_kws",
")",
":",
"if",
"outvals",
"is",
"None",
":",
"outvals"... | Function to compute a Join_Count statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
cols : string or list of string
name or list of names of columns to use to co... | [
"Function",
"to",
"compute",
"a",
"Join_Count",
"statistic",
"on",
"a",
"dataframe"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/join_counts.py#L171-L214 |
13,928 | pysal/esda | esda/moran.py | Moran_BV_matrix | def Moran_BV_matrix(variables, w, permutations=0, varnames=None):
"""
Bivariate Moran Matrix
Calculates bivariate Moran between all pairs of a set of variables.
Parameters
----------
variables : array or pandas.DataFrame
sequence of variables to be assessed
w ... | python | def Moran_BV_matrix(variables, w, permutations=0, varnames=None):
"""
Bivariate Moran Matrix
Calculates bivariate Moran between all pairs of a set of variables.
Parameters
----------
variables : array or pandas.DataFrame
sequence of variables to be assessed
w ... | [
"def",
"Moran_BV_matrix",
"(",
"variables",
",",
"w",
",",
"permutations",
"=",
"0",
",",
"varnames",
"=",
"None",
")",
":",
"try",
":",
"# check if pandas is installed",
"import",
"pandas",
"if",
"isinstance",
"(",
"variables",
",",
"pandas",
".",
"DataFrame"... | Bivariate Moran Matrix
Calculates bivariate Moran between all pairs of a set of variables.
Parameters
----------
variables : array or pandas.DataFrame
sequence of variables to be assessed
w : W
a spatial weights object
permutations : int
... | [
"Bivariate",
"Moran",
"Matrix"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/moran.py#L464-L537 |
13,929 | pysal/esda | esda/moran.py | _Moran_BV_Matrix_array | def _Moran_BV_Matrix_array(variables, w, permutations=0, varnames=None):
"""
Base calculation for MORAN_BV_Matrix
"""
if varnames is None:
varnames = ['x{}'.format(i) for i in range(k)]
k = len(variables)
rk = list(range(0, k - 1))
results = {}
for i in rk:
for j in rang... | python | def _Moran_BV_Matrix_array(variables, w, permutations=0, varnames=None):
"""
Base calculation for MORAN_BV_Matrix
"""
if varnames is None:
varnames = ['x{}'.format(i) for i in range(k)]
k = len(variables)
rk = list(range(0, k - 1))
results = {}
for i in rk:
for j in rang... | [
"def",
"_Moran_BV_Matrix_array",
"(",
"variables",
",",
"w",
",",
"permutations",
"=",
"0",
",",
"varnames",
"=",
"None",
")",
":",
"if",
"varnames",
"is",
"None",
":",
"varnames",
"=",
"[",
"'x{}'",
".",
"format",
"(",
"i",
")",
"for",
"i",
"in",
"r... | Base calculation for MORAN_BV_Matrix | [
"Base",
"calculation",
"for",
"MORAN_BV_Matrix"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/moran.py#L540-L558 |
13,930 | pysal/esda | esda/moran.py | Moran_BV.by_col | def by_col(cls, df, x, y=None, w=None, inplace=False, pvalue='sim', outvals=None, **stat_kws):
"""
Function to compute a Moran_BV statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
... | python | def by_col(cls, df, x, y=None, w=None, inplace=False, pvalue='sim', outvals=None, **stat_kws):
"""
Function to compute a Moran_BV statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
... | [
"def",
"by_col",
"(",
"cls",
",",
"df",
",",
"x",
",",
"y",
"=",
"None",
",",
"w",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"pvalue",
"=",
"'sim'",
",",
"outvals",
"=",
"None",
",",
"*",
"*",
"stat_kws",
")",
":",
"return",
"_bivariate_han... | Function to compute a Moran_BV statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
X : list of strings
column name or list of column names to use as X values t... | [
"Function",
"to",
"compute",
"a",
"Moran_BV",
"statistic",
"on",
"a",
"dataframe"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/moran.py#L415-L461 |
13,931 | pysal/esda | esda/moran.py | Moran_Rate.by_col | def by_col(cls, df, events, populations, w=None, inplace=False,
pvalue='sim', outvals=None, swapname='', **stat_kws):
"""
Function to compute a Moran_Rate statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pand... | python | def by_col(cls, df, events, populations, w=None, inplace=False,
pvalue='sim', outvals=None, swapname='', **stat_kws):
"""
Function to compute a Moran_Rate statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pand... | [
"def",
"by_col",
"(",
"cls",
",",
"df",
",",
"events",
",",
"populations",
",",
"w",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"pvalue",
"=",
"'sim'",
",",
"outvals",
"=",
"None",
",",
"swapname",
"=",
"''",
",",
"*",
"*",
"stat_kws",
")",
... | Function to compute a Moran_Rate statistic on a dataframe
Arguments
---------
df : pandas.DataFrame
a pandas dataframe with a geometry column
events : string or list of strings
one or more names where events are stored
... | [
"Function",
"to",
"compute",
"a",
"Moran_Rate",
"statistic",
"on",
"a",
"dataframe"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/moran.py#L679-L758 |
13,932 | pysal/esda | esda/smoothing.py | flatten | def flatten(l, unique=True):
"""flatten a list of lists
Parameters
----------
l : list
of lists
unique : boolean
whether or not only unique items are wanted (default=True)
Returns
-------
list
of single items
Examples
----... | python | def flatten(l, unique=True):
"""flatten a list of lists
Parameters
----------
l : list
of lists
unique : boolean
whether or not only unique items are wanted (default=True)
Returns
-------
list
of single items
Examples
----... | [
"def",
"flatten",
"(",
"l",
",",
"unique",
"=",
"True",
")",
":",
"l",
"=",
"reduce",
"(",
"lambda",
"x",
",",
"y",
":",
"x",
"+",
"y",
",",
"l",
")",
"if",
"not",
"unique",
":",
"return",
"list",
"(",
"l",
")",
"return",
"list",
"(",
"set",
... | flatten a list of lists
Parameters
----------
l : list
of lists
unique : boolean
whether or not only unique items are wanted (default=True)
Returns
-------
list
of single items
Examples
--------
Creating a sample list who... | [
"flatten",
"a",
"list",
"of",
"lists"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/smoothing.py#L32-L63 |
13,933 | pysal/esda | esda/smoothing.py | weighted_median | def weighted_median(d, w):
"""A utility function to find a median of d based on w
Parameters
----------
d : array
(n, 1), variable for which median will be found
w : array
(n, 1), variable on which d's median will be decided
Notes
-----
... | python | def weighted_median(d, w):
"""A utility function to find a median of d based on w
Parameters
----------
d : array
(n, 1), variable for which median will be found
w : array
(n, 1), variable on which d's median will be decided
Notes
-----
... | [
"def",
"weighted_median",
"(",
"d",
",",
"w",
")",
":",
"dtype",
"=",
"[",
"(",
"'w'",
",",
"'%s'",
"%",
"w",
".",
"dtype",
")",
",",
"(",
"'v'",
",",
"'%s'",
"%",
"d",
".",
"dtype",
")",
"]",
"d_w",
"=",
"np",
".",
"array",
"(",
"list",
"(... | A utility function to find a median of d based on w
Parameters
----------
d : array
(n, 1), variable for which median will be found
w : array
(n, 1), variable on which d's median will be decided
Notes
-----
d and w are arranged in the sam... | [
"A",
"utility",
"function",
"to",
"find",
"a",
"median",
"of",
"d",
"based",
"on",
"w"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/smoothing.py#L66-L113 |
13,934 | pysal/esda | esda/smoothing.py | sum_by_n | def sum_by_n(d, w, n):
"""A utility function to summarize a data array into n values
after weighting the array with another weight array w
Parameters
----------
d : array
(t, 1), numerical values
w : array
(t, 1), numerical values for weigh... | python | def sum_by_n(d, w, n):
"""A utility function to summarize a data array into n values
after weighting the array with another weight array w
Parameters
----------
d : array
(t, 1), numerical values
w : array
(t, 1), numerical values for weigh... | [
"def",
"sum_by_n",
"(",
"d",
",",
"w",
",",
"n",
")",
":",
"t",
"=",
"len",
"(",
"d",
")",
"h",
"=",
"t",
"//",
"n",
"#must be floor!",
"d",
"=",
"d",
"*",
"w",
"return",
"np",
".",
"array",
"(",
"[",
"sum",
"(",
"d",
"[",
"i",
":",
"i",
... | A utility function to summarize a data array into n values
after weighting the array with another weight array w
Parameters
----------
d : array
(t, 1), numerical values
w : array
(t, 1), numerical values for weighting
n : integer
... | [
"A",
"utility",
"function",
"to",
"summarize",
"a",
"data",
"array",
"into",
"n",
"values",
"after",
"weighting",
"the",
"array",
"with",
"another",
"weight",
"array",
"w"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/smoothing.py#L116-L160 |
13,935 | pysal/esda | esda/smoothing.py | crude_age_standardization | def crude_age_standardization(e, b, n):
"""A utility function to compute rate through crude age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
(n*h, 1), populat... | python | def crude_age_standardization(e, b, n):
"""A utility function to compute rate through crude age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
(n*h, 1), populat... | [
"def",
"crude_age_standardization",
"(",
"e",
",",
"b",
",",
"n",
")",
":",
"r",
"=",
"e",
"*",
"1.0",
"/",
"b",
"b_by_n",
"=",
"sum_by_n",
"(",
"b",
",",
"1.0",
",",
"n",
")",
"age_weight",
"=",
"b",
"*",
"1.0",
"/",
"b_by_n",
".",
"repeat",
"... | A utility function to compute rate through crude age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
(n*h, 1), population at risk variable measured for each age grou... | [
"A",
"utility",
"function",
"to",
"compute",
"rate",
"through",
"crude",
"age",
"standardization"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/smoothing.py#L163-L213 |
13,936 | pysal/esda | esda/smoothing.py | direct_age_standardization | def direct_age_standardization(e, b, s, n, alpha=0.05):
"""A utility function to compute rate through direct age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
... | python | def direct_age_standardization(e, b, s, n, alpha=0.05):
"""A utility function to compute rate through direct age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
... | [
"def",
"direct_age_standardization",
"(",
"e",
",",
"b",
",",
"s",
",",
"n",
",",
"alpha",
"=",
"0.05",
")",
":",
"age_weight",
"=",
"(",
"1.0",
"/",
"b",
")",
"*",
"(",
"s",
"*",
"1.0",
"/",
"sum_by_n",
"(",
"s",
",",
"1.0",
",",
"n",
")",
"... | A utility function to compute rate through direct age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
(n*h, 1), population at risk variable measured for each age gro... | [
"A",
"utility",
"function",
"to",
"compute",
"rate",
"through",
"direct",
"age",
"standardization"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/smoothing.py#L216-L298 |
13,937 | pysal/esda | esda/smoothing.py | indirect_age_standardization | def indirect_age_standardization(e, b, s_e, s_b, n, alpha=0.05):
"""A utility function to compute rate through indirect age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
... | python | def indirect_age_standardization(e, b, s_e, s_b, n, alpha=0.05):
"""A utility function to compute rate through indirect age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
... | [
"def",
"indirect_age_standardization",
"(",
"e",
",",
"b",
",",
"s_e",
",",
"s_b",
",",
"n",
",",
"alpha",
"=",
"0.05",
")",
":",
"smr",
"=",
"standardized_mortality_ratio",
"(",
"e",
",",
"b",
",",
"s_e",
",",
"s_b",
",",
"n",
")",
"s_r_all",
"=",
... | A utility function to compute rate through indirect age standardization
Parameters
----------
e : array
(n*h, 1), event variable measured for each age group across n spatial units
b : array
(n*h, 1), population at risk variable measured for each age g... | [
"A",
"utility",
"function",
"to",
"compute",
"rate",
"through",
"indirect",
"age",
"standardization"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/smoothing.py#L301-L379 |
13,938 | pysal/esda | esda/tabular.py | _univariate_handler | def _univariate_handler(df, cols, stat=None, w=None, inplace=True,
pvalue = 'sim', outvals = None, swapname='', **kwargs):
"""
Compute a univariate descriptive statistic `stat` over columns `cols` in
`df`.
Parameters
----------
df : pandas.DataFrame
... | python | def _univariate_handler(df, cols, stat=None, w=None, inplace=True,
pvalue = 'sim', outvals = None, swapname='', **kwargs):
"""
Compute a univariate descriptive statistic `stat` over columns `cols` in
`df`.
Parameters
----------
df : pandas.DataFrame
... | [
"def",
"_univariate_handler",
"(",
"df",
",",
"cols",
",",
"stat",
"=",
"None",
",",
"w",
"=",
"None",
",",
"inplace",
"=",
"True",
",",
"pvalue",
"=",
"'sim'",
",",
"outvals",
"=",
"None",
",",
"swapname",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
... | Compute a univariate descriptive statistic `stat` over columns `cols` in
`df`.
Parameters
----------
df : pandas.DataFrame
the dataframe containing columns to compute the descriptive
statistics
cols : string or list of strings
on... | [
"Compute",
"a",
"univariate",
"descriptive",
"statistic",
"stat",
"over",
"columns",
"cols",
"in",
"df",
"."
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/tabular.py#L10-L98 |
13,939 | pysal/esda | esda/tabular.py | _bivariate_handler | def _bivariate_handler(df, x, y=None, w=None, inplace=True, pvalue='sim',
outvals=None, **kwargs):
"""
Compute a descriptive bivariate statistic over two sets of columns, `x` and
`y`, contained in `df`.
Parameters
----------
df : pandas.DataFrame
... | python | def _bivariate_handler(df, x, y=None, w=None, inplace=True, pvalue='sim',
outvals=None, **kwargs):
"""
Compute a descriptive bivariate statistic over two sets of columns, `x` and
`y`, contained in `df`.
Parameters
----------
df : pandas.DataFrame
... | [
"def",
"_bivariate_handler",
"(",
"df",
",",
"x",
",",
"y",
"=",
"None",
",",
"w",
"=",
"None",
",",
"inplace",
"=",
"True",
",",
"pvalue",
"=",
"'sim'",
",",
"outvals",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"real_swapname",
"=",
"kwargs"... | Compute a descriptive bivariate statistic over two sets of columns, `x` and
`y`, contained in `df`.
Parameters
----------
df : pandas.DataFrame
dataframe in which columns `x` and `y` are contained
x : string or list of strings
one or more colum... | [
"Compute",
"a",
"descriptive",
"bivariate",
"statistic",
"over",
"two",
"sets",
"of",
"columns",
"x",
"and",
"y",
"contained",
"in",
"df",
"."
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/tabular.py#L100-L154 |
13,940 | pysal/esda | esda/tabular.py | _swap_ending | def _swap_ending(s, ending, delim='_'):
"""
Replace the ending of a string, delimited into an arbitrary
number of chunks by `delim`, with the ending provided
Parameters
----------
s : string
string to replace endings
ending : string
string used to ... | python | def _swap_ending(s, ending, delim='_'):
"""
Replace the ending of a string, delimited into an arbitrary
number of chunks by `delim`, with the ending provided
Parameters
----------
s : string
string to replace endings
ending : string
string used to ... | [
"def",
"_swap_ending",
"(",
"s",
",",
"ending",
",",
"delim",
"=",
"'_'",
")",
":",
"parts",
"=",
"[",
"x",
"for",
"x",
"in",
"s",
".",
"split",
"(",
"delim",
")",
"[",
":",
"-",
"1",
"]",
"if",
"x",
"!=",
"''",
"]",
"parts",
".",
"append",
... | Replace the ending of a string, delimited into an arbitrary
number of chunks by `delim`, with the ending provided
Parameters
----------
s : string
string to replace endings
ending : string
string used to replace ending of `s`
delim : string
... | [
"Replace",
"the",
"ending",
"of",
"a",
"string",
"delimited",
"into",
"an",
"arbitrary",
"number",
"of",
"chunks",
"by",
"delim",
"with",
"the",
"ending",
"provided"
] | 2fafc6ec505e153152a86601d3e0fba080610c20 | https://github.com/pysal/esda/blob/2fafc6ec505e153152a86601d3e0fba080610c20/esda/tabular.py#L156-L177 |
13,941 | symengine/symengine.py | symengine/compatibility.py | is_sequence | def is_sequence(i, include=None):
"""
Return a boolean indicating whether ``i`` is a sequence in the SymPy
sense. If anything that fails the test below should be included as
being a sequence for your application, set 'include' to that object's
type; multiple types should be passed as a tuple of type... | python | def is_sequence(i, include=None):
"""
Return a boolean indicating whether ``i`` is a sequence in the SymPy
sense. If anything that fails the test below should be included as
being a sequence for your application, set 'include' to that object's
type; multiple types should be passed as a tuple of type... | [
"def",
"is_sequence",
"(",
"i",
",",
"include",
"=",
"None",
")",
":",
"return",
"(",
"hasattr",
"(",
"i",
",",
"'__getitem__'",
")",
"and",
"iterable",
"(",
"i",
")",
"or",
"bool",
"(",
"include",
")",
"and",
"isinstance",
"(",
"i",
",",
"include",
... | Return a boolean indicating whether ``i`` is a sequence in the SymPy
sense. If anything that fails the test below should be included as
being a sequence for your application, set 'include' to that object's
type; multiple types should be passed as a tuple of types.
Note: although generators can generate... | [
"Return",
"a",
"boolean",
"indicating",
"whether",
"i",
"is",
"a",
"sequence",
"in",
"the",
"SymPy",
"sense",
".",
"If",
"anything",
"that",
"fails",
"the",
"test",
"below",
"should",
"be",
"included",
"as",
"being",
"a",
"sequence",
"for",
"your",
"applic... | 1366cf98ceaade339c5dd24ae3381a0e63ea9dad | https://github.com/symengine/symengine.py/blob/1366cf98ceaade339c5dd24ae3381a0e63ea9dad/symengine/compatibility.py#L245-L282 |
13,942 | symengine/symengine.py | symengine/compatibility.py | as_int | def as_int(n):
"""
Convert the argument to a builtin integer.
The return value is guaranteed to be equal to the input. ValueError is
raised if the input has a non-integral value.
Examples
========
>>> from sympy.core.compatibility import as_int
>>> from sympy import sqrt
>>> 3.0
... | python | def as_int(n):
"""
Convert the argument to a builtin integer.
The return value is guaranteed to be equal to the input. ValueError is
raised if the input has a non-integral value.
Examples
========
>>> from sympy.core.compatibility import as_int
>>> from sympy import sqrt
>>> 3.0
... | [
"def",
"as_int",
"(",
"n",
")",
":",
"try",
":",
"result",
"=",
"int",
"(",
"n",
")",
"if",
"result",
"!=",
"n",
":",
"raise",
"TypeError",
"except",
"TypeError",
":",
"raise",
"ValueError",
"(",
"'%s is not an integer'",
"%",
"n",
")",
"return",
"resu... | Convert the argument to a builtin integer.
The return value is guaranteed to be equal to the input. ValueError is
raised if the input has a non-integral value.
Examples
========
>>> from sympy.core.compatibility import as_int
>>> from sympy import sqrt
>>> 3.0
3.0
>>> as_int(3.0) ... | [
"Convert",
"the",
"argument",
"to",
"a",
"builtin",
"integer",
"."
] | 1366cf98ceaade339c5dd24ae3381a0e63ea9dad | https://github.com/symengine/symengine.py/blob/1366cf98ceaade339c5dd24ae3381a0e63ea9dad/symengine/compatibility.py#L359-L389 |
13,943 | symengine/symengine.py | symengine/compatibility.py | default_sort_key | def default_sort_key(item, order=None):
"""Return a key that can be used for sorting.
The key has the structure:
(class_key, (len(args), args), exponent.sort_key(), coefficient)
This key is supplied by the sort_key routine of Basic objects when
``item`` is a Basic object or an object (other than ... | python | def default_sort_key(item, order=None):
"""Return a key that can be used for sorting.
The key has the structure:
(class_key, (len(args), args), exponent.sort_key(), coefficient)
This key is supplied by the sort_key routine of Basic objects when
``item`` is a Basic object or an object (other than ... | [
"def",
"default_sort_key",
"(",
"item",
",",
"order",
"=",
"None",
")",
":",
"from",
"sympy",
".",
"core",
"import",
"S",
",",
"Basic",
"from",
"sympy",
".",
"core",
".",
"sympify",
"import",
"sympify",
",",
"SympifyError",
"from",
"sympy",
".",
"core",
... | Return a key that can be used for sorting.
The key has the structure:
(class_key, (len(args), args), exponent.sort_key(), coefficient)
This key is supplied by the sort_key routine of Basic objects when
``item`` is a Basic object or an object (other than a string) that
sympifies to a Basic object.... | [
"Return",
"a",
"key",
"that",
"can",
"be",
"used",
"for",
"sorting",
"."
] | 1366cf98ceaade339c5dd24ae3381a0e63ea9dad | https://github.com/symengine/symengine.py/blob/1366cf98ceaade339c5dd24ae3381a0e63ea9dad/symengine/compatibility.py#L392-L541 |
13,944 | symengine/symengine.py | symengine/utilities.py | var | def var(names, **args):
"""
Create symbols and inject them into the global namespace.
INPUT:
- s -- a string, either a single variable name, or
- a space separated list of variable names, or
- a list of variable names.
This calls :func:`symbols` with the same... | python | def var(names, **args):
"""
Create symbols and inject them into the global namespace.
INPUT:
- s -- a string, either a single variable name, or
- a space separated list of variable names, or
- a list of variable names.
This calls :func:`symbols` with the same... | [
"def",
"var",
"(",
"names",
",",
"*",
"*",
"args",
")",
":",
"def",
"traverse",
"(",
"symbols",
",",
"frame",
")",
":",
"\"\"\"Recursively inject symbols to the global namespace. \"\"\"",
"for",
"symbol",
"in",
"symbols",
":",
"if",
"isinstance",
"(",
"symbol",
... | Create symbols and inject them into the global namespace.
INPUT:
- s -- a string, either a single variable name, or
- a space separated list of variable names, or
- a list of variable names.
This calls :func:`symbols` with the same arguments and puts the results
... | [
"Create",
"symbols",
"and",
"inject",
"them",
"into",
"the",
"global",
"namespace",
"."
] | 1366cf98ceaade339c5dd24ae3381a0e63ea9dad | https://github.com/symengine/symengine.py/blob/1366cf98ceaade339c5dd24ae3381a0e63ea9dad/symengine/utilities.py#L184-L242 |
13,945 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph._combine_attribute_arguments | def _combine_attribute_arguments(self, attr_dict, attr):
# Note: Code & comments unchanged from DirectedHypergraph
"""Combines attr_dict and attr dictionaries, by updating attr_dict
with attr.
:param attr_dict: dictionary of attributes of the node.
:param attr: keyword argum... | python | def _combine_attribute_arguments(self, attr_dict, attr):
# Note: Code & comments unchanged from DirectedHypergraph
"""Combines attr_dict and attr dictionaries, by updating attr_dict
with attr.
:param attr_dict: dictionary of attributes of the node.
:param attr: keyword argum... | [
"def",
"_combine_attribute_arguments",
"(",
"self",
",",
"attr_dict",
",",
"attr",
")",
":",
"# Note: Code & comments unchanged from DirectedHypergraph",
"# If no attribute dict was passed, treat the keyword",
"# arguments as the dict",
"if",
"attr_dict",
"is",
"None",
":",
"attr... | Combines attr_dict and attr dictionaries, by updating attr_dict
with attr.
:param attr_dict: dictionary of attributes of the node.
:param attr: keyword arguments of attributes of the node;
attr's values will override attr_dict's values
if both are pro... | [
"Combines",
"attr_dict",
"and",
"attr",
"dictionaries",
"by",
"updating",
"attr_dict",
"with",
"attr",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L137-L162 |
13,946 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.remove_node | def remove_node(self, node):
"""Removes a node and its attributes from the hypergraph. Removes
every hyperedge that contains this node.
:param node: reference to the node being added.
:raises: ValueError -- No such node exists.
Examples:
::
>>> H = Undirect... | python | def remove_node(self, node):
"""Removes a node and its attributes from the hypergraph. Removes
every hyperedge that contains this node.
:param node: reference to the node being added.
:raises: ValueError -- No such node exists.
Examples:
::
>>> H = Undirect... | [
"def",
"remove_node",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"self",
".",
"has_node",
"(",
"node",
")",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"# Loop over every hyperedge in the star of the node;",
"# i.e., over every hyperedge that... | Removes a node and its attributes from the hypergraph. Removes
every hyperedge that contains this node.
:param node: reference to the node being added.
:raises: ValueError -- No such node exists.
Examples:
::
>>> H = UndirectedHypergraph()
>>> H.add_nod... | [
"Removes",
"a",
"node",
"and",
"its",
"attributes",
"from",
"the",
"hypergraph",
".",
"Removes",
"every",
"hyperedge",
"that",
"contains",
"this",
"node",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L256-L288 |
13,947 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.add_hyperedge | def add_hyperedge(self, nodes, attr_dict=None, **attr):
"""Adds a hyperedge to the hypergraph, along with any related
attributes of the hyperedge.
This method will automatically add any node from the node set
that was not in the hypergraph.
A hyperedge without a "... | python | def add_hyperedge(self, nodes, attr_dict=None, **attr):
"""Adds a hyperedge to the hypergraph, along with any related
attributes of the hyperedge.
This method will automatically add any node from the node set
that was not in the hypergraph.
A hyperedge without a "... | [
"def",
"add_hyperedge",
"(",
"self",
",",
"nodes",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr",
")",
"# Don't allow empty node set (invalid hyperedge)"... | Adds a hyperedge to the hypergraph, along with any related
attributes of the hyperedge.
This method will automatically add any node from the node set
that was not in the hypergraph.
A hyperedge without a "weight" attribute specified will be
assigned the defaul... | [
"Adds",
"a",
"hyperedge",
"to",
"the",
"hypergraph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"hyperedge",
".",
"This",
"method",
"will",
"automatically",
"add",
"any",
"node",
"from",
"the",
"node",
"set",
"that",
"was",
"not",
"in",
... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L384-L447 |
13,948 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.add_hyperedges | def add_hyperedges(self, hyperedges, attr_dict=None, **attr):
"""Adds multiple hyperedges to the graph, along with any related
attributes of the hyperedges.
If any node of a hyperedge has not previously been added to the
hypergraph, it will automatically be added here.
... | python | def add_hyperedges(self, hyperedges, attr_dict=None, **attr):
"""Adds multiple hyperedges to the graph, along with any related
attributes of the hyperedges.
If any node of a hyperedge has not previously been added to the
hypergraph, it will automatically be added here.
... | [
"def",
"add_hyperedges",
"(",
"self",
",",
"hyperedges",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr",
")",
"hyperedge_ids",
"=",
"[",
"]",
"for... | Adds multiple hyperedges to the graph, along with any related
attributes of the hyperedges.
If any node of a hyperedge has not previously been added to the
hypergraph, it will automatically be added here.
Hyperedges without a "weight" attribute specified will be
... | [
"Adds",
"multiple",
"hyperedges",
"to",
"the",
"graph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"hyperedges",
".",
"If",
"any",
"node",
"of",
"a",
"hyperedge",
"has",
"not",
"previously",
"been",
"added",
"to",
"the",
"hypergraph",
"it"... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L449-L487 |
13,949 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.get_hyperedge_id | def get_hyperedge_id(self, nodes):
"""From a set of nodes, returns the ID of the hyperedge that this
set comprises.
:param nodes: iterable container of references to nodes in the
the hyperedge to be added
:returns: str -- ID of the hyperedge that has that the specifi... | python | def get_hyperedge_id(self, nodes):
"""From a set of nodes, returns the ID of the hyperedge that this
set comprises.
:param nodes: iterable container of references to nodes in the
the hyperedge to be added
:returns: str -- ID of the hyperedge that has that the specifi... | [
"def",
"get_hyperedge_id",
"(",
"self",
",",
"nodes",
")",
":",
"frozen_nodes",
"=",
"frozenset",
"(",
"nodes",
")",
"if",
"not",
"self",
".",
"has_hyperedge",
"(",
"frozen_nodes",
")",
":",
"raise",
"ValueError",
"(",
"\"No such hyperedge exists.\"",
")",
"re... | From a set of nodes, returns the ID of the hyperedge that this
set comprises.
:param nodes: iterable container of references to nodes in the
the hyperedge to be added
:returns: str -- ID of the hyperedge that has that the specified
node set comprises.
... | [
"From",
"a",
"set",
"of",
"nodes",
"returns",
"the",
"ID",
"of",
"the",
"hyperedge",
"that",
"this",
"set",
"comprises",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L592-L618 |
13,950 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.get_hyperedge_attribute | def get_hyperedge_attribute(self, hyperedge_id, attribute_name):
# Note: Code unchanged from DirectedHypergraph
"""Given a hyperedge ID and the name of an attribute, get a copy
of that hyperedge's attribute.
:param hyperedge_id: ID of the hyperedge to retrieve the attribute of.
... | python | def get_hyperedge_attribute(self, hyperedge_id, attribute_name):
# Note: Code unchanged from DirectedHypergraph
"""Given a hyperedge ID and the name of an attribute, get a copy
of that hyperedge's attribute.
:param hyperedge_id: ID of the hyperedge to retrieve the attribute of.
... | [
"def",
"get_hyperedge_attribute",
"(",
"self",
",",
"hyperedge_id",
",",
"attribute_name",
")",
":",
"# Note: Code unchanged from DirectedHypergraph",
"if",
"not",
"self",
".",
"has_hyperedge_id",
"(",
"hyperedge_id",
")",
":",
"raise",
"ValueError",
"(",
"\"No such hyp... | Given a hyperedge ID and the name of an attribute, get a copy
of that hyperedge's attribute.
:param hyperedge_id: ID of the hyperedge to retrieve the attribute of.
:param attribute_name: name of the attribute to retrieve.
:returns: attribute value of the attribute_name key for the
... | [
"Given",
"a",
"hyperedge",
"ID",
"and",
"the",
"name",
"of",
"an",
"attribute",
"get",
"a",
"copy",
"of",
"that",
"hyperedge",
"s",
"attribute",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L620-L649 |
13,951 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.get_hyperedge_attributes | def get_hyperedge_attributes(self, hyperedge_id):
"""Given a hyperedge ID, get a dictionary of copies of that hyperedge's
attributes.
:param hyperedge_id: ID of the hyperedge to retrieve the attributes of.
:returns: dict -- copy of each attribute of the specified hyperedge_id
... | python | def get_hyperedge_attributes(self, hyperedge_id):
"""Given a hyperedge ID, get a dictionary of copies of that hyperedge's
attributes.
:param hyperedge_id: ID of the hyperedge to retrieve the attributes of.
:returns: dict -- copy of each attribute of the specified hyperedge_id
... | [
"def",
"get_hyperedge_attributes",
"(",
"self",
",",
"hyperedge_id",
")",
":",
"if",
"not",
"self",
".",
"has_hyperedge_id",
"(",
"hyperedge_id",
")",
":",
"raise",
"ValueError",
"(",
"\"No such hyperedge exists.\"",
")",
"dict_to_copy",
"=",
"self",
".",
"_hypere... | Given a hyperedge ID, get a dictionary of copies of that hyperedge's
attributes.
:param hyperedge_id: ID of the hyperedge to retrieve the attributes of.
:returns: dict -- copy of each attribute of the specified hyperedge_id
(except the private __frozen_nodes entry).
:rai... | [
"Given",
"a",
"hyperedge",
"ID",
"get",
"a",
"dictionary",
"of",
"copies",
"of",
"that",
"hyperedge",
"s",
"attributes",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L651-L668 |
13,952 | Murali-group/halp | halp/undirected_hypergraph.py | UndirectedHypergraph.get_star | def get_star(self, node):
"""Given a node, get a copy of that node's star, that is, the set of
hyperedges that the node belongs to.
:param node: node to retrieve the star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's star.
:ra... | python | def get_star(self, node):
"""Given a node, get a copy of that node's star, that is, the set of
hyperedges that the node belongs to.
:param node: node to retrieve the star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's star.
:ra... | [
"def",
"get_star",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"not",
"in",
"self",
".",
"_node_attributes",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"return",
"self",
".",
"_star",
"[",
"node",
"]",
".",
"copy",
"(",
")"
] | Given a node, get a copy of that node's star, that is, the set of
hyperedges that the node belongs to.
:param node: node to retrieve the star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's star.
:raises: ValueError -- No such node exis... | [
"Given",
"a",
"node",
"get",
"a",
"copy",
"of",
"that",
"node",
"s",
"star",
"that",
"is",
"the",
"set",
"of",
"hyperedges",
"that",
"the",
"node",
"belongs",
"to",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L691-L703 |
13,953 | Murali-group/halp | halp/utilities/directed_statistics.py | _F_outdegree | def _F_outdegree(H, F):
"""Returns the result of a function F applied to the set of outdegrees in
in the hypergraph.
:param H: the hypergraph whose outdegrees will be operated on.
:param F: function to execute on the list of outdegrees in the hypergraph.
:returns: result of the given function F.
... | python | def _F_outdegree(H, F):
"""Returns the result of a function F applied to the set of outdegrees in
in the hypergraph.
:param H: the hypergraph whose outdegrees will be operated on.
:param F: function to execute on the list of outdegrees in the hypergraph.
:returns: result of the given function F.
... | [
"def",
"_F_outdegree",
"(",
"H",
",",
"F",
")",
":",
"if",
"not",
"isinstance",
"(",
"H",
",",
"DirectedHypergraph",
")",
":",
"raise",
"TypeError",
"(",
"\"Algorithm only applicable to directed hypergraphs\"",
")",
"return",
"F",
"(",
"[",
"len",
"(",
"H",
... | Returns the result of a function F applied to the set of outdegrees in
in the hypergraph.
:param H: the hypergraph whose outdegrees will be operated on.
:param F: function to execute on the list of outdegrees in the hypergraph.
:returns: result of the given function F.
:raises: TypeError -- Algorit... | [
"Returns",
"the",
"result",
"of",
"a",
"function",
"F",
"applied",
"to",
"the",
"set",
"of",
"outdegrees",
"in",
"in",
"the",
"hypergraph",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/directed_statistics.py#L40-L54 |
13,954 | Murali-group/halp | halp/utilities/directed_statistics.py | _F_indegree | def _F_indegree(H, F):
"""Returns the result of a function F applied to the list of indegrees in
in the hypergraph.
:param H: the hypergraph whose indegrees will be operated on.
:param F: function to execute on the list of indegrees in the hypergraph.
:returns: result of the given function F.
:... | python | def _F_indegree(H, F):
"""Returns the result of a function F applied to the list of indegrees in
in the hypergraph.
:param H: the hypergraph whose indegrees will be operated on.
:param F: function to execute on the list of indegrees in the hypergraph.
:returns: result of the given function F.
:... | [
"def",
"_F_indegree",
"(",
"H",
",",
"F",
")",
":",
"if",
"not",
"isinstance",
"(",
"H",
",",
"DirectedHypergraph",
")",
":",
"raise",
"TypeError",
"(",
"\"Algorithm only applicable to directed hypergraphs\"",
")",
"return",
"F",
"(",
"[",
"len",
"(",
"H",
"... | Returns the result of a function F applied to the list of indegrees in
in the hypergraph.
:param H: the hypergraph whose indegrees will be operated on.
:param F: function to execute on the list of indegrees in the hypergraph.
:returns: result of the given function F.
:raises: TypeError -- Algorithm... | [
"Returns",
"the",
"result",
"of",
"a",
"function",
"F",
"applied",
"to",
"the",
"list",
"of",
"indegrees",
"in",
"in",
"the",
"hypergraph",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/directed_statistics.py#L105-L119 |
13,955 | Murali-group/halp | halp/utilities/directed_statistics.py | _F_hyperedge_tail_cardinality | def _F_hyperedge_tail_cardinality(H, F):
"""Returns the result of a function F applied to the set of cardinalities
of hyperedge tails in the hypergraph.
:param H: the hypergraph whose tail cardinalities will be
operated on.
:param F: function to execute on the set of cardinalities i... | python | def _F_hyperedge_tail_cardinality(H, F):
"""Returns the result of a function F applied to the set of cardinalities
of hyperedge tails in the hypergraph.
:param H: the hypergraph whose tail cardinalities will be
operated on.
:param F: function to execute on the set of cardinalities i... | [
"def",
"_F_hyperedge_tail_cardinality",
"(",
"H",
",",
"F",
")",
":",
"if",
"not",
"isinstance",
"(",
"H",
",",
"DirectedHypergraph",
")",
":",
"raise",
"TypeError",
"(",
"\"Algorithm only applicable to directed hypergraphs\"",
")",
"return",
"F",
"(",
"[",
"len",... | Returns the result of a function F applied to the set of cardinalities
of hyperedge tails in the hypergraph.
:param H: the hypergraph whose tail cardinalities will be
operated on.
:param F: function to execute on the set of cardinalities in the
hypergraph.
:returns: resu... | [
"Returns",
"the",
"result",
"of",
"a",
"function",
"F",
"applied",
"to",
"the",
"set",
"of",
"cardinalities",
"of",
"hyperedge",
"tails",
"in",
"the",
"hypergraph",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/directed_statistics.py#L170-L186 |
13,956 | Murali-group/halp | halp/utilities/directed_statistics.py | _F_hyperedge_head_cardinality | def _F_hyperedge_head_cardinality(H, F):
"""Returns the result of a function F applied to the set of cardinalities
of hyperedge heads in the hypergraph.
:param H: the hypergraph whose head cardinalities will be
operated on.
:param F: function to execute on the set of cardinalities i... | python | def _F_hyperedge_head_cardinality(H, F):
"""Returns the result of a function F applied to the set of cardinalities
of hyperedge heads in the hypergraph.
:param H: the hypergraph whose head cardinalities will be
operated on.
:param F: function to execute on the set of cardinalities i... | [
"def",
"_F_hyperedge_head_cardinality",
"(",
"H",
",",
"F",
")",
":",
"if",
"not",
"isinstance",
"(",
"H",
",",
"DirectedHypergraph",
")",
":",
"raise",
"TypeError",
"(",
"\"Algorithm only applicable to directed hypergraphs\"",
")",
"return",
"F",
"(",
"[",
"len",... | Returns the result of a function F applied to the set of cardinalities
of hyperedge heads in the hypergraph.
:param H: the hypergraph whose head cardinalities will be
operated on.
:param F: function to execute on the set of cardinalities in the
hypergraph.
:returns: resu... | [
"Returns",
"the",
"result",
"of",
"a",
"function",
"F",
"applied",
"to",
"the",
"set",
"of",
"cardinalities",
"of",
"hyperedge",
"heads",
"in",
"the",
"hypergraph",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/directed_statistics.py#L240-L256 |
13,957 | Murali-group/halp | halp/utilities/undirected_matrices.py | get_hyperedge_weight_matrix | def get_hyperedge_weight_matrix(H, hyperedge_ids_to_indices):
"""Creates the diagonal matrix W of hyperedge weights as a sparse matrix.
:param H: the hypergraph to find the weights.
:param hyperedge_weights: the mapping from the indices of hyperedge IDs to
the corresponding hype... | python | def get_hyperedge_weight_matrix(H, hyperedge_ids_to_indices):
"""Creates the diagonal matrix W of hyperedge weights as a sparse matrix.
:param H: the hypergraph to find the weights.
:param hyperedge_weights: the mapping from the indices of hyperedge IDs to
the corresponding hype... | [
"def",
"get_hyperedge_weight_matrix",
"(",
"H",
",",
"hyperedge_ids_to_indices",
")",
":",
"# Combined 2 methods into 1; this could be written better",
"hyperedge_weights",
"=",
"{",
"}",
"for",
"hyperedge_id",
"in",
"H",
".",
"hyperedge_id_iterator",
"(",
")",
":",
"hype... | Creates the diagonal matrix W of hyperedge weights as a sparse matrix.
:param H: the hypergraph to find the weights.
:param hyperedge_weights: the mapping from the indices of hyperedge IDs to
the corresponding hyperedge weights.
:returns: sparse.csc_matrix -- the diagonal edge w... | [
"Creates",
"the",
"diagonal",
"matrix",
"W",
"of",
"hyperedge",
"weights",
"as",
"a",
"sparse",
"matrix",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/undirected_matrices.py#L103-L123 |
13,958 | Murali-group/halp | halp/utilities/undirected_matrices.py | get_hyperedge_degree_matrix | def get_hyperedge_degree_matrix(M):
"""Creates the diagonal matrix of hyperedge degrees D_e as a sparse matrix,
where a hyperedge degree is the cardinality of the hyperedge.
:param M: the incidence matrix of the hypergraph to find the D_e matrix on.
:returns: sparse.csc_matrix -- the diagonal hyperedge... | python | def get_hyperedge_degree_matrix(M):
"""Creates the diagonal matrix of hyperedge degrees D_e as a sparse matrix,
where a hyperedge degree is the cardinality of the hyperedge.
:param M: the incidence matrix of the hypergraph to find the D_e matrix on.
:returns: sparse.csc_matrix -- the diagonal hyperedge... | [
"def",
"get_hyperedge_degree_matrix",
"(",
"M",
")",
":",
"degrees",
"=",
"M",
".",
"sum",
"(",
"0",
")",
".",
"transpose",
"(",
")",
"new_degree",
"=",
"[",
"]",
"for",
"degree",
"in",
"degrees",
":",
"new_degree",
".",
"append",
"(",
"int",
"(",
"d... | Creates the diagonal matrix of hyperedge degrees D_e as a sparse matrix,
where a hyperedge degree is the cardinality of the hyperedge.
:param M: the incidence matrix of the hypergraph to find the D_e matrix on.
:returns: sparse.csc_matrix -- the diagonal hyperedge degree matrix as a
sparse matr... | [
"Creates",
"the",
"diagonal",
"matrix",
"of",
"hyperedge",
"degrees",
"D_e",
"as",
"a",
"sparse",
"matrix",
"where",
"a",
"hyperedge",
"degree",
"is",
"the",
"cardinality",
"of",
"the",
"hyperedge",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/undirected_matrices.py#L126-L140 |
13,959 | Murali-group/halp | halp/utilities/undirected_matrices.py | fast_inverse | def fast_inverse(M):
"""Computes the inverse of a diagonal matrix.
:param H: the diagonal matrix to find the inverse of.
:returns: sparse.csc_matrix -- the inverse of the input matrix as a
sparse matrix.
"""
diags = M.diagonal()
new_diag = []
for value in diags:
new_dia... | python | def fast_inverse(M):
"""Computes the inverse of a diagonal matrix.
:param H: the diagonal matrix to find the inverse of.
:returns: sparse.csc_matrix -- the inverse of the input matrix as a
sparse matrix.
"""
diags = M.diagonal()
new_diag = []
for value in diags:
new_dia... | [
"def",
"fast_inverse",
"(",
"M",
")",
":",
"diags",
"=",
"M",
".",
"diagonal",
"(",
")",
"new_diag",
"=",
"[",
"]",
"for",
"value",
"in",
"diags",
":",
"new_diag",
".",
"append",
"(",
"1.0",
"/",
"value",
")",
"return",
"sparse",
".",
"diags",
"(",... | Computes the inverse of a diagonal matrix.
:param H: the diagonal matrix to find the inverse of.
:returns: sparse.csc_matrix -- the inverse of the input matrix as a
sparse matrix. | [
"Computes",
"the",
"inverse",
"of",
"a",
"diagonal",
"matrix",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/undirected_matrices.py#L143-L156 |
13,960 | Murali-group/halp | halp/signaling_hypergraph.py | node_iterator | def node_iterator(self):
"""Provides an iterator over the nodes.
"""
return iter(self._node_attributes)
def has_hypernode(self, hypernode):
"""Determines if a specific hypernode is present in the hypergraph.
:param node: reference to hypernode whose presence is being checked.... | python | def node_iterator(self):
"""Provides an iterator over the nodes.
"""
return iter(self._node_attributes)
def has_hypernode(self, hypernode):
"""Determines if a specific hypernode is present in the hypergraph.
:param node: reference to hypernode whose presence is being checked.... | [
"def",
"node_iterator",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"_node_attributes",
")",
"def",
"has_hypernode",
"(",
"self",
",",
"hypernode",
")",
":",
"\"\"\"Determines if a specific hypernode is present in the hypergraph.\n\n :param node: refer... | Provides an iterator over the nodes. | [
"Provides",
"an",
"iterator",
"over",
"the",
"nodes",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/signaling_hypergraph.py#L243-L256 |
13,961 | Murali-group/halp | halp/signaling_hypergraph.py | add_hypernode | def add_hypernode(self, hypernode, composing_nodes=set(), attr_dict=None, **attr):
"""Adds a hypernode to the graph, along with any related attributes
of the hypernode.
:param hypernode: reference to the hypernode being added.
:param nodes: reference to the set of nodes that compose
... | python | def add_hypernode(self, hypernode, composing_nodes=set(), attr_dict=None, **attr):
"""Adds a hypernode to the graph, along with any related attributes
of the hypernode.
:param hypernode: reference to the hypernode being added.
:param nodes: reference to the set of nodes that compose
... | [
"def",
"add_hypernode",
"(",
"self",
",",
"hypernode",
",",
"composing_nodes",
"=",
"set",
"(",
")",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr... | Adds a hypernode to the graph, along with any related attributes
of the hypernode.
:param hypernode: reference to the hypernode being added.
:param nodes: reference to the set of nodes that compose
the hypernode.
:param in_hypernodes: set of references to the hypernodes th... | [
"Adds",
"a",
"hypernode",
"to",
"the",
"graph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"hypernode",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/signaling_hypergraph.py#L305-L344 |
13,962 | Murali-group/halp | halp/algorithms/undirected_partitioning.py | _create_random_starter | def _create_random_starter(node_count):
"""Creates the random starter for the random walk.
:param node_count: number of nodes to create the random vector.
:returns: list -- list of starting probabilities for each node.
"""
pi = np.zeros(node_count, dtype=float)
for i in range(node_count):
... | python | def _create_random_starter(node_count):
"""Creates the random starter for the random walk.
:param node_count: number of nodes to create the random vector.
:returns: list -- list of starting probabilities for each node.
"""
pi = np.zeros(node_count, dtype=float)
for i in range(node_count):
... | [
"def",
"_create_random_starter",
"(",
"node_count",
")",
":",
"pi",
"=",
"np",
".",
"zeros",
"(",
"node_count",
",",
"dtype",
"=",
"float",
")",
"for",
"i",
"in",
"range",
"(",
"node_count",
")",
":",
"pi",
"[",
"i",
"]",
"=",
"random",
".",
"random"... | Creates the random starter for the random walk.
:param node_count: number of nodes to create the random vector.
:returns: list -- list of starting probabilities for each node. | [
"Creates",
"the",
"random",
"starter",
"for",
"the",
"random",
"walk",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/algorithms/undirected_partitioning.py#L188-L202 |
13,963 | Murali-group/halp | halp/algorithms/undirected_partitioning.py | _has_converged | def _has_converged(pi_star, pi):
"""Checks if the random walk has converged.
:param pi_star: the new vector
:param pi: the old vector
:returns: bool-- True iff pi has converged.
"""
node_count = pi.shape[0]
EPS = 10e-6
for i in range(node_count):
if pi[i] - pi_star[i] > EPS:
... | python | def _has_converged(pi_star, pi):
"""Checks if the random walk has converged.
:param pi_star: the new vector
:param pi: the old vector
:returns: bool-- True iff pi has converged.
"""
node_count = pi.shape[0]
EPS = 10e-6
for i in range(node_count):
if pi[i] - pi_star[i] > EPS:
... | [
"def",
"_has_converged",
"(",
"pi_star",
",",
"pi",
")",
":",
"node_count",
"=",
"pi",
".",
"shape",
"[",
"0",
"]",
"EPS",
"=",
"10e-6",
"for",
"i",
"in",
"range",
"(",
"node_count",
")",
":",
"if",
"pi",
"[",
"i",
"]",
"-",
"pi_star",
"[",
"i",
... | Checks if the random walk has converged.
:param pi_star: the new vector
:param pi: the old vector
:returns: bool-- True iff pi has converged. | [
"Checks",
"if",
"the",
"random",
"walk",
"has",
"converged",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/algorithms/undirected_partitioning.py#L205-L219 |
13,964 | Murali-group/halp | halp/utilities/priority_queue.py | PriorityQueue.add_element | def add_element(self, priority, element, count=None):
"""Adds an element with a specific priority.
:param priority: priority of the element.
:param element: element to add.
"""
if count is None:
count = next(self.counter)
entry = [priority, count, element]
... | python | def add_element(self, priority, element, count=None):
"""Adds an element with a specific priority.
:param priority: priority of the element.
:param element: element to add.
"""
if count is None:
count = next(self.counter)
entry = [priority, count, element]
... | [
"def",
"add_element",
"(",
"self",
",",
"priority",
",",
"element",
",",
"count",
"=",
"None",
")",
":",
"if",
"count",
"is",
"None",
":",
"count",
"=",
"next",
"(",
"self",
".",
"counter",
")",
"entry",
"=",
"[",
"priority",
",",
"count",
",",
"el... | Adds an element with a specific priority.
:param priority: priority of the element.
:param element: element to add. | [
"Adds",
"an",
"element",
"with",
"a",
"specific",
"priority",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/priority_queue.py#L41-L52 |
13,965 | Murali-group/halp | halp/utilities/priority_queue.py | PriorityQueue.reprioritize | def reprioritize(self, priority, element):
"""Updates the priority of an element.
:raises: ValueError -- No such element in the priority queue.
"""
if element not in self.element_finder:
raise ValueError("No such element in the priority queue.")
entry = self.element... | python | def reprioritize(self, priority, element):
"""Updates the priority of an element.
:raises: ValueError -- No such element in the priority queue.
"""
if element not in self.element_finder:
raise ValueError("No such element in the priority queue.")
entry = self.element... | [
"def",
"reprioritize",
"(",
"self",
",",
"priority",
",",
"element",
")",
":",
"if",
"element",
"not",
"in",
"self",
".",
"element_finder",
":",
"raise",
"ValueError",
"(",
"\"No such element in the priority queue.\"",
")",
"entry",
"=",
"self",
".",
"element_fi... | Updates the priority of an element.
:raises: ValueError -- No such element in the priority queue. | [
"Updates",
"the",
"priority",
"of",
"an",
"element",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/priority_queue.py#L79-L89 |
13,966 | Murali-group/halp | halp/utilities/priority_queue.py | PriorityQueue.contains_element | def contains_element(self, element):
"""Determines if an element is contained in the priority queue."
:returns: bool -- true iff element is in the priority queue.
"""
return (element in self.element_finder) and \
(self.element_finder[element][1] != self.INVALID) | python | def contains_element(self, element):
"""Determines if an element is contained in the priority queue."
:returns: bool -- true iff element is in the priority queue.
"""
return (element in self.element_finder) and \
(self.element_finder[element][1] != self.INVALID) | [
"def",
"contains_element",
"(",
"self",
",",
"element",
")",
":",
"return",
"(",
"element",
"in",
"self",
".",
"element_finder",
")",
"and",
"(",
"self",
".",
"element_finder",
"[",
"element",
"]",
"[",
"1",
"]",
"!=",
"self",
".",
"INVALID",
")"
] | Determines if an element is contained in the priority queue."
:returns: bool -- true iff element is in the priority queue. | [
"Determines",
"if",
"an",
"element",
"is",
"contained",
"in",
"the",
"priority",
"queue",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/priority_queue.py#L102-L109 |
13,967 | Murali-group/halp | halp/utilities/priority_queue.py | PriorityQueue.is_empty | def is_empty(self):
"""Determines if the priority queue has any elements.
Performs removal of any elements that were "marked-as-invalid".
:returns: true iff the priority queue has no elements.
"""
while self.pq:
if self.pq[0][1] != self.INVALID:
retu... | python | def is_empty(self):
"""Determines if the priority queue has any elements.
Performs removal of any elements that were "marked-as-invalid".
:returns: true iff the priority queue has no elements.
"""
while self.pq:
if self.pq[0][1] != self.INVALID:
retu... | [
"def",
"is_empty",
"(",
"self",
")",
":",
"while",
"self",
".",
"pq",
":",
"if",
"self",
".",
"pq",
"[",
"0",
"]",
"[",
"1",
"]",
"!=",
"self",
".",
"INVALID",
":",
"return",
"False",
"else",
":",
"_",
",",
"_",
",",
"element",
"=",
"heapq",
... | Determines if the priority queue has any elements.
Performs removal of any elements that were "marked-as-invalid".
:returns: true iff the priority queue has no elements. | [
"Determines",
"if",
"the",
"priority",
"queue",
"has",
"any",
"elements",
".",
"Performs",
"removal",
"of",
"any",
"elements",
"that",
"were",
"marked",
"-",
"as",
"-",
"invalid",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/priority_queue.py#L111-L125 |
13,968 | Murali-group/halp | halp/algorithms/directed_paths.py | is_connected | def is_connected(H, source_node, target_node):
"""Checks if a target node is connected to a source node. That is,
this method determines if a target node can be visited from the source
node in the sense of the 'Visit' algorithm.
Refer to 'visit's documentation for more details.
:param H: the hyper... | python | def is_connected(H, source_node, target_node):
"""Checks if a target node is connected to a source node. That is,
this method determines if a target node can be visited from the source
node in the sense of the 'Visit' algorithm.
Refer to 'visit's documentation for more details.
:param H: the hyper... | [
"def",
"is_connected",
"(",
"H",
",",
"source_node",
",",
"target_node",
")",
":",
"visited_nodes",
",",
"Pv",
",",
"Pe",
"=",
"visit",
"(",
"H",
",",
"source_node",
")",
"return",
"target_node",
"in",
"visited_nodes"
] | Checks if a target node is connected to a source node. That is,
this method determines if a target node can be visited from the source
node in the sense of the 'Visit' algorithm.
Refer to 'visit's documentation for more details.
:param H: the hypergraph to check connectedness on.
:param source_nod... | [
"Checks",
"if",
"a",
"target",
"node",
"is",
"connected",
"to",
"a",
"source",
"node",
".",
"That",
"is",
"this",
"method",
"determines",
"if",
"a",
"target",
"node",
"can",
"be",
"visited",
"from",
"the",
"source",
"node",
"in",
"the",
"sense",
"of",
... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/algorithms/directed_paths.py#L84-L98 |
13,969 | Murali-group/halp | halp/algorithms/directed_paths.py | is_b_connected | def is_b_connected(H, source_node, target_node):
"""Checks if a target node is B-connected to a source node.
A node t is B-connected to a node s iff:
- t is s, or
- there exists an edge in the backward star of t such that all nodes in
the tail of that edge are B-connected to s
... | python | def is_b_connected(H, source_node, target_node):
"""Checks if a target node is B-connected to a source node.
A node t is B-connected to a node s iff:
- t is s, or
- there exists an edge in the backward star of t such that all nodes in
the tail of that edge are B-connected to s
... | [
"def",
"is_b_connected",
"(",
"H",
",",
"source_node",
",",
"target_node",
")",
":",
"b_visited_nodes",
",",
"Pv",
",",
"Pe",
",",
"v",
"=",
"b_visit",
"(",
"H",
",",
"source_node",
")",
"return",
"target_node",
"in",
"b_visited_nodes"
] | Checks if a target node is B-connected to a source node.
A node t is B-connected to a node s iff:
- t is s, or
- there exists an edge in the backward star of t such that all nodes in
the tail of that edge are B-connected to s
In other words, this method determines if a target node ... | [
"Checks",
"if",
"a",
"target",
"node",
"is",
"B",
"-",
"connected",
"to",
"a",
"source",
"node",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/algorithms/directed_paths.py#L215-L234 |
13,970 | Murali-group/halp | halp/algorithms/directed_paths.py | is_f_connected | def is_f_connected(H, source_node, target_node):
"""Checks if a target node is F-connected to a source node.
A node t is F-connected to a node s iff s if B-connected to t.
Refer to 'f_visit's or 'is_b_connected's documentation for more details.
:param H: the hypergraph to check F-connectedness on.
... | python | def is_f_connected(H, source_node, target_node):
"""Checks if a target node is F-connected to a source node.
A node t is F-connected to a node s iff s if B-connected to t.
Refer to 'f_visit's or 'is_b_connected's documentation for more details.
:param H: the hypergraph to check F-connectedness on.
... | [
"def",
"is_f_connected",
"(",
"H",
",",
"source_node",
",",
"target_node",
")",
":",
"f_visited_nodes",
",",
"Pv",
",",
"Pe",
",",
"v",
"=",
"f_visit",
"(",
"H",
",",
"source_node",
")",
"return",
"target_node",
"in",
"f_visited_nodes"
] | Checks if a target node is F-connected to a source node.
A node t is F-connected to a node s iff s if B-connected to t.
Refer to 'f_visit's or 'is_b_connected's documentation for more details.
:param H: the hypergraph to check F-connectedness on.
:param source_node: the node to check F-connectedness t... | [
"Checks",
"if",
"a",
"target",
"node",
"is",
"F",
"-",
"connected",
"to",
"a",
"source",
"node",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/algorithms/directed_paths.py#L263-L276 |
13,971 | Murali-group/halp | halp/utilities/undirected_graph_transformations.py | from_networkx_graph | def from_networkx_graph(nx_graph):
"""Returns an UndirectedHypergraph object that is the graph equivalent of
the given NetworkX Graph object.
:param nx_graph: the NetworkX undirected graph object to transform.
:returns: UndirectedHypergraph -- H object equivalent to the
NetworkX undirected ... | python | def from_networkx_graph(nx_graph):
"""Returns an UndirectedHypergraph object that is the graph equivalent of
the given NetworkX Graph object.
:param nx_graph: the NetworkX undirected graph object to transform.
:returns: UndirectedHypergraph -- H object equivalent to the
NetworkX undirected ... | [
"def",
"from_networkx_graph",
"(",
"nx_graph",
")",
":",
"import",
"networkx",
"as",
"nx",
"if",
"not",
"isinstance",
"(",
"nx_graph",
",",
"nx",
".",
"Graph",
")",
":",
"raise",
"TypeError",
"(",
"\"Transformation only applicable to undirected \\\n ... | Returns an UndirectedHypergraph object that is the graph equivalent of
the given NetworkX Graph object.
:param nx_graph: the NetworkX undirected graph object to transform.
:returns: UndirectedHypergraph -- H object equivalent to the
NetworkX undirected graph.
:raises: TypeError -- Transform... | [
"Returns",
"an",
"UndirectedHypergraph",
"object",
"that",
"is",
"the",
"graph",
"equivalent",
"of",
"the",
"given",
"NetworkX",
"Graph",
"object",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/undirected_graph_transformations.py#L81-L107 |
13,972 | Murali-group/halp | halp/utilities/directed_graph_transformations.py | from_networkx_digraph | def from_networkx_digraph(nx_digraph):
"""Returns a DirectedHypergraph object that is the graph equivalent of the
given NetworkX DiGraph object.
:param nx_digraph: the NetworkX directed graph object to transform.
:returns: DirectedHypergraph -- hypergraph object equivalent to the
NetworkX d... | python | def from_networkx_digraph(nx_digraph):
"""Returns a DirectedHypergraph object that is the graph equivalent of the
given NetworkX DiGraph object.
:param nx_digraph: the NetworkX directed graph object to transform.
:returns: DirectedHypergraph -- hypergraph object equivalent to the
NetworkX d... | [
"def",
"from_networkx_digraph",
"(",
"nx_digraph",
")",
":",
"import",
"networkx",
"as",
"nx",
"if",
"not",
"isinstance",
"(",
"nx_digraph",
",",
"nx",
".",
"DiGraph",
")",
":",
"raise",
"TypeError",
"(",
"\"Transformation only applicable to directed \\\n ... | Returns a DirectedHypergraph object that is the graph equivalent of the
given NetworkX DiGraph object.
:param nx_digraph: the NetworkX directed graph object to transform.
:returns: DirectedHypergraph -- hypergraph object equivalent to the
NetworkX directed graph.
:raises: TypeError -- Trans... | [
"Returns",
"a",
"DirectedHypergraph",
"object",
"that",
"is",
"the",
"graph",
"equivalent",
"of",
"the",
"given",
"NetworkX",
"DiGraph",
"object",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/directed_graph_transformations.py#L81-L110 |
13,973 | Murali-group/halp | halp/utilities/directed_matrices.py | get_tail_incidence_matrix | def get_tail_incidence_matrix(H, nodes_to_indices, hyperedge_ids_to_indices):
"""Creates the incidence matrix of the tail nodes of the given
hypergraph as a sparse matrix.
:param H: the hypergraph for which to create the incidence matrix of.
:param nodes_to_indices: for each node, maps the node to its
... | python | def get_tail_incidence_matrix(H, nodes_to_indices, hyperedge_ids_to_indices):
"""Creates the incidence matrix of the tail nodes of the given
hypergraph as a sparse matrix.
:param H: the hypergraph for which to create the incidence matrix of.
:param nodes_to_indices: for each node, maps the node to its
... | [
"def",
"get_tail_incidence_matrix",
"(",
"H",
",",
"nodes_to_indices",
",",
"hyperedge_ids_to_indices",
")",
":",
"if",
"not",
"isinstance",
"(",
"H",
",",
"DirectedHypergraph",
")",
":",
"raise",
"TypeError",
"(",
"\"Algorithm only applicable to directed hypergraphs\"",
... | Creates the incidence matrix of the tail nodes of the given
hypergraph as a sparse matrix.
:param H: the hypergraph for which to create the incidence matrix of.
:param nodes_to_indices: for each node, maps the node to its
corresponding integer index.
:param hyperedge_ids_to_... | [
"Creates",
"the",
"incidence",
"matrix",
"of",
"the",
"tail",
"nodes",
"of",
"the",
"given",
"hypergraph",
"as",
"a",
"sparse",
"matrix",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/utilities/directed_matrices.py#L59-L87 |
13,974 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.add_node | def add_node(self, node, attr_dict=None, **attr):
"""Adds a node to the graph, along with any related attributes
of the node.
:param node: reference to the node being added.
:param attr_dict: dictionary of attributes of the node.
:param attr: keyword arguments of attributes o... | python | def add_node(self, node, attr_dict=None, **attr):
"""Adds a node to the graph, along with any related attributes
of the node.
:param node: reference to the node being added.
:param attr_dict: dictionary of attributes of the node.
:param attr: keyword arguments of attributes o... | [
"def",
"add_node",
"(",
"self",
",",
"node",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr",
")",
"# If the node hasn't previously been added, add it alon... | Adds a node to the graph, along with any related attributes
of the node.
:param node: reference to the node being added.
:param attr_dict: dictionary of attributes of the node.
:param attr: keyword arguments of attributes of the node;
attr's values will override a... | [
"Adds",
"a",
"node",
"to",
"the",
"graph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"node",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L204-L234 |
13,975 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.add_nodes | def add_nodes(self, nodes, attr_dict=None, **attr):
"""Adds multiple nodes to the graph, along with any related attributes
of the nodes.
:param nodes: iterable container to either references of the nodes
OR tuples of (node reference, attribute dictionary);
... | python | def add_nodes(self, nodes, attr_dict=None, **attr):
"""Adds multiple nodes to the graph, along with any related attributes
of the nodes.
:param nodes: iterable container to either references of the nodes
OR tuples of (node reference, attribute dictionary);
... | [
"def",
"add_nodes",
"(",
"self",
",",
"nodes",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr",
")",
"for",
"node",
"in",
"nodes",
":",
"# Note: ... | Adds multiple nodes to the graph, along with any related attributes
of the nodes.
:param nodes: iterable container to either references of the nodes
OR tuples of (node reference, attribute dictionary);
if an attribute dictionary is provided in the tuple,
... | [
"Adds",
"multiple",
"nodes",
"to",
"the",
"graph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"nodes",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L236-L278 |
13,976 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.remove_node | def remove_node(self, node):
"""Removes a node and its attributes from the hypergraph. Removes
every hyperedge that contains this node in either the head or the tail.
:param node: reference to the node being added.
:raises: ValueError -- No such node exists.
Examples:
:... | python | def remove_node(self, node):
"""Removes a node and its attributes from the hypergraph. Removes
every hyperedge that contains this node in either the head or the tail.
:param node: reference to the node being added.
:raises: ValueError -- No such node exists.
Examples:
:... | [
"def",
"remove_node",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"self",
".",
"has_node",
"(",
"node",
")",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"# Remove every hyperedge which is in the forward star of the node",
"forward_star",
"="... | Removes a node and its attributes from the hypergraph. Removes
every hyperedge that contains this node in either the head or the tail.
:param node: reference to the node being added.
:raises: ValueError -- No such node exists.
Examples:
::
>>> H = DirectedHypergrap... | [
"Removes",
"a",
"node",
"and",
"its",
"attributes",
"from",
"the",
"hypergraph",
".",
"Removes",
"every",
"hyperedge",
"that",
"contains",
"this",
"node",
"in",
"either",
"the",
"head",
"or",
"the",
"tail",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L280-L315 |
13,977 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_node_attribute | def get_node_attribute(self, node, attribute_name):
"""Given a node and the name of an attribute, get a copy
of that node's attribute.
:param node: reference to the node to retrieve the attribute of.
:param attribute_name: name of the attribute to retrieve.
:returns: attribute v... | python | def get_node_attribute(self, node, attribute_name):
"""Given a node and the name of an attribute, get a copy
of that node's attribute.
:param node: reference to the node to retrieve the attribute of.
:param attribute_name: name of the attribute to retrieve.
:returns: attribute v... | [
"def",
"get_node_attribute",
"(",
"self",
",",
"node",
",",
"attribute_name",
")",
":",
"if",
"not",
"self",
".",
"has_node",
"(",
"node",
")",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"elif",
"attribute_name",
"not",
"in",
"self",
"... | Given a node and the name of an attribute, get a copy
of that node's attribute.
:param node: reference to the node to retrieve the attribute of.
:param attribute_name: name of the attribute to retrieve.
:returns: attribute value of the attribute_name key for the
specifie... | [
"Given",
"a",
"node",
"and",
"the",
"name",
"of",
"an",
"attribute",
"get",
"a",
"copy",
"of",
"that",
"node",
"s",
"attribute",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L420-L438 |
13,978 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_node_attributes | def get_node_attributes(self, node):
"""Given a node, get a dictionary with copies of that node's
attributes.
:param node: reference to the node to retrieve the attributes of.
:returns: dict -- copy of each attribute of the specified node.
:raises: ValueError -- No such node exi... | python | def get_node_attributes(self, node):
"""Given a node, get a dictionary with copies of that node's
attributes.
:param node: reference to the node to retrieve the attributes of.
:returns: dict -- copy of each attribute of the specified node.
:raises: ValueError -- No such node exi... | [
"def",
"get_node_attributes",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"self",
".",
"has_node",
"(",
"node",
")",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"attributes",
"=",
"{",
"}",
"for",
"attr_name",
",",
"attr_value",
... | Given a node, get a dictionary with copies of that node's
attributes.
:param node: reference to the node to retrieve the attributes of.
:returns: dict -- copy of each attribute of the specified node.
:raises: ValueError -- No such node exists. | [
"Given",
"a",
"node",
"get",
"a",
"dictionary",
"with",
"copies",
"of",
"that",
"node",
"s",
"attributes",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L440-L454 |
13,979 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.add_hyperedge | def add_hyperedge(self, tail, head, attr_dict=None, **attr):
"""Adds a hyperedge to the hypergraph, along with any related
attributes of the hyperedge.
This method will automatically add any node from the tail and
head that was not in the hypergraph.
A hyperedge without a "weight... | python | def add_hyperedge(self, tail, head, attr_dict=None, **attr):
"""Adds a hyperedge to the hypergraph, along with any related
attributes of the hyperedge.
This method will automatically add any node from the tail and
head that was not in the hypergraph.
A hyperedge without a "weight... | [
"def",
"add_hyperedge",
"(",
"self",
",",
"tail",
",",
"head",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr",
")",
"# Don't allow both empty tail and... | Adds a hyperedge to the hypergraph, along with any related
attributes of the hyperedge.
This method will automatically add any node from the tail and
head that was not in the hypergraph.
A hyperedge without a "weight" attribute specified will be
assigned the default value of 1.
... | [
"Adds",
"a",
"hyperedge",
"to",
"the",
"hypergraph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"hyperedge",
".",
"This",
"method",
"will",
"automatically",
"add",
"any",
"node",
"from",
"the",
"tail",
"and",
"head",
"that",
"was",
"not",
... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L465-L548 |
13,980 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.add_hyperedges | def add_hyperedges(self, hyperedges, attr_dict=None, **attr):
"""Adds multiple hyperedges to the graph, along with any related
attributes of the hyperedges.
If any node in the tail or head of any hyperedge has not
previously been added to the hypergraph, it will automatically... | python | def add_hyperedges(self, hyperedges, attr_dict=None, **attr):
"""Adds multiple hyperedges to the graph, along with any related
attributes of the hyperedges.
If any node in the tail or head of any hyperedge has not
previously been added to the hypergraph, it will automatically... | [
"def",
"add_hyperedges",
"(",
"self",
",",
"hyperedges",
",",
"attr_dict",
"=",
"None",
",",
"*",
"*",
"attr",
")",
":",
"attr_dict",
"=",
"self",
".",
"_combine_attribute_arguments",
"(",
"attr_dict",
",",
"attr",
")",
"hyperedge_ids",
"=",
"[",
"]",
"for... | Adds multiple hyperedges to the graph, along with any related
attributes of the hyperedges.
If any node in the tail or head of any hyperedge has not
previously been added to the hypergraph, it will automatically
be added here. Hyperedges without a "weight" attribute speci... | [
"Adds",
"multiple",
"hyperedges",
"to",
"the",
"graph",
"along",
"with",
"any",
"related",
"attributes",
"of",
"the",
"hyperedges",
".",
"If",
"any",
"node",
"in",
"the",
"tail",
"or",
"head",
"of",
"any",
"hyperedge",
"has",
"not",
"previously",
"been",
"... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L550-L606 |
13,981 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_hyperedge_id | def get_hyperedge_id(self, tail, head):
"""From a tail and head set of nodes, returns the ID of the hyperedge
that these sets comprise.
:param tail: iterable container of references to nodes in the
tail of the hyperedge to be added
:param head: iterable container of ... | python | def get_hyperedge_id(self, tail, head):
"""From a tail and head set of nodes, returns the ID of the hyperedge
that these sets comprise.
:param tail: iterable container of references to nodes in the
tail of the hyperedge to be added
:param head: iterable container of ... | [
"def",
"get_hyperedge_id",
"(",
"self",
",",
"tail",
",",
"head",
")",
":",
"frozen_tail",
"=",
"frozenset",
"(",
"tail",
")",
"frozen_head",
"=",
"frozenset",
"(",
"head",
")",
"if",
"not",
"self",
".",
"has_hyperedge",
"(",
"frozen_tail",
",",
"frozen_he... | From a tail and head set of nodes, returns the ID of the hyperedge
that these sets comprise.
:param tail: iterable container of references to nodes in the
tail of the hyperedge to be added
:param head: iterable container of references to nodes in the
head... | [
"From",
"a",
"tail",
"and",
"head",
"set",
"of",
"nodes",
"returns",
"the",
"ID",
"of",
"the",
"hyperedge",
"that",
"these",
"sets",
"comprise",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L724-L753 |
13,982 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_forward_star | def get_forward_star(self, node):
"""Given a node, get a copy of that node's forward star.
:param node: node to retrieve the forward-star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's forward star.
:raises: ValueError -- No such node ... | python | def get_forward_star(self, node):
"""Given a node, get a copy of that node's forward star.
:param node: node to retrieve the forward-star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's forward star.
:raises: ValueError -- No such node ... | [
"def",
"get_forward_star",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"not",
"in",
"self",
".",
"_node_attributes",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"return",
"self",
".",
"_forward_star",
"[",
"node",
"]",
".",
"copy"... | Given a node, get a copy of that node's forward star.
:param node: node to retrieve the forward-star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's forward star.
:raises: ValueError -- No such node exists. | [
"Given",
"a",
"node",
"get",
"a",
"copy",
"of",
"that",
"node",
"s",
"forward",
"star",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L833-L844 |
13,983 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_backward_star | def get_backward_star(self, node):
"""Given a node, get a copy of that node's backward star.
:param node: node to retrieve the backward-star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's backward star.
:raises: ValueError -- No such node exis... | python | def get_backward_star(self, node):
"""Given a node, get a copy of that node's backward star.
:param node: node to retrieve the backward-star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's backward star.
:raises: ValueError -- No such node exis... | [
"def",
"get_backward_star",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
"not",
"in",
"self",
".",
"_node_attributes",
":",
"raise",
"ValueError",
"(",
"\"No such node exists.\"",
")",
"return",
"self",
".",
"_backward_star",
"[",
"node",
"]",
".",
"cop... | Given a node, get a copy of that node's backward star.
:param node: node to retrieve the backward-star of.
:returns: set -- set of hyperedge_ids for the hyperedges
in the node's backward star.
:raises: ValueError -- No such node exists. | [
"Given",
"a",
"node",
"get",
"a",
"copy",
"of",
"that",
"node",
"s",
"backward",
"star",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L846-L857 |
13,984 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_successors | def get_successors(self, tail):
"""Given a tail set of nodes, get a list of edges of which the node
set is the tail of each edge.
:param tail: set of nodes that correspond to the tails of some
(possibly empty) set of edges.
:returns: set -- hyperedge_ids of the h... | python | def get_successors(self, tail):
"""Given a tail set of nodes, get a list of edges of which the node
set is the tail of each edge.
:param tail: set of nodes that correspond to the tails of some
(possibly empty) set of edges.
:returns: set -- hyperedge_ids of the h... | [
"def",
"get_successors",
"(",
"self",
",",
"tail",
")",
":",
"frozen_tail",
"=",
"frozenset",
"(",
"tail",
")",
"# If this node set isn't any tail in the hypergraph, then it has",
"# no successors; thus, return an empty list",
"if",
"frozen_tail",
"not",
"in",
"self",
".",
... | Given a tail set of nodes, get a list of edges of which the node
set is the tail of each edge.
:param tail: set of nodes that correspond to the tails of some
(possibly empty) set of edges.
:returns: set -- hyperedge_ids of the hyperedges that have tail
in... | [
"Given",
"a",
"tail",
"set",
"of",
"nodes",
"get",
"a",
"list",
"of",
"edges",
"of",
"which",
"the",
"node",
"set",
"is",
"the",
"tail",
"of",
"each",
"edge",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L859-L875 |
13,985 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_predecessors | def get_predecessors(self, head):
"""Given a head set of nodes, get a list of edges of which the node set
is the head of each edge.
:param head: set of nodes that correspond to the heads of some
(possibly empty) set of edges.
:returns: set -- hyperedge_ids of the... | python | def get_predecessors(self, head):
"""Given a head set of nodes, get a list of edges of which the node set
is the head of each edge.
:param head: set of nodes that correspond to the heads of some
(possibly empty) set of edges.
:returns: set -- hyperedge_ids of the... | [
"def",
"get_predecessors",
"(",
"self",
",",
"head",
")",
":",
"frozen_head",
"=",
"frozenset",
"(",
"head",
")",
"# If this node set isn't any head in the hypergraph, then it has",
"# no predecessors; thus, return an empty list",
"if",
"frozen_head",
"not",
"in",
"self",
"... | Given a head set of nodes, get a list of edges of which the node set
is the head of each edge.
:param head: set of nodes that correspond to the heads of some
(possibly empty) set of edges.
:returns: set -- hyperedge_ids of the hyperedges that have head
in... | [
"Given",
"a",
"head",
"set",
"of",
"nodes",
"get",
"a",
"list",
"of",
"edges",
"of",
"which",
"the",
"node",
"set",
"is",
"the",
"head",
"of",
"each",
"edge",
"."
] | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L877-L892 |
13,986 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.is_BF_hypergraph | def is_BF_hypergraph(self):
"""Indicates whether the hypergraph is a BF-hypergraph.
A BF-hypergraph consists of only B-hyperedges and F-hyperedges.
See "is_B_hypergraph" or "is_F_hypergraph" for more details.
:returns: bool -- True iff the hypergraph is an F-hypergraph.
"""
... | python | def is_BF_hypergraph(self):
"""Indicates whether the hypergraph is a BF-hypergraph.
A BF-hypergraph consists of only B-hyperedges and F-hyperedges.
See "is_B_hypergraph" or "is_F_hypergraph" for more details.
:returns: bool -- True iff the hypergraph is an F-hypergraph.
"""
... | [
"def",
"is_BF_hypergraph",
"(",
"self",
")",
":",
"for",
"hyperedge_id",
"in",
"self",
".",
"_hyperedge_attributes",
":",
"tail",
"=",
"self",
".",
"get_hyperedge_tail",
"(",
"hyperedge_id",
")",
"head",
"=",
"self",
".",
"get_hyperedge_head",
"(",
"hyperedge_id... | Indicates whether the hypergraph is a BF-hypergraph.
A BF-hypergraph consists of only B-hyperedges and F-hyperedges.
See "is_B_hypergraph" or "is_F_hypergraph" for more details.
:returns: bool -- True iff the hypergraph is an F-hypergraph. | [
"Indicates",
"whether",
"the",
"hypergraph",
"is",
"a",
"BF",
"-",
"hypergraph",
".",
"A",
"BF",
"-",
"hypergraph",
"consists",
"of",
"only",
"B",
"-",
"hyperedges",
"and",
"F",
"-",
"hyperedges",
".",
"See",
"is_B_hypergraph",
"or",
"is_F_hypergraph",
"for"... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L928-L941 |
13,987 | Murali-group/halp | halp/directed_hypergraph.py | DirectedHypergraph.get_induced_subhypergraph | def get_induced_subhypergraph(self, nodes):
"""Gives a new hypergraph that is the subhypergraph of the current
hypergraph induced by the provided set of nodes. That is, the induced
subhypergraph's node set corresponds precisely to the nodes provided,
and the coressponding hyperedges in t... | python | def get_induced_subhypergraph(self, nodes):
"""Gives a new hypergraph that is the subhypergraph of the current
hypergraph induced by the provided set of nodes. That is, the induced
subhypergraph's node set corresponds precisely to the nodes provided,
and the coressponding hyperedges in t... | [
"def",
"get_induced_subhypergraph",
"(",
"self",
",",
"nodes",
")",
":",
"sub_H",
"=",
"self",
".",
"copy",
"(",
")",
"sub_H",
".",
"remove_nodes",
"(",
"sub_H",
".",
"get_node_set",
"(",
")",
"-",
"set",
"(",
"nodes",
")",
")",
"return",
"sub_H"
] | Gives a new hypergraph that is the subhypergraph of the current
hypergraph induced by the provided set of nodes. That is, the induced
subhypergraph's node set corresponds precisely to the nodes provided,
and the coressponding hyperedges in the subhypergraph are only those
from the origin... | [
"Gives",
"a",
"new",
"hypergraph",
"that",
"is",
"the",
"subhypergraph",
"of",
"the",
"current",
"hypergraph",
"induced",
"by",
"the",
"provided",
"set",
"of",
"nodes",
".",
"That",
"is",
"the",
"induced",
"subhypergraph",
"s",
"node",
"set",
"corresponds",
... | 6eb27466ba84e2281e18f93b62aae5efb21ef8b3 | https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L1046-L1061 |
13,988 | aio-libs/multidict | multidict/_multidict_py.py | _Base.getall | def getall(self, key, default=_marker):
"""Return a list of all values matching the key."""
identity = self._title(key)
res = [v for i, k, v in self._impl._items if i == identity]
if res:
return res
if not res and default is not _marker:
return default
... | python | def getall(self, key, default=_marker):
"""Return a list of all values matching the key."""
identity = self._title(key)
res = [v for i, k, v in self._impl._items if i == identity]
if res:
return res
if not res and default is not _marker:
return default
... | [
"def",
"getall",
"(",
"self",
",",
"key",
",",
"default",
"=",
"_marker",
")",
":",
"identity",
"=",
"self",
".",
"_title",
"(",
"key",
")",
"res",
"=",
"[",
"v",
"for",
"i",
",",
"k",
",",
"v",
"in",
"self",
".",
"_impl",
".",
"_items",
"if",
... | Return a list of all values matching the key. | [
"Return",
"a",
"list",
"of",
"all",
"values",
"matching",
"the",
"key",
"."
] | 1ecfa942cf6ae79727711a109e1f46ed24fae07f | https://github.com/aio-libs/multidict/blob/1ecfa942cf6ae79727711a109e1f46ed24fae07f/multidict/_multidict_py.py#L64-L72 |
13,989 | aio-libs/multidict | multidict/_multidict_py.py | MultiDict.extend | def extend(self, *args, **kwargs):
"""Extend current MultiDict with more values.
This method must be used instead of update.
"""
self._extend(args, kwargs, 'extend', self._extend_items) | python | def extend(self, *args, **kwargs):
"""Extend current MultiDict with more values.
This method must be used instead of update.
"""
self._extend(args, kwargs, 'extend', self._extend_items) | [
"def",
"extend",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_extend",
"(",
"args",
",",
"kwargs",
",",
"'extend'",
",",
"self",
".",
"_extend_items",
")"
] | Extend current MultiDict with more values.
This method must be used instead of update. | [
"Extend",
"current",
"MultiDict",
"with",
"more",
"values",
"."
] | 1ecfa942cf6ae79727711a109e1f46ed24fae07f | https://github.com/aio-libs/multidict/blob/1ecfa942cf6ae79727711a109e1f46ed24fae07f/multidict/_multidict_py.py#L218-L223 |
13,990 | aio-libs/multidict | multidict/_multidict_py.py | MultiDict.setdefault | def setdefault(self, key, default=None):
"""Return value for key, set value to default if key is not present."""
identity = self._title(key)
for i, k, v in self._impl._items:
if i == identity:
return v
self.add(key, default)
return default | python | def setdefault(self, key, default=None):
"""Return value for key, set value to default if key is not present."""
identity = self._title(key)
for i, k, v in self._impl._items:
if i == identity:
return v
self.add(key, default)
return default | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"identity",
"=",
"self",
".",
"_title",
"(",
"key",
")",
"for",
"i",
",",
"k",
",",
"v",
"in",
"self",
".",
"_impl",
".",
"_items",
":",
"if",
"i",
"==",
"iden... | Return value for key, set value to default if key is not present. | [
"Return",
"value",
"for",
"key",
"set",
"value",
"to",
"default",
"if",
"key",
"is",
"not",
"present",
"."
] | 1ecfa942cf6ae79727711a109e1f46ed24fae07f | https://github.com/aio-libs/multidict/blob/1ecfa942cf6ae79727711a109e1f46ed24fae07f/multidict/_multidict_py.py#L281-L288 |
13,991 | aio-libs/multidict | multidict/_multidict_py.py | MultiDict.popall | def popall(self, key, default=_marker):
"""Remove all occurrences of key and return the list of corresponding
values.
If key is not found, default is returned if given, otherwise
KeyError is raised.
"""
found = False
identity = self._title(key)
ret = []
... | python | def popall(self, key, default=_marker):
"""Remove all occurrences of key and return the list of corresponding
values.
If key is not found, default is returned if given, otherwise
KeyError is raised.
"""
found = False
identity = self._title(key)
ret = []
... | [
"def",
"popall",
"(",
"self",
",",
"key",
",",
"default",
"=",
"_marker",
")",
":",
"found",
"=",
"False",
"identity",
"=",
"self",
".",
"_title",
"(",
"key",
")",
"ret",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"... | Remove all occurrences of key and return the list of corresponding
values.
If key is not found, default is returned if given, otherwise
KeyError is raised. | [
"Remove",
"all",
"occurrences",
"of",
"key",
"and",
"return",
"the",
"list",
"of",
"corresponding",
"values",
"."
] | 1ecfa942cf6ae79727711a109e1f46ed24fae07f | https://github.com/aio-libs/multidict/blob/1ecfa942cf6ae79727711a109e1f46ed24fae07f/multidict/_multidict_py.py#L311-L336 |
13,992 | rootpy/rootpy | rootpy/stats/histfactory/histfactory.py | Data.total | def total(self, xbin1=1, xbin2=-2):
"""
Return the total yield and its associated statistical uncertainty.
"""
return self.hist.integral(xbin1=xbin1, xbin2=xbin2, error=True) | python | def total(self, xbin1=1, xbin2=-2):
"""
Return the total yield and its associated statistical uncertainty.
"""
return self.hist.integral(xbin1=xbin1, xbin2=xbin2, error=True) | [
"def",
"total",
"(",
"self",
",",
"xbin1",
"=",
"1",
",",
"xbin2",
"=",
"-",
"2",
")",
":",
"return",
"self",
".",
"hist",
".",
"integral",
"(",
"xbin1",
"=",
"xbin1",
",",
"xbin2",
"=",
"xbin2",
",",
"error",
"=",
"True",
")"
] | Return the total yield and its associated statistical uncertainty. | [
"Return",
"the",
"total",
"yield",
"and",
"its",
"associated",
"statistical",
"uncertainty",
"."
] | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/histfactory.py#L133-L137 |
13,993 | rootpy/rootpy | rootpy/stats/histfactory/histfactory.py | Sample.iter_sys | def iter_sys(self):
"""
Iterate over sys_name, overall_sys, histo_sys.
overall_sys or histo_sys may be None for any given sys_name.
"""
names = self.sys_names()
for name in names:
osys = self.GetOverallSys(name)
hsys = self.GetHistoSys(name)
... | python | def iter_sys(self):
"""
Iterate over sys_name, overall_sys, histo_sys.
overall_sys or histo_sys may be None for any given sys_name.
"""
names = self.sys_names()
for name in names:
osys = self.GetOverallSys(name)
hsys = self.GetHistoSys(name)
... | [
"def",
"iter_sys",
"(",
"self",
")",
":",
"names",
"=",
"self",
".",
"sys_names",
"(",
")",
"for",
"name",
"in",
"names",
":",
"osys",
"=",
"self",
".",
"GetOverallSys",
"(",
"name",
")",
"hsys",
"=",
"self",
".",
"GetHistoSys",
"(",
"name",
")",
"... | Iterate over sys_name, overall_sys, histo_sys.
overall_sys or histo_sys may be None for any given sys_name. | [
"Iterate",
"over",
"sys_name",
"overall_sys",
"histo_sys",
".",
"overall_sys",
"or",
"histo_sys",
"may",
"be",
"None",
"for",
"any",
"given",
"sys_name",
"."
] | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/histfactory.py#L260-L269 |
13,994 | rootpy/rootpy | rootpy/stats/histfactory/histfactory.py | Sample.sys_hist | def sys_hist(self, name=None):
"""
Return the effective low and high histogram for a given systematic.
If this sample does not contain the named systematic then return
the nominal histogram for both low and high variations.
"""
if name is None:
low = self.hist... | python | def sys_hist(self, name=None):
"""
Return the effective low and high histogram for a given systematic.
If this sample does not contain the named systematic then return
the nominal histogram for both low and high variations.
"""
if name is None:
low = self.hist... | [
"def",
"sys_hist",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"low",
"=",
"self",
".",
"hist",
".",
"Clone",
"(",
"shallow",
"=",
"True",
")",
"high",
"=",
"self",
".",
"hist",
".",
"Clone",
"(",
"shallow",
... | Return the effective low and high histogram for a given systematic.
If this sample does not contain the named systematic then return
the nominal histogram for both low and high variations. | [
"Return",
"the",
"effective",
"low",
"and",
"high",
"histogram",
"for",
"a",
"given",
"systematic",
".",
"If",
"this",
"sample",
"does",
"not",
"contain",
"the",
"named",
"systematic",
"then",
"return",
"the",
"nominal",
"histogram",
"for",
"both",
"low",
"a... | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/histfactory.py#L271-L293 |
13,995 | rootpy/rootpy | rootpy/stats/histfactory/histfactory.py | Channel.sys_hist | def sys_hist(self, name=None, where=None):
"""
Return the effective total low and high histogram for a given
systematic over samples in this channel.
If a sample does not contain the named systematic then its nominal
histogram is used for both low and high variations.
Pa... | python | def sys_hist(self, name=None, where=None):
"""
Return the effective total low and high histogram for a given
systematic over samples in this channel.
If a sample does not contain the named systematic then its nominal
histogram is used for both low and high variations.
Pa... | [
"def",
"sys_hist",
"(",
"self",
",",
"name",
"=",
"None",
",",
"where",
"=",
"None",
")",
":",
"total_low",
",",
"total_high",
"=",
"None",
",",
"None",
"for",
"sample",
"in",
"self",
".",
"samples",
":",
"if",
"where",
"is",
"not",
"None",
"and",
... | Return the effective total low and high histogram for a given
systematic over samples in this channel.
If a sample does not contain the named systematic then its nominal
histogram is used for both low and high variations.
Parameters
----------
name : string, optional (d... | [
"Return",
"the",
"effective",
"total",
"low",
"and",
"high",
"histogram",
"for",
"a",
"given",
"systematic",
"over",
"samples",
"in",
"this",
"channel",
".",
"If",
"a",
"sample",
"does",
"not",
"contain",
"the",
"named",
"systematic",
"then",
"its",
"nominal... | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/histfactory.py#L894-L931 |
13,996 | rootpy/rootpy | rootpy/stats/histfactory/histfactory.py | Channel.apply_snapshot | def apply_snapshot(self, argset):
"""
Create a clone of this Channel where histograms are modified according
to the values of the nuisance parameters in the snapshot. This is
useful when creating post-fit distribution plots.
Parameters
----------
argset : RooArt... | python | def apply_snapshot(self, argset):
"""
Create a clone of this Channel where histograms are modified according
to the values of the nuisance parameters in the snapshot. This is
useful when creating post-fit distribution plots.
Parameters
----------
argset : RooArt... | [
"def",
"apply_snapshot",
"(",
"self",
",",
"argset",
")",
":",
"clone",
"=",
"self",
".",
"Clone",
"(",
")",
"args",
"=",
"[",
"var",
"for",
"var",
"in",
"argset",
"if",
"not",
"(",
"var",
".",
"name",
".",
"startswith",
"(",
"'binWidth_obs_x_'",
")"... | Create a clone of this Channel where histograms are modified according
to the values of the nuisance parameters in the snapshot. This is
useful when creating post-fit distribution plots.
Parameters
----------
argset : RooArtSet
A RooArgSet of RooRealVar nuisance par... | [
"Create",
"a",
"clone",
"of",
"this",
"Channel",
"where",
"histograms",
"are",
"modified",
"according",
"to",
"the",
"values",
"of",
"the",
"nuisance",
"parameters",
"in",
"the",
"snapshot",
".",
"This",
"is",
"useful",
"when",
"creating",
"post",
"-",
"fit"... | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/histfactory.py#L1040-L1109 |
13,997 | rootpy/rootpy | rootpy/extern/byteplay2/__init__.py | printcodelist | def printcodelist(codelist, to=sys.stdout):
"""Get a code list. Print it nicely."""
labeldict = {}
pendinglabels = []
for i, (op, arg) in enumerate(codelist):
if isinstance(op, Label):
pendinglabels.append(op)
elif op is SetLineno:
pass
else:
... | python | def printcodelist(codelist, to=sys.stdout):
"""Get a code list. Print it nicely."""
labeldict = {}
pendinglabels = []
for i, (op, arg) in enumerate(codelist):
if isinstance(op, Label):
pendinglabels.append(op)
elif op is SetLineno:
pass
else:
... | [
"def",
"printcodelist",
"(",
"codelist",
",",
"to",
"=",
"sys",
".",
"stdout",
")",
":",
"labeldict",
"=",
"{",
"}",
"pendinglabels",
"=",
"[",
"]",
"for",
"i",
",",
"(",
"op",
",",
"arg",
")",
"in",
"enumerate",
"(",
"codelist",
")",
":",
"if",
... | Get a code list. Print it nicely. | [
"Get",
"a",
"code",
"list",
".",
"Print",
"it",
"nicely",
"."
] | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/byteplay2/__init__.py#L785-L840 |
13,998 | rootpy/rootpy | rootpy/extern/byteplay2/__init__.py | recompile | def recompile(filename):
"""Create a .pyc by disassembling the file and assembling it again, printing
a message that the reassembled file was loaded."""
# Most of the code here based on the compile.py module.
import os
import imp
import marshal
import struct
f = open(filename, 'U')
... | python | def recompile(filename):
"""Create a .pyc by disassembling the file and assembling it again, printing
a message that the reassembled file was loaded."""
# Most of the code here based on the compile.py module.
import os
import imp
import marshal
import struct
f = open(filename, 'U')
... | [
"def",
"recompile",
"(",
"filename",
")",
":",
"# Most of the code here based on the compile.py module.",
"import",
"os",
"import",
"imp",
"import",
"marshal",
"import",
"struct",
"f",
"=",
"open",
"(",
"filename",
",",
"'U'",
")",
"try",
":",
"timestamp",
"=",
... | Create a .pyc by disassembling the file and assembling it again, printing
a message that the reassembled file was loaded. | [
"Create",
"a",
".",
"pyc",
"by",
"disassembling",
"the",
"file",
"and",
"assembling",
"it",
"again",
"printing",
"a",
"message",
"that",
"the",
"reassembled",
"file",
"was",
"loaded",
"."
] | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/byteplay2/__init__.py#L842-L885 |
13,999 | rootpy/rootpy | rootpy/extern/byteplay2/__init__.py | recompile_all | def recompile_all(path):
"""recursively recompile all .py files in the directory"""
import os
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
for name in files:
if name.endswith('.py'):
filename = os.path.abspath(os.path.join(root, name... | python | def recompile_all(path):
"""recursively recompile all .py files in the directory"""
import os
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
for name in files:
if name.endswith('.py'):
filename = os.path.abspath(os.path.join(root, name... | [
"def",
"recompile_all",
"(",
"path",
")",
":",
"import",
"os",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"for",
"name",
"in",
"files",
... | recursively recompile all .py files in the directory | [
"recursively",
"recompile",
"all",
".",
"py",
"files",
"in",
"the",
"directory"
] | 3926935e1f2100d8ba68070c2ab44055d4800f73 | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/byteplay2/__init__.py#L887-L899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.