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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40,600 | solocompt/plugs-core | plugs_core/utils.py | html_to_text | def html_to_text(html_string):
"""
returns a plain text string when given a html string text
handles a, p, h1 to h6 and br, inserts newline chars to
create space in the string
@todo handle images
"""
# create a valid html document from string
# beware that it inserts <hmtl> <body> and <p... | python | def html_to_text(html_string):
"""
returns a plain text string when given a html string text
handles a, p, h1 to h6 and br, inserts newline chars to
create space in the string
@todo handle images
"""
# create a valid html document from string
# beware that it inserts <hmtl> <body> and <p... | [
"def",
"html_to_text",
"(",
"html_string",
")",
":",
"# create a valid html document from string",
"# beware that it inserts <hmtl> <body> and <p> tags",
"# where needed",
"html_tree",
"=",
"html",
".",
"document_fromstring",
"(",
"html_string",
")",
"# handle header tags",
"for"... | returns a plain text string when given a html string text
handles a, p, h1 to h6 and br, inserts newline chars to
create space in the string
@todo handle images | [
"returns",
"a",
"plain",
"text",
"string",
"when",
"given",
"a",
"html",
"string",
"text",
"handles",
"a",
"p",
"h1",
"to",
"h6",
"and",
"br",
"inserts",
"newline",
"chars",
"to",
"create",
"space",
"in",
"the",
"string"
] | 19fd23101fcfdabe657485f0a22e6b63e2b44f9d | https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/utils.py#L82-L119 |
40,601 | solocompt/plugs-core | plugs_core/utils.py | random_string | def random_string(**kwargs):
"""
By default generates a random string of 10 chars composed
of digits and ascii lowercase letters. String length and pool can
be override by using kwargs. Pool must be a list of strings
"""
n = kwargs.get('length', 10)
pool = kwargs.get('pool') or string.digits... | python | def random_string(**kwargs):
"""
By default generates a random string of 10 chars composed
of digits and ascii lowercase letters. String length and pool can
be override by using kwargs. Pool must be a list of strings
"""
n = kwargs.get('length', 10)
pool = kwargs.get('pool') or string.digits... | [
"def",
"random_string",
"(",
"*",
"*",
"kwargs",
")",
":",
"n",
"=",
"kwargs",
".",
"get",
"(",
"'length'",
",",
"10",
")",
"pool",
"=",
"kwargs",
".",
"get",
"(",
"'pool'",
")",
"or",
"string",
".",
"digits",
"+",
"string",
".",
"ascii_lowercase",
... | By default generates a random string of 10 chars composed
of digits and ascii lowercase letters. String length and pool can
be override by using kwargs. Pool must be a list of strings | [
"By",
"default",
"generates",
"a",
"random",
"string",
"of",
"10",
"chars",
"composed",
"of",
"digits",
"and",
"ascii",
"lowercase",
"letters",
".",
"String",
"length",
"and",
"pool",
"can",
"be",
"override",
"by",
"using",
"kwargs",
".",
"Pool",
"must",
"... | 19fd23101fcfdabe657485f0a22e6b63e2b44f9d | https://github.com/solocompt/plugs-core/blob/19fd23101fcfdabe657485f0a22e6b63e2b44f9d/plugs_core/utils.py#L122-L130 |
40,602 | pbrisk/timewave | timewave/engine.py | Engine._run_parallel_process_with_profiling | def _run_parallel_process_with_profiling(self, start_path, stop_path, queue, filename):
"""
wrapper for usage of profiling
"""
runctx('Engine._run_parallel_process(self, start_path, stop_path, queue)', globals(), locals(), filename) | python | def _run_parallel_process_with_profiling(self, start_path, stop_path, queue, filename):
"""
wrapper for usage of profiling
"""
runctx('Engine._run_parallel_process(self, start_path, stop_path, queue)', globals(), locals(), filename) | [
"def",
"_run_parallel_process_with_profiling",
"(",
"self",
",",
"start_path",
",",
"stop_path",
",",
"queue",
",",
"filename",
")",
":",
"runctx",
"(",
"'Engine._run_parallel_process(self, start_path, stop_path, queue)'",
",",
"globals",
"(",
")",
",",
"locals",
"(",
... | wrapper for usage of profiling | [
"wrapper",
"for",
"usage",
"of",
"profiling"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L159-L163 |
40,603 | pbrisk/timewave | timewave/engine.py | Engine._run_parallel_process | def _run_parallel_process(self, start_path, stop_path, queue):
"""
The function calls _run_process and puts results produced by
consumer at observations of top most consumer in to the queue
"""
process_num = int(current_process().name.split('-', 2)[1])
self._run_process(s... | python | def _run_parallel_process(self, start_path, stop_path, queue):
"""
The function calls _run_process and puts results produced by
consumer at observations of top most consumer in to the queue
"""
process_num = int(current_process().name.split('-', 2)[1])
self._run_process(s... | [
"def",
"_run_parallel_process",
"(",
"self",
",",
"start_path",
",",
"stop_path",
",",
"queue",
")",
":",
"process_num",
"=",
"int",
"(",
"current_process",
"(",
")",
".",
"name",
".",
"split",
"(",
"'-'",
",",
"2",
")",
"[",
"1",
"]",
")",
"self",
"... | The function calls _run_process and puts results produced by
consumer at observations of top most consumer in to the queue | [
"The",
"function",
"calls",
"_run_process",
"and",
"puts",
"results",
"produced",
"by",
"consumer",
"at",
"observations",
"of",
"top",
"most",
"consumer",
"in",
"to",
"the",
"queue"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L165-L172 |
40,604 | pbrisk/timewave | timewave/engine.py | Engine._run_process | def _run_process(self, start_path, stop_path, process_num=0):
"""
The function calls _run_path for given set of paths
"""
# pre processing
self.producer.initialize_worker(process_num)
self.consumer.initialize_worker(process_num)
# processing
for path in r... | python | def _run_process(self, start_path, stop_path, process_num=0):
"""
The function calls _run_path for given set of paths
"""
# pre processing
self.producer.initialize_worker(process_num)
self.consumer.initialize_worker(process_num)
# processing
for path in r... | [
"def",
"_run_process",
"(",
"self",
",",
"start_path",
",",
"stop_path",
",",
"process_num",
"=",
"0",
")",
":",
"# pre processing",
"self",
".",
"producer",
".",
"initialize_worker",
"(",
"process_num",
")",
"self",
".",
"consumer",
".",
"initialize_worker",
... | The function calls _run_path for given set of paths | [
"The",
"function",
"calls",
"_run_path",
"for",
"given",
"set",
"of",
"paths"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L174-L187 |
40,605 | pbrisk/timewave | timewave/engine.py | Engine._run_path | def _run_path(self, path_num):
"""
standalone function implementing a single loop of Monte Carlo
It returns list produced by consumer at observation dates
:param int path_num: path number
"""
# pre processing
self.producer.initialize_path(path_num)
self.c... | python | def _run_path(self, path_num):
"""
standalone function implementing a single loop of Monte Carlo
It returns list produced by consumer at observation dates
:param int path_num: path number
"""
# pre processing
self.producer.initialize_path(path_num)
self.c... | [
"def",
"_run_path",
"(",
"self",
",",
"path_num",
")",
":",
"# pre processing",
"self",
".",
"producer",
".",
"initialize_path",
"(",
"path_num",
")",
"self",
".",
"consumer",
".",
"initialize_path",
"(",
"path_num",
")",
"# processing",
"for",
"new_date",
"in... | standalone function implementing a single loop of Monte Carlo
It returns list produced by consumer at observation dates
:param int path_num: path number | [
"standalone",
"function",
"implementing",
"a",
"single",
"loop",
"of",
"Monte",
"Carlo",
"It",
"returns",
"list",
"produced",
"by",
"consumer",
"at",
"observation",
"dates"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L189-L206 |
40,606 | pbrisk/timewave | timewave/engine.py | Consumer.initialize_worker | def initialize_worker(self, process_num=None):
"""
reinitialize consumer for process in multiprocesing
"""
self.initialize(self.grid, self.num_of_paths, self.seed) | python | def initialize_worker(self, process_num=None):
"""
reinitialize consumer for process in multiprocesing
"""
self.initialize(self.grid, self.num_of_paths, self.seed) | [
"def",
"initialize_worker",
"(",
"self",
",",
"process_num",
"=",
"None",
")",
":",
"self",
".",
"initialize",
"(",
"self",
".",
"grid",
",",
"self",
".",
"num_of_paths",
",",
"self",
".",
"seed",
")"
] | reinitialize consumer for process in multiprocesing | [
"reinitialize",
"consumer",
"for",
"process",
"in",
"multiprocesing"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L248-L252 |
40,607 | pbrisk/timewave | timewave/engine.py | Consumer.initialize_path | def initialize_path(self, path_num=None):
"""
initialize consumer for next path
"""
self.state = copy(self.initial_state)
return self.state | python | def initialize_path(self, path_num=None):
"""
initialize consumer for next path
"""
self.state = copy(self.initial_state)
return self.state | [
"def",
"initialize_path",
"(",
"self",
",",
"path_num",
"=",
"None",
")",
":",
"self",
".",
"state",
"=",
"copy",
"(",
"self",
".",
"initial_state",
")",
"return",
"self",
".",
"state"
] | initialize consumer for next path | [
"initialize",
"consumer",
"for",
"next",
"path"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L254-L259 |
40,608 | pbrisk/timewave | timewave/engine.py | Consumer.consume | def consume(self, state):
"""
consume new producer state
"""
self.state.append(self.func(state))
return self.state | python | def consume(self, state):
"""
consume new producer state
"""
self.state.append(self.func(state))
return self.state | [
"def",
"consume",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"state",
".",
"append",
"(",
"self",
".",
"func",
"(",
"state",
")",
")",
"return",
"self",
".",
"state"
] | consume new producer state | [
"consume",
"new",
"producer",
"state"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L261-L266 |
40,609 | pbrisk/timewave | timewave/engine.py | Consumer.get | def get(self, queue_get):
"""
to get states from multiprocessing.queue
"""
if isinstance(queue_get, (tuple, list)):
self.result.extend(queue_get) | python | def get(self, queue_get):
"""
to get states from multiprocessing.queue
"""
if isinstance(queue_get, (tuple, list)):
self.result.extend(queue_get) | [
"def",
"get",
"(",
"self",
",",
"queue_get",
")",
":",
"if",
"isinstance",
"(",
"queue_get",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"self",
".",
"result",
".",
"extend",
"(",
"queue_get",
")"
] | to get states from multiprocessing.queue | [
"to",
"get",
"states",
"from",
"multiprocessing",
".",
"queue"
] | cf641391d1607a424042724c8b990d43ee270ef6 | https://github.com/pbrisk/timewave/blob/cf641391d1607a424042724c8b990d43ee270ef6/timewave/engine.py#L296-L301 |
40,610 | Jarn/jarn.mkrelease | jarn/mkrelease/setup.py | walk_revctrl | def walk_revctrl(dirname='', ff=''):
"""Return files found by the file-finder 'ff'.
"""
file_finder = None
items = []
if not ff:
distutils.log.error('No file-finder passed to walk_revctrl')
sys.exit(1)
for ep in pkg_resources.iter_entry_points('setuptools.file_finders'):
... | python | def walk_revctrl(dirname='', ff=''):
"""Return files found by the file-finder 'ff'.
"""
file_finder = None
items = []
if not ff:
distutils.log.error('No file-finder passed to walk_revctrl')
sys.exit(1)
for ep in pkg_resources.iter_entry_points('setuptools.file_finders'):
... | [
"def",
"walk_revctrl",
"(",
"dirname",
"=",
"''",
",",
"ff",
"=",
"''",
")",
":",
"file_finder",
"=",
"None",
"items",
"=",
"[",
"]",
"if",
"not",
"ff",
":",
"distutils",
".",
"log",
".",
"error",
"(",
"'No file-finder passed to walk_revctrl'",
")",
"sys... | Return files found by the file-finder 'ff'. | [
"Return",
"files",
"found",
"by",
"the",
"file",
"-",
"finder",
"ff",
"."
] | 844377f37a3cdc0a154148790a926f991019ec4a | https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setup.py#L29-L58 |
40,611 | Jarn/jarn.mkrelease | jarn/mkrelease/setup.py | cleanup_pycache | def cleanup_pycache():
"""Remove .pyc files we leave around because of import.
"""
try:
for file in glob.glob('setup.py[co]'):
os.remove(file)
if isdir('__pycache__'):
for file in glob.glob(join('__pycache__', 'setup.*.py[co]')):
os.remove(file)
... | python | def cleanup_pycache():
"""Remove .pyc files we leave around because of import.
"""
try:
for file in glob.glob('setup.py[co]'):
os.remove(file)
if isdir('__pycache__'):
for file in glob.glob(join('__pycache__', 'setup.*.py[co]')):
os.remove(file)
... | [
"def",
"cleanup_pycache",
"(",
")",
":",
"try",
":",
"for",
"file",
"in",
"glob",
".",
"glob",
"(",
"'setup.py[co]'",
")",
":",
"os",
".",
"remove",
"(",
"file",
")",
"if",
"isdir",
"(",
"'__pycache__'",
")",
":",
"for",
"file",
"in",
"glob",
".",
... | Remove .pyc files we leave around because of import. | [
"Remove",
".",
"pyc",
"files",
"we",
"leave",
"around",
"because",
"of",
"import",
"."
] | 844377f37a3cdc0a154148790a926f991019ec4a | https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setup.py#L69-L81 |
40,612 | Jarn/jarn.mkrelease | jarn/mkrelease/setup.py | run | def run(args, ff=''):
"""Run setup.py with monkey patches applied.
"""
import setuptools.command.egg_info
if ff == 'none':
setuptools.command.egg_info.walk_revctrl = no_walk_revctrl
else:
setuptools.command.egg_info.walk_revctrl = partial(walk_revctrl, ff=ff)
sys.argv = ['setup.... | python | def run(args, ff=''):
"""Run setup.py with monkey patches applied.
"""
import setuptools.command.egg_info
if ff == 'none':
setuptools.command.egg_info.walk_revctrl = no_walk_revctrl
else:
setuptools.command.egg_info.walk_revctrl = partial(walk_revctrl, ff=ff)
sys.argv = ['setup.... | [
"def",
"run",
"(",
"args",
",",
"ff",
"=",
"''",
")",
":",
"import",
"setuptools",
".",
"command",
".",
"egg_info",
"if",
"ff",
"==",
"'none'",
":",
"setuptools",
".",
"command",
".",
"egg_info",
".",
"walk_revctrl",
"=",
"no_walk_revctrl",
"else",
":",
... | Run setup.py with monkey patches applied. | [
"Run",
"setup",
".",
"py",
"with",
"monkey",
"patches",
"applied",
"."
] | 844377f37a3cdc0a154148790a926f991019ec4a | https://github.com/Jarn/jarn.mkrelease/blob/844377f37a3cdc0a154148790a926f991019ec4a/jarn/mkrelease/setup.py#L84-L96 |
40,613 | childsish/lhc-python | lhc/tools/sorter.py | Sorter._get_sorted_iterator | def _get_sorted_iterator(self, iterator):
"""
Get the iterator over the sorted items.
This function decides whether the items can be sorted in memory or on disk.
:return:
"""
lines = list(next(iterator))
if len(lines) < self.max_lines:
return iter(sor... | python | def _get_sorted_iterator(self, iterator):
"""
Get the iterator over the sorted items.
This function decides whether the items can be sorted in memory or on disk.
:return:
"""
lines = list(next(iterator))
if len(lines) < self.max_lines:
return iter(sor... | [
"def",
"_get_sorted_iterator",
"(",
"self",
",",
"iterator",
")",
":",
"lines",
"=",
"list",
"(",
"next",
"(",
"iterator",
")",
")",
"if",
"len",
"(",
"lines",
")",
"<",
"self",
".",
"max_lines",
":",
"return",
"iter",
"(",
"sorted",
"(",
"lines",
",... | Get the iterator over the sorted items.
This function decides whether the items can be sorted in memory or on disk.
:return: | [
"Get",
"the",
"iterator",
"over",
"the",
"sorted",
"items",
"."
] | 0a669f46a40a39f24d28665e8b5b606dc7e86beb | https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/tools/sorter.py#L20-L34 |
40,614 | childsish/lhc-python | lhc/tools/sorter.py | Sorter._split | def _split(self, iterator, tmp_dir):
"""
Splits the file into several chunks.
If the original file is too big to fit in the allocated space, the sorting will be split into several chunks,
then merged.
:param tmp_dir: Where to put the intermediate sorted results.
:param o... | python | def _split(self, iterator, tmp_dir):
"""
Splits the file into several chunks.
If the original file is too big to fit in the allocated space, the sorting will be split into several chunks,
then merged.
:param tmp_dir: Where to put the intermediate sorted results.
:param o... | [
"def",
"_split",
"(",
"self",
",",
"iterator",
",",
"tmp_dir",
")",
":",
"fnames",
"=",
"[",
"]",
"for",
"i",
",",
"lines",
"in",
"enumerate",
"(",
"iterator",
")",
":",
"lines",
"=",
"list",
"(",
"lines",
")",
"out_fname",
"=",
"os",
".",
"path",
... | Splits the file into several chunks.
If the original file is too big to fit in the allocated space, the sorting will be split into several chunks,
then merged.
:param tmp_dir: Where to put the intermediate sorted results.
:param orig_lines: The lines read before running out of space.
... | [
"Splits",
"the",
"file",
"into",
"several",
"chunks",
"."
] | 0a669f46a40a39f24d28665e8b5b606dc7e86beb | https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/tools/sorter.py#L36-L54 |
40,615 | childsish/lhc-python | lhc/tools/sorter.py | Sorter._write | def _write(self, lines, fname):
"""
Writes a intermediate temporary sorted file
:param lines: The lines to write.
:param fname: The name of the temporary file.
:return:
"""
with open(fname, 'wb') as out_fhndl:
for line in sorted(lines, key=self.key):
... | python | def _write(self, lines, fname):
"""
Writes a intermediate temporary sorted file
:param lines: The lines to write.
:param fname: The name of the temporary file.
:return:
"""
with open(fname, 'wb') as out_fhndl:
for line in sorted(lines, key=self.key):
... | [
"def",
"_write",
"(",
"self",
",",
"lines",
",",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
",",
"'wb'",
")",
"as",
"out_fhndl",
":",
"for",
"line",
"in",
"sorted",
"(",
"lines",
",",
"key",
"=",
"self",
".",
"key",
")",
":",
"pickle",
".",... | Writes a intermediate temporary sorted file
:param lines: The lines to write.
:param fname: The name of the temporary file.
:return: | [
"Writes",
"a",
"intermediate",
"temporary",
"sorted",
"file"
] | 0a669f46a40a39f24d28665e8b5b606dc7e86beb | https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/tools/sorter.py#L56-L66 |
40,616 | lamoreauxlab/srpenergy-api-client-python | srpenergy/client.py | get_iso_time | def get_iso_time(date_part, time_part):
r"""Combign date and time into an iso datetime."""
str_date = datetime.datetime.strptime(
date_part, '%m/%d/%Y').strftime('%Y-%m-%d')
str_time = datetime.datetime.strptime(
time_part, '%I:%M %p').strftime('%H:%M:%S')
return str_date + "T" +... | python | def get_iso_time(date_part, time_part):
r"""Combign date and time into an iso datetime."""
str_date = datetime.datetime.strptime(
date_part, '%m/%d/%Y').strftime('%Y-%m-%d')
str_time = datetime.datetime.strptime(
time_part, '%I:%M %p').strftime('%H:%M:%S')
return str_date + "T" +... | [
"def",
"get_iso_time",
"(",
"date_part",
",",
"time_part",
")",
":",
"str_date",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"date_part",
",",
"'%m/%d/%Y'",
")",
".",
"strftime",
"(",
"'%Y-%m-%d'",
")",
"str_time",
"=",
"datetime",
".",
"datetime... | r"""Combign date and time into an iso datetime. | [
"r",
"Combign",
"date",
"and",
"time",
"into",
"an",
"iso",
"datetime",
"."
] | dc703510672c2a3e7f3e82c879c9474d04874a40 | https://github.com/lamoreauxlab/srpenergy-api-client-python/blob/dc703510672c2a3e7f3e82c879c9474d04874a40/srpenergy/client.py#L17-L24 |
40,617 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | get_user_list | def get_user_list(host_name, client_name, client_pass):
"""
Pulls the list of users in a client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's pass... | python | def get_user_list(host_name, client_name, client_pass):
"""
Pulls the list of users in a client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's pass... | [
"def",
"get_user_list",
"(",
"host_name",
",",
"client_name",
",",
"client_pass",
")",
":",
"# Construct request.",
"request",
"=",
"construct_request",
"(",
"model_type",
"=",
"\"pers\"",
",",
"client_name",
"=",
"client_name",
",",
"client_pass",
"=",
"client_pass... | Pulls the list of users in a client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
Output: - user_id_list: A python list of user ids. | [
"Pulls",
"the",
"list",
"of",
"users",
"in",
"a",
"client",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L8-L41 |
40,618 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | add_features | def add_features(host_name, client_name, client_pass, feature_names):
"""
Add a number of numerical features in the client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass... | python | def add_features(host_name, client_name, client_pass, feature_names):
"""
Add a number of numerical features in the client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass... | [
"def",
"add_features",
"(",
"host_name",
",",
"client_name",
",",
"client_pass",
",",
"feature_names",
")",
":",
"init_feats",
"=",
"(",
"\"&\"",
".",
"join",
"(",
"[",
"\"%s=0\"",
"]",
"*",
"len",
"(",
"feature_names",
")",
")",
")",
"%",
"tuple",
"(",
... | Add a number of numerical features in the client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
- feature_names: A python list of fea... | [
"Add",
"a",
"number",
"of",
"numerical",
"features",
"in",
"the",
"client",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L44-L60 |
40,619 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | delete_features | def delete_features(host_name, client_name, client_pass, feature_names=None):
"""
Remove a number of numerical features in the client. If a list is not provided, remove all features.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- cli... | python | def delete_features(host_name, client_name, client_pass, feature_names=None):
"""
Remove a number of numerical features in the client. If a list is not provided, remove all features.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- cli... | [
"def",
"delete_features",
"(",
"host_name",
",",
"client_name",
",",
"client_pass",
",",
"feature_names",
"=",
"None",
")",
":",
"# Get all features.",
"if",
"feature_names",
"is",
"None",
":",
"feature_names",
"=",
"get_feature_names",
"(",
"host_name",
",",
"cli... | Remove a number of numerical features in the client. If a list is not provided, remove all features.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's passwor... | [
"Remove",
"a",
"number",
"of",
"numerical",
"features",
"in",
"the",
"client",
".",
"If",
"a",
"list",
"is",
"not",
"provided",
"remove",
"all",
"features",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L63-L86 |
40,620 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | get_feature_names | def get_feature_names(host_name, client_name, client_pass):
"""
Get the names of all features in a PServer client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PSe... | python | def get_feature_names(host_name, client_name, client_pass):
"""
Get the names of all features in a PServer client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PSe... | [
"def",
"get_feature_names",
"(",
"host_name",
",",
"client_name",
",",
"client_pass",
")",
":",
"# Construct request.",
"request",
"=",
"construct_request",
"(",
"model_type",
"=",
"\"pers\"",
",",
"client_name",
"=",
"client_name",
",",
"client_pass",
"=",
"client_... | Get the names of all features in a PServer client.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
Output: - feature_names: A python list of f... | [
"Get",
"the",
"names",
"of",
"all",
"features",
"in",
"a",
"PServer",
"client",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L89-L123 |
40,621 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | construct_request | def construct_request(model_type, client_name, client_pass, command, values):
"""
Construct the request url.
Inputs: - model_type: PServer usage mode type.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
- command: A PServer command.... | python | def construct_request(model_type, client_name, client_pass, command, values):
"""
Construct the request url.
Inputs: - model_type: PServer usage mode type.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
- command: A PServer command.... | [
"def",
"construct_request",
"(",
"model_type",
",",
"client_name",
",",
"client_pass",
",",
"command",
",",
"values",
")",
":",
"base_request",
"=",
"(",
"\"{model_type}?\"",
"\"clnt={client_name}|{client_pass}&\"",
"\"com={command}&{values}\"",
".",
"format",
"(",
"mod... | Construct the request url.
Inputs: - model_type: PServer usage mode type.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
- command: A PServer command.
- values: PServer command arguments.
Output: - base_request: The base re... | [
"Construct",
"the",
"request",
"url",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L155-L174 |
40,622 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | send_request | def send_request(host_name, request):
"""
Sends a PServer url request.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- request: The url request.
"""
request = "%s%s" % (host_name, request)
# print(request)
try:
... | python | def send_request(host_name, request):
"""
Sends a PServer url request.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- request: The url request.
"""
request = "%s%s" % (host_name, request)
# print(request)
try:
... | [
"def",
"send_request",
"(",
"host_name",
",",
"request",
")",
":",
"request",
"=",
"\"%s%s\"",
"%",
"(",
"host_name",
",",
"request",
")",
"# print(request)",
"try",
":",
"result",
"=",
"requests",
".",
"get",
"(",
"request",
")",
"if",
"result",
".",
"s... | Sends a PServer url request.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- request: The url request. | [
"Sends",
"a",
"PServer",
"url",
"request",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L177-L195 |
40,623 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/pserver/request.py | update_feature_value | def update_feature_value(host_name, client_name, client_pass, user_twitter_id, feature_name, feature_score):
"""
Updates a single topic score, for a single user.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer ... | python | def update_feature_value(host_name, client_name, client_pass, user_twitter_id, feature_name, feature_score):
"""
Updates a single topic score, for a single user.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer ... | [
"def",
"update_feature_value",
"(",
"host_name",
",",
"client_name",
",",
"client_pass",
",",
"user_twitter_id",
",",
"feature_name",
",",
"feature_score",
")",
":",
"username",
"=",
"str",
"(",
"user_twitter_id",
")",
"feature_value",
"=",
"\"{0:.2f}\"",
".",
"fo... | Updates a single topic score, for a single user.
Inputs: - host_name: A string containing the address of the machine where the PServer instance is hosted.
- client_name: The PServer client name.
- client_pass: The PServer client's password.
- user_twitter_id: A Twitter user iden... | [
"Updates",
"a",
"single",
"topic",
"score",
"for",
"a",
"single",
"user",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/pserver/request.py#L198-L223 |
40,624 | zerok/flask-compass | flaskext/compass.py | Compass.init_app | def init_app(self, app):
"""
Initialize the application once the configuration has been loaded
there.
"""
self.app = app
self.log = app.logger.getChild('compass')
self.log.debug("Initializing compass integration")
self.compass_path = self.app.config.get('C... | python | def init_app(self, app):
"""
Initialize the application once the configuration has been loaded
there.
"""
self.app = app
self.log = app.logger.getChild('compass')
self.log.debug("Initializing compass integration")
self.compass_path = self.app.config.get('C... | [
"def",
"init_app",
"(",
"self",
",",
"app",
")",
":",
"self",
".",
"app",
"=",
"app",
"self",
".",
"log",
"=",
"app",
".",
"logger",
".",
"getChild",
"(",
"'compass'",
")",
"self",
".",
"log",
".",
"debug",
"(",
"\"Initializing compass integration\"",
... | Initialize the application once the configuration has been loaded
there. | [
"Initialize",
"the",
"application",
"once",
"the",
"configuration",
"has",
"been",
"loaded",
"there",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L40-L62 |
40,625 | zerok/flask-compass | flaskext/compass.py | Compass.compile | def compile(self):
"""
Main entry point that compiles all the specified or found compass
projects.
"""
if self.disabled:
return
self._check_configs()
for _, cfg in self.configs.iteritems():
cfg.parse()
if cfg.changes_found() or ... | python | def compile(self):
"""
Main entry point that compiles all the specified or found compass
projects.
"""
if self.disabled:
return
self._check_configs()
for _, cfg in self.configs.iteritems():
cfg.parse()
if cfg.changes_found() or ... | [
"def",
"compile",
"(",
"self",
")",
":",
"if",
"self",
".",
"disabled",
":",
"return",
"self",
".",
"_check_configs",
"(",
")",
"for",
"_",
",",
"cfg",
"in",
"self",
".",
"configs",
".",
"iteritems",
"(",
")",
":",
"cfg",
".",
"parse",
"(",
")",
... | Main entry point that compiles all the specified or found compass
projects. | [
"Main",
"entry",
"point",
"that",
"compiles",
"all",
"the",
"specified",
"or",
"found",
"compass",
"projects",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L64-L77 |
40,626 | zerok/flask-compass | flaskext/compass.py | Compass.after_request | def after_request(self, response):
"""
after_request handler for compiling the compass projects with
each request.
"""
if response is not None and request is not None:
# When used as response processor, only run if we are requesting
# anything but a static... | python | def after_request(self, response):
"""
after_request handler for compiling the compass projects with
each request.
"""
if response is not None and request is not None:
# When used as response processor, only run if we are requesting
# anything but a static... | [
"def",
"after_request",
"(",
"self",
",",
"response",
")",
":",
"if",
"response",
"is",
"not",
"None",
"and",
"request",
"is",
"not",
"None",
":",
"# When used as response processor, only run if we are requesting",
"# anything but a static resource.",
"if",
"request",
"... | after_request handler for compiling the compass projects with
each request. | [
"after_request",
"handler",
"for",
"compiling",
"the",
"compass",
"projects",
"with",
"each",
"request",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L79-L90 |
40,627 | zerok/flask-compass | flaskext/compass.py | Compass._check_configs | def _check_configs(self):
"""
Reloads the configuration files.
"""
configs = set(self._find_configs())
known_configs = set(self.configs.keys())
new_configs = configs - known_configs
for cfg in (known_configs - configs):
self.log.debug("Compass configur... | python | def _check_configs(self):
"""
Reloads the configuration files.
"""
configs = set(self._find_configs())
known_configs = set(self.configs.keys())
new_configs = configs - known_configs
for cfg in (known_configs - configs):
self.log.debug("Compass configur... | [
"def",
"_check_configs",
"(",
"self",
")",
":",
"configs",
"=",
"set",
"(",
"self",
".",
"_find_configs",
"(",
")",
")",
"known_configs",
"=",
"set",
"(",
"self",
".",
"configs",
".",
"keys",
"(",
")",
")",
"new_configs",
"=",
"configs",
"-",
"known_co... | Reloads the configuration files. | [
"Reloads",
"the",
"configuration",
"files",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L92-L104 |
40,628 | zerok/flask-compass | flaskext/compass.py | Compass._find_configs | def _find_configs(self):
"""
Scans the project directory for config files or returns
the explicitly specified list of files.
"""
if self.config_files is not None:
return self.config_files
# Walk the whole project tree and look for "config.rb" files
re... | python | def _find_configs(self):
"""
Scans the project directory for config files or returns
the explicitly specified list of files.
"""
if self.config_files is not None:
return self.config_files
# Walk the whole project tree and look for "config.rb" files
re... | [
"def",
"_find_configs",
"(",
"self",
")",
":",
"if",
"self",
".",
"config_files",
"is",
"not",
"None",
":",
"return",
"self",
".",
"config_files",
"# Walk the whole project tree and look for \"config.rb\" files",
"result",
"=",
"[",
"]",
"for",
"path",
",",
"_",
... | Scans the project directory for config files or returns
the explicitly specified list of files. | [
"Scans",
"the",
"project",
"directory",
"for",
"config",
"files",
"or",
"returns",
"the",
"explicitly",
"specified",
"list",
"of",
"files",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L106-L119 |
40,629 | zerok/flask-compass | flaskext/compass.py | CompassConfig.parse | def parse(self, replace=False):
"""
Parse the given compass config file
"""
if self.last_parsed is not None \
and self.last_parsed > os.path.getmtime(self.path) \
and not replace:
return
self.last_parsed = time.time()
with open(... | python | def parse(self, replace=False):
"""
Parse the given compass config file
"""
if self.last_parsed is not None \
and self.last_parsed > os.path.getmtime(self.path) \
and not replace:
return
self.last_parsed = time.time()
with open(... | [
"def",
"parse",
"(",
"self",
",",
"replace",
"=",
"False",
")",
":",
"if",
"self",
".",
"last_parsed",
"is",
"not",
"None",
"and",
"self",
".",
"last_parsed",
">",
"os",
".",
"path",
".",
"getmtime",
"(",
"self",
".",
"path",
")",
"and",
"not",
"re... | Parse the given compass config file | [
"Parse",
"the",
"given",
"compass",
"config",
"file"
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L134-L152 |
40,630 | zerok/flask-compass | flaskext/compass.py | CompassConfig.changes_found | def changes_found(self):
"""
Returns True if the target folder is older than the source folder.
"""
if self.dest is None:
warnings.warn("dest directory not found!")
if self.src is None:
warnings.warn("src directory not found!")
if self.src is None ... | python | def changes_found(self):
"""
Returns True if the target folder is older than the source folder.
"""
if self.dest is None:
warnings.warn("dest directory not found!")
if self.src is None:
warnings.warn("src directory not found!")
if self.src is None ... | [
"def",
"changes_found",
"(",
"self",
")",
":",
"if",
"self",
".",
"dest",
"is",
"None",
":",
"warnings",
".",
"warn",
"(",
"\"dest directory not found!\"",
")",
"if",
"self",
".",
"src",
"is",
"None",
":",
"warnings",
".",
"warn",
"(",
"\"src directory not... | Returns True if the target folder is older than the source folder. | [
"Returns",
"True",
"if",
"the",
"target",
"folder",
"is",
"older",
"than",
"the",
"source",
"folder",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L154-L177 |
40,631 | zerok/flask-compass | flaskext/compass.py | CompassConfig.compile | def compile(self, compass):
"""
Calls the compass script specified in the compass extension
with the paths provided by the config.rb.
"""
try:
output = subprocess.check_output(
[compass.compass_path, 'compile', '-q'],
cwd=self.b... | python | def compile(self, compass):
"""
Calls the compass script specified in the compass extension
with the paths provided by the config.rb.
"""
try:
output = subprocess.check_output(
[compass.compass_path, 'compile', '-q'],
cwd=self.b... | [
"def",
"compile",
"(",
"self",
",",
"compass",
")",
":",
"try",
":",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"compass",
".",
"compass_path",
",",
"'compile'",
",",
"'-q'",
"]",
",",
"cwd",
"=",
"self",
".",
"base_dir",
")",
"os",
... | Calls the compass script specified in the compass extension
with the paths provided by the config.rb. | [
"Calls",
"the",
"compass",
"script",
"specified",
"in",
"the",
"compass",
"extension",
"with",
"the",
"paths",
"provided",
"by",
"the",
"config",
".",
"rb",
"."
] | 633ef4bcbfbf0882a337d84f776b3c090ef5f464 | https://github.com/zerok/flask-compass/blob/633ef4bcbfbf0882a337d84f776b3c090ef5f464/flaskext/compass.py#L179-L197 |
40,632 | LinkCareServices/period | period/main.py | _remove_otiose | def _remove_otiose(lst):
"""lift deeply nested expressions out of redundant parentheses"""
listtype = type([])
while type(lst) == listtype and len(lst) == 1:
lst = lst[0]
return lst | python | def _remove_otiose(lst):
"""lift deeply nested expressions out of redundant parentheses"""
listtype = type([])
while type(lst) == listtype and len(lst) == 1:
lst = lst[0]
return lst | [
"def",
"_remove_otiose",
"(",
"lst",
")",
":",
"listtype",
"=",
"type",
"(",
"[",
"]",
")",
"while",
"type",
"(",
"lst",
")",
"==",
"listtype",
"and",
"len",
"(",
"lst",
")",
"==",
"1",
":",
"lst",
"=",
"lst",
"[",
"0",
"]",
"return",
"lst"
] | lift deeply nested expressions out of redundant parentheses | [
"lift",
"deeply",
"nested",
"expressions",
"out",
"of",
"redundant",
"parentheses"
] | 014f3c766940658904c52547d8cf8c12d4895e07 | https://github.com/LinkCareServices/period/blob/014f3c766940658904c52547d8cf8c12d4895e07/period/main.py#L34-L40 |
40,633 | asherp/hourly | hourly/hourly.py | get_work_commits | def get_work_commits(repo_addr, ascending = True, tz = 'US/Eastern', correct_times = True):
"""Retrives work commits from repo"""
repo = git.Repo(repo_addr)
commits = list(repo.iter_commits())
logs = [(c.authored_datetime, c.message.strip('\n'), str(c)) for c in repo.iter_commits()]
work = pd.Dat... | python | def get_work_commits(repo_addr, ascending = True, tz = 'US/Eastern', correct_times = True):
"""Retrives work commits from repo"""
repo = git.Repo(repo_addr)
commits = list(repo.iter_commits())
logs = [(c.authored_datetime, c.message.strip('\n'), str(c)) for c in repo.iter_commits()]
work = pd.Dat... | [
"def",
"get_work_commits",
"(",
"repo_addr",
",",
"ascending",
"=",
"True",
",",
"tz",
"=",
"'US/Eastern'",
",",
"correct_times",
"=",
"True",
")",
":",
"repo",
"=",
"git",
".",
"Repo",
"(",
"repo_addr",
")",
"commits",
"=",
"list",
"(",
"repo",
".",
"... | Retrives work commits from repo | [
"Retrives",
"work",
"commits",
"from",
"repo"
] | c2778a5b4dd7ac523fe3d56f5c9f7fe72b8826de | https://github.com/asherp/hourly/blob/c2778a5b4dd7ac523fe3d56f5c9f7fe72b8826de/hourly/hourly.py#L27-L44 |
40,634 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/manage_resources.py | get_topic_set | def get_topic_set(file_path):
"""
Opens one of the topic set resource files and returns a set of topics.
- Input: - file_path: The path pointing to the topic set resource file.
- Output: - topic_set: A python set of strings.
"""
topic_set = set()
file_row_gen = get_file_row_generator(file... | python | def get_topic_set(file_path):
"""
Opens one of the topic set resource files and returns a set of topics.
- Input: - file_path: The path pointing to the topic set resource file.
- Output: - topic_set: A python set of strings.
"""
topic_set = set()
file_row_gen = get_file_row_generator(file... | [
"def",
"get_topic_set",
"(",
"file_path",
")",
":",
"topic_set",
"=",
"set",
"(",
")",
"file_row_gen",
"=",
"get_file_row_generator",
"(",
"file_path",
",",
"\",\"",
")",
"# The separator here is irrelevant.",
"for",
"file_row",
"in",
"file_row_gen",
":",
"topic_set... | Opens one of the topic set resource files and returns a set of topics.
- Input: - file_path: The path pointing to the topic set resource file.
- Output: - topic_set: A python set of strings. | [
"Opens",
"one",
"of",
"the",
"topic",
"set",
"resource",
"files",
"and",
"returns",
"a",
"set",
"of",
"topics",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/manage_resources.py#L7-L20 |
40,635 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/manage_resources.py | get_reveal_set | def get_reveal_set():
"""
Returns a set of all the topics that are interesting for REVEAL use-cases.
"""
file_path = get_package_path() + "/twitter/res/topics/story_set.txt"
story_topics = get_topic_set(file_path)
file_path = get_package_path() + "/twitter/res/topics/theme_set.txt"
theme_to... | python | def get_reveal_set():
"""
Returns a set of all the topics that are interesting for REVEAL use-cases.
"""
file_path = get_package_path() + "/twitter/res/topics/story_set.txt"
story_topics = get_topic_set(file_path)
file_path = get_package_path() + "/twitter/res/topics/theme_set.txt"
theme_to... | [
"def",
"get_reveal_set",
"(",
")",
":",
"file_path",
"=",
"get_package_path",
"(",
")",
"+",
"\"/twitter/res/topics/story_set.txt\"",
"story_topics",
"=",
"get_topic_set",
"(",
"file_path",
")",
"file_path",
"=",
"get_package_path",
"(",
")",
"+",
"\"/twitter/res/topi... | Returns a set of all the topics that are interesting for REVEAL use-cases. | [
"Returns",
"a",
"set",
"of",
"all",
"the",
"topics",
"that",
"are",
"interesting",
"for",
"REVEAL",
"use",
"-",
"cases",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/manage_resources.py#L83-L104 |
40,636 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/twitter/manage_resources.py | get_topic_keyword_dictionary | def get_topic_keyword_dictionary():
"""
Opens the topic-keyword map resource file and returns the corresponding python dictionary.
- Input: - file_path: The path pointing to the topic-keyword map resource file.
- Output: - topic_set: A topic to keyword python dictionary.
"""
topic_keyword_dic... | python | def get_topic_keyword_dictionary():
"""
Opens the topic-keyword map resource file and returns the corresponding python dictionary.
- Input: - file_path: The path pointing to the topic-keyword map resource file.
- Output: - topic_set: A topic to keyword python dictionary.
"""
topic_keyword_dic... | [
"def",
"get_topic_keyword_dictionary",
"(",
")",
":",
"topic_keyword_dictionary",
"=",
"dict",
"(",
")",
"file_row_gen",
"=",
"get_file_row_generator",
"(",
"get_package_path",
"(",
")",
"+",
"\"/twitter/res/topics/topic_keyword_mapping\"",
"+",
"\".txt\"",
",",
"\",\"",
... | Opens the topic-keyword map resource file and returns the corresponding python dictionary.
- Input: - file_path: The path pointing to the topic-keyword map resource file.
- Output: - topic_set: A topic to keyword python dictionary. | [
"Opens",
"the",
"topic",
"-",
"keyword",
"map",
"resource",
"file",
"and",
"returns",
"the",
"corresponding",
"python",
"dictionary",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/twitter/manage_resources.py#L107-L122 |
40,637 | shoprunback/openflow | openflow/openflow.py | OpenFlow.get_input | def get_input(self, name, ds):
"""
Retrieves the content of an input given a DataSource. The input acts like a filter over the outputs of the DataSource.
Args:
name (str): The name of the input.
ds (openflow.DataSource): The DataSource that will feed the data.
R... | python | def get_input(self, name, ds):
"""
Retrieves the content of an input given a DataSource. The input acts like a filter over the outputs of the DataSource.
Args:
name (str): The name of the input.
ds (openflow.DataSource): The DataSource that will feed the data.
R... | [
"def",
"get_input",
"(",
"self",
",",
"name",
",",
"ds",
")",
":",
"columns",
"=",
"self",
".",
"inputs",
".",
"get",
"(",
"name",
")",
"df",
"=",
"ds",
".",
"get_dataframe",
"(",
")",
"# set defaults",
"for",
"column",
"in",
"columns",
":",
"if",
... | Retrieves the content of an input given a DataSource. The input acts like a filter over the outputs of the DataSource.
Args:
name (str): The name of the input.
ds (openflow.DataSource): The DataSource that will feed the data.
Returns:
pandas.DataFrame: The content o... | [
"Retrieves",
"the",
"content",
"of",
"an",
"input",
"given",
"a",
"DataSource",
".",
"The",
"input",
"acts",
"like",
"a",
"filter",
"over",
"the",
"outputs",
"of",
"the",
"DataSource",
"."
] | 5bd739a0890cf09198e39bb141f987abf960ee8e | https://github.com/shoprunback/openflow/blob/5bd739a0890cf09198e39bb141f987abf960ee8e/openflow/openflow.py#L9-L28 |
40,638 | helixyte/everest | everest/resources/relationship.py | ResourceRelationship.domain_relationship | def domain_relationship(self):
"""
Returns a domain relationship equivalent with this resource
relationship.
"""
if self.__domain_relationship is None:
ent = self.relator.get_entity()
self.__domain_relationship = \
self.descriptor.make_... | python | def domain_relationship(self):
"""
Returns a domain relationship equivalent with this resource
relationship.
"""
if self.__domain_relationship is None:
ent = self.relator.get_entity()
self.__domain_relationship = \
self.descriptor.make_... | [
"def",
"domain_relationship",
"(",
"self",
")",
":",
"if",
"self",
".",
"__domain_relationship",
"is",
"None",
":",
"ent",
"=",
"self",
".",
"relator",
".",
"get_entity",
"(",
")",
"self",
".",
"__domain_relationship",
"=",
"self",
".",
"descriptor",
".",
... | Returns a domain relationship equivalent with this resource
relationship. | [
"Returns",
"a",
"domain",
"relationship",
"equivalent",
"with",
"this",
"resource",
"relationship",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/resources/relationship.py#L27-L36 |
40,639 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.fit | def fit(self):
"""Fit MCMC AgeDepthModel"""
self._mcmcfit = self.mcmcsetup.run()
self._mcmcfit.burnin(self.burnin)
dmin = min(self._mcmcfit.depth_segments)
dmax = max(self._mcmcfit.depth_segments)
self._thick = (dmax - dmin) / len(self.mcmcfit.depth_segments)
self... | python | def fit(self):
"""Fit MCMC AgeDepthModel"""
self._mcmcfit = self.mcmcsetup.run()
self._mcmcfit.burnin(self.burnin)
dmin = min(self._mcmcfit.depth_segments)
dmax = max(self._mcmcfit.depth_segments)
self._thick = (dmax - dmin) / len(self.mcmcfit.depth_segments)
self... | [
"def",
"fit",
"(",
"self",
")",
":",
"self",
".",
"_mcmcfit",
"=",
"self",
".",
"mcmcsetup",
".",
"run",
"(",
")",
"self",
".",
"_mcmcfit",
".",
"burnin",
"(",
"self",
".",
"burnin",
")",
"dmin",
"=",
"min",
"(",
"self",
".",
"_mcmcfit",
".",
"de... | Fit MCMC AgeDepthModel | [
"Fit",
"MCMC",
"AgeDepthModel"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L64-L72 |
40,640 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.date | def date(self, proxy, how='median', n=500):
"""Date a proxy record
Parameters
----------
proxy : ProxyRecord
how : str
How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n'
randomly selected members of the ... | python | def date(self, proxy, how='median', n=500):
"""Date a proxy record
Parameters
----------
proxy : ProxyRecord
how : str
How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n'
randomly selected members of the ... | [
"def",
"date",
"(",
"self",
",",
"proxy",
",",
"how",
"=",
"'median'",
",",
"n",
"=",
"500",
")",
":",
"assert",
"how",
"in",
"[",
"'median'",
",",
"'ensemble'",
"]",
"ens_members",
"=",
"self",
".",
"mcmcfit",
".",
"n_members",
"(",
")",
"if",
"ho... | Date a proxy record
Parameters
----------
proxy : ProxyRecord
how : str
How to perform the dating. 'median' returns the average of the MCMC ensemble. 'ensemble' returns a 'n'
randomly selected members of the MCMC ensemble. Default is 'median'.
n : int
... | [
"Date",
"a",
"proxy",
"record"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L74-L102 |
40,641 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.plot | def plot(self, agebins=50, p=(2.5, 97.5), ax=None):
"""Age-depth plot"""
if ax is None:
ax = plt.gca()
ax.hist2d(np.repeat(self.depth, self.age_ensemble.shape[1]), self.age_ensemble.flatten(),
(len(self.depth), agebins), cmin=1)
ax.step(self.depth, self.age... | python | def plot(self, agebins=50, p=(2.5, 97.5), ax=None):
"""Age-depth plot"""
if ax is None:
ax = plt.gca()
ax.hist2d(np.repeat(self.depth, self.age_ensemble.shape[1]), self.age_ensemble.flatten(),
(len(self.depth), agebins), cmin=1)
ax.step(self.depth, self.age... | [
"def",
"plot",
"(",
"self",
",",
"agebins",
"=",
"50",
",",
"p",
"=",
"(",
"2.5",
",",
"97.5",
")",
",",
"ax",
"=",
"None",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"ax",
".",
"hist2d",
"(",
"np",
"... | Age-depth plot | [
"Age",
"-",
"depth",
"plot"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L104-L116 |
40,642 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.agedepth | def agedepth(self, d):
"""Get calendar age for a depth
Parameters
----------
d : float
Sediment depth (in cm).
Returns
-------
Numeric giving true age at given depth.
"""
# TODO(brews): Function cannot handle hiatus
# See line... | python | def agedepth(self, d):
"""Get calendar age for a depth
Parameters
----------
d : float
Sediment depth (in cm).
Returns
-------
Numeric giving true age at given depth.
"""
# TODO(brews): Function cannot handle hiatus
# See line... | [
"def",
"agedepth",
"(",
"self",
",",
"d",
")",
":",
"# TODO(brews): Function cannot handle hiatus",
"# See lines 77 - 100 of hist2.cpp",
"x",
"=",
"self",
".",
"mcmcfit",
".",
"sediment_rate",
"theta0",
"=",
"self",
".",
"mcmcfit",
".",
"headage",
"# Age abscissa (in ... | Get calendar age for a depth
Parameters
----------
d : float
Sediment depth (in cm).
Returns
-------
Numeric giving true age at given depth. | [
"Get",
"calendar",
"age",
"for",
"a",
"depth"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L118-L149 |
40,643 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.plot_prior_dates | def plot_prior_dates(self, dwidth=30, ax=None):
"""Plot prior chronology dates in age-depth plot"""
if ax is None:
ax = plt.gca()
depth, probs = self.prior_dates()
pat = []
for i, d in enumerate(depth):
p = probs[i]
z = np.array([p[:, 0], dwidt... | python | def plot_prior_dates(self, dwidth=30, ax=None):
"""Plot prior chronology dates in age-depth plot"""
if ax is None:
ax = plt.gca()
depth, probs = self.prior_dates()
pat = []
for i, d in enumerate(depth):
p = probs[i]
z = np.array([p[:, 0], dwidt... | [
"def",
"plot_prior_dates",
"(",
"self",
",",
"dwidth",
"=",
"30",
",",
"ax",
"=",
"None",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"depth",
",",
"probs",
"=",
"self",
".",
"prior_dates",
"(",
")",
"pat",
... | Plot prior chronology dates in age-depth plot | [
"Plot",
"prior",
"chronology",
"dates",
"in",
"age",
"-",
"depth",
"plot"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L154-L176 |
40,644 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.plot_sediment_rate | def plot_sediment_rate(self, ax=None):
"""Plot sediment accumulation rate prior and posterior distributions"""
if ax is None:
ax = plt.gca()
y_prior, x_prior = self.prior_sediment_rate()
ax.plot(x_prior, y_prior, label='Prior')
y_posterior = self.mcmcfit.sediment_ra... | python | def plot_sediment_rate(self, ax=None):
"""Plot sediment accumulation rate prior and posterior distributions"""
if ax is None:
ax = plt.gca()
y_prior, x_prior = self.prior_sediment_rate()
ax.plot(x_prior, y_prior, label='Prior')
y_posterior = self.mcmcfit.sediment_ra... | [
"def",
"plot_sediment_rate",
"(",
"self",
",",
"ax",
"=",
"None",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"y_prior",
",",
"x_prior",
"=",
"self",
".",
"prior_sediment_rate",
"(",
")",
"ax",
".",
"plot",
"(",... | Plot sediment accumulation rate prior and posterior distributions | [
"Plot",
"sediment",
"accumulation",
"rate",
"prior",
"and",
"posterior",
"distributions"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L181-L205 |
40,645 | brews/snakebacon | snakebacon/agedepth.py | AgeDepthModel.plot_sediment_memory | def plot_sediment_memory(self, ax=None):
"""Plot sediment memory prior and posterior distributions"""
if ax is None:
ax = plt.gca()
y_prior, x_prior = self.prior_sediment_memory()
ax.plot(x_prior, y_prior, label='Prior')
y_posterior = self.mcmcfit.sediment_memory
... | python | def plot_sediment_memory(self, ax=None):
"""Plot sediment memory prior and posterior distributions"""
if ax is None:
ax = plt.gca()
y_prior, x_prior = self.prior_sediment_memory()
ax.plot(x_prior, y_prior, label='Prior')
y_posterior = self.mcmcfit.sediment_memory
... | [
"def",
"plot_sediment_memory",
"(",
"self",
",",
"ax",
"=",
"None",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"y_prior",
",",
"x_prior",
"=",
"self",
".",
"prior_sediment_memory",
"(",
")",
"ax",
".",
"plot",
... | Plot sediment memory prior and posterior distributions | [
"Plot",
"sediment",
"memory",
"prior",
"and",
"posterior",
"distributions"
] | f5363d0d1225912adc30031bf2c13b54000de8f2 | https://github.com/brews/snakebacon/blob/f5363d0d1225912adc30031bf2c13b54000de8f2/snakebacon/agedepth.py#L210-L234 |
40,646 | RI-imaging/qpformat | qpformat/cli.py | qpinfo | def qpinfo():
"""Print information of a quantitative phase imaging dataset"""
parser = qpinfo_parser()
args = parser.parse_args()
path = pathlib.Path(args.path).resolve()
try:
ds = load_data(path)
except UnknownFileFormatError:
print("Unknown file format: {}".format(path))
... | python | def qpinfo():
"""Print information of a quantitative phase imaging dataset"""
parser = qpinfo_parser()
args = parser.parse_args()
path = pathlib.Path(args.path).resolve()
try:
ds = load_data(path)
except UnknownFileFormatError:
print("Unknown file format: {}".format(path))
... | [
"def",
"qpinfo",
"(",
")",
":",
"parser",
"=",
"qpinfo_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"path",
"=",
"pathlib",
".",
"Path",
"(",
"args",
".",
"path",
")",
".",
"resolve",
"(",
")",
"try",
":",
"ds",
"=",
"lo... | Print information of a quantitative phase imaging dataset | [
"Print",
"information",
"of",
"a",
"quantitative",
"phase",
"imaging",
"dataset"
] | 364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb | https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/cli.py#L9-L24 |
40,647 | NORDUnet/python-norduniclient | norduniclient/core.py | get_node_meta_type | def get_node_meta_type(manager, handle_id):
"""
Returns the meta type of the supplied node as a string.
:param manager: Neo4jDBSessionManager
:param handle_id: Unique id
:return: string
"""
node = get_node(manager=manager, handle_id=handle_id, legacy=False)
for label in node.labels:
... | python | def get_node_meta_type(manager, handle_id):
"""
Returns the meta type of the supplied node as a string.
:param manager: Neo4jDBSessionManager
:param handle_id: Unique id
:return: string
"""
node = get_node(manager=manager, handle_id=handle_id, legacy=False)
for label in node.labels:
... | [
"def",
"get_node_meta_type",
"(",
"manager",
",",
"handle_id",
")",
":",
"node",
"=",
"get_node",
"(",
"manager",
"=",
"manager",
",",
"handle_id",
"=",
"handle_id",
",",
"legacy",
"=",
"False",
")",
"for",
"label",
"in",
"node",
".",
"labels",
":",
"if"... | Returns the meta type of the supplied node as a string.
:param manager: Neo4jDBSessionManager
:param handle_id: Unique id
:return: string | [
"Returns",
"the",
"meta",
"type",
"of",
"the",
"supplied",
"node",
"as",
"a",
"string",
"."
] | ee5084a6f45caac614b4fda4a023749ca52f786c | https://github.com/NORDUnet/python-norduniclient/blob/ee5084a6f45caac614b4fda4a023749ca52f786c/norduniclient/core.py#L353-L365 |
40,648 | NORDUnet/python-norduniclient | norduniclient/core.py | create_relationship | def create_relationship(manager, handle_id, other_handle_id, rel_type):
"""
Makes a relationship from node to other_node depending on which
meta_type the nodes are. Returns the relationship or raises
NoRelationshipPossible exception.
"""
meta_type = get_node_meta_type(manager, handle_id)
if ... | python | def create_relationship(manager, handle_id, other_handle_id, rel_type):
"""
Makes a relationship from node to other_node depending on which
meta_type the nodes are. Returns the relationship or raises
NoRelationshipPossible exception.
"""
meta_type = get_node_meta_type(manager, handle_id)
if ... | [
"def",
"create_relationship",
"(",
"manager",
",",
"handle_id",
",",
"other_handle_id",
",",
"rel_type",
")",
":",
"meta_type",
"=",
"get_node_meta_type",
"(",
"manager",
",",
"handle_id",
")",
"if",
"meta_type",
"==",
"'Location'",
":",
"return",
"create_location... | Makes a relationship from node to other_node depending on which
meta_type the nodes are. Returns the relationship or raises
NoRelationshipPossible exception. | [
"Makes",
"a",
"relationship",
"from",
"node",
"to",
"other_node",
"depending",
"on",
"which",
"meta_type",
"the",
"nodes",
"are",
".",
"Returns",
"the",
"relationship",
"or",
"raises",
"NoRelationshipPossible",
"exception",
"."
] | ee5084a6f45caac614b4fda4a023749ca52f786c | https://github.com/NORDUnet/python-norduniclient/blob/ee5084a6f45caac614b4fda4a023749ca52f786c/norduniclient/core.py#L655-L671 |
40,649 | regardscitoyens/legipy | legipy/parsers/code_parser.py | CodeParser.parse_code | def parse_code(self, url, html):
"""
Parse the code details and TOC from the given HTML content
:type url: str
:param url: source URL of the page
:type html: unicode
:param html: Content of the HTML
:return: the code
"""
soup = BeautifulSoup(h... | python | def parse_code(self, url, html):
"""
Parse the code details and TOC from the given HTML content
:type url: str
:param url: source URL of the page
:type html: unicode
:param html: Content of the HTML
:return: the code
"""
soup = BeautifulSoup(h... | [
"def",
"parse_code",
"(",
"self",
",",
"url",
",",
"html",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"html",
",",
"'html5lib'",
",",
"from_encoding",
"=",
"'utf-8'",
")",
"# -- main text",
"div",
"=",
"(",
"soup",
".",
"find",
"(",
"'div'",
",",
"id... | Parse the code details and TOC from the given HTML content
:type url: str
:param url: source URL of the page
:type html: unicode
:param html: Content of the HTML
:return: the code | [
"Parse",
"the",
"code",
"details",
"and",
"TOC",
"from",
"the",
"given",
"HTML",
"content"
] | 3553c5a56769f23d8922adfbfe44d7b9f4a5204c | https://github.com/regardscitoyens/legipy/blob/3553c5a56769f23d8922adfbfe44d7b9f4a5204c/legipy/parsers/code_parser.py#L52-L93 |
40,650 | regardscitoyens/legipy | legipy/parsers/code_parser.py | CodeParser.parse_code_ul | def parse_code_ul(self, url, ul):
"""Fill the toc item"""
li_list = ul.find_all('li', recursive=False)
li = li_list[0]
span_title = li.find('span',
attrs={'class': re.compile(r'TM\d+Code')},
recursive=False)
section = Sec... | python | def parse_code_ul(self, url, ul):
"""Fill the toc item"""
li_list = ul.find_all('li', recursive=False)
li = li_list[0]
span_title = li.find('span',
attrs={'class': re.compile(r'TM\d+Code')},
recursive=False)
section = Sec... | [
"def",
"parse_code_ul",
"(",
"self",
",",
"url",
",",
"ul",
")",
":",
"li_list",
"=",
"ul",
".",
"find_all",
"(",
"'li'",
",",
"recursive",
"=",
"False",
")",
"li",
"=",
"li_list",
"[",
"0",
"]",
"span_title",
"=",
"li",
".",
"find",
"(",
"'span'",... | Fill the toc item | [
"Fill",
"the",
"toc",
"item"
] | 3553c5a56769f23d8922adfbfe44d7b9f4a5204c | https://github.com/regardscitoyens/legipy/blob/3553c5a56769f23d8922adfbfe44d7b9f4a5204c/legipy/parsers/code_parser.py#L95-L123 |
40,651 | childsish/lhc-python | lhc/indices/tracked_index.py | Track.add | def add(self, interval, offset):
"""
The added interval must be overlapping or beyond the last stored interval ie. added in sorted order.
:param interval: interval to add
:param offset: full virtual offset to add
:return:
"""
start, stop = self.get_start_stop(int... | python | def add(self, interval, offset):
"""
The added interval must be overlapping or beyond the last stored interval ie. added in sorted order.
:param interval: interval to add
:param offset: full virtual offset to add
:return:
"""
start, stop = self.get_start_stop(int... | [
"def",
"add",
"(",
"self",
",",
"interval",
",",
"offset",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"get_start_stop",
"(",
"interval",
")",
"if",
"len",
"(",
"self",
".",
"starts",
")",
">",
"0",
":",
"if",
"start",
"<",
"self",
".",
"st... | The added interval must be overlapping or beyond the last stored interval ie. added in sorted order.
:param interval: interval to add
:param offset: full virtual offset to add
:return: | [
"The",
"added",
"interval",
"must",
"be",
"overlapping",
"or",
"beyond",
"the",
"last",
"stored",
"interval",
"ie",
".",
"added",
"in",
"sorted",
"order",
"."
] | 0a669f46a40a39f24d28665e8b5b606dc7e86beb | https://github.com/childsish/lhc-python/blob/0a669f46a40a39f24d28665e8b5b606dc7e86beb/lhc/indices/tracked_index.py#L30-L48 |
40,652 | vicalloy/lbutils | lbutils/qs.py | get_sum | def get_sum(qs, field):
"""
get sum for queryset.
``qs``: queryset
``field``: The field name to sum.
"""
sum_field = '%s__sum' % field
qty = qs.aggregate(Sum(field))[sum_field]
return qty if qty else 0 | python | def get_sum(qs, field):
"""
get sum for queryset.
``qs``: queryset
``field``: The field name to sum.
"""
sum_field = '%s__sum' % field
qty = qs.aggregate(Sum(field))[sum_field]
return qty if qty else 0 | [
"def",
"get_sum",
"(",
"qs",
",",
"field",
")",
":",
"sum_field",
"=",
"'%s__sum'",
"%",
"field",
"qty",
"=",
"qs",
".",
"aggregate",
"(",
"Sum",
"(",
"field",
")",
")",
"[",
"sum_field",
"]",
"return",
"qty",
"if",
"qty",
"else",
"0"
] | get sum for queryset.
``qs``: queryset
``field``: The field name to sum. | [
"get",
"sum",
"for",
"queryset",
"."
] | 66ae7e73bc939f073cdc1b91602a95e67caf4ba6 | https://github.com/vicalloy/lbutils/blob/66ae7e73bc939f073cdc1b91602a95e67caf4ba6/lbutils/qs.py#L28-L37 |
40,653 | vicalloy/lbutils | lbutils/qs.py | get_max | def get_max(qs, field):
"""
get max for queryset.
qs: queryset
field: The field name to max.
"""
max_field = '%s__max' % field
num = qs.aggregate(Max(field))[max_field]
return num if num else 0 | python | def get_max(qs, field):
"""
get max for queryset.
qs: queryset
field: The field name to max.
"""
max_field = '%s__max' % field
num = qs.aggregate(Max(field))[max_field]
return num if num else 0 | [
"def",
"get_max",
"(",
"qs",
",",
"field",
")",
":",
"max_field",
"=",
"'%s__max'",
"%",
"field",
"num",
"=",
"qs",
".",
"aggregate",
"(",
"Max",
"(",
"field",
")",
")",
"[",
"max_field",
"]",
"return",
"num",
"if",
"num",
"else",
"0"
] | get max for queryset.
qs: queryset
field: The field name to max. | [
"get",
"max",
"for",
"queryset",
"."
] | 66ae7e73bc939f073cdc1b91602a95e67caf4ba6 | https://github.com/vicalloy/lbutils/blob/66ae7e73bc939f073cdc1b91602a95e67caf4ba6/lbutils/qs.py#L40-L49 |
40,654 | vicalloy/lbutils | lbutils/qs.py | do_filter | def do_filter(qs, qdata, quick_query_fields=[], int_quick_query_fields=[]):
"""
auto filter queryset by dict.
qs: queryset need to filter.
qdata:
quick_query_fields:
int_quick_query_fields:
"""
try:
qs = qs.filter(
__gen_quick_query_params(
qdata.get(... | python | def do_filter(qs, qdata, quick_query_fields=[], int_quick_query_fields=[]):
"""
auto filter queryset by dict.
qs: queryset need to filter.
qdata:
quick_query_fields:
int_quick_query_fields:
"""
try:
qs = qs.filter(
__gen_quick_query_params(
qdata.get(... | [
"def",
"do_filter",
"(",
"qs",
",",
"qdata",
",",
"quick_query_fields",
"=",
"[",
"]",
",",
"int_quick_query_fields",
"=",
"[",
"]",
")",
":",
"try",
":",
"qs",
"=",
"qs",
".",
"filter",
"(",
"__gen_quick_query_params",
"(",
"qdata",
".",
"get",
"(",
"... | auto filter queryset by dict.
qs: queryset need to filter.
qdata:
quick_query_fields:
int_quick_query_fields: | [
"auto",
"filter",
"queryset",
"by",
"dict",
"."
] | 66ae7e73bc939f073cdc1b91602a95e67caf4ba6 | https://github.com/vicalloy/lbutils/blob/66ae7e73bc939f073cdc1b91602a95e67caf4ba6/lbutils/qs.py#L52-L72 |
40,655 | zsiciarz/pygcvs | pygcvs/helpers.py | read_gcvs | def read_gcvs(filename):
"""
Reads variable star data in `GCVS format`_.
:param filename: path to GCVS data file (usually ``iii.dat``)
.. _`GCVS format`: http://www.sai.msu.su/gcvs/gcvs/iii/html/
"""
with open(filename, 'r') as fp:
parser = GcvsParser(fp)
for star in parser:
... | python | def read_gcvs(filename):
"""
Reads variable star data in `GCVS format`_.
:param filename: path to GCVS data file (usually ``iii.dat``)
.. _`GCVS format`: http://www.sai.msu.su/gcvs/gcvs/iii/html/
"""
with open(filename, 'r') as fp:
parser = GcvsParser(fp)
for star in parser:
... | [
"def",
"read_gcvs",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"fp",
":",
"parser",
"=",
"GcvsParser",
"(",
"fp",
")",
"for",
"star",
"in",
"parser",
":",
"yield",
"star"
] | Reads variable star data in `GCVS format`_.
:param filename: path to GCVS data file (usually ``iii.dat``)
.. _`GCVS format`: http://www.sai.msu.su/gcvs/gcvs/iii/html/ | [
"Reads",
"variable",
"star",
"data",
"in",
"GCVS",
"format",
"_",
"."
] | ed5522ab9cf9237592a6af7a0bc8cad079afeb67 | https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/helpers.py#L9-L20 |
40,656 | zsiciarz/pygcvs | pygcvs/helpers.py | dict_to_body | def dict_to_body(star_dict):
"""
Converts a dictionary of variable star data to a `Body` instance.
Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed.
"""
if ephem is None: # pragma: no cover
raise NotImplementedError("Please install PyEphem in order to use dict_to_body."... | python | def dict_to_body(star_dict):
"""
Converts a dictionary of variable star data to a `Body` instance.
Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed.
"""
if ephem is None: # pragma: no cover
raise NotImplementedError("Please install PyEphem in order to use dict_to_body."... | [
"def",
"dict_to_body",
"(",
"star_dict",
")",
":",
"if",
"ephem",
"is",
"None",
":",
"# pragma: no cover",
"raise",
"NotImplementedError",
"(",
"\"Please install PyEphem in order to use dict_to_body.\"",
")",
"body",
"=",
"ephem",
".",
"FixedBody",
"(",
")",
"body",
... | Converts a dictionary of variable star data to a `Body` instance.
Requires `PyEphem <http://rhodesmill.org/pyephem/>`_ to be installed. | [
"Converts",
"a",
"dictionary",
"of",
"variable",
"star",
"data",
"to",
"a",
"Body",
"instance",
"."
] | ed5522ab9cf9237592a6af7a0bc8cad079afeb67 | https://github.com/zsiciarz/pygcvs/blob/ed5522ab9cf9237592a6af7a0bc8cad079afeb67/pygcvs/helpers.py#L23-L36 |
40,657 | BlackEarth/bxml | bxml/xlsx.py | XLSX.tempfile | def tempfile(self):
"write the docx to a named tmpfile and return the tmpfile filename"
tf = tempfile.NamedTemporaryFile()
tfn = tf.name
tf.close()
os.remove(tf.name)
shutil.copy(self.fn, tfn)
return tfn | python | def tempfile(self):
"write the docx to a named tmpfile and return the tmpfile filename"
tf = tempfile.NamedTemporaryFile()
tfn = tf.name
tf.close()
os.remove(tf.name)
shutil.copy(self.fn, tfn)
return tfn | [
"def",
"tempfile",
"(",
"self",
")",
":",
"tf",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"tfn",
"=",
"tf",
".",
"name",
"tf",
".",
"close",
"(",
")",
"os",
".",
"remove",
"(",
"tf",
".",
"name",
")",
"shutil",
".",
"copy",
"(",
"self... | write the docx to a named tmpfile and return the tmpfile filename | [
"write",
"the",
"docx",
"to",
"a",
"named",
"tmpfile",
"and",
"return",
"the",
"tmpfile",
"filename"
] | 8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77 | https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xlsx.py#L26-L33 |
40,658 | BlackEarth/bxml | bxml/xlsx.py | XLSX.sheets | def sheets(self):
"""return the sheets of data."""
data = Dict()
for src in [src for src in self.zipfile.namelist() if 'xl/worksheets/' in src]:
name = os.path.splitext(os.path.basename(src))[0]
xml = self.xml(src)
data[name] = xml
return data | python | def sheets(self):
"""return the sheets of data."""
data = Dict()
for src in [src for src in self.zipfile.namelist() if 'xl/worksheets/' in src]:
name = os.path.splitext(os.path.basename(src))[0]
xml = self.xml(src)
data[name] = xml
return data | [
"def",
"sheets",
"(",
"self",
")",
":",
"data",
"=",
"Dict",
"(",
")",
"for",
"src",
"in",
"[",
"src",
"for",
"src",
"in",
"self",
".",
"zipfile",
".",
"namelist",
"(",
")",
"if",
"'xl/worksheets/'",
"in",
"src",
"]",
":",
"name",
"=",
"os",
".",... | return the sheets of data. | [
"return",
"the",
"sheets",
"of",
"data",
"."
] | 8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77 | https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xlsx.py#L50-L57 |
40,659 | BlackEarth/bxml | bxml/xlsx.py | XLSX.workbook_data | def workbook_data(self):
"""return a readable XML form of the data."""
document = XML(
fn=os.path.splitext(self.fn)[0]+'.xml',
root=Element.workbook())
shared_strings = [
str(t.text) for t in
self.xml('xl/sharedStrings.xml')
.root... | python | def workbook_data(self):
"""return a readable XML form of the data."""
document = XML(
fn=os.path.splitext(self.fn)[0]+'.xml',
root=Element.workbook())
shared_strings = [
str(t.text) for t in
self.xml('xl/sharedStrings.xml')
.root... | [
"def",
"workbook_data",
"(",
"self",
")",
":",
"document",
"=",
"XML",
"(",
"fn",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"self",
".",
"fn",
")",
"[",
"0",
"]",
"+",
"'.xml'",
",",
"root",
"=",
"Element",
".",
"workbook",
"(",
")",
")",
"... | return a readable XML form of the data. | [
"return",
"a",
"readable",
"XML",
"form",
"of",
"the",
"data",
"."
] | 8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77 | https://github.com/BlackEarth/bxml/blob/8fbea5dad7fadc7b854ddbeff6ecfb55aaceeb77/bxml/xlsx.py#L63-L75 |
40,660 | erikvw/django-collect-offline-files | django_collect_offline_files/file_queues/file_queue_handlers.py | RegexFileQueueHandlerIncoming.process | def process(self, event):
"""Put and process tasks in queue.
"""
logger.info(f"{self}: put {event.src_path}")
self.queue.put(os.path.basename(event.src_path)) | python | def process(self, event):
"""Put and process tasks in queue.
"""
logger.info(f"{self}: put {event.src_path}")
self.queue.put(os.path.basename(event.src_path)) | [
"def",
"process",
"(",
"self",
",",
"event",
")",
":",
"logger",
".",
"info",
"(",
"f\"{self}: put {event.src_path}\"",
")",
"self",
".",
"queue",
".",
"put",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"event",
".",
"src_path",
")",
")"
] | Put and process tasks in queue. | [
"Put",
"and",
"process",
"tasks",
"in",
"queue",
"."
] | 78f61c823ea3926eb88206b019b5dca3c36017da | https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/file_queues/file_queue_handlers.py#L26-L30 |
40,661 | Caramel/treacle | treacle/scrape_apple_ical.py | main | def main():
"""
Scrapes Apple's iCal feed for Australian public holidays and generates per-
state listings.
"""
print "Downloading Holidays from Apple's server..."
r = requests.get('http://files.apple.com/calendars/Australian32Holidays.ics')
cal = Calendar.from_ical(r.text)
print "Processing calendar data... | python | def main():
"""
Scrapes Apple's iCal feed for Australian public holidays and generates per-
state listings.
"""
print "Downloading Holidays from Apple's server..."
r = requests.get('http://files.apple.com/calendars/Australian32Holidays.ics')
cal = Calendar.from_ical(r.text)
print "Processing calendar data... | [
"def",
"main",
"(",
")",
":",
"print",
"\"Downloading Holidays from Apple's server...\"",
"r",
"=",
"requests",
".",
"get",
"(",
"'http://files.apple.com/calendars/Australian32Holidays.ics'",
")",
"cal",
"=",
"Calendar",
".",
"from_ical",
"(",
"r",
".",
"text",
")",
... | Scrapes Apple's iCal feed for Australian public holidays and generates per-
state listings. | [
"Scrapes",
"Apple",
"s",
"iCal",
"feed",
"for",
"Australian",
"public",
"holidays",
"and",
"generates",
"per",
"-",
"state",
"listings",
"."
] | 70f85a505c0f345659850aec1715c46c687d0e48 | https://github.com/Caramel/treacle/blob/70f85a505c0f345659850aec1715c46c687d0e48/treacle/scrape_apple_ical.py#L45-L101 |
40,662 | SeattleTestbed/seash | pyreadline/modes/vi.py | ViMode.init_editing_mode | def init_editing_mode(self, e): # (M-C-j)
'''Initialize vi editingmode'''
self.show_all_if_ambiguous = 'on'
self.key_dispatch = {}
self.__vi_insert_mode = None
self._vi_command = None
self._vi_command_edit = None
self._vi_key_find_char = None
self._vi_key_... | python | def init_editing_mode(self, e): # (M-C-j)
'''Initialize vi editingmode'''
self.show_all_if_ambiguous = 'on'
self.key_dispatch = {}
self.__vi_insert_mode = None
self._vi_command = None
self._vi_command_edit = None
self._vi_key_find_char = None
self._vi_key_... | [
"def",
"init_editing_mode",
"(",
"self",
",",
"e",
")",
":",
"# (M-C-j)",
"self",
".",
"show_all_if_ambiguous",
"=",
"'on'",
"self",
".",
"key_dispatch",
"=",
"{",
"}",
"self",
".",
"__vi_insert_mode",
"=",
"None",
"self",
".",
"_vi_command",
"=",
"None",
... | Initialize vi editingmode | [
"Initialize",
"vi",
"editingmode"
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/vi.py#L51-L89 |
40,663 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/mongo/preprocess_data.py | get_collection_documents_generator | def get_collection_documents_generator(client, database_name, collection_name, spec, latest_n, sort_key):
"""
This is a python generator that yields tweets stored in a mongodb collection.
Tweet "created_at" field is assumed to have been stored in the format supported by MongoDB.
Inputs: - client: A py... | python | def get_collection_documents_generator(client, database_name, collection_name, spec, latest_n, sort_key):
"""
This is a python generator that yields tweets stored in a mongodb collection.
Tweet "created_at" field is assumed to have been stored in the format supported by MongoDB.
Inputs: - client: A py... | [
"def",
"get_collection_documents_generator",
"(",
"client",
",",
"database_name",
",",
"collection_name",
",",
"spec",
",",
"latest_n",
",",
"sort_key",
")",
":",
"mongo_database",
"=",
"client",
"[",
"database_name",
"]",
"collection",
"=",
"mongo_database",
"[",
... | This is a python generator that yields tweets stored in a mongodb collection.
Tweet "created_at" field is assumed to have been stored in the format supported by MongoDB.
Inputs: - client: A pymongo MongoClient object.
- database_name: The name of a Mongo database as a string.
- collect... | [
"This",
"is",
"a",
"python",
"generator",
"that",
"yields",
"tweets",
"stored",
"in",
"a",
"mongodb",
"collection",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/mongo/preprocess_data.py#L117-L146 |
40,664 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/mongo/preprocess_data.py | extract_connected_components | def extract_connected_components(graph, connectivity_type, node_to_id):
"""
Extract the largest connected component from a graph.
Inputs: - graph: An adjacency matrix in scipy sparse matrix format.
- connectivity_type: A string that can be either: "strong" or "weak".
- node_to_id... | python | def extract_connected_components(graph, connectivity_type, node_to_id):
"""
Extract the largest connected component from a graph.
Inputs: - graph: An adjacency matrix in scipy sparse matrix format.
- connectivity_type: A string that can be either: "strong" or "weak".
- node_to_id... | [
"def",
"extract_connected_components",
"(",
"graph",
",",
"connectivity_type",
",",
"node_to_id",
")",
":",
"# Get a networkx graph.",
"nx_graph",
"=",
"nx",
".",
"from_scipy_sparse_matrix",
"(",
"graph",
",",
"create_using",
"=",
"nx",
".",
"DiGraph",
"(",
")",
"... | Extract the largest connected component from a graph.
Inputs: - graph: An adjacency matrix in scipy sparse matrix format.
- connectivity_type: A string that can be either: "strong" or "weak".
- node_to_id: A map from graph node id to Twitter id, in python dictionary format.
Outputs:... | [
"Extract",
"the",
"largest",
"connected",
"component",
"from",
"a",
"graph",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/mongo/preprocess_data.py#L768-L808 |
40,665 | agrc/agrc.python | agrc/messaging.py | Emailer.sendEmail | def sendEmail(self, subject, body, toAddress=False):
"""
sends an email using the agrcpythonemailer@gmail.com account
"""
if not toAddress:
toAddress = self.toAddress
toAddress = toAddress.split(';')
message = MIMEText(body)
message['Subject'] = subj... | python | def sendEmail(self, subject, body, toAddress=False):
"""
sends an email using the agrcpythonemailer@gmail.com account
"""
if not toAddress:
toAddress = self.toAddress
toAddress = toAddress.split(';')
message = MIMEText(body)
message['Subject'] = subj... | [
"def",
"sendEmail",
"(",
"self",
",",
"subject",
",",
"body",
",",
"toAddress",
"=",
"False",
")",
":",
"if",
"not",
"toAddress",
":",
"toAddress",
"=",
"self",
".",
"toAddress",
"toAddress",
"=",
"toAddress",
".",
"split",
"(",
"';'",
")",
"message",
... | sends an email using the agrcpythonemailer@gmail.com account | [
"sends",
"an",
"email",
"using",
"the",
"agrcpythonemailer"
] | be427e919bd4cdd6f19524b7f7fe18882429c25b | https://github.com/agrc/agrc.python/blob/be427e919bd4cdd6f19524b7f7fe18882429c25b/agrc/messaging.py#L25-L49 |
40,666 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode._get_completions | def _get_completions(self):
"""Return a list of possible completions for the string ending at the point.
Also set begidx and endidx in the process."""
completions = []
self.begidx = self.l_buffer.point
self.endidx = self.l_buffer.point
buf=self.l_buffer.line_buffer
... | python | def _get_completions(self):
"""Return a list of possible completions for the string ending at the point.
Also set begidx and endidx in the process."""
completions = []
self.begidx = self.l_buffer.point
self.endidx = self.l_buffer.point
buf=self.l_buffer.line_buffer
... | [
"def",
"_get_completions",
"(",
"self",
")",
":",
"completions",
"=",
"[",
"]",
"self",
".",
"begidx",
"=",
"self",
".",
"l_buffer",
".",
"point",
"self",
".",
"endidx",
"=",
"self",
".",
"l_buffer",
".",
"point",
"buf",
"=",
"self",
".",
"l_buffer",
... | Return a list of possible completions for the string ending at the point.
Also set begidx and endidx in the process. | [
"Return",
"a",
"list",
"of",
"possible",
"completions",
"for",
"the",
"string",
"ending",
"at",
"the",
"point",
".",
"Also",
"set",
"begidx",
"and",
"endidx",
"in",
"the",
"process",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L179-L228 |
40,667 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.complete | def complete(self, e): # (TAB)
u"""Attempt to perform completion on the text before point. The
actual completion performed is application-specific. The default is
filename completion."""
completions = self._get_completions()
if completions:
cprefix = commonprefi... | python | def complete(self, e): # (TAB)
u"""Attempt to perform completion on the text before point. The
actual completion performed is application-specific. The default is
filename completion."""
completions = self._get_completions()
if completions:
cprefix = commonprefi... | [
"def",
"complete",
"(",
"self",
",",
"e",
")",
":",
"# (TAB)\r",
"completions",
"=",
"self",
".",
"_get_completions",
"(",
")",
"if",
"completions",
":",
"cprefix",
"=",
"commonprefix",
"(",
"completions",
")",
"if",
"len",
"(",
"cprefix",
")",
">",
"0",... | u"""Attempt to perform completion on the text before point. The
actual completion performed is application-specific. The default is
filename completion. | [
"u",
"Attempt",
"to",
"perform",
"completion",
"on",
"the",
"text",
"before",
"point",
".",
"The",
"actual",
"completion",
"performed",
"is",
"application",
"-",
"specific",
".",
"The",
"default",
"is",
"filename",
"completion",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L251-L270 |
40,668 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.possible_completions | def possible_completions(self, e): # (M-?)
u"""List the possible completions of the text before point. """
completions = self._get_completions()
self._display_completions(completions)
self.finalize() | python | def possible_completions(self, e): # (M-?)
u"""List the possible completions of the text before point. """
completions = self._get_completions()
self._display_completions(completions)
self.finalize() | [
"def",
"possible_completions",
"(",
"self",
",",
"e",
")",
":",
"# (M-?)\r",
"completions",
"=",
"self",
".",
"_get_completions",
"(",
")",
"self",
".",
"_display_completions",
"(",
"completions",
")",
"self",
".",
"finalize",
"(",
")"
] | u"""List the possible completions of the text before point. | [
"u",
"List",
"the",
"possible",
"completions",
"of",
"the",
"text",
"before",
"point",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L272-L276 |
40,669 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.insert_completions | def insert_completions(self, e): # (M-*)
u"""Insert all completions of the text before point that would have
been generated by possible-completions."""
completions = self._get_completions()
b = self.begidx
e = self.endidx
for comp in completions:
rep = ... | python | def insert_completions(self, e): # (M-*)
u"""Insert all completions of the text before point that would have
been generated by possible-completions."""
completions = self._get_completions()
b = self.begidx
e = self.endidx
for comp in completions:
rep = ... | [
"def",
"insert_completions",
"(",
"self",
",",
"e",
")",
":",
"# (M-*)\r",
"completions",
"=",
"self",
".",
"_get_completions",
"(",
")",
"b",
"=",
"self",
".",
"begidx",
"e",
"=",
"self",
".",
"endidx",
"for",
"comp",
"in",
"completions",
":",
"rep",
... | u"""Insert all completions of the text before point that would have
been generated by possible-completions. | [
"u",
"Insert",
"all",
"completions",
"of",
"the",
"text",
"before",
"point",
"that",
"would",
"have",
"been",
"generated",
"by",
"possible",
"-",
"completions",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L278-L291 |
40,670 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.insert_text | def insert_text(self, string):
u"""Insert text into the command line."""
self.l_buffer.insert_text(string, self.argument_reset)
self.finalize() | python | def insert_text(self, string):
u"""Insert text into the command line."""
self.l_buffer.insert_text(string, self.argument_reset)
self.finalize() | [
"def",
"insert_text",
"(",
"self",
",",
"string",
")",
":",
"self",
".",
"l_buffer",
".",
"insert_text",
"(",
"string",
",",
"self",
".",
"argument_reset",
")",
"self",
".",
"finalize",
"(",
")"
] | u"""Insert text into the command line. | [
"u",
"Insert",
"text",
"into",
"the",
"command",
"line",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L308-L311 |
40,671 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.delete_char | def delete_char(self, e): # (C-d)
u"""Delete the character at point. If point is at the beginning of
the line, there are no characters in the line, and the last
character typed was not bound to delete-char, then return EOF."""
self.l_buffer.delete_char(self.argument_reset)
s... | python | def delete_char(self, e): # (C-d)
u"""Delete the character at point. If point is at the beginning of
the line, there are no characters in the line, and the last
character typed was not bound to delete-char, then return EOF."""
self.l_buffer.delete_char(self.argument_reset)
s... | [
"def",
"delete_char",
"(",
"self",
",",
"e",
")",
":",
"# (C-d)\r",
"self",
".",
"l_buffer",
".",
"delete_char",
"(",
"self",
".",
"argument_reset",
")",
"self",
".",
"finalize",
"(",
")"
] | u"""Delete the character at point. If point is at the beginning of
the line, there are no characters in the line, and the last
character typed was not bound to delete-char, then return EOF. | [
"u",
"Delete",
"the",
"character",
"at",
"point",
".",
"If",
"point",
"is",
"at",
"the",
"beginning",
"of",
"the",
"line",
"there",
"are",
"no",
"characters",
"in",
"the",
"line",
"and",
"the",
"last",
"character",
"typed",
"was",
"not",
"bound",
"to",
... | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L443-L448 |
40,672 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.self_insert | def self_insert(self, e): # (a, b, A, 1, !, ...)
u"""Insert yourself. """
if e.char and ord(e.char)!=0: #don't insert null character in buffer, can happen with dead keys.
self.insert_text(e.char)
self.finalize() | python | def self_insert(self, e): # (a, b, A, 1, !, ...)
u"""Insert yourself. """
if e.char and ord(e.char)!=0: #don't insert null character in buffer, can happen with dead keys.
self.insert_text(e.char)
self.finalize() | [
"def",
"self_insert",
"(",
"self",
",",
"e",
")",
":",
"# (a, b, A, 1, !, ...)\r",
"if",
"e",
".",
"char",
"and",
"ord",
"(",
"e",
".",
"char",
")",
"!=",
"0",
":",
"#don't insert null character in buffer, can happen with dead keys.\r",
"self",
".",
"insert_text",... | u"""Insert yourself. | [
"u",
"Insert",
"yourself",
"."
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L473-L477 |
40,673 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.paste | def paste(self,e):
u"""Paste windows clipboard.
Assume single line strip other lines and end of line markers and trailing spaces""" #(Control-v)
if self.enable_win32_clipboard:
txt=clipboard.get_clipboard_text_and_convert(False)
txt=txt.split("\n")[0].strip("... | python | def paste(self,e):
u"""Paste windows clipboard.
Assume single line strip other lines and end of line markers and trailing spaces""" #(Control-v)
if self.enable_win32_clipboard:
txt=clipboard.get_clipboard_text_and_convert(False)
txt=txt.split("\n")[0].strip("... | [
"def",
"paste",
"(",
"self",
",",
"e",
")",
":",
"#(Control-v)\r",
"if",
"self",
".",
"enable_win32_clipboard",
":",
"txt",
"=",
"clipboard",
".",
"get_clipboard_text_and_convert",
"(",
"False",
")",
"txt",
"=",
"txt",
".",
"split",
"(",
"\"\\n\"",
")",
"[... | u"""Paste windows clipboard.
Assume single line strip other lines and end of line markers and trailing spaces | [
"u",
"Paste",
"windows",
"clipboard",
".",
"Assume",
"single",
"line",
"strip",
"other",
"lines",
"and",
"end",
"of",
"line",
"markers",
"and",
"trailing",
"spaces"
] | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L482-L490 |
40,674 | SeattleTestbed/seash | pyreadline/modes/basemode.py | BaseMode.dump_functions | def dump_functions(self, e): # ()
u"""Print all of the functions and their key bindings to the Readline
output stream. If a numeric argument is supplied, the output is
formatted in such a way that it can be made part of an inputrc
file. This command is unbound by default."""
... | python | def dump_functions(self, e): # ()
u"""Print all of the functions and their key bindings to the Readline
output stream. If a numeric argument is supplied, the output is
formatted in such a way that it can be made part of an inputrc
file. This command is unbound by default."""
... | [
"def",
"dump_functions",
"(",
"self",
",",
"e",
")",
":",
"# ()\r",
"print",
"txt",
"=",
"\"\\n\"",
".",
"join",
"(",
"self",
".",
"rl_settings_to_string",
"(",
")",
")",
"print",
"txt",
"self",
".",
"_print_prompt",
"(",
")",
"self",
".",
"finalize",
... | u"""Print all of the functions and their key bindings to the Readline
output stream. If a numeric argument is supplied, the output is
formatted in such a way that it can be made part of an inputrc
file. This command is unbound by default. | [
"u",
"Print",
"all",
"of",
"the",
"functions",
"and",
"their",
"key",
"bindings",
"to",
"the",
"Readline",
"output",
"stream",
".",
"If",
"a",
"numeric",
"argument",
"is",
"supplied",
"the",
"output",
"is",
"formatted",
"in",
"such",
"a",
"way",
"that",
... | 40f9d2285662ff8b61e0468b4196acee089b273b | https://github.com/SeattleTestbed/seash/blob/40f9d2285662ff8b61e0468b4196acee089b273b/pyreadline/modes/basemode.py#L540-L549 |
40,675 | kmedian/ctmc | ctmc/ctmc_class.py | Ctmc.fit | def fit(self, X, y=None):
"""Calls the ctmc.ctmc function
Parameters
----------
X : list of lists
(see ctmc function 'data')
y
not used, present for API consistence purpose.
"""
self.transmat, self.genmat, self.transcount, self.statetime ... | python | def fit(self, X, y=None):
"""Calls the ctmc.ctmc function
Parameters
----------
X : list of lists
(see ctmc function 'data')
y
not used, present for API consistence purpose.
"""
self.transmat, self.genmat, self.transcount, self.statetime ... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"self",
".",
"transmat",
",",
"self",
".",
"genmat",
",",
"self",
".",
"transcount",
",",
"self",
".",
"statetime",
"=",
"ctmc",
"(",
"X",
",",
"self",
".",
"numstates",
",",
... | Calls the ctmc.ctmc function
Parameters
----------
X : list of lists
(see ctmc function 'data')
y
not used, present for API consistence purpose. | [
"Calls",
"the",
"ctmc",
".",
"ctmc",
"function"
] | e30747f797ce777fd2aaa1b7ee5a77e91d7db5e4 | https://github.com/kmedian/ctmc/blob/e30747f797ce777fd2aaa1b7ee5a77e91d7db5e4/ctmc/ctmc_class.py#L17-L30 |
40,676 | timothydmorton/orbitutils | orbitutils/populations.py | TripleOrbitPopulation.RV_1 | def RV_1(self):
"""Instantaneous RV of star 1 with respect to system center-of-mass
"""
return self.orbpop_long.RV * (self.orbpop_long.M2 / (self.orbpop_long.M1 + self.orbpop_long.M2)) | python | def RV_1(self):
"""Instantaneous RV of star 1 with respect to system center-of-mass
"""
return self.orbpop_long.RV * (self.orbpop_long.M2 / (self.orbpop_long.M1 + self.orbpop_long.M2)) | [
"def",
"RV_1",
"(",
"self",
")",
":",
"return",
"self",
".",
"orbpop_long",
".",
"RV",
"*",
"(",
"self",
".",
"orbpop_long",
".",
"M2",
"/",
"(",
"self",
".",
"orbpop_long",
".",
"M1",
"+",
"self",
".",
"orbpop_long",
".",
"M2",
")",
")"
] | Instantaneous RV of star 1 with respect to system center-of-mass | [
"Instantaneous",
"RV",
"of",
"star",
"1",
"with",
"respect",
"to",
"system",
"center",
"-",
"of",
"-",
"mass"
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L92-L95 |
40,677 | timothydmorton/orbitutils | orbitutils/populations.py | TripleOrbitPopulation.RV_2 | def RV_2(self):
"""Instantaneous RV of star 2 with respect to system center-of-mass
"""
return -self.orbpop_long.RV * (self.orbpop_long.M1 /
(self.orbpop_long.M1 + self.orbpop_long.M2)) +\
self.orbpop_short.RV_com1 | python | def RV_2(self):
"""Instantaneous RV of star 2 with respect to system center-of-mass
"""
return -self.orbpop_long.RV * (self.orbpop_long.M1 /
(self.orbpop_long.M1 + self.orbpop_long.M2)) +\
self.orbpop_short.RV_com1 | [
"def",
"RV_2",
"(",
"self",
")",
":",
"return",
"-",
"self",
".",
"orbpop_long",
".",
"RV",
"*",
"(",
"self",
".",
"orbpop_long",
".",
"M1",
"/",
"(",
"self",
".",
"orbpop_long",
".",
"M1",
"+",
"self",
".",
"orbpop_long",
".",
"M2",
")",
")",
"+... | Instantaneous RV of star 2 with respect to system center-of-mass | [
"Instantaneous",
"RV",
"of",
"star",
"2",
"with",
"respect",
"to",
"system",
"center",
"-",
"of",
"-",
"mass"
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L98-L103 |
40,678 | timothydmorton/orbitutils | orbitutils/populations.py | TripleOrbitPopulation.RV_3 | def RV_3(self):
"""Instantaneous RV of star 3 with respect to system center-of-mass
"""
return -self.orbpop_long.RV * (self.orbpop_long.M1 / (self.orbpop_long.M1 + self.orbpop_long.M2)) +\
self.orbpop_short.RV_com2 | python | def RV_3(self):
"""Instantaneous RV of star 3 with respect to system center-of-mass
"""
return -self.orbpop_long.RV * (self.orbpop_long.M1 / (self.orbpop_long.M1 + self.orbpop_long.M2)) +\
self.orbpop_short.RV_com2 | [
"def",
"RV_3",
"(",
"self",
")",
":",
"return",
"-",
"self",
".",
"orbpop_long",
".",
"RV",
"*",
"(",
"self",
".",
"orbpop_long",
".",
"M1",
"/",
"(",
"self",
".",
"orbpop_long",
".",
"M1",
"+",
"self",
".",
"orbpop_long",
".",
"M2",
")",
")",
"+... | Instantaneous RV of star 3 with respect to system center-of-mass | [
"Instantaneous",
"RV",
"of",
"star",
"3",
"with",
"respect",
"to",
"system",
"center",
"-",
"of",
"-",
"mass"
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L106-L110 |
40,679 | timothydmorton/orbitutils | orbitutils/populations.py | TripleOrbitPopulation.save_hdf | def save_hdf(self,filename,path=''):
"""Save to .h5 file.
"""
self.orbpop_long.save_hdf(filename,'{}/long'.format(path))
self.orbpop_short.save_hdf(filename,'{}/short'.format(path)) | python | def save_hdf(self,filename,path=''):
"""Save to .h5 file.
"""
self.orbpop_long.save_hdf(filename,'{}/long'.format(path))
self.orbpop_short.save_hdf(filename,'{}/short'.format(path)) | [
"def",
"save_hdf",
"(",
"self",
",",
"filename",
",",
"path",
"=",
"''",
")",
":",
"self",
".",
"orbpop_long",
".",
"save_hdf",
"(",
"filename",
",",
"'{}/long'",
".",
"format",
"(",
"path",
")",
")",
"self",
".",
"orbpop_short",
".",
"save_hdf",
"(",
... | Save to .h5 file. | [
"Save",
"to",
".",
"h5",
"file",
"."
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L140-L144 |
40,680 | timothydmorton/orbitutils | orbitutils/populations.py | OrbitPopulation.Rsky | def Rsky(self):
"""Projected sky separation of stars
"""
return np.sqrt(self.position.x**2 + self.position.y**2) | python | def Rsky(self):
"""Projected sky separation of stars
"""
return np.sqrt(self.position.x**2 + self.position.y**2) | [
"def",
"Rsky",
"(",
"self",
")",
":",
"return",
"np",
".",
"sqrt",
"(",
"self",
".",
"position",
".",
"x",
"**",
"2",
"+",
"self",
".",
"position",
".",
"y",
"**",
"2",
")"
] | Projected sky separation of stars | [
"Projected",
"sky",
"separation",
"of",
"stars"
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L281-L284 |
40,681 | timothydmorton/orbitutils | orbitutils/populations.py | OrbitPopulation.RV_com1 | def RV_com1(self):
"""RVs of star 1 relative to center-of-mass
"""
return self.RV * (self.M2 / (self.M1 + self.M2)) | python | def RV_com1(self):
"""RVs of star 1 relative to center-of-mass
"""
return self.RV * (self.M2 / (self.M1 + self.M2)) | [
"def",
"RV_com1",
"(",
"self",
")",
":",
"return",
"self",
".",
"RV",
"*",
"(",
"self",
".",
"M2",
"/",
"(",
"self",
".",
"M1",
"+",
"self",
".",
"M2",
")",
")"
] | RVs of star 1 relative to center-of-mass | [
"RVs",
"of",
"star",
"1",
"relative",
"to",
"center",
"-",
"of",
"-",
"mass"
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L293-L296 |
40,682 | timothydmorton/orbitutils | orbitutils/populations.py | OrbitPopulation.RV_com2 | def RV_com2(self):
"""RVs of star 2 relative to center-of-mass
"""
return -self.RV * (self.M1 / (self.M1 + self.M2)) | python | def RV_com2(self):
"""RVs of star 2 relative to center-of-mass
"""
return -self.RV * (self.M1 / (self.M1 + self.M2)) | [
"def",
"RV_com2",
"(",
"self",
")",
":",
"return",
"-",
"self",
".",
"RV",
"*",
"(",
"self",
".",
"M1",
"/",
"(",
"self",
".",
"M1",
"+",
"self",
".",
"M2",
")",
")"
] | RVs of star 2 relative to center-of-mass | [
"RVs",
"of",
"star",
"2",
"relative",
"to",
"center",
"-",
"of",
"-",
"mass"
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L299-L302 |
40,683 | timothydmorton/orbitutils | orbitutils/populations.py | OrbitPopulation.save_hdf | def save_hdf(self,filename,path=''):
"""Saves all relevant data to .h5 file; so state can be restored.
"""
self.dataframe.to_hdf(filename,'{}/df'.format(path)) | python | def save_hdf(self,filename,path=''):
"""Saves all relevant data to .h5 file; so state can be restored.
"""
self.dataframe.to_hdf(filename,'{}/df'.format(path)) | [
"def",
"save_hdf",
"(",
"self",
",",
"filename",
",",
"path",
"=",
"''",
")",
":",
"self",
".",
"dataframe",
".",
"to_hdf",
"(",
"filename",
",",
"'{}/df'",
".",
"format",
"(",
"path",
")",
")"
] | Saves all relevant data to .h5 file; so state can be restored. | [
"Saves",
"all",
"relevant",
"data",
"to",
".",
"h5",
"file",
";",
"so",
"state",
"can",
"be",
"restored",
"."
] | 949c6b901e519458d80b8d7427916c0698e4013e | https://github.com/timothydmorton/orbitutils/blob/949c6b901e519458d80b8d7427916c0698e4013e/orbitutils/populations.py#L387-L390 |
40,684 | clinicedc/edc-permissions | edc_permissions/pii_updater.py | PiiUpdater.add_pii_permissions | def add_pii_permissions(self, group, view_only=None):
"""Adds PII model permissions.
"""
pii_model_names = [m.split(".")[1] for m in self.pii_models]
if view_only:
permissions = Permission.objects.filter(
(Q(codename__startswith="view") | Q(codename__startswit... | python | def add_pii_permissions(self, group, view_only=None):
"""Adds PII model permissions.
"""
pii_model_names = [m.split(".")[1] for m in self.pii_models]
if view_only:
permissions = Permission.objects.filter(
(Q(codename__startswith="view") | Q(codename__startswit... | [
"def",
"add_pii_permissions",
"(",
"self",
",",
"group",
",",
"view_only",
"=",
"None",
")",
":",
"pii_model_names",
"=",
"[",
"m",
".",
"split",
"(",
"\".\"",
")",
"[",
"1",
"]",
"for",
"m",
"in",
"self",
".",
"pii_models",
"]",
"if",
"view_only",
"... | Adds PII model permissions. | [
"Adds",
"PII",
"model",
"permissions",
"."
] | d1aee39a8ddaf4b7741d9306139ddd03625d4e1a | https://github.com/clinicedc/edc-permissions/blob/d1aee39a8ddaf4b7741d9306139ddd03625d4e1a/edc_permissions/pii_updater.py#L39-L77 |
40,685 | helixyte/everest | everest/attributes.py | get_attribute_cardinality | def get_attribute_cardinality(attribute):
"""
Returns the cardinality of the given resource attribute.
:returns: One of the constants defined in
:class:`evererst.constants.CARDINALITY_CONSTANTS`.
:raises ValueError: If the given attribute is not a relation attribute
(i.e., if it is a termin... | python | def get_attribute_cardinality(attribute):
"""
Returns the cardinality of the given resource attribute.
:returns: One of the constants defined in
:class:`evererst.constants.CARDINALITY_CONSTANTS`.
:raises ValueError: If the given attribute is not a relation attribute
(i.e., if it is a termin... | [
"def",
"get_attribute_cardinality",
"(",
"attribute",
")",
":",
"if",
"attribute",
".",
"kind",
"==",
"RESOURCE_ATTRIBUTE_KINDS",
".",
"MEMBER",
":",
"card",
"=",
"CARDINALITY_CONSTANTS",
".",
"ONE",
"elif",
"attribute",
".",
"kind",
"==",
"RESOURCE_ATTRIBUTE_KINDS"... | Returns the cardinality of the given resource attribute.
:returns: One of the constants defined in
:class:`evererst.constants.CARDINALITY_CONSTANTS`.
:raises ValueError: If the given attribute is not a relation attribute
(i.e., if it is a terminal attribute). | [
"Returns",
"the",
"cardinality",
"of",
"the",
"given",
"resource",
"attribute",
"."
] | 70c9b93c3061db5cb62428349d18b8fb8566411b | https://github.com/helixyte/everest/blob/70c9b93c3061db5cb62428349d18b8fb8566411b/everest/attributes.py#L41-L57 |
40,686 | wdbm/scalar | scalar/__init__.py | setup | def setup(path_config="~/.config/scalar/config.yaml", configuration_name=None):
"""
Load a configuration from a default or specified configuration file, accessing a default or
specified configuration name.
"""
global config
global client
global token
global room
# config file
pat... | python | def setup(path_config="~/.config/scalar/config.yaml", configuration_name=None):
"""
Load a configuration from a default or specified configuration file, accessing a default or
specified configuration name.
"""
global config
global client
global token
global room
# config file
pat... | [
"def",
"setup",
"(",
"path_config",
"=",
"\"~/.config/scalar/config.yaml\"",
",",
"configuration_name",
"=",
"None",
")",
":",
"global",
"config",
"global",
"client",
"global",
"token",
"global",
"room",
"# config file",
"path_config",
"=",
"Path",
"(",
"path_config... | Load a configuration from a default or specified configuration file, accessing a default or
specified configuration name. | [
"Load",
"a",
"configuration",
"from",
"a",
"default",
"or",
"specified",
"configuration",
"file",
"accessing",
"a",
"default",
"or",
"specified",
"configuration",
"name",
"."
] | c4d70e778a6151b95aad721ca2d3a8bfa38126da | https://github.com/wdbm/scalar/blob/c4d70e778a6151b95aad721ca2d3a8bfa38126da/scalar/__init__.py#L71-L101 |
40,687 | ViiSiX/FlaskRedislite | flask_redislite.py | worker_wrapper | def worker_wrapper(worker_instance, pid_path):
"""
A wrapper to start RQ worker as a new process.
:param worker_instance: RQ's worker instance
:param pid_path: A file to check if the worker
is running or not
"""
def exit_handler(*args):
"""
Remove pid file on exit
... | python | def worker_wrapper(worker_instance, pid_path):
"""
A wrapper to start RQ worker as a new process.
:param worker_instance: RQ's worker instance
:param pid_path: A file to check if the worker
is running or not
"""
def exit_handler(*args):
"""
Remove pid file on exit
... | [
"def",
"worker_wrapper",
"(",
"worker_instance",
",",
"pid_path",
")",
":",
"def",
"exit_handler",
"(",
"*",
"args",
")",
":",
"\"\"\"\n Remove pid file on exit\n \"\"\"",
"if",
"len",
"(",
"args",
")",
">",
"0",
":",
"print",
"(",
"\"Exit py signal ... | A wrapper to start RQ worker as a new process.
:param worker_instance: RQ's worker instance
:param pid_path: A file to check if the worker
is running or not | [
"A",
"wrapper",
"to",
"start",
"RQ",
"worker",
"as",
"a",
"new",
"process",
"."
] | 01bc9fbbeb415aac621c7a9cc091a666e728e651 | https://github.com/ViiSiX/FlaskRedislite/blob/01bc9fbbeb415aac621c7a9cc091a666e728e651/flask_redislite.py#L29-L52 |
40,688 | ViiSiX/FlaskRedislite | flask_redislite.py | FlaskRedis.collection | def collection(self):
"""Return the redis-collection instance."""
if not self.include_collections:
return None
ctx = stack.top
if ctx is not None:
if not hasattr(ctx, 'redislite_collection'):
ctx.redislite_collection = Collection(redis=self.connect... | python | def collection(self):
"""Return the redis-collection instance."""
if not self.include_collections:
return None
ctx = stack.top
if ctx is not None:
if not hasattr(ctx, 'redislite_collection'):
ctx.redislite_collection = Collection(redis=self.connect... | [
"def",
"collection",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"include_collections",
":",
"return",
"None",
"ctx",
"=",
"stack",
".",
"top",
"if",
"ctx",
"is",
"not",
"None",
":",
"if",
"not",
"hasattr",
"(",
"ctx",
",",
"'redislite_collection'",... | Return the redis-collection instance. | [
"Return",
"the",
"redis",
"-",
"collection",
"instance",
"."
] | 01bc9fbbeb415aac621c7a9cc091a666e728e651 | https://github.com/ViiSiX/FlaskRedislite/blob/01bc9fbbeb415aac621c7a9cc091a666e728e651/flask_redislite.py#L150-L158 |
40,689 | ViiSiX/FlaskRedislite | flask_redislite.py | FlaskRedis.queue | def queue(self):
"""The queue property. Return rq.Queue instance."""
if not self.include_rq:
return None
ctx = stack.top
if ctx is not None:
if not hasattr(ctx, 'redislite_queue'):
ctx.redislite_queue = {}
for queue_name in self.qu... | python | def queue(self):
"""The queue property. Return rq.Queue instance."""
if not self.include_rq:
return None
ctx = stack.top
if ctx is not None:
if not hasattr(ctx, 'redislite_queue'):
ctx.redislite_queue = {}
for queue_name in self.qu... | [
"def",
"queue",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"include_rq",
":",
"return",
"None",
"ctx",
"=",
"stack",
".",
"top",
"if",
"ctx",
"is",
"not",
"None",
":",
"if",
"not",
"hasattr",
"(",
"ctx",
",",
"'redislite_queue'",
")",
":",
"c... | The queue property. Return rq.Queue instance. | [
"The",
"queue",
"property",
".",
"Return",
"rq",
".",
"Queue",
"instance",
"."
] | 01bc9fbbeb415aac621c7a9cc091a666e728e651 | https://github.com/ViiSiX/FlaskRedislite/blob/01bc9fbbeb415aac621c7a9cc091a666e728e651/flask_redislite.py#L161-L174 |
40,690 | ViiSiX/FlaskRedislite | flask_redislite.py | FlaskRedis.start_worker | def start_worker(self):
"""Trigger new process as a RQ worker."""
if not self.include_rq:
return None
worker = Worker(queues=self.queues,
connection=self.connection)
worker_pid_path = current_app.config.get(
"{}_WORKER_PID".format(self.con... | python | def start_worker(self):
"""Trigger new process as a RQ worker."""
if not self.include_rq:
return None
worker = Worker(queues=self.queues,
connection=self.connection)
worker_pid_path = current_app.config.get(
"{}_WORKER_PID".format(self.con... | [
"def",
"start_worker",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"include_rq",
":",
"return",
"None",
"worker",
"=",
"Worker",
"(",
"queues",
"=",
"self",
".",
"queues",
",",
"connection",
"=",
"self",
".",
"connection",
")",
"worker_pid_path",
"=... | Trigger new process as a RQ worker. | [
"Trigger",
"new",
"process",
"as",
"a",
"RQ",
"worker",
"."
] | 01bc9fbbeb415aac621c7a9cc091a666e728e651 | https://github.com/ViiSiX/FlaskRedislite/blob/01bc9fbbeb415aac621c7a9cc091a666e728e651/flask_redislite.py#L176-L208 |
40,691 | liminspace/dju-image | dju_image/image.py | image_save_buffer_fix | def image_save_buffer_fix(maxblock=1048576):
"""
Contextmanager that change MAXBLOCK in ImageFile.
"""
before = ImageFile.MAXBLOCK
ImageFile.MAXBLOCK = maxblock
try:
yield
finally:
ImageFile.MAXBLOCK = before | python | def image_save_buffer_fix(maxblock=1048576):
"""
Contextmanager that change MAXBLOCK in ImageFile.
"""
before = ImageFile.MAXBLOCK
ImageFile.MAXBLOCK = maxblock
try:
yield
finally:
ImageFile.MAXBLOCK = before | [
"def",
"image_save_buffer_fix",
"(",
"maxblock",
"=",
"1048576",
")",
":",
"before",
"=",
"ImageFile",
".",
"MAXBLOCK",
"ImageFile",
".",
"MAXBLOCK",
"=",
"maxblock",
"try",
":",
"yield",
"finally",
":",
"ImageFile",
".",
"MAXBLOCK",
"=",
"before"
] | Contextmanager that change MAXBLOCK in ImageFile. | [
"Contextmanager",
"that",
"change",
"MAXBLOCK",
"in",
"ImageFile",
"."
] | b06eb3be2069cd6cb52cf1e26c2c761883142d4e | https://github.com/liminspace/dju-image/blob/b06eb3be2069cd6cb52cf1e26c2c761883142d4e/dju_image/image.py#L62-L71 |
40,692 | ponty/confduino | confduino/examples/upgrademany.py | upgrade_many | def upgrade_many(upgrade=True, create_examples_all=True):
"""upgrade many libs.
source: http://arduino.cc/playground/Main/LibraryList
you can set your arduino path if it is not default
os.environ['ARDUINO_HOME'] = '/home/...'
"""
urls = set()
def inst(url):
print('upgrading %s' %... | python | def upgrade_many(upgrade=True, create_examples_all=True):
"""upgrade many libs.
source: http://arduino.cc/playground/Main/LibraryList
you can set your arduino path if it is not default
os.environ['ARDUINO_HOME'] = '/home/...'
"""
urls = set()
def inst(url):
print('upgrading %s' %... | [
"def",
"upgrade_many",
"(",
"upgrade",
"=",
"True",
",",
"create_examples_all",
"=",
"True",
")",
":",
"urls",
"=",
"set",
"(",
")",
"def",
"inst",
"(",
"url",
")",
":",
"print",
"(",
"'upgrading %s'",
"%",
"url",
")",
"assert",
"url",
"not",
"in",
"... | upgrade many libs.
source: http://arduino.cc/playground/Main/LibraryList
you can set your arduino path if it is not default
os.environ['ARDUINO_HOME'] = '/home/...' | [
"upgrade",
"many",
"libs",
"."
] | f4c261e5e84997f145a8bdd001f471db74c9054b | https://github.com/ponty/confduino/blob/f4c261e5e84997f145a8bdd001f471db74c9054b/confduino/examples/upgrademany.py#L7-L180 |
40,693 | erikvw/django-collect-offline-files | django_collect_offline_files/confirmation.py | Confirmation.confirm | def confirm(self, batch_id=None, filename=None):
"""Flags the batch as confirmed by updating
confirmation_datetime on the history model for this batch.
"""
if batch_id or filename:
export_history = self.history_model.objects.using(self.using).filter(
Q(batch_i... | python | def confirm(self, batch_id=None, filename=None):
"""Flags the batch as confirmed by updating
confirmation_datetime on the history model for this batch.
"""
if batch_id or filename:
export_history = self.history_model.objects.using(self.using).filter(
Q(batch_i... | [
"def",
"confirm",
"(",
"self",
",",
"batch_id",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"if",
"batch_id",
"or",
"filename",
":",
"export_history",
"=",
"self",
".",
"history_model",
".",
"objects",
".",
"using",
"(",
"self",
".",
"using",
... | Flags the batch as confirmed by updating
confirmation_datetime on the history model for this batch. | [
"Flags",
"the",
"batch",
"as",
"confirmed",
"by",
"updating",
"confirmation_datetime",
"on",
"the",
"history",
"model",
"for",
"this",
"batch",
"."
] | 78f61c823ea3926eb88206b019b5dca3c36017da | https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/confirmation.py#L24-L48 |
40,694 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/text/clean_text.py | clean_single_word | def clean_single_word(word, lemmatizing="wordnet"):
"""
Performs stemming or lemmatizing on a single word.
If we are to search for a word in a clean bag-of-words, we need to search it after the same kind of preprocessing.
Inputs: - word: A string containing the source word.
- lemmatizing: ... | python | def clean_single_word(word, lemmatizing="wordnet"):
"""
Performs stemming or lemmatizing on a single word.
If we are to search for a word in a clean bag-of-words, we need to search it after the same kind of preprocessing.
Inputs: - word: A string containing the source word.
- lemmatizing: ... | [
"def",
"clean_single_word",
"(",
"word",
",",
"lemmatizing",
"=",
"\"wordnet\"",
")",
":",
"if",
"lemmatizing",
"==",
"\"porter\"",
":",
"porter",
"=",
"PorterStemmer",
"(",
")",
"lemma",
"=",
"porter",
".",
"stem",
"(",
"word",
")",
"elif",
"lemmatizing",
... | Performs stemming or lemmatizing on a single word.
If we are to search for a word in a clean bag-of-words, we need to search it after the same kind of preprocessing.
Inputs: - word: A string containing the source word.
- lemmatizing: A string containing one of the following: "porter", "snowball" o... | [
"Performs",
"stemming",
"or",
"lemmatizing",
"on",
"a",
"single",
"word",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/clean_text.py#L72-L96 |
40,695 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/text/clean_text.py | clean_document | def clean_document(document,
sent_tokenize, _treebank_word_tokenize,
tagger,
lemmatizer,
lemmatize,
stopset,
first_cap_re, all_cap_re,
digits_punctuation_whitespace_re,
... | python | def clean_document(document,
sent_tokenize, _treebank_word_tokenize,
tagger,
lemmatizer,
lemmatize,
stopset,
first_cap_re, all_cap_re,
digits_punctuation_whitespace_re,
... | [
"def",
"clean_document",
"(",
"document",
",",
"sent_tokenize",
",",
"_treebank_word_tokenize",
",",
"tagger",
",",
"lemmatizer",
",",
"lemmatize",
",",
"stopset",
",",
"first_cap_re",
",",
"all_cap_re",
",",
"digits_punctuation_whitespace_re",
",",
"pos_set",
")",
... | Extracts a clean bag-of-words from a document.
Inputs: - document: A string containing some text.
Output: - lemma_list: A python list of lemmas or stems.
- lemma_to_keywordbag: A python dictionary that maps stems/lemmas to original topic keywords. | [
"Extracts",
"a",
"clean",
"bag",
"-",
"of",
"-",
"words",
"from",
"a",
"document",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/clean_text.py#L99-L199 |
40,696 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/text/clean_text.py | clean_corpus_serial | def clean_corpus_serial(corpus, lemmatizing="wordnet"):
"""
Extracts a bag-of-words from each document in a corpus serially.
Inputs: - corpus: A python list of python strings. Each string is a document.
- lemmatizing: A string containing one of the following: "porter", "snowball" or "wordnet".
... | python | def clean_corpus_serial(corpus, lemmatizing="wordnet"):
"""
Extracts a bag-of-words from each document in a corpus serially.
Inputs: - corpus: A python list of python strings. Each string is a document.
- lemmatizing: A string containing one of the following: "porter", "snowball" or "wordnet".
... | [
"def",
"clean_corpus_serial",
"(",
"corpus",
",",
"lemmatizing",
"=",
"\"wordnet\"",
")",
":",
"list_of_bags_of_words",
"=",
"list",
"(",
")",
"append_bag_of_words",
"=",
"list_of_bags_of_words",
".",
"append",
"lemma_to_keywordbag_total",
"=",
"defaultdict",
"(",
"la... | Extracts a bag-of-words from each document in a corpus serially.
Inputs: - corpus: A python list of python strings. Each string is a document.
- lemmatizing: A string containing one of the following: "porter", "snowball" or "wordnet".
Output: - list_of_bags_of_words: A list of python dictionaries ... | [
"Extracts",
"a",
"bag",
"-",
"of",
"-",
"words",
"from",
"each",
"document",
"in",
"a",
"corpus",
"serially",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/clean_text.py#L252-L276 |
40,697 | MKLab-ITI/reveal-user-annotation | reveal_user_annotation/text/clean_text.py | extract_bag_of_words_from_corpus_parallel | def extract_bag_of_words_from_corpus_parallel(corpus, lemmatizing="wordnet"):
"""
This extracts one bag-of-words from a list of strings. The documents are mapped to parallel processes.
Inputs: - corpus: A list of strings.
- lemmatizing: A string containing one of the following: "porter", "snowb... | python | def extract_bag_of_words_from_corpus_parallel(corpus, lemmatizing="wordnet"):
"""
This extracts one bag-of-words from a list of strings. The documents are mapped to parallel processes.
Inputs: - corpus: A list of strings.
- lemmatizing: A string containing one of the following: "porter", "snowb... | [
"def",
"extract_bag_of_words_from_corpus_parallel",
"(",
"corpus",
",",
"lemmatizing",
"=",
"\"wordnet\"",
")",
":",
"####################################################################################################################",
"# Map and reduce document cleaning.",
"###############... | This extracts one bag-of-words from a list of strings. The documents are mapped to parallel processes.
Inputs: - corpus: A list of strings.
- lemmatizing: A string containing one of the following: "porter", "snowball" or "wordnet".
Output: - bag_of_words: This is a bag-of-words in python dictionar... | [
"This",
"extracts",
"one",
"bag",
"-",
"of",
"-",
"words",
"from",
"a",
"list",
"of",
"strings",
".",
"The",
"documents",
"are",
"mapped",
"to",
"parallel",
"processes",
"."
] | ed019c031857b091e5601f53ba3f01a499a0e3ef | https://github.com/MKLab-ITI/reveal-user-annotation/blob/ed019c031857b091e5601f53ba3f01a499a0e3ef/reveal_user_annotation/text/clean_text.py#L279-L311 |
40,698 | AtomHash/evernode | evernode/decorators/middleware.py | middleware | def middleware(func):
""" Executes routes.py route middleware """
@wraps(func)
def parse(*args, **kwargs):
""" get middleware from route, execute middleware in order """
middleware = copy.deepcopy(kwargs['middleware'])
kwargs.pop('middleware')
if request.method == "OPT... | python | def middleware(func):
""" Executes routes.py route middleware """
@wraps(func)
def parse(*args, **kwargs):
""" get middleware from route, execute middleware in order """
middleware = copy.deepcopy(kwargs['middleware'])
kwargs.pop('middleware')
if request.method == "OPT... | [
"def",
"middleware",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"parse",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\" get middleware from route, execute middleware in order \"\"\"",
"middleware",
"=",
"copy",
".",
"deepcopy",
... | Executes routes.py route middleware | [
"Executes",
"routes",
".",
"py",
"route",
"middleware"
] | b2fb91555fb937a3f3eba41db56dee26f9b034be | https://github.com/AtomHash/evernode/blob/b2fb91555fb937a3f3eba41db56dee26f9b034be/evernode/decorators/middleware.py#L8-L25 |
40,699 | foobarbecue/afterflight | afterflight/progressbarupload/templatetags/progress_bar.py | progress_bar_media | def progress_bar_media():
"""
progress_bar_media simple tag
return rendered script tag for javascript used by progress_bar
"""
if PROGRESSBARUPLOAD_INCLUDE_JQUERY:
js = ["http://code.jquery.com/jquery-1.8.3.min.js",]
else:
js = []
js.append("js/progress_bar.js")
... | python | def progress_bar_media():
"""
progress_bar_media simple tag
return rendered script tag for javascript used by progress_bar
"""
if PROGRESSBARUPLOAD_INCLUDE_JQUERY:
js = ["http://code.jquery.com/jquery-1.8.3.min.js",]
else:
js = []
js.append("js/progress_bar.js")
... | [
"def",
"progress_bar_media",
"(",
")",
":",
"if",
"PROGRESSBARUPLOAD_INCLUDE_JQUERY",
":",
"js",
"=",
"[",
"\"http://code.jquery.com/jquery-1.8.3.min.js\"",
",",
"]",
"else",
":",
"js",
"=",
"[",
"]",
"js",
".",
"append",
"(",
"\"js/progress_bar.js\"",
")",
"m",
... | progress_bar_media simple tag
return rendered script tag for javascript used by progress_bar | [
"progress_bar_media",
"simple",
"tag"
] | 7085f719593f88999dce93f35caec5f15d2991b6 | https://github.com/foobarbecue/afterflight/blob/7085f719593f88999dce93f35caec5f15d2991b6/afterflight/progressbarupload/templatetags/progress_bar.py#L31-L44 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.