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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
46,500 | bihealth/vcfpy | vcfpy/parser.py | process_alt | def process_alt(header, ref, alt_str): # pylint: disable=W0613
"""Process alternative value using Header in ``header``"""
# By its nature, this function contains a large number of case distinctions
if "]" in alt_str or "[" in alt_str:
return record.BreakEnd(*parse_breakend(alt_str))
elif alt_st... | python | def process_alt(header, ref, alt_str): # pylint: disable=W0613
"""Process alternative value using Header in ``header``"""
# By its nature, this function contains a large number of case distinctions
if "]" in alt_str or "[" in alt_str:
return record.BreakEnd(*parse_breakend(alt_str))
elif alt_st... | [
"def",
"process_alt",
"(",
"header",
",",
"ref",
",",
"alt_str",
")",
":",
"# pylint: disable=W0613",
"# By its nature, this function contains a large number of case distinctions",
"if",
"\"]\"",
"in",
"alt_str",
"or",
"\"[\"",
"in",
"alt_str",
":",
"return",
"record",
... | Process alternative value using Header in ``header`` | [
"Process",
"alternative",
"value",
"using",
"Header",
"in",
"header"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L339-L352 |
46,501 | bihealth/vcfpy | vcfpy/parser.py | QuotedStringSplitter.run | def run(self, s):
"""Split string ``s`` at delimiter, correctly interpreting quotes
Further, interprets arrays wrapped in one level of ``[]``. No
recursive brackets are interpreted (as this would make the grammar
non-regular and currently this complexity is not needed). Currently,
... | python | def run(self, s):
"""Split string ``s`` at delimiter, correctly interpreting quotes
Further, interprets arrays wrapped in one level of ``[]``. No
recursive brackets are interpreted (as this would make the grammar
non-regular and currently this complexity is not needed). Currently,
... | [
"def",
"run",
"(",
"self",
",",
"s",
")",
":",
"begins",
",",
"ends",
"=",
"[",
"0",
"]",
",",
"[",
"]",
"# transition table",
"DISPATCH",
"=",
"{",
"self",
".",
"NORMAL",
":",
"self",
".",
"_handle_normal",
",",
"self",
".",
"QUOTED",
":",
"self",... | Split string ``s`` at delimiter, correctly interpreting quotes
Further, interprets arrays wrapped in one level of ``[]``. No
recursive brackets are interpreted (as this would make the grammar
non-regular and currently this complexity is not needed). Currently,
quoting inside of braces... | [
"Split",
"string",
"s",
"at",
"delimiter",
"correctly",
"interpreting",
"quotes"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L64-L89 |
46,502 | bihealth/vcfpy | vcfpy/parser.py | RecordParser._handle_calls | def _handle_calls(self, alts, format_, format_str, arr):
"""Handle FORMAT and calls columns, factored out of parse_line"""
if format_str not in self._format_cache:
self._format_cache[format_str] = list(map(self.header.get_format_field_info, format_))
# per-sample calls
calls ... | python | def _handle_calls(self, alts, format_, format_str, arr):
"""Handle FORMAT and calls columns, factored out of parse_line"""
if format_str not in self._format_cache:
self._format_cache[format_str] = list(map(self.header.get_format_field_info, format_))
# per-sample calls
calls ... | [
"def",
"_handle_calls",
"(",
"self",
",",
"alts",
",",
"format_",
",",
"format_str",
",",
"arr",
")",
":",
"if",
"format_str",
"not",
"in",
"self",
".",
"_format_cache",
":",
"self",
".",
"_format_cache",
"[",
"format_str",
"]",
"=",
"list",
"(",
"map",
... | Handle FORMAT and calls columns, factored out of parse_line | [
"Handle",
"FORMAT",
"and",
"calls",
"columns",
"factored",
"out",
"of",
"parse_line"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L470-L485 |
46,503 | bihealth/vcfpy | vcfpy/parser.py | RecordParser._split_line | def _split_line(self, line_str):
"""Split line and check number of columns"""
arr = line_str.rstrip().split("\t")
if len(arr) != self.expected_fields:
raise exceptions.InvalidRecordException(
(
"The line contains an invalid number of fields. Was "
... | python | def _split_line(self, line_str):
"""Split line and check number of columns"""
arr = line_str.rstrip().split("\t")
if len(arr) != self.expected_fields:
raise exceptions.InvalidRecordException(
(
"The line contains an invalid number of fields. Was "
... | [
"def",
"_split_line",
"(",
"self",
",",
"line_str",
")",
":",
"arr",
"=",
"line_str",
".",
"rstrip",
"(",
")",
".",
"split",
"(",
"\"\\t\"",
")",
"if",
"len",
"(",
"arr",
")",
"!=",
"self",
".",
"expected_fields",
":",
"raise",
"exceptions",
".",
"In... | Split line and check number of columns | [
"Split",
"line",
"and",
"check",
"number",
"of",
"columns"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L512-L522 |
46,504 | bihealth/vcfpy | vcfpy/parser.py | RecordParser._parse_info | def _parse_info(self, info_str, num_alts):
"""Parse INFO column from string"""
result = OrderedDict()
if info_str == ".":
return result
# The standard is very nice to parsers, we can simply split at
# semicolon characters, although I (Manuel) don't know how strict
... | python | def _parse_info(self, info_str, num_alts):
"""Parse INFO column from string"""
result = OrderedDict()
if info_str == ".":
return result
# The standard is very nice to parsers, we can simply split at
# semicolon characters, although I (Manuel) don't know how strict
... | [
"def",
"_parse_info",
"(",
"self",
",",
"info_str",
",",
"num_alts",
")",
":",
"result",
"=",
"OrderedDict",
"(",
")",
"if",
"info_str",
"==",
"\".\"",
":",
"return",
"result",
"# The standard is very nice to parsers, we can simply split at",
"# semicolon characters, al... | Parse INFO column from string | [
"Parse",
"INFO",
"column",
"from",
"string"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L524-L540 |
46,505 | bihealth/vcfpy | vcfpy/parser.py | RecordParser._parse_calls_data | def _parse_calls_data(klass, format_, infos, gt_str):
"""Parse genotype call information from arrays using format array
:param list format: List of strings with format names
:param gt_str arr: string with genotype information values
"""
data = OrderedDict()
# The standar... | python | def _parse_calls_data(klass, format_, infos, gt_str):
"""Parse genotype call information from arrays using format array
:param list format: List of strings with format names
:param gt_str arr: string with genotype information values
"""
data = OrderedDict()
# The standar... | [
"def",
"_parse_calls_data",
"(",
"klass",
",",
"format_",
",",
"infos",
",",
"gt_str",
")",
":",
"data",
"=",
"OrderedDict",
"(",
")",
"# The standard is very nice to parsers, we can simply split at",
"# colon characters, although I (Manuel) don't know how strict",
"# programs ... | Parse genotype call information from arrays using format array
:param list format: List of strings with format names
:param gt_str arr: string with genotype information values | [
"Parse",
"genotype",
"call",
"information",
"from",
"arrays",
"using",
"format",
"array"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L543-L555 |
46,506 | bihealth/vcfpy | vcfpy/parser.py | FormatChecker.run | def run(self, call, num_alts):
"""Check ``FORMAT`` of a record.Call
Currently, only checks for consistent counts are implemented
"""
for key, value in call.data.items():
self._check_count(call, key, value, num_alts) | python | def run(self, call, num_alts):
"""Check ``FORMAT`` of a record.Call
Currently, only checks for consistent counts are implemented
"""
for key, value in call.data.items():
self._check_count(call, key, value, num_alts) | [
"def",
"run",
"(",
"self",
",",
"call",
",",
"num_alts",
")",
":",
"for",
"key",
",",
"value",
"in",
"call",
".",
"data",
".",
"items",
"(",
")",
":",
"self",
".",
"_check_count",
"(",
"call",
",",
"key",
",",
"value",
",",
"num_alts",
")"
] | Check ``FORMAT`` of a record.Call
Currently, only checks for consistent counts are implemented | [
"Check",
"FORMAT",
"of",
"a",
"record",
".",
"Call"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L656-L662 |
46,507 | bihealth/vcfpy | vcfpy/parser.py | Parser._read_next_line | def _read_next_line(self):
"""Read next line store in self._line and return old one"""
prev_line = self._line
self._line = self.stream.readline()
return prev_line | python | def _read_next_line(self):
"""Read next line store in self._line and return old one"""
prev_line = self._line
self._line = self.stream.readline()
return prev_line | [
"def",
"_read_next_line",
"(",
"self",
")",
":",
"prev_line",
"=",
"self",
".",
"_line",
"self",
".",
"_line",
"=",
"self",
".",
"stream",
".",
"readline",
"(",
")",
"return",
"prev_line"
] | Read next line store in self._line and return old one | [
"Read",
"next",
"line",
"store",
"in",
"self",
".",
"_line",
"and",
"return",
"old",
"one"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L714-L718 |
46,508 | bihealth/vcfpy | vcfpy/parser.py | Parser._check_samples_line | def _check_samples_line(klass, arr):
"""Peform additional check on samples line"""
if len(arr) <= len(REQUIRE_NO_SAMPLE_HEADER):
if tuple(arr) != REQUIRE_NO_SAMPLE_HEADER:
raise exceptions.IncorrectVCFFormat(
"Sample header line indicates no sample but doe... | python | def _check_samples_line(klass, arr):
"""Peform additional check on samples line"""
if len(arr) <= len(REQUIRE_NO_SAMPLE_HEADER):
if tuple(arr) != REQUIRE_NO_SAMPLE_HEADER:
raise exceptions.IncorrectVCFFormat(
"Sample header line indicates no sample but doe... | [
"def",
"_check_samples_line",
"(",
"klass",
",",
"arr",
")",
":",
"if",
"len",
"(",
"arr",
")",
"<=",
"len",
"(",
"REQUIRE_NO_SAMPLE_HEADER",
")",
":",
"if",
"tuple",
"(",
"arr",
")",
"!=",
"REQUIRE_NO_SAMPLE_HEADER",
":",
"raise",
"exceptions",
".",
"Inco... | Peform additional check on samples line | [
"Peform",
"additional",
"check",
"on",
"samples",
"line"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/parser.py#L777-L789 |
46,509 | chriso/timeseries | timeseries/lazy_import.py | LazyImport.numpy | def numpy():
'''Lazily import the numpy module'''
if LazyImport.numpy_module is None:
try:
LazyImport.numpy_module = __import__('numpypy')
except ImportError:
try:
LazyImport.numpy_module = __import__('numpy')
ex... | python | def numpy():
'''Lazily import the numpy module'''
if LazyImport.numpy_module is None:
try:
LazyImport.numpy_module = __import__('numpypy')
except ImportError:
try:
LazyImport.numpy_module = __import__('numpy')
ex... | [
"def",
"numpy",
"(",
")",
":",
"if",
"LazyImport",
".",
"numpy_module",
"is",
"None",
":",
"try",
":",
"LazyImport",
".",
"numpy_module",
"=",
"__import__",
"(",
"'numpypy'",
")",
"except",
"ImportError",
":",
"try",
":",
"LazyImport",
".",
"numpy_module",
... | Lazily import the numpy module | [
"Lazily",
"import",
"the",
"numpy",
"module"
] | 8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d | https://github.com/chriso/timeseries/blob/8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d/timeseries/lazy_import.py#L10-L20 |
46,510 | chriso/timeseries | timeseries/lazy_import.py | LazyImport.rpy2 | def rpy2():
'''Lazily import the rpy2 module'''
if LazyImport.rpy2_module is None:
try:
rpy2 = __import__('rpy2.robjects')
except ImportError:
raise ImportError('The rpy2 module is required')
LazyImport.rpy2_module = rpy2
tr... | python | def rpy2():
'''Lazily import the rpy2 module'''
if LazyImport.rpy2_module is None:
try:
rpy2 = __import__('rpy2.robjects')
except ImportError:
raise ImportError('The rpy2 module is required')
LazyImport.rpy2_module = rpy2
tr... | [
"def",
"rpy2",
"(",
")",
":",
"if",
"LazyImport",
".",
"rpy2_module",
"is",
"None",
":",
"try",
":",
"rpy2",
"=",
"__import__",
"(",
"'rpy2.robjects'",
")",
"except",
"ImportError",
":",
"raise",
"ImportError",
"(",
"'The rpy2 module is required'",
")",
"LazyI... | Lazily import the rpy2 module | [
"Lazily",
"import",
"the",
"rpy2",
"module"
] | 8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d | https://github.com/chriso/timeseries/blob/8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d/timeseries/lazy_import.py#L23-L38 |
46,511 | eraclitux/ipcampy | ipcampy/foscam.py | map_position | def map_position(pos):
"""Map natural position to machine code postion"""
posiction_dict = dict(zip(range(1, 17), [i for i in range(30, 62) if i % 2]))
return posiction_dict[pos] | python | def map_position(pos):
"""Map natural position to machine code postion"""
posiction_dict = dict(zip(range(1, 17), [i for i in range(30, 62) if i % 2]))
return posiction_dict[pos] | [
"def",
"map_position",
"(",
"pos",
")",
":",
"posiction_dict",
"=",
"dict",
"(",
"zip",
"(",
"range",
"(",
"1",
",",
"17",
")",
",",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"30",
",",
"62",
")",
"if",
"i",
"%",
"2",
"]",
")",
")",
"return",... | Map natural position to machine code postion | [
"Map",
"natural",
"position",
"to",
"machine",
"code",
"postion"
] | bffd1c4df9006705cffa5b83a090b0db90cbcbcf | https://github.com/eraclitux/ipcampy/blob/bffd1c4df9006705cffa5b83a090b0db90cbcbcf/ipcampy/foscam.py#L15-L19 |
46,512 | eraclitux/ipcampy | ipcampy/foscam.py | FosCam.snap | def snap(self, path=None):
"""Get a snapshot and save it to disk."""
if path is None:
path = "/tmp"
else:
path = path.rstrip("/")
day_dir = datetime.datetime.now().strftime("%d%m%Y")
hour_dir = datetime.datetime.now().strftime("%H%M")
ensure_snapsh... | python | def snap(self, path=None):
"""Get a snapshot and save it to disk."""
if path is None:
path = "/tmp"
else:
path = path.rstrip("/")
day_dir = datetime.datetime.now().strftime("%d%m%Y")
hour_dir = datetime.datetime.now().strftime("%H%M")
ensure_snapsh... | [
"def",
"snap",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"\"/tmp\"",
"else",
":",
"path",
"=",
"path",
".",
"rstrip",
"(",
"\"/\"",
")",
"day_dir",
"=",
"datetime",
".",
"datetime",
".",
"now",
... | Get a snapshot and save it to disk. | [
"Get",
"a",
"snapshot",
"and",
"save",
"it",
"to",
"disk",
"."
] | bffd1c4df9006705cffa5b83a090b0db90cbcbcf | https://github.com/eraclitux/ipcampy/blob/bffd1c4df9006705cffa5b83a090b0db90cbcbcf/ipcampy/foscam.py#L28-L52 |
46,513 | timmahrt/pysle | pysle/isletool.py | getNumPhones | def getNumPhones(isleDict, word, maxFlag):
'''
Get the number of syllables and phones in this word
If maxFlag=True, use the longest pronunciation. Otherwise, take the
average length.
'''
phoneCount = 0
syllableCount = 0
syllableCountList = []
phoneCountList = []
w... | python | def getNumPhones(isleDict, word, maxFlag):
'''
Get the number of syllables and phones in this word
If maxFlag=True, use the longest pronunciation. Otherwise, take the
average length.
'''
phoneCount = 0
syllableCount = 0
syllableCountList = []
phoneCountList = []
w... | [
"def",
"getNumPhones",
"(",
"isleDict",
",",
"word",
",",
"maxFlag",
")",
":",
"phoneCount",
"=",
"0",
"syllableCount",
"=",
"0",
"syllableCountList",
"=",
"[",
"]",
"phoneCountList",
"=",
"[",
"]",
"wordList",
"=",
"isleDict",
".",
"lookup",
"(",
"word",
... | Get the number of syllables and phones in this word
If maxFlag=True, use the longest pronunciation. Otherwise, take the
average length. | [
"Get",
"the",
"number",
"of",
"syllables",
"and",
"phones",
"in",
"this",
"word",
"If",
"maxFlag",
"=",
"True",
"use",
"the",
"longest",
"pronunciation",
".",
"Otherwise",
"take",
"the",
"average",
"length",
"."
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/isletool.py#L363-L398 |
46,514 | timmahrt/pysle | pysle/isletool.py | findOODWords | def findOODWords(isleDict, wordList):
'''
Returns all of the out-of-dictionary words found in a list of utterances
'''
oodList = []
for word in wordList:
try:
isleDict.lookup(word)
except WordNotInISLE:
oodList.append(word)
oodList = list(... | python | def findOODWords(isleDict, wordList):
'''
Returns all of the out-of-dictionary words found in a list of utterances
'''
oodList = []
for word in wordList:
try:
isleDict.lookup(word)
except WordNotInISLE:
oodList.append(word)
oodList = list(... | [
"def",
"findOODWords",
"(",
"isleDict",
",",
"wordList",
")",
":",
"oodList",
"=",
"[",
"]",
"for",
"word",
"in",
"wordList",
":",
"try",
":",
"isleDict",
".",
"lookup",
"(",
"word",
")",
"except",
"WordNotInISLE",
":",
"oodList",
".",
"append",
"(",
"... | Returns all of the out-of-dictionary words found in a list of utterances | [
"Returns",
"all",
"of",
"the",
"out",
"-",
"of",
"-",
"dictionary",
"words",
"found",
"in",
"a",
"list",
"of",
"utterances"
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/isletool.py#L401-L415 |
46,515 | timmahrt/pysle | pysle/isletool.py | LexicalTool._buildDict | def _buildDict(self):
'''
Builds the isle textfile into a dictionary for fast searching
'''
lexDict = {}
with io.open(self.islePath, "r", encoding='utf-8') as fd:
wordList = [line.rstrip('\n') for line in fd]
for row in wordList:
word, pro... | python | def _buildDict(self):
'''
Builds the isle textfile into a dictionary for fast searching
'''
lexDict = {}
with io.open(self.islePath, "r", encoding='utf-8') as fd:
wordList = [line.rstrip('\n') for line in fd]
for row in wordList:
word, pro... | [
"def",
"_buildDict",
"(",
"self",
")",
":",
"lexDict",
"=",
"{",
"}",
"with",
"io",
".",
"open",
"(",
"self",
".",
"islePath",
",",
"\"r\"",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"fd",
":",
"wordList",
"=",
"[",
"line",
".",
"rstrip",
"(",
... | Builds the isle textfile into a dictionary for fast searching | [
"Builds",
"the",
"isle",
"textfile",
"into",
"a",
"dictionary",
"for",
"fast",
"searching"
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/isletool.py#L66-L86 |
46,516 | chriso/timeseries | timeseries/data_frame.py | DataFrame.timestamps | def timestamps(self):
'''Get all timestamps from all series in the group.'''
timestamps = set()
for series in self.groups.itervalues():
timestamps |= set(series.timestamps)
return sorted(list(timestamps)) | python | def timestamps(self):
'''Get all timestamps from all series in the group.'''
timestamps = set()
for series in self.groups.itervalues():
timestamps |= set(series.timestamps)
return sorted(list(timestamps)) | [
"def",
"timestamps",
"(",
"self",
")",
":",
"timestamps",
"=",
"set",
"(",
")",
"for",
"series",
"in",
"self",
".",
"groups",
".",
"itervalues",
"(",
")",
":",
"timestamps",
"|=",
"set",
"(",
"series",
".",
"timestamps",
")",
"return",
"sorted",
"(",
... | Get all timestamps from all series in the group. | [
"Get",
"all",
"timestamps",
"from",
"all",
"series",
"in",
"the",
"group",
"."
] | 8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d | https://github.com/chriso/timeseries/blob/8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d/timeseries/data_frame.py#L13-L18 |
46,517 | chriso/timeseries | timeseries/data_frame.py | DataFrame.plot | def plot(self, overlay=True, **labels): # pragma: no cover
'''Plot all time series in the group.'''
pylab = LazyImport.pylab()
colours = list('rgbymc')
colours_len = len(colours)
colours_pos = 0
plots = len(self.groups)
for name, series in self.groups.iteritems():... | python | def plot(self, overlay=True, **labels): # pragma: no cover
'''Plot all time series in the group.'''
pylab = LazyImport.pylab()
colours = list('rgbymc')
colours_len = len(colours)
colours_pos = 0
plots = len(self.groups)
for name, series in self.groups.iteritems():... | [
"def",
"plot",
"(",
"self",
",",
"overlay",
"=",
"True",
",",
"*",
"*",
"labels",
")",
":",
"# pragma: no cover",
"pylab",
"=",
"LazyImport",
".",
"pylab",
"(",
")",
"colours",
"=",
"list",
"(",
"'rgbymc'",
")",
"colours_len",
"=",
"len",
"(",
"colours... | Plot all time series in the group. | [
"Plot",
"all",
"time",
"series",
"in",
"the",
"group",
"."
] | 8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d | https://github.com/chriso/timeseries/blob/8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d/timeseries/data_frame.py#L32-L52 |
46,518 | chriso/timeseries | timeseries/data_frame.py | DataFrame.rename | def rename(self, **kwargs):
'''Rename series in the group.'''
for old, new in kwargs.iteritems():
if old in self.groups:
self.groups[new] = self.groups[old]
del self.groups[old] | python | def rename(self, **kwargs):
'''Rename series in the group.'''
for old, new in kwargs.iteritems():
if old in self.groups:
self.groups[new] = self.groups[old]
del self.groups[old] | [
"def",
"rename",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"old",
",",
"new",
"in",
"kwargs",
".",
"iteritems",
"(",
")",
":",
"if",
"old",
"in",
"self",
".",
"groups",
":",
"self",
".",
"groups",
"[",
"new",
"]",
"=",
"self",
".",... | Rename series in the group. | [
"Rename",
"series",
"in",
"the",
"group",
"."
] | 8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d | https://github.com/chriso/timeseries/blob/8b81e6cfd955a7cf75a421dfdb71b3f9e53be64d/timeseries/data_frame.py#L54-L59 |
46,519 | bihealth/vcfpy | vcfpy/reader.py | Reader.fetch | def fetch(self, chrom_or_region, begin=None, end=None):
"""Jump to the start position of the given chromosomal position
and limit iteration to the end position
:param str chrom_or_region: name of the chromosome to jump to if
begin and end are given and a samtools region string other... | python | def fetch(self, chrom_or_region, begin=None, end=None):
"""Jump to the start position of the given chromosomal position
and limit iteration to the end position
:param str chrom_or_region: name of the chromosome to jump to if
begin and end are given and a samtools region string other... | [
"def",
"fetch",
"(",
"self",
",",
"chrom_or_region",
",",
"begin",
"=",
"None",
",",
"end",
"=",
"None",
")",
":",
"if",
"begin",
"is",
"not",
"None",
"and",
"end",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"begin and end must both be None or neither\... | Jump to the start position of the given chromosomal position
and limit iteration to the end position
:param str chrom_or_region: name of the chromosome to jump to if
begin and end are given and a samtools region string otherwise
(e.g. "chr1:123,456-123,900").
:param int ... | [
"Jump",
"to",
"the",
"start",
"position",
"of",
"the",
"given",
"chromosomal",
"position",
"and",
"limit",
"iteration",
"to",
"the",
"end",
"position"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/reader.py#L123-L146 |
46,520 | bihealth/vcfpy | vcfpy/reader.py | Reader.close | def close(self):
"""Close underlying stream"""
if self.tabix_file and not self.tabix_file.closed:
self.tabix_file.close()
if self.stream:
self.stream.close() | python | def close(self):
"""Close underlying stream"""
if self.tabix_file and not self.tabix_file.closed:
self.tabix_file.close()
if self.stream:
self.stream.close() | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"tabix_file",
"and",
"not",
"self",
".",
"tabix_file",
".",
"closed",
":",
"self",
".",
"tabix_file",
".",
"close",
"(",
")",
"if",
"self",
".",
"stream",
":",
"self",
".",
"stream",
".",
"c... | Close underlying stream | [
"Close",
"underlying",
"stream"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/reader.py#L148-L153 |
46,521 | bihealth/vcfpy | vcfpy/header.py | serialize_for_header | def serialize_for_header(key, value):
"""Serialize value for the given mapping key for a VCF header line"""
if key in QUOTE_FIELDS:
return json.dumps(value)
elif isinstance(value, str):
if " " in value or "\t" in value:
return json.dumps(value)
else:
return va... | python | def serialize_for_header(key, value):
"""Serialize value for the given mapping key for a VCF header line"""
if key in QUOTE_FIELDS:
return json.dumps(value)
elif isinstance(value, str):
if " " in value or "\t" in value:
return json.dumps(value)
else:
return va... | [
"def",
"serialize_for_header",
"(",
"key",
",",
"value",
")",
":",
"if",
"key",
"in",
"QUOTE_FIELDS",
":",
"return",
"json",
".",
"dumps",
"(",
"value",
")",
"elif",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"if",
"\" \"",
"in",
"value",
"or",
... | Serialize value for the given mapping key for a VCF header line | [
"Serialize",
"value",
"for",
"the",
"given",
"mapping",
"key",
"for",
"a",
"VCF",
"header",
"line"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L212-L224 |
46,522 | bihealth/vcfpy | vcfpy/header.py | mapping_to_str | def mapping_to_str(mapping):
"""Convert mapping to string"""
result = ["<"]
for i, (key, value) in enumerate(mapping.items()):
if i > 0:
result.append(",")
result += [key, "=", serialize_for_header(key, value)]
result += [">"]
return "".join(result) | python | def mapping_to_str(mapping):
"""Convert mapping to string"""
result = ["<"]
for i, (key, value) in enumerate(mapping.items()):
if i > 0:
result.append(",")
result += [key, "=", serialize_for_header(key, value)]
result += [">"]
return "".join(result) | [
"def",
"mapping_to_str",
"(",
"mapping",
")",
":",
"result",
"=",
"[",
"\"<\"",
"]",
"for",
"i",
",",
"(",
"key",
",",
"value",
")",
"in",
"enumerate",
"(",
"mapping",
".",
"items",
"(",
")",
")",
":",
"if",
"i",
">",
"0",
":",
"result",
".",
"... | Convert mapping to string | [
"Convert",
"mapping",
"to",
"string"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L482-L490 |
46,523 | bihealth/vcfpy | vcfpy/header.py | Header._build_indices | def _build_indices(self):
"""Build indices for the different field types"""
result = {key: OrderedDict() for key in LINES_WITH_ID}
for line in self.lines:
if line.key in LINES_WITH_ID:
result.setdefault(line.key, OrderedDict())
if line.mapping["ID"] in... | python | def _build_indices(self):
"""Build indices for the different field types"""
result = {key: OrderedDict() for key in LINES_WITH_ID}
for line in self.lines:
if line.key in LINES_WITH_ID:
result.setdefault(line.key, OrderedDict())
if line.mapping["ID"] in... | [
"def",
"_build_indices",
"(",
"self",
")",
":",
"result",
"=",
"{",
"key",
":",
"OrderedDict",
"(",
")",
"for",
"key",
"in",
"LINES_WITH_ID",
"}",
"for",
"line",
"in",
"self",
".",
"lines",
":",
"if",
"line",
".",
"key",
"in",
"LINES_WITH_ID",
":",
"... | Build indices for the different field types | [
"Build",
"indices",
"for",
"the",
"different",
"field",
"types"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L277-L295 |
46,524 | bihealth/vcfpy | vcfpy/header.py | Header.copy | def copy(self):
"""Return a copy of this header"""
return Header([line.copy() for line in self.lines], self.samples.copy()) | python | def copy(self):
"""Return a copy of this header"""
return Header([line.copy() for line in self.lines], self.samples.copy()) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"Header",
"(",
"[",
"line",
".",
"copy",
"(",
")",
"for",
"line",
"in",
"self",
".",
"lines",
"]",
",",
"self",
".",
"samples",
".",
"copy",
"(",
")",
")"
] | Return a copy of this header | [
"Return",
"a",
"copy",
"of",
"this",
"header"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L297-L299 |
46,525 | bihealth/vcfpy | vcfpy/header.py | Header.get_lines | def get_lines(self, key):
"""Return header lines having the given ``key`` as their type"""
if key in self._indices:
return self._indices[key].values()
else:
return [] | python | def get_lines(self, key):
"""Return header lines having the given ``key`` as their type"""
if key in self._indices:
return self._indices[key].values()
else:
return [] | [
"def",
"get_lines",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"_indices",
":",
"return",
"self",
".",
"_indices",
"[",
"key",
"]",
".",
"values",
"(",
")",
"else",
":",
"return",
"[",
"]"
] | Return header lines having the given ``key`` as their type | [
"Return",
"header",
"lines",
"having",
"the",
"given",
"key",
"as",
"their",
"type"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L353-L358 |
46,526 | bihealth/vcfpy | vcfpy/header.py | Header.has_header_line | def has_header_line(self, key, id_):
"""Return whether there is a header line with the given ID of the
type given by ``key``
:param key: The VCF header key/line type.
:param id_: The ID value to compare fore
:return: ``True`` if there is a header line starting with ``##${key}=`... | python | def has_header_line(self, key, id_):
"""Return whether there is a header line with the given ID of the
type given by ``key``
:param key: The VCF header key/line type.
:param id_: The ID value to compare fore
:return: ``True`` if there is a header line starting with ``##${key}=`... | [
"def",
"has_header_line",
"(",
"self",
",",
"key",
",",
"id_",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_indices",
":",
"return",
"False",
"else",
":",
"return",
"id_",
"in",
"self",
".",
"_indices",
"[",
"key",
"]"
] | Return whether there is a header line with the given ID of the
type given by ``key``
:param key: The VCF header key/line type.
:param id_: The ID value to compare fore
:return: ``True`` if there is a header line starting with ``##${key}=``
in the VCF file having the mapping... | [
"Return",
"whether",
"there",
"is",
"a",
"header",
"line",
"with",
"the",
"given",
"ID",
"of",
"the",
"type",
"given",
"by",
"key"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L360-L373 |
46,527 | bihealth/vcfpy | vcfpy/header.py | Header.add_line | def add_line(self, header_line):
"""Add header line, updating any necessary support indices
:return: ``False`` on conflicting line and ``True`` otherwise
"""
self.lines.append(header_line)
self._indices.setdefault(header_line.key, OrderedDict())
if not hasattr(header_lin... | python | def add_line(self, header_line):
"""Add header line, updating any necessary support indices
:return: ``False`` on conflicting line and ``True`` otherwise
"""
self.lines.append(header_line)
self._indices.setdefault(header_line.key, OrderedDict())
if not hasattr(header_lin... | [
"def",
"add_line",
"(",
"self",
",",
"header_line",
")",
":",
"self",
".",
"lines",
".",
"append",
"(",
"header_line",
")",
"self",
".",
"_indices",
".",
"setdefault",
"(",
"header_line",
".",
"key",
",",
"OrderedDict",
"(",
")",
")",
"if",
"not",
"has... | Add header line, updating any necessary support indices
:return: ``False`` on conflicting line and ``True`` otherwise | [
"Add",
"header",
"line",
"updating",
"any",
"necessary",
"support",
"indices"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L375-L395 |
46,528 | bihealth/vcfpy | vcfpy/header.py | SimpleHeaderLine.copy | def copy(self):
"""Return a copy"""
mapping = OrderedDict(self.mapping.items())
return self.__class__(self.key, self.value, mapping) | python | def copy(self):
"""Return a copy"""
mapping = OrderedDict(self.mapping.items())
return self.__class__(self.key, self.value, mapping) | [
"def",
"copy",
"(",
"self",
")",
":",
"mapping",
"=",
"OrderedDict",
"(",
"self",
".",
"mapping",
".",
"items",
"(",
")",
")",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"key",
",",
"self",
".",
"value",
",",
"mapping",
")"
] | Return a copy | [
"Return",
"a",
"copy"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/header.py#L513-L516 |
46,529 | timmahrt/pysle | pysle/pronunciationtools.py | _adjustSyllabification | def _adjustSyllabification(adjustedPhoneList, syllableList):
'''
Inserts spaces into a syllable if needed
Originally the phone list and syllable list contained the same number
of phones. But the adjustedPhoneList may have some insertions which are
not accounted for in the syllableList.
'''... | python | def _adjustSyllabification(adjustedPhoneList, syllableList):
'''
Inserts spaces into a syllable if needed
Originally the phone list and syllable list contained the same number
of phones. But the adjustedPhoneList may have some insertions which are
not accounted for in the syllableList.
'''... | [
"def",
"_adjustSyllabification",
"(",
"adjustedPhoneList",
",",
"syllableList",
")",
":",
"i",
"=",
"0",
"retSyllableList",
"=",
"[",
"]",
"for",
"syllableNum",
",",
"syllable",
"in",
"enumerate",
"(",
"syllableList",
")",
":",
"j",
"=",
"len",
"(",
"syllabl... | Inserts spaces into a syllable if needed
Originally the phone list and syllable list contained the same number
of phones. But the adjustedPhoneList may have some insertions which are
not accounted for in the syllableList. | [
"Inserts",
"spaces",
"into",
"a",
"syllable",
"if",
"needed",
"Originally",
"the",
"phone",
"list",
"and",
"syllable",
"list",
"contained",
"the",
"same",
"number",
"of",
"phones",
".",
"But",
"the",
"adjustedPhoneList",
"may",
"have",
"some",
"insertions",
"w... | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L132-L165 |
46,530 | timmahrt/pysle | pysle/pronunciationtools.py | _findBestPronunciation | def _findBestPronunciation(isleWordList, aPron):
'''
Words may have multiple candidates in ISLE; returns the 'optimal' one.
'''
aP = _prepPronunciation(aPron) # Mapping to simplified phone inventory
numDiffList = []
withStress = []
i = 0
alignedSyllabificationList = []
ali... | python | def _findBestPronunciation(isleWordList, aPron):
'''
Words may have multiple candidates in ISLE; returns the 'optimal' one.
'''
aP = _prepPronunciation(aPron) # Mapping to simplified phone inventory
numDiffList = []
withStress = []
i = 0
alignedSyllabificationList = []
ali... | [
"def",
"_findBestPronunciation",
"(",
"isleWordList",
",",
"aPron",
")",
":",
"aP",
"=",
"_prepPronunciation",
"(",
"aPron",
")",
"# Mapping to simplified phone inventory",
"numDiffList",
"=",
"[",
"]",
"withStress",
"=",
"[",
"]",
"i",
"=",
"0",
"alignedSyllabifi... | Words may have multiple candidates in ISLE; returns the 'optimal' one. | [
"Words",
"may",
"have",
"multiple",
"candidates",
"in",
"ISLE",
";",
"returns",
"the",
"optimal",
"one",
"."
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L168-L235 |
46,531 | timmahrt/pysle | pysle/pronunciationtools.py | _syllabifyPhones | def _syllabifyPhones(phoneList, syllableList):
'''
Given a phone list and a syllable list, syllabify the phones
Typically used by findBestSyllabification which first aligns the phoneList
with a dictionary phoneList and then uses the dictionary syllabification
to syllabify the input phoneList.
... | python | def _syllabifyPhones(phoneList, syllableList):
'''
Given a phone list and a syllable list, syllabify the phones
Typically used by findBestSyllabification which first aligns the phoneList
with a dictionary phoneList and then uses the dictionary syllabification
to syllabify the input phoneList.
... | [
"def",
"_syllabifyPhones",
"(",
"phoneList",
",",
"syllableList",
")",
":",
"numPhoneList",
"=",
"[",
"len",
"(",
"syllable",
")",
"for",
"syllable",
"in",
"syllableList",
"]",
"start",
"=",
"0",
"syllabifiedList",
"=",
"[",
"]",
"for",
"end",
"in",
"numPh... | Given a phone list and a syllable list, syllabify the phones
Typically used by findBestSyllabification which first aligns the phoneList
with a dictionary phoneList and then uses the dictionary syllabification
to syllabify the input phoneList. | [
"Given",
"a",
"phone",
"list",
"and",
"a",
"syllable",
"list",
"syllabify",
"the",
"phones",
"Typically",
"used",
"by",
"findBestSyllabification",
"which",
"first",
"aligns",
"the",
"phoneList",
"with",
"a",
"dictionary",
"phoneList",
"and",
"then",
"uses",
"the... | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L238-L258 |
46,532 | timmahrt/pysle | pysle/pronunciationtools.py | alignPronunciations | def alignPronunciations(pronI, pronA):
'''
Align the phones in two pronunciations
'''
# First prep the two pronunctions
pronI = [char for char in pronI]
pronA = [char for char in pronA]
# Remove any elements not in the other list (but maintain order)
pronITmp = pronI
pronAT... | python | def alignPronunciations(pronI, pronA):
'''
Align the phones in two pronunciations
'''
# First prep the two pronunctions
pronI = [char for char in pronI]
pronA = [char for char in pronA]
# Remove any elements not in the other list (but maintain order)
pronITmp = pronI
pronAT... | [
"def",
"alignPronunciations",
"(",
"pronI",
",",
"pronA",
")",
":",
"# First prep the two pronunctions",
"pronI",
"=",
"[",
"char",
"for",
"char",
"in",
"pronI",
"]",
"pronA",
"=",
"[",
"char",
"for",
"char",
"in",
"pronA",
"]",
"# Remove any elements not in the... | Align the phones in two pronunciations | [
"Align",
"the",
"phones",
"in",
"two",
"pronunciations"
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L261-L311 |
46,533 | timmahrt/pysle | pysle/pronunciationtools.py | _findBestSyllabification | def _findBestSyllabification(inputIsleWordList, actualPronunciationList):
'''
Find the best syllabification for a word
First find the closest pronunciation to a given pronunciation. Then take
the syllabification for that pronunciation and map it onto the
input pronunciation.
'''
retList... | python | def _findBestSyllabification(inputIsleWordList, actualPronunciationList):
'''
Find the best syllabification for a word
First find the closest pronunciation to a given pronunciation. Then take
the syllabification for that pronunciation and map it onto the
input pronunciation.
'''
retList... | [
"def",
"_findBestSyllabification",
"(",
"inputIsleWordList",
",",
"actualPronunciationList",
")",
":",
"retList",
"=",
"_findBestPronunciation",
"(",
"inputIsleWordList",
",",
"actualPronunciationList",
")",
"isleWordList",
",",
"alignedAPronList",
",",
"alignedSyllableList",... | Find the best syllabification for a word
First find the closest pronunciation to a given pronunciation. Then take
the syllabification for that pronunciation and map it onto the
input pronunciation. | [
"Find",
"the",
"best",
"syllabification",
"for",
"a",
"word",
"First",
"find",
"the",
"closest",
"pronunciation",
"to",
"a",
"given",
"pronunciation",
".",
"Then",
"take",
"the",
"syllabification",
"for",
"that",
"pronunciation",
"and",
"map",
"it",
"onto",
"t... | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L347-L387 |
46,534 | timmahrt/pysle | pysle/pronunciationtools.py | _getSyllableNucleus | def _getSyllableNucleus(phoneList):
'''
Given the phones in a syllable, retrieves the vowel index
'''
cvList = ['V' if isletool.isVowel(phone) else 'C' for phone in phoneList]
vowelCount = cvList.count('V')
if vowelCount > 1:
raise TooManyVowelsInSyllable(phoneList, cvList)
... | python | def _getSyllableNucleus(phoneList):
'''
Given the phones in a syllable, retrieves the vowel index
'''
cvList = ['V' if isletool.isVowel(phone) else 'C' for phone in phoneList]
vowelCount = cvList.count('V')
if vowelCount > 1:
raise TooManyVowelsInSyllable(phoneList, cvList)
... | [
"def",
"_getSyllableNucleus",
"(",
"phoneList",
")",
":",
"cvList",
"=",
"[",
"'V'",
"if",
"isletool",
".",
"isVowel",
"(",
"phone",
")",
"else",
"'C'",
"for",
"phone",
"in",
"phoneList",
"]",
"vowelCount",
"=",
"cvList",
".",
"count",
"(",
"'V'",
")",
... | Given the phones in a syllable, retrieves the vowel index | [
"Given",
"the",
"phones",
"in",
"a",
"syllable",
"retrieves",
"the",
"vowel",
"index"
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L390-L405 |
46,535 | timmahrt/pysle | pysle/pronunciationtools.py | findClosestPronunciation | def findClosestPronunciation(inputIsleWordList, aPron):
'''
Find the closest dictionary pronunciation to a provided pronunciation
'''
retList = _findBestPronunciation(inputIsleWordList, aPron)
isleWordList = retList[0]
bestIndex = retList[3]
return isleWordList[bestIndex] | python | def findClosestPronunciation(inputIsleWordList, aPron):
'''
Find the closest dictionary pronunciation to a provided pronunciation
'''
retList = _findBestPronunciation(inputIsleWordList, aPron)
isleWordList = retList[0]
bestIndex = retList[3]
return isleWordList[bestIndex] | [
"def",
"findClosestPronunciation",
"(",
"inputIsleWordList",
",",
"aPron",
")",
":",
"retList",
"=",
"_findBestPronunciation",
"(",
"inputIsleWordList",
",",
"aPron",
")",
"isleWordList",
"=",
"retList",
"[",
"0",
"]",
"bestIndex",
"=",
"retList",
"[",
"3",
"]",... | Find the closest dictionary pronunciation to a provided pronunciation | [
"Find",
"the",
"closest",
"dictionary",
"pronunciation",
"to",
"a",
"provided",
"pronunciation"
] | da7c3d9ebdc01647be845f442b6f072a854eba3b | https://github.com/timmahrt/pysle/blob/da7c3d9ebdc01647be845f442b6f072a854eba3b/pysle/pronunciationtools.py#L408-L417 |
46,536 | lexruee/pi-switch-python | send.py | create_switch | def create_switch(type, settings, pin):
"""Create a switch.
Args:
type: (str): type of the switch [A,B,C,D]
settings (str): a comma separted list
pin (int): wiringPi pin
Returns:
switch
"""
switch = None
if type == "A":
group, device = settings.split(",")
switch = p... | python | def create_switch(type, settings, pin):
"""Create a switch.
Args:
type: (str): type of the switch [A,B,C,D]
settings (str): a comma separted list
pin (int): wiringPi pin
Returns:
switch
"""
switch = None
if type == "A":
group, device = settings.split(",")
switch = p... | [
"def",
"create_switch",
"(",
"type",
",",
"settings",
",",
"pin",
")",
":",
"switch",
"=",
"None",
"if",
"type",
"==",
"\"A\"",
":",
"group",
",",
"device",
"=",
"settings",
".",
"split",
"(",
"\",\"",
")",
"switch",
"=",
"pi_switch",
".",
"RCSwitchA",... | Create a switch.
Args:
type: (str): type of the switch [A,B,C,D]
settings (str): a comma separted list
pin (int): wiringPi pin
Returns:
switch | [
"Create",
"a",
"switch",
"."
] | 5c367a6d51aa15811e997160746d1512a37e2dc6 | https://github.com/lexruee/pi-switch-python/blob/5c367a6d51aa15811e997160746d1512a37e2dc6/send.py#L32-L71 |
46,537 | bihealth/vcfpy | vcfpy/writer.py | format_atomic | def format_atomic(value):
"""Format atomic value
This function also takes care of escaping the value in case one of the
reserved characters occurs in the value.
"""
# Perform escaping
if isinstance(value, str):
if any(r in value for r in record.RESERVED_CHARS):
for k, v in r... | python | def format_atomic(value):
"""Format atomic value
This function also takes care of escaping the value in case one of the
reserved characters occurs in the value.
"""
# Perform escaping
if isinstance(value, str):
if any(r in value for r in record.RESERVED_CHARS):
for k, v in r... | [
"def",
"format_atomic",
"(",
"value",
")",
":",
"# Perform escaping",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"if",
"any",
"(",
"r",
"in",
"value",
"for",
"r",
"in",
"record",
".",
"RESERVED_CHARS",
")",
":",
"for",
"k",
",",
"v",
"in... | Format atomic value
This function also takes care of escaping the value in case one of the
reserved characters occurs in the value. | [
"Format",
"atomic",
"value"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/writer.py#L14-L29 |
46,538 | bihealth/vcfpy | vcfpy/writer.py | format_value | def format_value(field_info, value, section):
"""Format possibly compound value given the FieldInfo"""
if section == "FORMAT" and field_info.id == "FT":
if not value:
return "."
elif isinstance(value, list):
return ";".join(map(format_atomic, value))
elif field_info.n... | python | def format_value(field_info, value, section):
"""Format possibly compound value given the FieldInfo"""
if section == "FORMAT" and field_info.id == "FT":
if not value:
return "."
elif isinstance(value, list):
return ";".join(map(format_atomic, value))
elif field_info.n... | [
"def",
"format_value",
"(",
"field_info",
",",
"value",
",",
"section",
")",
":",
"if",
"section",
"==",
"\"FORMAT\"",
"and",
"field_info",
".",
"id",
"==",
"\"FT\"",
":",
"if",
"not",
"value",
":",
"return",
"\".\"",
"elif",
"isinstance",
"(",
"value",
... | Format possibly compound value given the FieldInfo | [
"Format",
"possibly",
"compound",
"value",
"given",
"the",
"FieldInfo"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/writer.py#L32-L48 |
46,539 | bihealth/vcfpy | vcfpy/writer.py | Writer._write_header | def _write_header(self):
"""Write out the header"""
for line in self.header.lines:
print(line.serialize(), file=self.stream)
if self.header.samples.names:
print(
"\t".join(list(parser.REQUIRE_SAMPLE_HEADER) + self.header.samples.names),
fil... | python | def _write_header(self):
"""Write out the header"""
for line in self.header.lines:
print(line.serialize(), file=self.stream)
if self.header.samples.names:
print(
"\t".join(list(parser.REQUIRE_SAMPLE_HEADER) + self.header.samples.names),
fil... | [
"def",
"_write_header",
"(",
"self",
")",
":",
"for",
"line",
"in",
"self",
".",
"header",
".",
"lines",
":",
"print",
"(",
"line",
".",
"serialize",
"(",
")",
",",
"file",
"=",
"self",
".",
"stream",
")",
"if",
"self",
".",
"header",
".",
"samples... | Write out the header | [
"Write",
"out",
"the",
"header"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/writer.py#L111-L121 |
46,540 | bihealth/vcfpy | vcfpy/writer.py | Writer._serialize_record | def _serialize_record(self, record):
"""Serialize whole Record"""
f = self._empty_to_dot
row = [record.CHROM, record.POS]
row.append(f(";".join(record.ID)))
row.append(f(record.REF))
if not record.ALT:
row.append(".")
else:
row.append(",".j... | python | def _serialize_record(self, record):
"""Serialize whole Record"""
f = self._empty_to_dot
row = [record.CHROM, record.POS]
row.append(f(";".join(record.ID)))
row.append(f(record.REF))
if not record.ALT:
row.append(".")
else:
row.append(",".j... | [
"def",
"_serialize_record",
"(",
"self",
",",
"record",
")",
":",
"f",
"=",
"self",
".",
"_empty_to_dot",
"row",
"=",
"[",
"record",
".",
"CHROM",
",",
"record",
".",
"POS",
"]",
"row",
".",
"append",
"(",
"f",
"(",
"\";\"",
".",
"join",
"(",
"reco... | Serialize whole Record | [
"Serialize",
"whole",
"Record"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/writer.py#L132-L151 |
46,541 | bihealth/vcfpy | vcfpy/writer.py | Writer._serialize_info | def _serialize_info(self, record):
"""Return serialized version of record.INFO"""
result = []
for key, value in record.INFO.items():
info = self.header.get_info_field_info(key)
if info.type == "Flag":
result.append(key)
else:
re... | python | def _serialize_info(self, record):
"""Return serialized version of record.INFO"""
result = []
for key, value in record.INFO.items():
info = self.header.get_info_field_info(key)
if info.type == "Flag":
result.append(key)
else:
re... | [
"def",
"_serialize_info",
"(",
"self",
",",
"record",
")",
":",
"result",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"record",
".",
"INFO",
".",
"items",
"(",
")",
":",
"info",
"=",
"self",
".",
"header",
".",
"get_info_field_info",
"(",
"key",... | Return serialized version of record.INFO | [
"Return",
"serialized",
"version",
"of",
"record",
".",
"INFO"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/writer.py#L153-L162 |
46,542 | bihealth/vcfpy | vcfpy/writer.py | Writer._serialize_call | def _serialize_call(self, format_, call):
"""Return serialized version of the Call using the record's FORMAT'"""
if isinstance(call, record.UnparsedCall):
return call.unparsed_data
else:
result = [
format_value(self.header.get_format_field_info(key), call.... | python | def _serialize_call(self, format_, call):
"""Return serialized version of the Call using the record's FORMAT'"""
if isinstance(call, record.UnparsedCall):
return call.unparsed_data
else:
result = [
format_value(self.header.get_format_field_info(key), call.... | [
"def",
"_serialize_call",
"(",
"self",
",",
"format_",
",",
"call",
")",
":",
"if",
"isinstance",
"(",
"call",
",",
"record",
".",
"UnparsedCall",
")",
":",
"return",
"call",
".",
"unparsed_data",
"else",
":",
"result",
"=",
"[",
"format_value",
"(",
"se... | Return serialized version of the Call using the record's FORMAT | [
"Return",
"serialized",
"version",
"of",
"the",
"Call",
"using",
"the",
"record",
"s",
"FORMAT"
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/vcfpy/writer.py#L164-L173 |
46,543 | Pitmairen/hamlish-jinja | hamlish_jinja.py | Hamlish._create_extended_jinja_tags | def _create_extended_jinja_tags(self, nodes):
"""Loops through the nodes and looks for special jinja tags that
contains more than one tag but only one ending tag."""
jinja_a = None
jinja_b = None
ext_node = None
ext_nodes = []
for node in nodes:
if ... | python | def _create_extended_jinja_tags(self, nodes):
"""Loops through the nodes and looks for special jinja tags that
contains more than one tag but only one ending tag."""
jinja_a = None
jinja_b = None
ext_node = None
ext_nodes = []
for node in nodes:
if ... | [
"def",
"_create_extended_jinja_tags",
"(",
"self",
",",
"nodes",
")",
":",
"jinja_a",
"=",
"None",
"jinja_b",
"=",
"None",
"ext_node",
"=",
"None",
"ext_nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"nodes",
":",
"if",
"isinstance",
"(",
"node",
",",
"Empt... | Loops through the nodes and looks for special jinja tags that
contains more than one tag but only one ending tag. | [
"Loops",
"through",
"the",
"nodes",
"and",
"looks",
"for",
"special",
"jinja",
"tags",
"that",
"contains",
"more",
"than",
"one",
"tag",
"but",
"only",
"one",
"ending",
"tag",
"."
] | f8fdbddf2f444124c6fc69d1eb11603da2838093 | https://github.com/Pitmairen/hamlish-jinja/blob/f8fdbddf2f444124c6fc69d1eb11603da2838093/hamlish_jinja.py#L585-L633 |
46,544 | Pitmairen/hamlish-jinja | hamlish_jinja.py | Node.has_children | def has_children(self):
"returns False if children is empty or contains only empty lines else True."
return bool([x for x in self.children if not isinstance(x, EmptyLine)]) | python | def has_children(self):
"returns False if children is empty or contains only empty lines else True."
return bool([x for x in self.children if not isinstance(x, EmptyLine)]) | [
"def",
"has_children",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"children",
"if",
"not",
"isinstance",
"(",
"x",
",",
"EmptyLine",
")",
"]",
")"
] | returns False if children is empty or contains only empty lines else True. | [
"returns",
"False",
"if",
"children",
"is",
"empty",
"or",
"contains",
"only",
"empty",
"lines",
"else",
"True",
"."
] | f8fdbddf2f444124c6fc69d1eb11603da2838093 | https://github.com/Pitmairen/hamlish-jinja/blob/f8fdbddf2f444124c6fc69d1eb11603da2838093/hamlish_jinja.py#L645-L647 |
46,545 | bihealth/vcfpy | setup.py | parse_requirements | def parse_requirements(path):
"""Parse ``requirements.txt`` at ``path``."""
requirements = []
with open(path, "rt") as reqs_f:
for line in reqs_f:
line = line.strip()
if line.startswith("-r"):
fname = line.split()[1]
inner_path = os.path.join(o... | python | def parse_requirements(path):
"""Parse ``requirements.txt`` at ``path``."""
requirements = []
with open(path, "rt") as reqs_f:
for line in reqs_f:
line = line.strip()
if line.startswith("-r"):
fname = line.split()[1]
inner_path = os.path.join(o... | [
"def",
"parse_requirements",
"(",
"path",
")",
":",
"requirements",
"=",
"[",
"]",
"with",
"open",
"(",
"path",
",",
"\"rt\"",
")",
"as",
"reqs_f",
":",
"for",
"line",
"in",
"reqs_f",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
... | Parse ``requirements.txt`` at ``path``. | [
"Parse",
"requirements",
".",
"txt",
"at",
"path",
"."
] | 99e2165df30f11e0c95f3170f31bc5191d9e9e15 | https://github.com/bihealth/vcfpy/blob/99e2165df30f11e0c95f3170f31bc5191d9e9e15/setup.py#L13-L25 |
46,546 | eraclitux/ipcampy | ipcampy/sentry.py | watch | def watch(cams, path=None, delay=10):
"""Get screenshots from all cams at defined intervall."""
while True:
for c in cams:
c.snap(path)
time.sleep(delay) | python | def watch(cams, path=None, delay=10):
"""Get screenshots from all cams at defined intervall."""
while True:
for c in cams:
c.snap(path)
time.sleep(delay) | [
"def",
"watch",
"(",
"cams",
",",
"path",
"=",
"None",
",",
"delay",
"=",
"10",
")",
":",
"while",
"True",
":",
"for",
"c",
"in",
"cams",
":",
"c",
".",
"snap",
"(",
"path",
")",
"time",
".",
"sleep",
"(",
"delay",
")"
] | Get screenshots from all cams at defined intervall. | [
"Get",
"screenshots",
"from",
"all",
"cams",
"at",
"defined",
"intervall",
"."
] | bffd1c4df9006705cffa5b83a090b0db90cbcbcf | https://github.com/eraclitux/ipcampy/blob/bffd1c4df9006705cffa5b83a090b0db90cbcbcf/ipcampy/sentry.py#L34-L39 |
46,547 | TeleSign/python_telesign | telesign/score.py | ScoreClient.score | def score(self, phone_number, account_lifecycle_event, **params):
"""
Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
learning, and a global data consortium.
See https://developer.telesign.com/docs/score-api for detailed API... | python | def score(self, phone_number, account_lifecycle_event, **params):
"""
Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
learning, and a global data consortium.
See https://developer.telesign.com/docs/score-api for detailed API... | [
"def",
"score",
"(",
"self",
",",
"phone_number",
",",
"account_lifecycle_event",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"post",
"(",
"SCORE_RESOURCE",
".",
"format",
"(",
"phone_number",
"=",
"phone_number",
")",
",",
"account_lifecycle_eve... | Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
learning, and a global data consortium.
See https://developer.telesign.com/docs/score-api for detailed API documentation. | [
"Score",
"is",
"an",
"API",
"that",
"delivers",
"reputation",
"scoring",
"based",
"on",
"phone",
"number",
"intelligence",
"traffic",
"patterns",
"machine",
"learning",
"and",
"a",
"global",
"data",
"consortium",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/score.py#L16-L25 |
46,548 | TeleSign/python_telesign | telesign/rest.py | RestClient.generate_telesign_headers | def generate_telesign_headers(customer_id,
api_key,
method_name,
resource,
url_encoded_fields,
date_rfc2616=None,
no... | python | def generate_telesign_headers(customer_id,
api_key,
method_name,
resource,
url_encoded_fields,
date_rfc2616=None,
no... | [
"def",
"generate_telesign_headers",
"(",
"customer_id",
",",
"api_key",
",",
"method_name",
",",
"resource",
",",
"url_encoded_fields",
",",
"date_rfc2616",
"=",
"None",
",",
"nonce",
"=",
"None",
",",
"user_agent",
"=",
"None",
",",
"content_type",
"=",
"None",... | Generates the TeleSign REST API headers used to authenticate requests.
Creates the canonicalized string_to_sign and generates the HMAC signature. This is used to authenticate requests
against the TeleSign REST API.
See https://developer.telesign.com/docs/authentication for detailed API documen... | [
"Generates",
"the",
"TeleSign",
"REST",
"API",
"headers",
"used",
"to",
"authenticate",
"requests",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/rest.py#L77-L152 |
46,549 | TeleSign/python_telesign | telesign/rest.py | RestClient.post | def post(self, resource, **params):
"""
Generic TeleSign REST API POST handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the POST request with, as a dictionary.
:return: The RestClient Response o... | python | def post(self, resource, **params):
"""
Generic TeleSign REST API POST handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the POST request with, as a dictionary.
:return: The RestClient Response o... | [
"def",
"post",
"(",
"self",
",",
"resource",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"_execute",
"(",
"self",
".",
"session",
".",
"post",
",",
"'POST'",
",",
"resource",
",",
"*",
"*",
"params",
")"
] | Generic TeleSign REST API POST handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the POST request with, as a dictionary.
:return: The RestClient Response object. | [
"Generic",
"TeleSign",
"REST",
"API",
"POST",
"handler",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/rest.py#L154-L162 |
46,550 | TeleSign/python_telesign | telesign/rest.py | RestClient.get | def get(self, resource, **params):
"""
Generic TeleSign REST API GET handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the GET request with, as a dictionary.
:return: The RestClient Response obje... | python | def get(self, resource, **params):
"""
Generic TeleSign REST API GET handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the GET request with, as a dictionary.
:return: The RestClient Response obje... | [
"def",
"get",
"(",
"self",
",",
"resource",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"_execute",
"(",
"self",
".",
"session",
".",
"get",
",",
"'GET'",
",",
"resource",
",",
"*",
"*",
"params",
")"
] | Generic TeleSign REST API GET handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the GET request with, as a dictionary.
:return: The RestClient Response object. | [
"Generic",
"TeleSign",
"REST",
"API",
"GET",
"handler",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/rest.py#L164-L172 |
46,551 | TeleSign/python_telesign | telesign/rest.py | RestClient.put | def put(self, resource, **params):
"""
Generic TeleSign REST API PUT handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the PUT request with, as a dictionary.
:return: The RestClient Response obje... | python | def put(self, resource, **params):
"""
Generic TeleSign REST API PUT handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the PUT request with, as a dictionary.
:return: The RestClient Response obje... | [
"def",
"put",
"(",
"self",
",",
"resource",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"_execute",
"(",
"self",
".",
"session",
".",
"put",
",",
"'PUT'",
",",
"resource",
",",
"*",
"*",
"params",
")"
] | Generic TeleSign REST API PUT handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the PUT request with, as a dictionary.
:return: The RestClient Response object. | [
"Generic",
"TeleSign",
"REST",
"API",
"PUT",
"handler",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/rest.py#L174-L182 |
46,552 | TeleSign/python_telesign | telesign/rest.py | RestClient.delete | def delete(self, resource, **params):
"""
Generic TeleSign REST API DELETE handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the DELETE request with, as a dictionary.
:return: The RestClient Resp... | python | def delete(self, resource, **params):
"""
Generic TeleSign REST API DELETE handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the DELETE request with, as a dictionary.
:return: The RestClient Resp... | [
"def",
"delete",
"(",
"self",
",",
"resource",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"_execute",
"(",
"self",
".",
"session",
".",
"delete",
",",
"'DELETE'",
",",
"resource",
",",
"*",
"*",
"params",
")"
] | Generic TeleSign REST API DELETE handler.
:param resource: The partial resource URI to perform the request against, as a string.
:param params: Body params to perform the DELETE request with, as a dictionary.
:return: The RestClient Response object. | [
"Generic",
"TeleSign",
"REST",
"API",
"DELETE",
"handler",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/rest.py#L184-L192 |
46,553 | TeleSign/python_telesign | telesign/rest.py | RestClient._execute | def _execute(self, method_function, method_name, resource, **params):
"""
Generic TeleSign REST API request handler.
:param method_function: The Requests HTTP request function to perform the request.
:param method_name: The HTTP method name, as an upper case string.
:param resou... | python | def _execute(self, method_function, method_name, resource, **params):
"""
Generic TeleSign REST API request handler.
:param method_function: The Requests HTTP request function to perform the request.
:param method_name: The HTTP method name, as an upper case string.
:param resou... | [
"def",
"_execute",
"(",
"self",
",",
"method_function",
",",
"method_name",
",",
"resource",
",",
"*",
"*",
"params",
")",
":",
"resource_uri",
"=",
"\"{api_host}{resource}\"",
".",
"format",
"(",
"api_host",
"=",
"self",
".",
"api_host",
",",
"resource",
"=... | Generic TeleSign REST API request handler.
:param method_function: The Requests HTTP request function to perform the request.
:param method_name: The HTTP method name, as an upper case string.
:param resource: The partial resource URI to perform the request against, as a string.
:param ... | [
"Generic",
"TeleSign",
"REST",
"API",
"request",
"handler",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/rest.py#L194-L225 |
46,554 | TeleSign/python_telesign | telesign/messaging.py | MessagingClient.message | def message(self, phone_number, message, message_type, **params):
"""
Send a message to the target phone_number.
See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
"""
return self.post(MESSAGING_RESOURCE,
phone_number=p... | python | def message(self, phone_number, message, message_type, **params):
"""
Send a message to the target phone_number.
See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
"""
return self.post(MESSAGING_RESOURCE,
phone_number=p... | [
"def",
"message",
"(",
"self",
",",
"phone_number",
",",
"message",
",",
"message_type",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"post",
"(",
"MESSAGING_RESOURCE",
",",
"phone_number",
"=",
"phone_number",
",",
"message",
"=",
"message",
... | Send a message to the target phone_number.
See https://developer.telesign.com/docs/messaging-api for detailed API documentation. | [
"Send",
"a",
"message",
"to",
"the",
"target",
"phone_number",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/messaging.py#L18-L28 |
46,555 | TeleSign/python_telesign | telesign/messaging.py | MessagingClient.status | def status(self, reference_id, **params):
"""
Retrieves the current status of the message.
See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
"""
return self.get(MESSAGING_STATUS_RESOURCE.format(reference_id=reference_id),
... | python | def status(self, reference_id, **params):
"""
Retrieves the current status of the message.
See https://developer.telesign.com/docs/messaging-api for detailed API documentation.
"""
return self.get(MESSAGING_STATUS_RESOURCE.format(reference_id=reference_id),
... | [
"def",
"status",
"(",
"self",
",",
"reference_id",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"get",
"(",
"MESSAGING_STATUS_RESOURCE",
".",
"format",
"(",
"reference_id",
"=",
"reference_id",
")",
",",
"*",
"*",
"params",
")"
] | Retrieves the current status of the message.
See https://developer.telesign.com/docs/messaging-api for detailed API documentation. | [
"Retrieves",
"the",
"current",
"status",
"of",
"the",
"message",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/messaging.py#L30-L37 |
46,556 | TeleSign/python_telesign | telesign/phoneid.py | PhoneIdClient.phoneid | def phoneid(self, phone_number, **params):
"""
The PhoneID API provides a cleansed phone number, phone type, and telecom carrier information to determine the
best communication method - SMS or voice.
See https://developer.telesign.com/docs/phoneid-api for detailed API documentation.
... | python | def phoneid(self, phone_number, **params):
"""
The PhoneID API provides a cleansed phone number, phone type, and telecom carrier information to determine the
best communication method - SMS or voice.
See https://developer.telesign.com/docs/phoneid-api for detailed API documentation.
... | [
"def",
"phoneid",
"(",
"self",
",",
"phone_number",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"post",
"(",
"PHONEID_RESOURCE",
".",
"format",
"(",
"phone_number",
"=",
"phone_number",
")",
",",
"*",
"*",
"params",
")"
] | The PhoneID API provides a cleansed phone number, phone type, and telecom carrier information to determine the
best communication method - SMS or voice.
See https://developer.telesign.com/docs/phoneid-api for detailed API documentation. | [
"The",
"PhoneID",
"API",
"provides",
"a",
"cleansed",
"phone",
"number",
"phone",
"type",
"and",
"telecom",
"carrier",
"information",
"to",
"determine",
"the",
"best",
"communication",
"method",
"-",
"SMS",
"or",
"voice",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/phoneid.py#L19-L27 |
46,557 | sptonkin/fuzzyhashlib | fuzzyhashlib/__init__.py | ssdeep.copy | def copy(self):
"""Returns a new instance which identical to this instance."""
if self._pre_computed_hash is None:
temp = ssdeep(buf="")
else:
temp = ssdeep(hash=hash)
libssdeep_wrapper.fuzzy_free(temp._state)
temp._state = libssdeep_wrapper.fuzzy_clone(se... | python | def copy(self):
"""Returns a new instance which identical to this instance."""
if self._pre_computed_hash is None:
temp = ssdeep(buf="")
else:
temp = ssdeep(hash=hash)
libssdeep_wrapper.fuzzy_free(temp._state)
temp._state = libssdeep_wrapper.fuzzy_clone(se... | [
"def",
"copy",
"(",
"self",
")",
":",
"if",
"self",
".",
"_pre_computed_hash",
"is",
"None",
":",
"temp",
"=",
"ssdeep",
"(",
"buf",
"=",
"\"\"",
")",
"else",
":",
"temp",
"=",
"ssdeep",
"(",
"hash",
"=",
"hash",
")",
"libssdeep_wrapper",
".",
"fuzzy... | Returns a new instance which identical to this instance. | [
"Returns",
"a",
"new",
"instance",
"which",
"identical",
"to",
"this",
"instance",
"."
] | 61999dcfb0893358a330f51d88e4fa494a91bce2 | https://github.com/sptonkin/fuzzyhashlib/blob/61999dcfb0893358a330f51d88e4fa494a91bce2/fuzzyhashlib/__init__.py#L100-L110 |
46,558 | TeleSign/python_telesign | telesign/voice.py | VoiceClient.call | def call(self, phone_number, message, message_type, **params):
"""
Send a voice call to the target phone_number.
See https://developer.telesign.com/docs/voice-api for detailed API documentation.
"""
return self.post(VOICE_RESOURCE,
phone_number=phone_num... | python | def call(self, phone_number, message, message_type, **params):
"""
Send a voice call to the target phone_number.
See https://developer.telesign.com/docs/voice-api for detailed API documentation.
"""
return self.post(VOICE_RESOURCE,
phone_number=phone_num... | [
"def",
"call",
"(",
"self",
",",
"phone_number",
",",
"message",
",",
"message_type",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"post",
"(",
"VOICE_RESOURCE",
",",
"phone_number",
"=",
"phone_number",
",",
"message",
"=",
"message",
",",
... | Send a voice call to the target phone_number.
See https://developer.telesign.com/docs/voice-api for detailed API documentation. | [
"Send",
"a",
"voice",
"call",
"to",
"the",
"target",
"phone_number",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/voice.py#L18-L28 |
46,559 | TeleSign/python_telesign | telesign/voice.py | VoiceClient.status | def status(self, reference_id, **params):
"""
Retrieves the current status of the voice call.
See https://developer.telesign.com/docs/voice-api for detailed API documentation.
"""
return self.get(VOICE_STATUS_RESOURCE.format(reference_id=reference_id),
**... | python | def status(self, reference_id, **params):
"""
Retrieves the current status of the voice call.
See https://developer.telesign.com/docs/voice-api for detailed API documentation.
"""
return self.get(VOICE_STATUS_RESOURCE.format(reference_id=reference_id),
**... | [
"def",
"status",
"(",
"self",
",",
"reference_id",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"get",
"(",
"VOICE_STATUS_RESOURCE",
".",
"format",
"(",
"reference_id",
"=",
"reference_id",
")",
",",
"*",
"*",
"params",
")"
] | Retrieves the current status of the voice call.
See https://developer.telesign.com/docs/voice-api for detailed API documentation. | [
"Retrieves",
"the",
"current",
"status",
"of",
"the",
"voice",
"call",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/voice.py#L30-L37 |
46,560 | TeleSign/python_telesign | telesign/appverify.py | AppVerifyClient.status | def status(self, external_id, **params):
"""
Retrieves the verification result for an App Verify transaction by external_id. To ensure a secure verification
flow you must check the status using TeleSign's servers on your backend. Do not rely on the SDK alone to
indicate a successful veri... | python | def status(self, external_id, **params):
"""
Retrieves the verification result for an App Verify transaction by external_id. To ensure a secure verification
flow you must check the status using TeleSign's servers on your backend. Do not rely on the SDK alone to
indicate a successful veri... | [
"def",
"status",
"(",
"self",
",",
"external_id",
",",
"*",
"*",
"params",
")",
":",
"return",
"self",
".",
"get",
"(",
"APPVERIFY_STATUS_RESOURCE",
".",
"format",
"(",
"external_id",
"=",
"external_id",
")",
",",
"*",
"*",
"params",
")"
] | Retrieves the verification result for an App Verify transaction by external_id. To ensure a secure verification
flow you must check the status using TeleSign's servers on your backend. Do not rely on the SDK alone to
indicate a successful verification.
See https://developer.telesign.com/docs/ap... | [
"Retrieves",
"the",
"verification",
"result",
"for",
"an",
"App",
"Verify",
"transaction",
"by",
"external_id",
".",
"To",
"ensure",
"a",
"secure",
"verification",
"flow",
"you",
"must",
"check",
"the",
"status",
"using",
"TeleSign",
"s",
"servers",
"on",
"you... | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/appverify.py#L17-L28 |
46,561 | danidee10/Staticfy | staticfy/staticfy.py | get_asset_location | def get_asset_location(element, attr):
"""
Get Asset Location.
Remove leading slash e.g '/static/images.jpg' ==> static/images.jpg
Also, if the url is also prefixed with static, it would be removed.
e.g static/image.jpg ==> image.jpg
"""
asset_location = re.match(r'^/?(static)?/?(.*)', ... | python | def get_asset_location(element, attr):
"""
Get Asset Location.
Remove leading slash e.g '/static/images.jpg' ==> static/images.jpg
Also, if the url is also prefixed with static, it would be removed.
e.g static/image.jpg ==> image.jpg
"""
asset_location = re.match(r'^/?(static)?/?(.*)', ... | [
"def",
"get_asset_location",
"(",
"element",
",",
"attr",
")",
":",
"asset_location",
"=",
"re",
".",
"match",
"(",
"r'^/?(static)?/?(.*)'",
",",
"element",
"[",
"attr",
"]",
",",
"re",
".",
"IGNORECASE",
")",
"# replace relative links i.e (../../static)",
"asset_... | Get Asset Location.
Remove leading slash e.g '/static/images.jpg' ==> static/images.jpg
Also, if the url is also prefixed with static, it would be removed.
e.g static/image.jpg ==> image.jpg | [
"Get",
"Asset",
"Location",
"."
] | ebc555b00377394b0f714e4a173d37833fec90cb | https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L27-L41 |
46,562 | danidee10/Staticfy | staticfy/staticfy.py | transform | def transform(matches, framework, namespace, static_endpoint):
"""
The actual transformation occurs here.
flask example: images/staticfy.jpg', ==>
"{{ url_for('static', filename='images/staticfy.jpg') }}"
"""
transformed = []
namespace = namespace + '/' if namespace else ''
for att... | python | def transform(matches, framework, namespace, static_endpoint):
"""
The actual transformation occurs here.
flask example: images/staticfy.jpg', ==>
"{{ url_for('static', filename='images/staticfy.jpg') }}"
"""
transformed = []
namespace = namespace + '/' if namespace else ''
for att... | [
"def",
"transform",
"(",
"matches",
",",
"framework",
",",
"namespace",
",",
"static_endpoint",
")",
":",
"transformed",
"=",
"[",
"]",
"namespace",
"=",
"namespace",
"+",
"'/'",
"if",
"namespace",
"else",
"''",
"for",
"attribute",
",",
"elements",
"in",
"... | The actual transformation occurs here.
flask example: images/staticfy.jpg', ==>
"{{ url_for('static', filename='images/staticfy.jpg') }}" | [
"The",
"actual",
"transformation",
"occurs",
"here",
"."
] | ebc555b00377394b0f714e4a173d37833fec90cb | https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L44-L68 |
46,563 | danidee10/Staticfy | staticfy/staticfy.py | get_elements | def get_elements(html_file, tags):
"""
Extract all the elements we're interested in.
Returns a list of tuples with the attribute as first item
and the list of elements as the second item.
"""
with open(html_file) as f:
document = BeautifulSoup(f, 'html.parser')
def condition(ta... | python | def get_elements(html_file, tags):
"""
Extract all the elements we're interested in.
Returns a list of tuples with the attribute as first item
and the list of elements as the second item.
"""
with open(html_file) as f:
document = BeautifulSoup(f, 'html.parser')
def condition(ta... | [
"def",
"get_elements",
"(",
"html_file",
",",
"tags",
")",
":",
"with",
"open",
"(",
"html_file",
")",
"as",
"f",
":",
"document",
"=",
"BeautifulSoup",
"(",
"f",
",",
"'html.parser'",
")",
"def",
"condition",
"(",
"tag",
",",
"attr",
")",
":",
"# Don'... | Extract all the elements we're interested in.
Returns a list of tuples with the attribute as first item
and the list of elements as the second item. | [
"Extract",
"all",
"the",
"elements",
"we",
"re",
"interested",
"in",
"."
] | ebc555b00377394b0f714e4a173d37833fec90cb | https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L71-L89 |
46,564 | danidee10/Staticfy | staticfy/staticfy.py | replace_lines | def replace_lines(html_file, transformed):
"""Replace lines in the old file with the transformed lines."""
result = []
with codecs.open(html_file, 'r', 'utf-8') as input_file:
for line in input_file:
# replace all single quotes with double quotes
line = re.sub(r'\'', '"', lin... | python | def replace_lines(html_file, transformed):
"""Replace lines in the old file with the transformed lines."""
result = []
with codecs.open(html_file, 'r', 'utf-8') as input_file:
for line in input_file:
# replace all single quotes with double quotes
line = re.sub(r'\'', '"', lin... | [
"def",
"replace_lines",
"(",
"html_file",
",",
"transformed",
")",
":",
"result",
"=",
"[",
"]",
"with",
"codecs",
".",
"open",
"(",
"html_file",
",",
"'r'",
",",
"'utf-8'",
")",
"as",
"input_file",
":",
"for",
"line",
"in",
"input_file",
":",
"# replace... | Replace lines in the old file with the transformed lines. | [
"Replace",
"lines",
"in",
"the",
"old",
"file",
"with",
"the",
"transformed",
"lines",
"."
] | ebc555b00377394b0f714e4a173d37833fec90cb | https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L92-L111 |
46,565 | danidee10/Staticfy | staticfy/staticfy.py | staticfy | def staticfy(html_file, args=argparse.ArgumentParser()):
"""
Staticfy method.
Loop through each line of the file and replaces the old links
"""
# unpack arguments
static_endpoint = args.static_endpoint or 'static'
framework = args.framework or os.getenv('STATICFY_FRAMEWORK', 'flask')
ad... | python | def staticfy(html_file, args=argparse.ArgumentParser()):
"""
Staticfy method.
Loop through each line of the file and replaces the old links
"""
# unpack arguments
static_endpoint = args.static_endpoint or 'static'
framework = args.framework or os.getenv('STATICFY_FRAMEWORK', 'flask')
ad... | [
"def",
"staticfy",
"(",
"html_file",
",",
"args",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
")",
":",
"# unpack arguments",
"static_endpoint",
"=",
"args",
".",
"static_endpoint",
"or",
"'static'",
"framework",
"=",
"args",
".",
"framework",
"or",
"os"... | Staticfy method.
Loop through each line of the file and replaces the old links | [
"Staticfy",
"method",
"."
] | ebc555b00377394b0f714e4a173d37833fec90cb | https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L114-L144 |
46,566 | danidee10/Staticfy | staticfy/staticfy.py | file_ops | def file_ops(staticfied, args):
"""Write to stdout or a file"""
destination = args.o or args.output
if destination:
with open(destination, 'w') as file:
file.write(staticfied)
else:
print(staticfied) | python | def file_ops(staticfied, args):
"""Write to stdout or a file"""
destination = args.o or args.output
if destination:
with open(destination, 'w') as file:
file.write(staticfied)
else:
print(staticfied) | [
"def",
"file_ops",
"(",
"staticfied",
",",
"args",
")",
":",
"destination",
"=",
"args",
".",
"o",
"or",
"args",
".",
"output",
"if",
"destination",
":",
"with",
"open",
"(",
"destination",
",",
"'w'",
")",
"as",
"file",
":",
"file",
".",
"write",
"(... | Write to stdout or a file | [
"Write",
"to",
"stdout",
"or",
"a",
"file"
] | ebc555b00377394b0f714e4a173d37833fec90cb | https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L147-L155 |
46,567 | mbarkhau/tinypng | tinypng/api.py | find_keys | def find_keys(args):
"""Get keys specified in arguments
returns list of keys or None
"""
key = args['--key']
if key:
return [key]
keyfile = args['--apikeys']
if keyfile:
return read_keyfile(keyfile)
envkey = os.environ.get('TINYPNG_API_KEY', None)
if envkey:
... | python | def find_keys(args):
"""Get keys specified in arguments
returns list of keys or None
"""
key = args['--key']
if key:
return [key]
keyfile = args['--apikeys']
if keyfile:
return read_keyfile(keyfile)
envkey = os.environ.get('TINYPNG_API_KEY', None)
if envkey:
... | [
"def",
"find_keys",
"(",
"args",
")",
":",
"key",
"=",
"args",
"[",
"'--key'",
"]",
"if",
"key",
":",
"return",
"[",
"key",
"]",
"keyfile",
"=",
"args",
"[",
"'--apikeys'",
"]",
"if",
"keyfile",
":",
"return",
"read_keyfile",
"(",
"keyfile",
")",
"en... | Get keys specified in arguments
returns list of keys or None | [
"Get",
"keys",
"specified",
"in",
"arguments"
] | 58e33cd5b46b26aab530a184b70856f7e936d79a | https://github.com/mbarkhau/tinypng/blob/58e33cd5b46b26aab530a184b70856f7e936d79a/tinypng/api.py#L24-L50 |
46,568 | mbarkhau/tinypng | tinypng/api.py | get_shrunk_data | def get_shrunk_data(shrink_info):
"""Read shrunk file from tinypng.org api."""
out_url = shrink_info['output']['url']
try:
return requests.get(out_url).content
except HTTPError as err:
if err.code != 404:
raise
exc = ValueError("Unable to read png file \"{0}\"".forma... | python | def get_shrunk_data(shrink_info):
"""Read shrunk file from tinypng.org api."""
out_url = shrink_info['output']['url']
try:
return requests.get(out_url).content
except HTTPError as err:
if err.code != 404:
raise
exc = ValueError("Unable to read png file \"{0}\"".forma... | [
"def",
"get_shrunk_data",
"(",
"shrink_info",
")",
":",
"out_url",
"=",
"shrink_info",
"[",
"'output'",
"]",
"[",
"'url'",
"]",
"try",
":",
"return",
"requests",
".",
"get",
"(",
"out_url",
")",
".",
"content",
"except",
"HTTPError",
"as",
"err",
":",
"i... | Read shrunk file from tinypng.org api. | [
"Read",
"shrunk",
"file",
"from",
"tinypng",
".",
"org",
"api",
"."
] | 58e33cd5b46b26aab530a184b70856f7e936d79a | https://github.com/mbarkhau/tinypng/blob/58e33cd5b46b26aab530a184b70856f7e936d79a/tinypng/api.py#L102-L113 |
46,569 | mbarkhau/tinypng | tinypng/api.py | shrink_file | def shrink_file(in_filepath, api_key=None, out_filepath=None):
"""Shrink png file and write it back to a new file
The default file path replaces ".png" with ".tiny.png".
returns api_info (including info['ouput']['filepath'])
"""
info = get_shrink_file_info(in_filepath, api_key, out_filepath)
wr... | python | def shrink_file(in_filepath, api_key=None, out_filepath=None):
"""Shrink png file and write it back to a new file
The default file path replaces ".png" with ".tiny.png".
returns api_info (including info['ouput']['filepath'])
"""
info = get_shrink_file_info(in_filepath, api_key, out_filepath)
wr... | [
"def",
"shrink_file",
"(",
"in_filepath",
",",
"api_key",
"=",
"None",
",",
"out_filepath",
"=",
"None",
")",
":",
"info",
"=",
"get_shrink_file_info",
"(",
"in_filepath",
",",
"api_key",
",",
"out_filepath",
")",
"write_shrunk_file",
"(",
"info",
")",
"return... | Shrink png file and write it back to a new file
The default file path replaces ".png" with ".tiny.png".
returns api_info (including info['ouput']['filepath']) | [
"Shrink",
"png",
"file",
"and",
"write",
"it",
"back",
"to",
"a",
"new",
"file"
] | 58e33cd5b46b26aab530a184b70856f7e936d79a | https://github.com/mbarkhau/tinypng/blob/58e33cd5b46b26aab530a184b70856f7e936d79a/tinypng/api.py#L144-L152 |
46,570 | TeleSign/python_telesign | telesign/util.py | verify_telesign_callback_signature | def verify_telesign_callback_signature(api_key, signature, json_str):
"""
Verify that a callback was made by TeleSign and was not sent by a malicious client by verifying the signature.
:param api_key: the TeleSign API api_key associated with your account.
:param signature: the TeleSign Authorization he... | python | def verify_telesign_callback_signature(api_key, signature, json_str):
"""
Verify that a callback was made by TeleSign and was not sent by a malicious client by verifying the signature.
:param api_key: the TeleSign API api_key associated with your account.
:param signature: the TeleSign Authorization he... | [
"def",
"verify_telesign_callback_signature",
"(",
"api_key",
",",
"signature",
",",
"json_str",
")",
":",
"your_signature",
"=",
"b64encode",
"(",
"HMAC",
"(",
"b64decode",
"(",
"api_key",
")",
",",
"json_str",
".",
"encode",
"(",
"\"utf-8\"",
")",
",",
"sha25... | Verify that a callback was made by TeleSign and was not sent by a malicious client by verifying the signature.
:param api_key: the TeleSign API api_key associated with your account.
:param signature: the TeleSign Authorization header value supplied in the callback, as a string.
:param json_str: the POST bo... | [
"Verify",
"that",
"a",
"callback",
"was",
"made",
"by",
"TeleSign",
"and",
"was",
"not",
"sent",
"by",
"a",
"malicious",
"client",
"by",
"verifying",
"the",
"signature",
"."
] | f0c2e4373dc8d685e1a7d65444b5e55955c340cb | https://github.com/TeleSign/python_telesign/blob/f0c2e4373dc8d685e1a7d65444b5e55955c340cb/telesign/util.py#L23-L42 |
46,571 | Dani4kor/stockfishpy | stockfishpy/stockfishpy.py | Engine.setposition | def setposition(self, position):
"""
The move format is in long algebraic notation.
Takes list of stirngs = ['e2e4', 'd7d5']
OR
FEN = 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1'
"""
try:
if isinstance(position, list):
... | python | def setposition(self, position):
"""
The move format is in long algebraic notation.
Takes list of stirngs = ['e2e4', 'd7d5']
OR
FEN = 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1'
"""
try:
if isinstance(position, list):
... | [
"def",
"setposition",
"(",
"self",
",",
"position",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"position",
",",
"list",
")",
":",
"self",
".",
"send",
"(",
"'position startpos moves {}'",
".",
"format",
"(",
"self",
".",
"__listtostring",
"(",
"positio... | The move format is in long algebraic notation.
Takes list of stirngs = ['e2e4', 'd7d5']
OR
FEN = 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1' | [
"The",
"move",
"format",
"is",
"in",
"long",
"algebraic",
"notation",
"."
] | af26e8180a7d186ca0cb48d06bac9f2561432f4f | https://github.com/Dani4kor/stockfishpy/blob/af26e8180a7d186ca0cb48d06bac9f2561432f4f/stockfishpy/stockfishpy.py#L107-L156 |
46,572 | jbfavre/python-protobix | protobix/datacontainer.py | DataContainer.add_item | def add_item(self, host, key, value, clock=None, state=0):
"""
Add a single item into DataContainer
:host: hostname to which item will be linked to
:key: item key as defined in Zabbix
:value: item value
:clock: timestemp as integer. If not provided self.clock()) will be ... | python | def add_item(self, host, key, value, clock=None, state=0):
"""
Add a single item into DataContainer
:host: hostname to which item will be linked to
:key: item key as defined in Zabbix
:value: item value
:clock: timestemp as integer. If not provided self.clock()) will be ... | [
"def",
"add_item",
"(",
"self",
",",
"host",
",",
"key",
",",
"value",
",",
"clock",
"=",
"None",
",",
"state",
"=",
"0",
")",
":",
"if",
"clock",
"is",
"None",
":",
"clock",
"=",
"self",
".",
"clock",
"if",
"self",
".",
"_config",
".",
"data_typ... | Add a single item into DataContainer
:host: hostname to which item will be linked to
:key: item key as defined in Zabbix
:value: item value
:clock: timestemp as integer. If not provided self.clock()) will be used | [
"Add",
"a",
"single",
"item",
"into",
"DataContainer"
] | 96b7095a9c2485c9e1bdba098b7d82b93f91acb1 | https://github.com/jbfavre/python-protobix/blob/96b7095a9c2485c9e1bdba098b7d82b93f91acb1/protobix/datacontainer.py#L37-L58 |
46,573 | jbfavre/python-protobix | protobix/datacontainer.py | DataContainer.add | def add(self, data):
"""
Add a list of item into the container
:data: dict of items & value per hostname
"""
for host in data:
for key in data[host]:
if not data[host][key] == []:
self.add_item(host, key, data[host][key]) | python | def add(self, data):
"""
Add a list of item into the container
:data: dict of items & value per hostname
"""
for host in data:
for key in data[host]:
if not data[host][key] == []:
self.add_item(host, key, data[host][key]) | [
"def",
"add",
"(",
"self",
",",
"data",
")",
":",
"for",
"host",
"in",
"data",
":",
"for",
"key",
"in",
"data",
"[",
"host",
"]",
":",
"if",
"not",
"data",
"[",
"host",
"]",
"[",
"key",
"]",
"==",
"[",
"]",
":",
"self",
".",
"add_item",
"(",
... | Add a list of item into the container
:data: dict of items & value per hostname | [
"Add",
"a",
"list",
"of",
"item",
"into",
"the",
"container"
] | 96b7095a9c2485c9e1bdba098b7d82b93f91acb1 | https://github.com/jbfavre/python-protobix/blob/96b7095a9c2485c9e1bdba098b7d82b93f91acb1/protobix/datacontainer.py#L60-L69 |
46,574 | jbfavre/python-protobix | protobix/datacontainer.py | DataContainer._send_common | def _send_common(self, item):
"""
Common part of sending operations
Calls SenderProtocol._send_to_zabbix
Returns result as provided by _handle_response
:item: either a list or a single item depending on debug_level
"""
total = len(item)
processed = failed... | python | def _send_common(self, item):
"""
Common part of sending operations
Calls SenderProtocol._send_to_zabbix
Returns result as provided by _handle_response
:item: either a list or a single item depending on debug_level
"""
total = len(item)
processed = failed... | [
"def",
"_send_common",
"(",
"self",
",",
"item",
")",
":",
"total",
"=",
"len",
"(",
"item",
")",
"processed",
"=",
"failed",
"=",
"time",
"=",
"0",
"if",
"self",
".",
"_config",
".",
"dryrun",
"is",
"True",
":",
"total",
"=",
"len",
"(",
"item",
... | Common part of sending operations
Calls SenderProtocol._send_to_zabbix
Returns result as provided by _handle_response
:item: either a list or a single item depending on debug_level | [
"Common",
"part",
"of",
"sending",
"operations",
"Calls",
"SenderProtocol",
".",
"_send_to_zabbix",
"Returns",
"result",
"as",
"provided",
"by",
"_handle_response"
] | 96b7095a9c2485c9e1bdba098b7d82b93f91acb1 | https://github.com/jbfavre/python-protobix/blob/96b7095a9c2485c9e1bdba098b7d82b93f91acb1/protobix/datacontainer.py#L149-L184 |
46,575 | jbfavre/python-protobix | protobix/datacontainer.py | DataContainer._reset | def _reset(self):
"""
Reset main DataContainer properties
"""
# Reset DataContainer to default values
# So that it can be reused
if self.logger: # pragma: no cover
self.logger.info("Reset DataContainer")
self._items_list = []
self._config.data_... | python | def _reset(self):
"""
Reset main DataContainer properties
"""
# Reset DataContainer to default values
# So that it can be reused
if self.logger: # pragma: no cover
self.logger.info("Reset DataContainer")
self._items_list = []
self._config.data_... | [
"def",
"_reset",
"(",
"self",
")",
":",
"# Reset DataContainer to default values",
"# So that it can be reused",
"if",
"self",
".",
"logger",
":",
"# pragma: no cover",
"self",
".",
"logger",
".",
"info",
"(",
"\"Reset DataContainer\"",
")",
"self",
".",
"_items_list"... | Reset main DataContainer properties | [
"Reset",
"main",
"DataContainer",
"properties"
] | 96b7095a9c2485c9e1bdba098b7d82b93f91acb1 | https://github.com/jbfavre/python-protobix/blob/96b7095a9c2485c9e1bdba098b7d82b93f91acb1/protobix/datacontainer.py#L186-L195 |
46,576 | jbfavre/python-protobix | protobix/datacontainer.py | DataContainer.logger | def logger(self, value):
"""
Set logger instance for the class
"""
if isinstance(value, logging.Logger):
self._logger = value
else:
if self._logger: # pragma: no cover
self._logger.error("logger requires a logging instance")
rai... | python | def logger(self, value):
"""
Set logger instance for the class
"""
if isinstance(value, logging.Logger):
self._logger = value
else:
if self._logger: # pragma: no cover
self._logger.error("logger requires a logging instance")
rai... | [
"def",
"logger",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"logging",
".",
"Logger",
")",
":",
"self",
".",
"_logger",
"=",
"value",
"else",
":",
"if",
"self",
".",
"_logger",
":",
"# pragma: no cover",
"self",
".",
... | Set logger instance for the class | [
"Set",
"logger",
"instance",
"for",
"the",
"class"
] | 96b7095a9c2485c9e1bdba098b7d82b93f91acb1 | https://github.com/jbfavre/python-protobix/blob/96b7095a9c2485c9e1bdba098b7d82b93f91acb1/protobix/datacontainer.py#L205-L214 |
46,577 | GearPlug/jira-python | jira/client.py | Client.get_issue | def get_issue(self, issue_id, params=None):
"""Returns a full representation of the issue for the given issue key.
The issue JSON consists of the issue key and a collection of fields. Additional information like links to
workflow transition sub-resources, or HTML rendered values of the fields s... | python | def get_issue(self, issue_id, params=None):
"""Returns a full representation of the issue for the given issue key.
The issue JSON consists of the issue key and a collection of fields. Additional information like links to
workflow transition sub-resources, or HTML rendered values of the fields s... | [
"def",
"get_issue",
"(",
"self",
",",
"issue_id",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_get",
"(",
"self",
".",
"API_URL",
"+",
"'issue/{}'",
".",
"format",
"(",
"issue_id",
")",
",",
"params",
"=",
"params",
")"
] | Returns a full representation of the issue for the given issue key.
The issue JSON consists of the issue key and a collection of fields. Additional information like links to
workflow transition sub-resources, or HTML rendered values of the fields supporting HTML rendering can be
retrieved with ... | [
"Returns",
"a",
"full",
"representation",
"of",
"the",
"issue",
"for",
"the",
"given",
"issue",
"key",
"."
] | 2af5a3defc44a80d9df49dec6808e6b63bde6f69 | https://github.com/GearPlug/jira-python/blob/2af5a3defc44a80d9df49dec6808e6b63bde6f69/jira/client.py#L57-L80 |
46,578 | GearPlug/jira-python | jira/client.py | Client.create_issue | def create_issue(self, data, params=None):
"""Creates an issue or a sub-task from a JSON representation.
You can provide two parameters in request's body: update or fields. The fields, that can be set on an issue
create operation, can be determined using the /rest/api/2/issue/createmeta resourc... | python | def create_issue(self, data, params=None):
"""Creates an issue or a sub-task from a JSON representation.
You can provide two parameters in request's body: update or fields. The fields, that can be set on an issue
create operation, can be determined using the /rest/api/2/issue/createmeta resourc... | [
"def",
"create_issue",
"(",
"self",
",",
"data",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_post",
"(",
"self",
".",
"API_URL",
"+",
"'issue'",
",",
"data",
"=",
"data",
",",
"params",
"=",
"params",
")"
] | Creates an issue or a sub-task from a JSON representation.
You can provide two parameters in request's body: update or fields. The fields, that can be set on an issue
create operation, can be determined using the /rest/api/2/issue/createmeta resource. If a particular field is
not configured to ... | [
"Creates",
"an",
"issue",
"or",
"a",
"sub",
"-",
"task",
"from",
"a",
"JSON",
"representation",
"."
] | 2af5a3defc44a80d9df49dec6808e6b63bde6f69 | https://github.com/GearPlug/jira-python/blob/2af5a3defc44a80d9df49dec6808e6b63bde6f69/jira/client.py#L82-L102 |
46,579 | GearPlug/jira-python | jira/client.py | Client.delete_issue | def delete_issue(self, issue_id, params=None):
"""Deletes an individual issue.
If the issue has sub-tasks you must set the deleteSubtasks=true parameter to delete the issue. You cannot delete
an issue without deleting its sub-tasks.
Args:
issue_id:
params:
... | python | def delete_issue(self, issue_id, params=None):
"""Deletes an individual issue.
If the issue has sub-tasks you must set the deleteSubtasks=true parameter to delete the issue. You cannot delete
an issue without deleting its sub-tasks.
Args:
issue_id:
params:
... | [
"def",
"delete_issue",
"(",
"self",
",",
"issue_id",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"_delete",
"(",
"self",
".",
"API_URL",
"+",
"'issue/{}'",
".",
"format",
"(",
"issue_id",
")",
",",
"params",
"=",
"params",
")"
] | Deletes an individual issue.
If the issue has sub-tasks you must set the deleteSubtasks=true parameter to delete the issue. You cannot delete
an issue without deleting its sub-tasks.
Args:
issue_id:
params:
Returns: | [
"Deletes",
"an",
"individual",
"issue",
"."
] | 2af5a3defc44a80d9df49dec6808e6b63bde6f69 | https://github.com/GearPlug/jira-python/blob/2af5a3defc44a80d9df49dec6808e6b63bde6f69/jira/client.py#L104-L117 |
46,580 | nephila/python-taiga | taiga/models/base.py | ListResource.list | def list(self, pagination=True, page_size=None, page=None, **queryparams):
"""
Retrieves a list of objects.
By default uses local cache and remote pagination
If pagination is used and no page is requested (the default), all the
remote objects are retrieved and appended in a sin... | python | def list(self, pagination=True, page_size=None, page=None, **queryparams):
"""
Retrieves a list of objects.
By default uses local cache and remote pagination
If pagination is used and no page is requested (the default), all the
remote objects are retrieved and appended in a sin... | [
"def",
"list",
"(",
"self",
",",
"pagination",
"=",
"True",
",",
"page_size",
"=",
"None",
",",
"page",
"=",
"None",
",",
"*",
"*",
"queryparams",
")",
":",
"if",
"page_size",
"and",
"pagination",
":",
"try",
":",
"page_size",
"=",
"int",
"(",
"page_... | Retrieves a list of objects.
By default uses local cache and remote pagination
If pagination is used and no page is requested (the default), all the
remote objects are retrieved and appended in a single list.
If pagination is disabled, all the objects are fetched from the
endp... | [
"Retrieves",
"a",
"list",
"of",
"objects",
"."
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/base.py#L37-L86 |
46,581 | nephila/python-taiga | taiga/models/base.py | InstanceResource.parse | def parse(cls, requester, entry):
"""
Turns a JSON object into a model instance.
"""
if not type(entry) is dict:
return entry
for key_to_parse, cls_to_parse in six.iteritems(cls.parser):
if key_to_parse in entry:
entry[key_to_parse] = cls_t... | python | def parse(cls, requester, entry):
"""
Turns a JSON object into a model instance.
"""
if not type(entry) is dict:
return entry
for key_to_parse, cls_to_parse in six.iteritems(cls.parser):
if key_to_parse in entry:
entry[key_to_parse] = cls_t... | [
"def",
"parse",
"(",
"cls",
",",
"requester",
",",
"entry",
")",
":",
"if",
"not",
"type",
"(",
"entry",
")",
"is",
"dict",
":",
"return",
"entry",
"for",
"key_to_parse",
",",
"cls_to_parse",
"in",
"six",
".",
"iteritems",
"(",
"cls",
".",
"parser",
... | Turns a JSON object into a model instance. | [
"Turns",
"a",
"JSON",
"object",
"into",
"a",
"model",
"instance",
"."
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/base.py#L221-L232 |
46,582 | nephila/python-taiga | taiga/models/models.py | CustomAttributeResource.set_attribute | def set_attribute(self, id, value, version=1):
"""
Set attribute to a specific value
:param id: id of the attribute
:param value: value of the attribute
:param version: version of the attribute (default = 1)
"""
attributes = self._get_attributes(cache=True)
... | python | def set_attribute(self, id, value, version=1):
"""
Set attribute to a specific value
:param id: id of the attribute
:param value: value of the attribute
:param version: version of the attribute (default = 1)
"""
attributes = self._get_attributes(cache=True)
... | [
"def",
"set_attribute",
"(",
"self",
",",
"id",
",",
"value",
",",
"version",
"=",
"1",
")",
":",
"attributes",
"=",
"self",
".",
"_get_attributes",
"(",
"cache",
"=",
"True",
")",
"formatted_id",
"=",
"'{0}'",
".",
"format",
"(",
"id",
")",
"attribute... | Set attribute to a specific value
:param id: id of the attribute
:param value: value of the attribute
:param version: version of the attribute (default = 1) | [
"Set",
"attribute",
"to",
"a",
"specific",
"value"
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L30-L54 |
46,583 | nephila/python-taiga | taiga/models/models.py | Project.issues_stats | def issues_stats(self):
"""
Get stats for issues of the project
"""
response = self.requester.get(
'/{endpoint}/{id}/issues_stats',
endpoint=self.endpoint, id=self.id
)
return response.json() | python | def issues_stats(self):
"""
Get stats for issues of the project
"""
response = self.requester.get(
'/{endpoint}/{id}/issues_stats',
endpoint=self.endpoint, id=self.id
)
return response.json() | [
"def",
"issues_stats",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"requester",
".",
"get",
"(",
"'/{endpoint}/{id}/issues_stats'",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"id",
"=",
"self",
".",
"id",
")",
"return",
"response",
".",
... | Get stats for issues of the project | [
"Get",
"stats",
"for",
"issues",
"of",
"the",
"project"
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1062-L1070 |
46,584 | nephila/python-taiga | taiga/models/models.py | Project.like | def like(self):
"""
Like the project
"""
self.requester.post(
'/{endpoint}/{id}/like',
endpoint=self.endpoint, id=self.id
)
return self | python | def like(self):
"""
Like the project
"""
self.requester.post(
'/{endpoint}/{id}/like',
endpoint=self.endpoint, id=self.id
)
return self | [
"def",
"like",
"(",
"self",
")",
":",
"self",
".",
"requester",
".",
"post",
"(",
"'/{endpoint}/{id}/like'",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"id",
"=",
"self",
".",
"id",
")",
"return",
"self"
] | Like the project | [
"Like",
"the",
"project"
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1072-L1080 |
46,585 | nephila/python-taiga | taiga/models/models.py | Project.unlike | def unlike(self):
"""
Unlike the project
"""
self.requester.post(
'/{endpoint}/{id}/unlike',
endpoint=self.endpoint, id=self.id
)
return self | python | def unlike(self):
"""
Unlike the project
"""
self.requester.post(
'/{endpoint}/{id}/unlike',
endpoint=self.endpoint, id=self.id
)
return self | [
"def",
"unlike",
"(",
"self",
")",
":",
"self",
".",
"requester",
".",
"post",
"(",
"'/{endpoint}/{id}/unlike'",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"id",
"=",
"self",
".",
"id",
")",
"return",
"self"
] | Unlike the project | [
"Unlike",
"the",
"project"
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1082-L1090 |
46,586 | nephila/python-taiga | taiga/models/models.py | Project.star | def star(self):
"""
Stars the project
.. deprecated:: 0.8.5
Update Taiga and use like instead
"""
warnings.warn(
"Deprecated! Update Taiga and use .like() instead",
DeprecationWarning
)
self.requester.post(
'/{endp... | python | def star(self):
"""
Stars the project
.. deprecated:: 0.8.5
Update Taiga and use like instead
"""
warnings.warn(
"Deprecated! Update Taiga and use .like() instead",
DeprecationWarning
)
self.requester.post(
'/{endp... | [
"def",
"star",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Deprecated! Update Taiga and use .like() instead\"",
",",
"DeprecationWarning",
")",
"self",
".",
"requester",
".",
"post",
"(",
"'/{endpoint}/{id}/star'",
",",
"endpoint",
"=",
"self",
".",
"e... | Stars the project
.. deprecated:: 0.8.5
Update Taiga and use like instead | [
"Stars",
"the",
"project"
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1092-L1108 |
46,587 | nephila/python-taiga | taiga/models/models.py | HistoryEntity.get | def get(self, resource_id):
"""
Get a history element
:param resource_id: ...
"""
response = self.requester.get(
'/{endpoint}/{entity}/{id}',
endpoint=self.endpoint, entity=self.entity, id=resource_id,
paginate=False
)
return r... | python | def get(self, resource_id):
"""
Get a history element
:param resource_id: ...
"""
response = self.requester.get(
'/{endpoint}/{entity}/{id}',
endpoint=self.endpoint, entity=self.entity, id=resource_id,
paginate=False
)
return r... | [
"def",
"get",
"(",
"self",
",",
"resource_id",
")",
":",
"response",
"=",
"self",
".",
"requester",
".",
"get",
"(",
"'/{endpoint}/{entity}/{id}'",
",",
"endpoint",
"=",
"self",
".",
"endpoint",
",",
"entity",
"=",
"self",
".",
"entity",
",",
"id",
"=",
... | Get a history element
:param resource_id: ... | [
"Get",
"a",
"history",
"element"
] | 5b471d6b8b59e5d410162a6f1c2f0d4188445a56 | https://github.com/nephila/python-taiga/blob/5b471d6b8b59e5d410162a6f1c2f0d4188445a56/taiga/models/models.py#L1695-L1706 |
46,588 | antidot/Pyckson | src/pyckson/parser.py | parse | def parse(cls, value):
"""Takes a class and a dict and try to build an instance of the class
:param cls: The class to parse
:param value: either a dict, a list or a scalar value
"""
if is_list_annotation(cls):
if not isinstance(value, list):
raise TypeError('Could not parse {} b... | python | def parse(cls, value):
"""Takes a class and a dict and try to build an instance of the class
:param cls: The class to parse
:param value: either a dict, a list or a scalar value
"""
if is_list_annotation(cls):
if not isinstance(value, list):
raise TypeError('Could not parse {} b... | [
"def",
"parse",
"(",
"cls",
",",
"value",
")",
":",
"if",
"is_list_annotation",
"(",
"cls",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"raise",
"TypeError",
"(",
"'Could not parse {} because value is not a list'",
".",
"format",
... | Takes a class and a dict and try to build an instance of the class
:param cls: The class to parse
:param value: either a dict, a list or a scalar value | [
"Takes",
"a",
"class",
"and",
"a",
"dict",
"and",
"try",
"to",
"build",
"an",
"instance",
"of",
"the",
"class"
] | 44e625164a53081eb46b8d4bc38f947a575de505 | https://github.com/antidot/Pyckson/blob/44e625164a53081eb46b8d4bc38f947a575de505/src/pyckson/parser.py#L6-L17 |
46,589 | lwgray/pyEntrezId | PyEntrezId/Conversion.py | Conversion.convert_ensembl_to_entrez | def convert_ensembl_to_entrez(self, ensembl):
"""Convert Ensembl Id to Entrez Gene Id"""
if 'ENST' in ensembl:
pass
else:
raise (IndexError)
# Submit resquest to NCBI eutils/Gene database
server = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?... | python | def convert_ensembl_to_entrez(self, ensembl):
"""Convert Ensembl Id to Entrez Gene Id"""
if 'ENST' in ensembl:
pass
else:
raise (IndexError)
# Submit resquest to NCBI eutils/Gene database
server = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?... | [
"def",
"convert_ensembl_to_entrez",
"(",
"self",
",",
"ensembl",
")",
":",
"if",
"'ENST'",
"in",
"ensembl",
":",
"pass",
"else",
":",
"raise",
"(",
"IndexError",
")",
"# Submit resquest to NCBI eutils/Gene database",
"server",
"=",
"\"http://eutils.ncbi.nlm.nih.gov/entr... | Convert Ensembl Id to Entrez Gene Id | [
"Convert",
"Ensembl",
"Id",
"to",
"Entrez",
"Gene",
"Id"
] | 28286cf21b876dd4894bf21a222dfd1022441b75 | https://github.com/lwgray/pyEntrezId/blob/28286cf21b876dd4894bf21a222dfd1022441b75/PyEntrezId/Conversion.py#L27-L47 |
46,590 | lwgray/pyEntrezId | PyEntrezId/Conversion.py | Conversion.convert_entrez_to_uniprot | def convert_entrez_to_uniprot(self, entrez):
"""Convert Entrez Id to Uniprot Id"""
server = "http://www.uniprot.org/uniprot/?query=%22GENEID+{0}%22&format=xml".format(entrez)
r = requests.get(server, headers={"Content-Type": "text/xml"})
if not r.ok:
r.raise_for_status()
... | python | def convert_entrez_to_uniprot(self, entrez):
"""Convert Entrez Id to Uniprot Id"""
server = "http://www.uniprot.org/uniprot/?query=%22GENEID+{0}%22&format=xml".format(entrez)
r = requests.get(server, headers={"Content-Type": "text/xml"})
if not r.ok:
r.raise_for_status()
... | [
"def",
"convert_entrez_to_uniprot",
"(",
"self",
",",
"entrez",
")",
":",
"server",
"=",
"\"http://www.uniprot.org/uniprot/?query=%22GENEID+{0}%22&format=xml\"",
".",
"format",
"(",
"entrez",
")",
"r",
"=",
"requests",
".",
"get",
"(",
"server",
",",
"headers",
"=",... | Convert Entrez Id to Uniprot Id | [
"Convert",
"Entrez",
"Id",
"to",
"Uniprot",
"Id"
] | 28286cf21b876dd4894bf21a222dfd1022441b75 | https://github.com/lwgray/pyEntrezId/blob/28286cf21b876dd4894bf21a222dfd1022441b75/PyEntrezId/Conversion.py#L66-L80 |
46,591 | lwgray/pyEntrezId | PyEntrezId/Conversion.py | Conversion.convert_uniprot_to_entrez | def convert_uniprot_to_entrez(self, uniprot):
"""Convert Uniprot Id to Entrez Id"""
# Submit request to NCBI eutils/Gene Database
server = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?" + self.options + "&db=gene&term={0}".format(
uniprot)
r = requests.get(serve... | python | def convert_uniprot_to_entrez(self, uniprot):
"""Convert Uniprot Id to Entrez Id"""
# Submit request to NCBI eutils/Gene Database
server = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?" + self.options + "&db=gene&term={0}".format(
uniprot)
r = requests.get(serve... | [
"def",
"convert_uniprot_to_entrez",
"(",
"self",
",",
"uniprot",
")",
":",
"# Submit request to NCBI eutils/Gene Database",
"server",
"=",
"\"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?\"",
"+",
"self",
".",
"options",
"+",
"\"&db=gene&term={0}\"",
".",
"format",... | Convert Uniprot Id to Entrez Id | [
"Convert",
"Uniprot",
"Id",
"to",
"Entrez",
"Id"
] | 28286cf21b876dd4894bf21a222dfd1022441b75 | https://github.com/lwgray/pyEntrezId/blob/28286cf21b876dd4894bf21a222dfd1022441b75/PyEntrezId/Conversion.py#L82-L105 |
46,592 | lwgray/pyEntrezId | PyEntrezId/Conversion.py | Conversion.convert_accession_to_taxid | def convert_accession_to_taxid(self, accessionid):
"""Convert Accession Id to Tax Id """
# Submit request to NCBI eutils/Taxonomy Database
server = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?" + self.options + "&db=nuccore&id={0}&retmode=xml".format(
accessionid)
... | python | def convert_accession_to_taxid(self, accessionid):
"""Convert Accession Id to Tax Id """
# Submit request to NCBI eutils/Taxonomy Database
server = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?" + self.options + "&db=nuccore&id={0}&retmode=xml".format(
accessionid)
... | [
"def",
"convert_accession_to_taxid",
"(",
"self",
",",
"accessionid",
")",
":",
"# Submit request to NCBI eutils/Taxonomy Database",
"server",
"=",
"\"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?\"",
"+",
"self",
".",
"options",
"+",
"\"&db=nuccore&id={0}&retmode=xml\"... | Convert Accession Id to Tax Id | [
"Convert",
"Accession",
"Id",
"to",
"Tax",
"Id"
] | 28286cf21b876dd4894bf21a222dfd1022441b75 | https://github.com/lwgray/pyEntrezId/blob/28286cf21b876dd4894bf21a222dfd1022441b75/PyEntrezId/Conversion.py#L107-L133 |
46,593 | lwgray/pyEntrezId | PyEntrezId/Conversion.py | Conversion.convert_symbol_to_entrezid | def convert_symbol_to_entrezid(self, symbol):
"""Convert Symbol to Entrez Gene Id"""
entrezdict = {}
server = "http://rest.genenames.org/fetch/symbol/{0}".format(symbol)
r = requests.get(server, headers={"Content-Type": "application/json"})
if not r.ok:
r.raise_for_st... | python | def convert_symbol_to_entrezid(self, symbol):
"""Convert Symbol to Entrez Gene Id"""
entrezdict = {}
server = "http://rest.genenames.org/fetch/symbol/{0}".format(symbol)
r = requests.get(server, headers={"Content-Type": "application/json"})
if not r.ok:
r.raise_for_st... | [
"def",
"convert_symbol_to_entrezid",
"(",
"self",
",",
"symbol",
")",
":",
"entrezdict",
"=",
"{",
"}",
"server",
"=",
"\"http://rest.genenames.org/fetch/symbol/{0}\"",
".",
"format",
"(",
"symbol",
")",
"r",
"=",
"requests",
".",
"get",
"(",
"server",
",",
"h... | Convert Symbol to Entrez Gene Id | [
"Convert",
"Symbol",
"to",
"Entrez",
"Gene",
"Id"
] | 28286cf21b876dd4894bf21a222dfd1022441b75 | https://github.com/lwgray/pyEntrezId/blob/28286cf21b876dd4894bf21a222dfd1022441b75/PyEntrezId/Conversion.py#L135-L150 |
46,594 | beaugunderson/django-gulp | django_gulp/management/commands/runserver.py | log_local_message | def log_local_message(message_format, *args):
"""
Log a request so that it matches our local log format.
"""
prefix = '{} {}'.format(color('INFO', fg=248), color('request', fg=5))
message = message_format % args
sys.stderr.write('{} {}\n'.format(prefix, message)) | python | def log_local_message(message_format, *args):
"""
Log a request so that it matches our local log format.
"""
prefix = '{} {}'.format(color('INFO', fg=248), color('request', fg=5))
message = message_format % args
sys.stderr.write('{} {}\n'.format(prefix, message)) | [
"def",
"log_local_message",
"(",
"message_format",
",",
"*",
"args",
")",
":",
"prefix",
"=",
"'{} {}'",
".",
"format",
"(",
"color",
"(",
"'INFO'",
",",
"fg",
"=",
"248",
")",
",",
"color",
"(",
"'request'",
",",
"fg",
"=",
"5",
")",
")",
"message",... | Log a request so that it matches our local log format. | [
"Log",
"a",
"request",
"so",
"that",
"it",
"matches",
"our",
"local",
"log",
"format",
"."
] | 227b121136941b7c32171be3262cc0dcc4a68e6f | https://github.com/beaugunderson/django-gulp/blob/227b121136941b7c32171be3262cc0dcc4a68e6f/django_gulp/management/commands/runserver.py#L13-L20 |
46,595 | antidot/Pyckson | src/pyckson/serializer.py | serialize | def serialize(obj):
"""Takes a object and produces a dict-like representation
:param obj: the object to serialize
"""
if isinstance(obj, list):
return [serialize(o) for o in obj]
return GenericSerializer(ModelProviderImpl()).serialize(obj) | python | def serialize(obj):
"""Takes a object and produces a dict-like representation
:param obj: the object to serialize
"""
if isinstance(obj, list):
return [serialize(o) for o in obj]
return GenericSerializer(ModelProviderImpl()).serialize(obj) | [
"def",
"serialize",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"serialize",
"(",
"o",
")",
"for",
"o",
"in",
"obj",
"]",
"return",
"GenericSerializer",
"(",
"ModelProviderImpl",
"(",
")",
")",
".",
"se... | Takes a object and produces a dict-like representation
:param obj: the object to serialize | [
"Takes",
"a",
"object",
"and",
"produces",
"a",
"dict",
"-",
"like",
"representation"
] | 44e625164a53081eb46b8d4bc38f947a575de505 | https://github.com/antidot/Pyckson/blob/44e625164a53081eb46b8d4bc38f947a575de505/src/pyckson/serializer.py#L5-L12 |
46,596 | jbasko/autoboto | botogen/indentist/blocks.py | CodeBlock.of | def of(self, *indented_blocks) -> "CodeBlock":
"""
By default, marks the block as expecting an indented "body" blocks of which are then supplied
as arguments to this method.
Unless the block specifies a "closed_by", if no body blocks are supplied or they are all Nones,
this will... | python | def of(self, *indented_blocks) -> "CodeBlock":
"""
By default, marks the block as expecting an indented "body" blocks of which are then supplied
as arguments to this method.
Unless the block specifies a "closed_by", if no body blocks are supplied or they are all Nones,
this will... | [
"def",
"of",
"(",
"self",
",",
"*",
"indented_blocks",
")",
"->",
"\"CodeBlock\"",
":",
"if",
"self",
".",
"closed_by",
"is",
"None",
":",
"self",
".",
"expects_body_or_pass",
"=",
"True",
"for",
"block",
"in",
"indented_blocks",
":",
"if",
"block",
"is",
... | By default, marks the block as expecting an indented "body" blocks of which are then supplied
as arguments to this method.
Unless the block specifies a "closed_by", if no body blocks are supplied or they are all Nones,
this will generate a "pass" statement as the body. If there is a "closed_by"... | [
"By",
"default",
"marks",
"the",
"block",
"as",
"expecting",
"an",
"indented",
"body",
"blocks",
"of",
"which",
"are",
"then",
"supplied",
"as",
"arguments",
"to",
"this",
"method",
"."
] | 0329afd4730d3d78bd021116857b10e6956dffb1 | https://github.com/jbasko/autoboto/blob/0329afd4730d3d78bd021116857b10e6956dffb1/botogen/indentist/blocks.py#L129-L156 |
46,597 | jbasko/autoboto | botogen/indentist/blocks.py | CodeBlock.add | def add(self, *blocks, indentation=0) -> "CodeBlock":
"""
Adds sub-blocks at the specified indentation level, which defaults to 0.
Nones are skipped.
Returns the parent block itself, useful for chaining.
"""
for block in blocks:
if block is not None:
... | python | def add(self, *blocks, indentation=0) -> "CodeBlock":
"""
Adds sub-blocks at the specified indentation level, which defaults to 0.
Nones are skipped.
Returns the parent block itself, useful for chaining.
"""
for block in blocks:
if block is not None:
... | [
"def",
"add",
"(",
"self",
",",
"*",
"blocks",
",",
"indentation",
"=",
"0",
")",
"->",
"\"CodeBlock\"",
":",
"for",
"block",
"in",
"blocks",
":",
"if",
"block",
"is",
"not",
"None",
":",
"self",
".",
"_blocks",
".",
"append",
"(",
"(",
"indentation"... | Adds sub-blocks at the specified indentation level, which defaults to 0.
Nones are skipped.
Returns the parent block itself, useful for chaining. | [
"Adds",
"sub",
"-",
"blocks",
"at",
"the",
"specified",
"indentation",
"level",
"which",
"defaults",
"to",
"0",
"."
] | 0329afd4730d3d78bd021116857b10e6956dffb1 | https://github.com/jbasko/autoboto/blob/0329afd4730d3d78bd021116857b10e6956dffb1/botogen/indentist/blocks.py#L158-L170 |
46,598 | jbasko/autoboto | botogen/indentist/blocks.py | CodeBlock.to_code | def to_code(self, context: Context =None):
"""
Generate the code and return it as a string.
"""
# Do not override this method!
context = context or Context()
for imp in self.imports:
if imp not in context.imports:
context.imports.append(imp)
... | python | def to_code(self, context: Context =None):
"""
Generate the code and return it as a string.
"""
# Do not override this method!
context = context or Context()
for imp in self.imports:
if imp not in context.imports:
context.imports.append(imp)
... | [
"def",
"to_code",
"(",
"self",
",",
"context",
":",
"Context",
"=",
"None",
")",
":",
"# Do not override this method!",
"context",
"=",
"context",
"or",
"Context",
"(",
")",
"for",
"imp",
"in",
"self",
".",
"imports",
":",
"if",
"imp",
"not",
"in",
"cont... | Generate the code and return it as a string. | [
"Generate",
"the",
"code",
"and",
"return",
"it",
"as",
"a",
"string",
"."
] | 0329afd4730d3d78bd021116857b10e6956dffb1 | https://github.com/jbasko/autoboto/blob/0329afd4730d3d78bd021116857b10e6956dffb1/botogen/indentist/blocks.py#L239-L262 |
46,599 | jbasko/autoboto | botogen/indentist/blocks.py | CodeBlock.exec | def exec(self, globals=None, locals=None):
"""
Execute simple code blocks.
Do not attempt this on modules or other blocks where you have
imports as they won't work.
Instead write the code to a file and use runpy.run_path()
"""
if locals is None:
local... | python | def exec(self, globals=None, locals=None):
"""
Execute simple code blocks.
Do not attempt this on modules or other blocks where you have
imports as they won't work.
Instead write the code to a file and use runpy.run_path()
"""
if locals is None:
local... | [
"def",
"exec",
"(",
"self",
",",
"globals",
"=",
"None",
",",
"locals",
"=",
"None",
")",
":",
"if",
"locals",
"is",
"None",
":",
"locals",
"=",
"{",
"}",
"builtins",
".",
"exec",
"(",
"self",
".",
"to_code",
"(",
")",
",",
"globals",
",",
"local... | Execute simple code blocks.
Do not attempt this on modules or other blocks where you have
imports as they won't work.
Instead write the code to a file and use runpy.run_path() | [
"Execute",
"simple",
"code",
"blocks",
"."
] | 0329afd4730d3d78bd021116857b10e6956dffb1 | https://github.com/jbasko/autoboto/blob/0329afd4730d3d78bd021116857b10e6956dffb1/botogen/indentist/blocks.py#L264-L275 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.