partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | hr_diagram_figure | Given a cluster create a Bokeh plot figure creating an
H-R diagram. | astropixie-widgets/astropixie_widgets/visual.py | def hr_diagram_figure(cluster):
"""
Given a cluster create a Bokeh plot figure creating an
H-R diagram.
"""
temps, lums = round_teff_luminosity(cluster)
x, y = temps, lums
colors, color_mapper = hr_diagram_color_helper(temps)
x_range = [max(x) + max(x) * 0.05, min(x) - min(x) * 0.05]
... | def hr_diagram_figure(cluster):
"""
Given a cluster create a Bokeh plot figure creating an
H-R diagram.
"""
temps, lums = round_teff_luminosity(cluster)
x, y = temps, lums
colors, color_mapper = hr_diagram_color_helper(temps)
x_range = [max(x) + max(x) * 0.05, min(x) - min(x) * 0.05]
... | [
"Given",
"a",
"cluster",
"create",
"a",
"Bokeh",
"plot",
"figure",
"creating",
"an",
"H",
"-",
"R",
"diagram",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L198-L221 | [
"def",
"hr_diagram_figure",
"(",
"cluster",
")",
":",
"temps",
",",
"lums",
"=",
"round_teff_luminosity",
"(",
"cluster",
")",
"x",
",",
"y",
"=",
"temps",
",",
"lums",
"colors",
",",
"color_mapper",
"=",
"hr_diagram_color_helper",
"(",
"temps",
")",
"x_rang... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | calculate_diagram_ranges | Given a numpy array calculate what the ranges of the H-R
diagram should be. | astropixie-widgets/astropixie_widgets/visual.py | def calculate_diagram_ranges(data):
"""
Given a numpy array calculate what the ranges of the H-R
diagram should be.
"""
data = round_arr_teff_luminosity(data)
temps = data['temp']
x_range = [1.05 * np.amax(temps), .95 * np.amin(temps)]
lums = data['lum']
y_range = [.50 * np.amin(lums... | def calculate_diagram_ranges(data):
"""
Given a numpy array calculate what the ranges of the H-R
diagram should be.
"""
data = round_arr_teff_luminosity(data)
temps = data['temp']
x_range = [1.05 * np.amax(temps), .95 * np.amin(temps)]
lums = data['lum']
y_range = [.50 * np.amin(lums... | [
"Given",
"a",
"numpy",
"array",
"calculate",
"what",
"the",
"ranges",
"of",
"the",
"H",
"-",
"R",
"diagram",
"should",
"be",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L224-L234 | [
"def",
"calculate_diagram_ranges",
"(",
"data",
")",
":",
"data",
"=",
"round_arr_teff_luminosity",
"(",
"data",
")",
"temps",
"=",
"data",
"[",
"'temp'",
"]",
"x_range",
"=",
"[",
"1.05",
"*",
"np",
".",
"amax",
"(",
"temps",
")",
",",
".95",
"*",
"np... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | hr_diagram_from_data | Given a numpy array create a Bokeh plot figure creating an
H-R diagram. | astropixie-widgets/astropixie_widgets/visual.py | def hr_diagram_from_data(data, x_range, y_range):
"""
Given a numpy array create a Bokeh plot figure creating an
H-R diagram.
"""
_, color_mapper = hr_diagram_color_helper([])
data_dict = {
'x': list(data['temperature']),
'y': list(data['luminosity']),
'color': list(data[... | def hr_diagram_from_data(data, x_range, y_range):
"""
Given a numpy array create a Bokeh plot figure creating an
H-R diagram.
"""
_, color_mapper = hr_diagram_color_helper([])
data_dict = {
'x': list(data['temperature']),
'y': list(data['luminosity']),
'color': list(data[... | [
"Given",
"a",
"numpy",
"array",
"create",
"a",
"Bokeh",
"plot",
"figure",
"creating",
"an",
"H",
"-",
"R",
"diagram",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L237-L254 | [
"def",
"hr_diagram_from_data",
"(",
"data",
",",
"x_range",
",",
"y_range",
")",
":",
"_",
",",
"color_mapper",
"=",
"hr_diagram_color_helper",
"(",
"[",
"]",
")",
"data_dict",
"=",
"{",
"'x'",
":",
"list",
"(",
"data",
"[",
"'temperature'",
"]",
")",
",... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | cluster_text_input | Create an :class:`~bokeh.models.widgets.TextInput` using
the cluster.name as the default value and title.
If no title is provided use, 'Type in the name of your cluster
and press Enter/Return:'. | astropixie-widgets/astropixie_widgets/visual.py | def cluster_text_input(cluster, title=None):
"""
Create an :class:`~bokeh.models.widgets.TextInput` using
the cluster.name as the default value and title.
If no title is provided use, 'Type in the name of your cluster
and press Enter/Return:'.
"""
if not title:
title = 'Type in the ... | def cluster_text_input(cluster, title=None):
"""
Create an :class:`~bokeh.models.widgets.TextInput` using
the cluster.name as the default value and title.
If no title is provided use, 'Type in the name of your cluster
and press Enter/Return:'.
"""
if not title:
title = 'Type in the ... | [
"Create",
"an",
":",
"class",
":",
"~bokeh",
".",
"models",
".",
"widgets",
".",
"TextInput",
"using",
"the",
"cluster",
".",
"name",
"as",
"the",
"default",
"value",
"and",
"title",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L257-L267 | [
"def",
"cluster_text_input",
"(",
"cluster",
",",
"title",
"=",
"None",
")",
":",
"if",
"not",
"title",
":",
"title",
"=",
"'Type in the name of your cluster and press Enter/Return:'",
"return",
"TextInput",
"(",
"value",
"=",
"cluster",
".",
"name",
",",
"title",... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | hr_diagram_selection | Given a cluster create two Bokeh plot based H-R diagrams.
The Selection in the left H-R diagram will show up on the
right one. | astropixie-widgets/astropixie_widgets/visual.py | def hr_diagram_selection(cluster_name):
"""
Given a cluster create two Bokeh plot based H-R diagrams.
The Selection in the left H-R diagram will show up on the
right one.
"""
cluster = get_hr_data(cluster_name)
temps, lums = round_teff_luminosity(cluster)
x, y = temps, lums
colors, c... | def hr_diagram_selection(cluster_name):
"""
Given a cluster create two Bokeh plot based H-R diagrams.
The Selection in the left H-R diagram will show up on the
right one.
"""
cluster = get_hr_data(cluster_name)
temps, lums = round_teff_luminosity(cluster)
x, y = temps, lums
colors, c... | [
"Given",
"a",
"cluster",
"create",
"two",
"Bokeh",
"plot",
"based",
"H",
"-",
"R",
"diagrams",
".",
"The",
"Selection",
"in",
"the",
"left",
"H",
"-",
"R",
"diagram",
"will",
"show",
"up",
"on",
"the",
"right",
"one",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L342-L387 | [
"def",
"hr_diagram_selection",
"(",
"cluster_name",
")",
":",
"cluster",
"=",
"get_hr_data",
"(",
"cluster_name",
")",
"temps",
",",
"lums",
"=",
"round_teff_luminosity",
"(",
"cluster",
")",
"x",
",",
"y",
"=",
"temps",
",",
"lums",
"colors",
",",
"color_ma... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | SHRD._filter_cluster_data | Filter the cluster data catalog into the filtered_data
catalog, which is what is shown in the H-R diagram.
Filter on the values of the sliders, as well as the lasso
selection in the skyviewer. | astropixie-widgets/astropixie_widgets/visual.py | def _filter_cluster_data(self):
"""
Filter the cluster data catalog into the filtered_data
catalog, which is what is shown in the H-R diagram.
Filter on the values of the sliders, as well as the lasso
selection in the skyviewer.
"""
min_temp = self.temperature_ra... | def _filter_cluster_data(self):
"""
Filter the cluster data catalog into the filtered_data
catalog, which is what is shown in the H-R diagram.
Filter on the values of the sliders, as well as the lasso
selection in the skyviewer.
"""
min_temp = self.temperature_ra... | [
"Filter",
"the",
"cluster",
"data",
"catalog",
"into",
"the",
"filtered_data",
"catalog",
"which",
"is",
"what",
"is",
"shown",
"in",
"the",
"H",
"-",
"R",
"diagram",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L463-L497 | [
"def",
"_filter_cluster_data",
"(",
"self",
")",
":",
"min_temp",
"=",
"self",
".",
"temperature_range_slider",
".",
"value",
"[",
"0",
"]",
"max_temp",
"=",
"self",
".",
"temperature_range_slider",
".",
"value",
"[",
"1",
"]",
"temp_mask",
"=",
"np",
".",
... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | modify_data | Creates a tempfile and starts the given editor, returns the data afterwards. | jackal/scripts/modify.py | def modify_data(data):
"""
Creates a tempfile and starts the given editor, returns the data afterwards.
"""
with tempfile.NamedTemporaryFile('w') as f:
for entry in data:
f.write(json.dumps(entry.to_dict(
include_meta=True),
default=datetime_handle... | def modify_data(data):
"""
Creates a tempfile and starts the given editor, returns the data afterwards.
"""
with tempfile.NamedTemporaryFile('w') as f:
for entry in data:
f.write(json.dumps(entry.to_dict(
include_meta=True),
default=datetime_handle... | [
"Creates",
"a",
"tempfile",
"and",
"starts",
"the",
"given",
"editor",
"returns",
"the",
"data",
"afterwards",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/modify.py#L10-L24 | [
"def",
"modify_data",
"(",
"data",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"'w'",
")",
"as",
"f",
":",
"for",
"entry",
"in",
"data",
":",
"f",
".",
"write",
"(",
"json",
".",
"dumps",
"(",
"entry",
".",
"to_dict",
"(",
"include_... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | modify_input | This functions gives the user a way to change the data that is given as input. | jackal/scripts/modify.py | def modify_input():
"""
This functions gives the user a way to change the data that is given as input.
"""
doc_mapper = DocMapper()
if doc_mapper.is_pipe:
objects = [obj for obj in doc_mapper.get_pipe()]
modified = modify_data(objects)
for line in modified:
ob... | def modify_input():
"""
This functions gives the user a way to change the data that is given as input.
"""
doc_mapper = DocMapper()
if doc_mapper.is_pipe:
objects = [obj for obj in doc_mapper.get_pipe()]
modified = modify_data(objects)
for line in modified:
ob... | [
"This",
"functions",
"gives",
"the",
"user",
"a",
"way",
"to",
"change",
"the",
"data",
"that",
"is",
"given",
"as",
"input",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/modify.py#L27-L40 | [
"def",
"modify_input",
"(",
")",
":",
"doc_mapper",
"=",
"DocMapper",
"(",
")",
"if",
"doc_mapper",
".",
"is_pipe",
":",
"objects",
"=",
"[",
"obj",
"for",
"obj",
"in",
"doc_mapper",
".",
"get_pipe",
"(",
")",
"]",
"modified",
"=",
"modify_data",
"(",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | bruteforce | Performs a bruteforce for the given users, password, domain on the given host. | jackal/scripts/ldap.py | def bruteforce(users, domain, password, host):
"""
Performs a bruteforce for the given users, password, domain on the given host.
"""
cs = CredentialSearch(use_pipe=False)
print_notification("Connecting to {}".format(host))
s = Server(host)
c = Connection(s)
for user in users:
... | def bruteforce(users, domain, password, host):
"""
Performs a bruteforce for the given users, password, domain on the given host.
"""
cs = CredentialSearch(use_pipe=False)
print_notification("Connecting to {}".format(host))
s = Server(host)
c = Connection(s)
for user in users:
... | [
"Performs",
"a",
"bruteforce",
"for",
"the",
"given",
"users",
"password",
"domain",
"on",
"the",
"given",
"host",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/ldap.py#L13-L39 | [
"def",
"bruteforce",
"(",
"users",
",",
"domain",
",",
"password",
",",
"host",
")",
":",
"cs",
"=",
"CredentialSearch",
"(",
"use_pipe",
"=",
"False",
")",
"print_notification",
"(",
"\"Connecting to {}\"",
".",
"format",
"(",
"host",
")",
")",
"s",
"=",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | Context.Adapter | .. TODO:: move this documentation into model/adapter.py?...
The Adapter constructor supports the following parameters:
:param devID:
sets the local adapter\'s device identifier. For servers, this
should be the externally accessible URL that launches the SyncML
transaction, and for clients t... | pysyncml/context.py | def Adapter(self, **kw):
'''
.. TODO:: move this documentation into model/adapter.py?...
The Adapter constructor supports the following parameters:
:param devID:
sets the local adapter\'s device identifier. For servers, this
should be the externally accessible URL that launches the SyncML... | def Adapter(self, **kw):
'''
.. TODO:: move this documentation into model/adapter.py?...
The Adapter constructor supports the following parameters:
:param devID:
sets the local adapter\'s device identifier. For servers, this
should be the externally accessible URL that launches the SyncML... | [
"..",
"TODO",
"::",
"move",
"this",
"documentation",
"into",
"model",
"/",
"adapter",
".",
"py?",
"..."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/context.py#L161-L234 | [
"def",
"Adapter",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"try",
":",
"ret",
"=",
"self",
".",
"_model",
".",
"Adapter",
".",
"q",
"(",
"isLocal",
"=",
"True",
")",
".",
"one",
"(",
")",
"for",
"k",
",",
"v",
"in",
"kw",
".",
"items",
"... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | Context.RemoteAdapter | .. TODO:: move this documentation into model/adapter.py?...
The RemoteAdapter constructor supports the following parameters:
:param url:
specifies the URL that this remote SyncML server can be reached
at. The URL must be a fully-qualified URL.
:param auth:
set what kind of authenticat... | pysyncml/context.py | def RemoteAdapter(self, **kw):
'''
.. TODO:: move this documentation into model/adapter.py?...
The RemoteAdapter constructor supports the following parameters:
:param url:
specifies the URL that this remote SyncML server can be reached
at. The URL must be a fully-qualified URL.
:para... | def RemoteAdapter(self, **kw):
'''
.. TODO:: move this documentation into model/adapter.py?...
The RemoteAdapter constructor supports the following parameters:
:param url:
specifies the URL that this remote SyncML server can be reached
at. The URL must be a fully-qualified URL.
:para... | [
"..",
"TODO",
"::",
"move",
"this",
"documentation",
"into",
"model",
"/",
"adapter",
".",
"py?",
"..."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/context.py#L237-L282 | [
"def",
"RemoteAdapter",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"# TODO: is this really the right way?...",
"ret",
"=",
"self",
".",
"_model",
".",
"Adapter",
"(",
"isLocal",
"=",
"False",
",",
"*",
"*",
"kw",
")",
"self",
".",
"_model",
".",
"sessio... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | pprint_path | print information of a pathlib / os.DirEntry() instance with all "is_*" functions. | pathlib_revised/pathlib.py | def pprint_path(path):
"""
print information of a pathlib / os.DirEntry() instance with all "is_*" functions.
"""
print("\n*** %s" % path)
for attrname in sorted(dir(path)):
if attrname.startswith("is_"):
value = getattr(path, attrname)
print("%20s: %s" % (attrname, v... | def pprint_path(path):
"""
print information of a pathlib / os.DirEntry() instance with all "is_*" functions.
"""
print("\n*** %s" % path)
for attrname in sorted(dir(path)):
if attrname.startswith("is_"):
value = getattr(path, attrname)
print("%20s: %s" % (attrname, v... | [
"print",
"information",
"of",
"a",
"pathlib",
"/",
"os",
".",
"DirEntry",
"()",
"instance",
"with",
"all",
"is_",
"*",
"functions",
"."
] | jedie/pathlib_revised | python | https://github.com/jedie/pathlib_revised/blob/9e3921b683852d717793c1ac193d5b174fea6036/pathlib_revised/pathlib.py#L169-L178 | [
"def",
"pprint_path",
"(",
"path",
")",
":",
"print",
"(",
"\"\\n*** %s\"",
"%",
"path",
")",
"for",
"attrname",
"in",
"sorted",
"(",
"dir",
"(",
"path",
")",
")",
":",
"if",
"attrname",
".",
"startswith",
"(",
"\"is_\"",
")",
":",
"value",
"=",
"get... | 9e3921b683852d717793c1ac193d5b174fea6036 |
valid | SharedPathMethods.utime | Set the access and modified times of the file specified by path. | pathlib_revised/pathlib.py | def utime(self, *args, **kwargs):
""" Set the access and modified times of the file specified by path. """
os.utime(self.extended_path, *args, **kwargs) | def utime(self, *args, **kwargs):
""" Set the access and modified times of the file specified by path. """
os.utime(self.extended_path, *args, **kwargs) | [
"Set",
"the",
"access",
"and",
"modified",
"times",
"of",
"the",
"file",
"specified",
"by",
"path",
"."
] | jedie/pathlib_revised | python | https://github.com/jedie/pathlib_revised/blob/9e3921b683852d717793c1ac193d5b174fea6036/pathlib_revised/pathlib.py#L40-L42 | [
"def",
"utime",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"os",
".",
"utime",
"(",
"self",
".",
"extended_path",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 9e3921b683852d717793c1ac193d5b174fea6036 |
valid | WindowsPath2._from_parts | Strip \\?\ prefix in init phase | pathlib_revised/pathlib.py | def _from_parts(cls, args, init=True):
"""
Strip \\?\ prefix in init phase
"""
if args:
args = list(args)
if isinstance(args[0], WindowsPath2):
args[0] = args[0].path
elif args[0].startswith("\\\\?\\"):
args[0] = args[0]... | def _from_parts(cls, args, init=True):
"""
Strip \\?\ prefix in init phase
"""
if args:
args = list(args)
if isinstance(args[0], WindowsPath2):
args[0] = args[0].path
elif args[0].startswith("\\\\?\\"):
args[0] = args[0]... | [
"Strip",
"\\\\",
"?",
"\\",
"prefix",
"in",
"init",
"phase"
] | jedie/pathlib_revised | python | https://github.com/jedie/pathlib_revised/blob/9e3921b683852d717793c1ac193d5b174fea6036/pathlib_revised/pathlib.py#L84-L95 | [
"def",
"_from_parts",
"(",
"cls",
",",
"args",
",",
"init",
"=",
"True",
")",
":",
"if",
"args",
":",
"args",
"=",
"list",
"(",
"args",
")",
"if",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"WindowsPath2",
")",
":",
"args",
"[",
"0",
"]",
"... | 9e3921b683852d717793c1ac193d5b174fea6036 |
valid | WindowsPath2.extended_path | Add prefix \\?\ to every absolute path, so that it's a "extended-length"
path, that should be longer than 259 characters (called: "MAX_PATH")
see:
https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath | pathlib_revised/pathlib.py | def extended_path(self):
"""
Add prefix \\?\ to every absolute path, so that it's a "extended-length"
path, that should be longer than 259 characters (called: "MAX_PATH")
see:
https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath
"""
if self.is_absolute()... | def extended_path(self):
"""
Add prefix \\?\ to every absolute path, so that it's a "extended-length"
path, that should be longer than 259 characters (called: "MAX_PATH")
see:
https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath
"""
if self.is_absolute()... | [
"Add",
"prefix",
"\\\\",
"?",
"\\",
"to",
"every",
"absolute",
"path",
"so",
"that",
"it",
"s",
"a",
"extended",
"-",
"length",
"path",
"that",
"should",
"be",
"longer",
"than",
"259",
"characters",
"(",
"called",
":",
"MAX_PATH",
")",
"see",
":",
"htt... | jedie/pathlib_revised | python | https://github.com/jedie/pathlib_revised/blob/9e3921b683852d717793c1ac193d5b174fea6036/pathlib_revised/pathlib.py#L98-L107 | [
"def",
"extended_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_absolute",
"(",
")",
"and",
"not",
"self",
".",
"path",
".",
"startswith",
"(",
"\"\\\\\\\\\"",
")",
":",
"return",
"\"\\\\\\\\?\\\\%s\"",
"%",
"self",
".",
"path",
"return",
"self",
"... | 9e3921b683852d717793c1ac193d5b174fea6036 |
valid | WindowsPath2.path | Return the path always without the \\?\ prefix. | pathlib_revised/pathlib.py | def path(self):
"""
Return the path always without the \\?\ prefix.
"""
path = super(WindowsPath2, self).path
if path.startswith("\\\\?\\"):
return path[4:]
return path | def path(self):
"""
Return the path always without the \\?\ prefix.
"""
path = super(WindowsPath2, self).path
if path.startswith("\\\\?\\"):
return path[4:]
return path | [
"Return",
"the",
"path",
"always",
"without",
"the",
"\\\\",
"?",
"\\",
"prefix",
"."
] | jedie/pathlib_revised | python | https://github.com/jedie/pathlib_revised/blob/9e3921b683852d717793c1ac193d5b174fea6036/pathlib_revised/pathlib.py#L110-L117 | [
"def",
"path",
"(",
"self",
")",
":",
"path",
"=",
"super",
"(",
"WindowsPath2",
",",
"self",
")",
".",
"path",
"if",
"path",
".",
"startswith",
"(",
"\"\\\\\\\\?\\\\\"",
")",
":",
"return",
"path",
"[",
"4",
":",
"]",
"return",
"path"
] | 9e3921b683852d717793c1ac193d5b174fea6036 |
valid | WindowsPath2.relative_to | Important here is, that both are always the same:
both with \\?\ prefix or both without it. | pathlib_revised/pathlib.py | def relative_to(self, other):
"""
Important here is, that both are always the same:
both with \\?\ prefix or both without it.
"""
return super(WindowsPath2, Path2(self.path)).relative_to(Path2(other).path) | def relative_to(self, other):
"""
Important here is, that both are always the same:
both with \\?\ prefix or both without it.
"""
return super(WindowsPath2, Path2(self.path)).relative_to(Path2(other).path) | [
"Important",
"here",
"is",
"that",
"both",
"are",
"always",
"the",
"same",
":",
"both",
"with",
"\\\\",
"?",
"\\",
"prefix",
"or",
"both",
"without",
"it",
"."
] | jedie/pathlib_revised | python | https://github.com/jedie/pathlib_revised/blob/9e3921b683852d717793c1ac193d5b174fea6036/pathlib_revised/pathlib.py#L119-L124 | [
"def",
"relative_to",
"(",
"self",
",",
"other",
")",
":",
"return",
"super",
"(",
"WindowsPath2",
",",
"Path2",
"(",
"self",
".",
"path",
")",
")",
".",
"relative_to",
"(",
"Path2",
"(",
"other",
")",
".",
"path",
")"
] | 9e3921b683852d717793c1ac193d5b174fea6036 |
valid | format | Formats the output of another tool in the given way.
Has default styles for ranges, hosts and services. | jackal/scripts/filter.py | def format():
"""
Formats the output of another tool in the given way.
Has default styles for ranges, hosts and services.
"""
argparser = argparse.ArgumentParser(description='Formats a json object in a certain way. Use with pipes.')
argparser.add_argument('format', metavar='format', help... | def format():
"""
Formats the output of another tool in the given way.
Has default styles for ranges, hosts and services.
"""
argparser = argparse.ArgumentParser(description='Formats a json object in a certain way. Use with pipes.')
argparser.add_argument('format', metavar='format', help... | [
"Formats",
"the",
"output",
"of",
"another",
"tool",
"in",
"the",
"given",
"way",
".",
"Has",
"default",
"styles",
"for",
"ranges",
"hosts",
"and",
"services",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/filter.py#L27-L56 | [
"def",
"format",
"(",
")",
":",
"argparser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Formats a json object in a certain way. Use with pipes.'",
")",
"argparser",
".",
"add_argument",
"(",
"'format'",
",",
"metavar",
"=",
"'format'",
",",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | print_line | Print the given line to stdout | jackal/utils.py | def print_line(text):
"""
Print the given line to stdout
"""
try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
except ValueError:
pass
try:
sys.stdout.write(text)
if not text.endswith('\n'):
sys.stdout.write('\n')
sys.stdout.flush()
e... | def print_line(text):
"""
Print the given line to stdout
"""
try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
except ValueError:
pass
try:
sys.stdout.write(text)
if not text.endswith('\n'):
sys.stdout.write('\n')
sys.stdout.flush()
e... | [
"Print",
"the",
"given",
"line",
"to",
"stdout"
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/utils.py#L21-L36 | [
"def",
"print_line",
"(",
"text",
")",
":",
"try",
":",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGPIPE",
",",
"signal",
".",
"SIG_DFL",
")",
"except",
"ValueError",
":",
"pass",
"try",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"text",
")",... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | draw_interface | Draws a ncurses interface. Based on the given object list, every object should have a "string" key, this is whats displayed on the screen, callback is called with the selected object.
Rest of the code is modified from:
https://stackoverflow.com/a/30834868 | jackal/utils.py | def draw_interface(objects, callback, callback_text):
"""
Draws a ncurses interface. Based on the given object list, every object should have a "string" key, this is whats displayed on the screen, callback is called with the selected object.
Rest of the code is modified from:
https://stackov... | def draw_interface(objects, callback, callback_text):
"""
Draws a ncurses interface. Based on the given object list, every object should have a "string" key, this is whats displayed on the screen, callback is called with the selected object.
Rest of the code is modified from:
https://stackov... | [
"Draws",
"a",
"ncurses",
"interface",
".",
"Based",
"on",
"the",
"given",
"object",
"list",
"every",
"object",
"should",
"have",
"a",
"string",
"key",
"this",
"is",
"whats",
"displayed",
"on",
"the",
"screen",
"callback",
"is",
"called",
"with",
"the",
"se... | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/utils.py#L85-L189 | [
"def",
"draw_interface",
"(",
"objects",
",",
"callback",
",",
"callback_text",
")",
":",
"screen",
"=",
"curses",
".",
"initscr",
"(",
")",
"height",
",",
"width",
"=",
"screen",
".",
"getmaxyx",
"(",
")",
"curses",
".",
"noecho",
"(",
")",
"curses",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | get_own_ip | Gets the IP from the inet interfaces. | jackal/utils.py | def get_own_ip():
"""
Gets the IP from the inet interfaces.
"""
own_ip = None
interfaces = psutil.net_if_addrs()
for _, details in interfaces.items():
for detail in details:
if detail.family == socket.AF_INET:
ip_address = ipaddress.ip_address(detail.addre... | def get_own_ip():
"""
Gets the IP from the inet interfaces.
"""
own_ip = None
interfaces = psutil.net_if_addrs()
for _, details in interfaces.items():
for detail in details:
if detail.family == socket.AF_INET:
ip_address = ipaddress.ip_address(detail.addre... | [
"Gets",
"the",
"IP",
"from",
"the",
"inet",
"interfaces",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/utils.py#L191-L204 | [
"def",
"get_own_ip",
"(",
")",
":",
"own_ip",
"=",
"None",
"interfaces",
"=",
"psutil",
".",
"net_if_addrs",
"(",
")",
"for",
"_",
",",
"details",
"in",
"interfaces",
".",
"items",
"(",
")",
":",
"for",
"detail",
"in",
"details",
":",
"if",
"detail",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | pprint | Create a pandas DataFrame from a numpy ndarray.
By default use temp and lum with max rows of 32 and precision of 2.
arr - An numpy.ndarray.
columns - The columns to include in the pandas DataFrame. Defaults to
temperature and luminosity.
names - The column names for the pandas DataFrame.... | astropixie/astropixie/data.py | def pprint(arr, columns=('temperature', 'luminosity'),
names=('Temperature (Kelvin)', 'Luminosity (solar units)'),
max_rows=32, precision=2):
"""
Create a pandas DataFrame from a numpy ndarray.
By default use temp and lum with max rows of 32 and precision of 2.
arr - An numpy.nda... | def pprint(arr, columns=('temperature', 'luminosity'),
names=('Temperature (Kelvin)', 'Luminosity (solar units)'),
max_rows=32, precision=2):
"""
Create a pandas DataFrame from a numpy ndarray.
By default use temp and lum with max rows of 32 and precision of 2.
arr - An numpy.nda... | [
"Create",
"a",
"pandas",
"DataFrame",
"from",
"a",
"numpy",
"ndarray",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie/astropixie/data.py#L296-L323 | [
"def",
"pprint",
"(",
"arr",
",",
"columns",
"=",
"(",
"'temperature'",
",",
"'luminosity'",
")",
",",
"names",
"=",
"(",
"'Temperature (Kelvin)'",
",",
"'Luminosity (solar units)'",
")",
",",
"max_rows",
"=",
"32",
",",
"precision",
"=",
"2",
")",
":",
"i... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | strip_labels | Strips labels. | processing_scripts/strip_labels.py | def strip_labels(filename):
"""Strips labels."""
labels = []
with open(filename) as f, open('processed_labels.txt', 'w') as f1:
for l in f:
if l.startswith('#'):
next
l = l.replace(" .", '')
l = l.replace(">\tskos:prefLabel\t", ' ')
l =... | def strip_labels(filename):
"""Strips labels."""
labels = []
with open(filename) as f, open('processed_labels.txt', 'w') as f1:
for l in f:
if l.startswith('#'):
next
l = l.replace(" .", '')
l = l.replace(">\tskos:prefLabel\t", ' ')
l =... | [
"Strips",
"labels",
"."
] | fantasticfears/kgekit | python | https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/processing_scripts/strip_labels.py#L3-L14 | [
"def",
"strip_labels",
"(",
"filename",
")",
":",
"labels",
"=",
"[",
"]",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
",",
"open",
"(",
"'processed_labels.txt'",
",",
"'w'",
")",
"as",
"f1",
":",
"for",
"l",
"in",
"f",
":",
"if",
"l",
".",
... | 5e464e1fc3ae9c7e216f6dd94f879a967d065247 |
valid | remove_namespace | Remove namespace in the passed document in place. | pysyncml/codec.py | def remove_namespace(doc, namespace):
'''Remove namespace in the passed document in place.'''
ns = u'{%s}' % namespace
nsl = len(ns)
for elem in doc.getiterator():
if elem.tag.startswith(ns):
elem.tag = elem.tag[nsl:]
elem.attrib['oxmlns'] = namespace | def remove_namespace(doc, namespace):
'''Remove namespace in the passed document in place.'''
ns = u'{%s}' % namespace
nsl = len(ns)
for elem in doc.getiterator():
if elem.tag.startswith(ns):
elem.tag = elem.tag[nsl:]
elem.attrib['oxmlns'] = namespace | [
"Remove",
"namespace",
"in",
"the",
"passed",
"document",
"in",
"place",
"."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/codec.py#L34-L41 | [
"def",
"remove_namespace",
"(",
"doc",
",",
"namespace",
")",
":",
"ns",
"=",
"u'{%s}'",
"%",
"namespace",
"nsl",
"=",
"len",
"(",
"ns",
")",
"for",
"elem",
"in",
"doc",
".",
"getiterator",
"(",
")",
":",
"if",
"elem",
".",
"tag",
".",
"startswith",
... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | Resolver.resolve | Resolve a Resource identified by URI
:param uri: The URI of the resource to be resolved
:type uri: str
:return: the contents of the resource as a string
:rtype: str | flask_nemo/query/resolve.py | def resolve(self, uri):
""" Resolve a Resource identified by URI
:param uri: The URI of the resource to be resolved
:type uri: str
:return: the contents of the resource as a string
:rtype: str
"""
for r in self.__retrievers__:
if r.match(uri):
... | def resolve(self, uri):
""" Resolve a Resource identified by URI
:param uri: The URI of the resource to be resolved
:type uri: str
:return: the contents of the resource as a string
:rtype: str
"""
for r in self.__retrievers__:
if r.match(uri):
... | [
"Resolve",
"a",
"Resource",
"identified",
"by",
"URI",
":",
"param",
"uri",
":",
"The",
"URI",
"of",
"the",
"resource",
"to",
"be",
"resolved",
":",
"type",
"uri",
":",
"str",
":",
"return",
":",
"the",
"contents",
"of",
"the",
"resource",
"as",
"a",
... | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/resolve.py#L24-L34 | [
"def",
"resolve",
"(",
"self",
",",
"uri",
")",
":",
"for",
"r",
"in",
"self",
".",
"__retrievers__",
":",
"if",
"r",
".",
"match",
"(",
"uri",
")",
":",
"return",
"r",
"raise",
"UnresolvableURIError",
"(",
")"
] | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | HTTPRetriever.read | Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str | flask_nemo/query/resolve.py | def read(self, uri):
""" Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str
"""
req = request("GET", uri)
return req.content, req.headers['Content-Type... | def read(self, uri):
""" Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str
"""
req = request("GET", uri)
return req.content, req.headers['Content-Type... | [
"Retrieve",
"the",
"contents",
"of",
"the",
"resource"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/resolve.py#L78-L87 | [
"def",
"read",
"(",
"self",
",",
"uri",
")",
":",
"req",
"=",
"request",
"(",
"\"GET\"",
",",
"uri",
")",
"return",
"req",
".",
"content",
",",
"req",
".",
"headers",
"[",
"'Content-Type'",
"]"
] | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | LocalRetriever.match | Check to see if this URI is retrievable by this Retriever implementation
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: True if it can be, False if not
:rtype: bool | flask_nemo/query/resolve.py | def match(self, uri):
""" Check to see if this URI is retrievable by this Retriever implementation
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: True if it can be, False if not
:rtype: bool
"""
absolute_uri = self.__absolute__(uri)
... | def match(self, uri):
""" Check to see if this URI is retrievable by this Retriever implementation
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: True if it can be, False if not
:rtype: bool
"""
absolute_uri = self.__absolute__(uri)
... | [
"Check",
"to",
"see",
"if",
"this",
"URI",
"is",
"retrievable",
"by",
"this",
"Retriever",
"implementation"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/resolve.py#L110-L120 | [
"def",
"match",
"(",
"self",
",",
"uri",
")",
":",
"absolute_uri",
"=",
"self",
".",
"__absolute__",
"(",
"uri",
")",
"return",
"absolute_uri",
".",
"startswith",
"(",
"self",
".",
"__path__",
")",
"and",
"op",
".",
"exists",
"(",
"absolute_uri",
")"
] | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | LocalRetriever.read | Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str | flask_nemo/query/resolve.py | def read(self, uri):
""" Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str
"""
uri = self.__absolute__(uri)
mime, _ = guess_type(uri)
if "imag... | def read(self, uri):
""" Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str
"""
uri = self.__absolute__(uri)
mime, _ = guess_type(uri)
if "imag... | [
"Retrieve",
"the",
"contents",
"of",
"the",
"resource"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/resolve.py#L122-L137 | [
"def",
"read",
"(",
"self",
",",
"uri",
")",
":",
"uri",
"=",
"self",
".",
"__absolute__",
"(",
"uri",
")",
"mime",
",",
"_",
"=",
"guess_type",
"(",
"uri",
")",
"if",
"\"image\"",
"in",
"mime",
":",
"return",
"send_file",
"(",
"uri",
")",
",",
"... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | CTSRetriever.read | Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str | flask_nemo/query/resolve.py | def read(self, uri):
""" Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str
"""
return self.__resolver__.getTextualNode(uri).export(Mimetypes.XML.TEI), "text/x... | def read(self, uri):
""" Retrieve the contents of the resource
:param uri: the URI of the resource to be retrieved
:type uri: str
:return: the contents of the resource
:rtype: str
"""
return self.__resolver__.getTextualNode(uri).export(Mimetypes.XML.TEI), "text/x... | [
"Retrieve",
"the",
"contents",
"of",
"the",
"resource"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/resolve.py#L165-L173 | [
"def",
"read",
"(",
"self",
",",
"uri",
")",
":",
"return",
"self",
".",
"__resolver__",
".",
"getTextualNode",
"(",
"uri",
")",
".",
"export",
"(",
"Mimetypes",
".",
"XML",
".",
"TEI",
")",
",",
"\"text/xml\""
] | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | hook | Decorator used to tag a method that should be used as a hook for the
specified `name` hook type. | pysyncml/cli/base.py | def hook(name):
'''
Decorator used to tag a method that should be used as a hook for the
specified `name` hook type.
'''
def hookTarget(wrapped):
if not hasattr(wrapped, '__hook__'):
wrapped.__hook__ = [name]
else:
wrapped.__hook__.append(name)
return wrapped
return hookTarget | def hook(name):
'''
Decorator used to tag a method that should be used as a hook for the
specified `name` hook type.
'''
def hookTarget(wrapped):
if not hasattr(wrapped, '__hook__'):
wrapped.__hook__ = [name]
else:
wrapped.__hook__.append(name)
return wrapped
return hookTarget | [
"Decorator",
"used",
"to",
"tag",
"a",
"method",
"that",
"should",
"be",
"used",
"as",
"a",
"hook",
"for",
"the",
"specified",
"name",
"hook",
"type",
"."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L109-L120 | [
"def",
"hook",
"(",
"name",
")",
":",
"def",
"hookTarget",
"(",
"wrapped",
")",
":",
"if",
"not",
"hasattr",
"(",
"wrapped",
",",
"'__hook__'",
")",
":",
"wrapped",
".",
"__hook__",
"=",
"[",
"name",
"]",
"else",
":",
"wrapped",
".",
"__hook__",
".",... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | CommandLineSyncEngine.addHook | Subscribes `callable` to listen to events of `name` type. The
parameters passed to `callable` are dependent on the specific
event being triggered. | pysyncml/cli/base.py | def addHook(self, name, callable):
'''
Subscribes `callable` to listen to events of `name` type. The
parameters passed to `callable` are dependent on the specific
event being triggered.
'''
if name not in self._hooks:
self._hooks[name] = []
self._hooks[name].append(callable) | def addHook(self, name, callable):
'''
Subscribes `callable` to listen to events of `name` type. The
parameters passed to `callable` are dependent on the specific
event being triggered.
'''
if name not in self._hooks:
self._hooks[name] = []
self._hooks[name].append(callable) | [
"Subscribes",
"callable",
"to",
"listen",
"to",
"events",
"of",
"name",
"type",
".",
"The",
"parameters",
"passed",
"to",
"callable",
"are",
"dependent",
"on",
"the",
"specific",
"event",
"being",
"triggered",
"."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L226-L234 | [
"def",
"addHook",
"(",
"self",
",",
"name",
",",
"callable",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"_hooks",
":",
"self",
".",
"_hooks",
"[",
"name",
"]",
"=",
"[",
"]",
"self",
".",
"_hooks",
"[",
"name",
"]",
".",
"append",
"(",
"... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | CommandLineSyncEngine._makeAdapter | Creates a tuple of ( Context, Adapter ) based on the options
specified by `self.options`. The Context is the pysyncml.Context created for
the storage location specified in `self.options`, and the Adapter is a newly
created Adapter if a previously created one was not found. | pysyncml/cli/base.py | def _makeAdapter(self):
'''
Creates a tuple of ( Context, Adapter ) based on the options
specified by `self.options`. The Context is the pysyncml.Context created for
the storage location specified in `self.options`, and the Adapter is a newly
created Adapter if a previously created one was not found... | def _makeAdapter(self):
'''
Creates a tuple of ( Context, Adapter ) based on the options
specified by `self.options`. The Context is the pysyncml.Context created for
the storage location specified in `self.options`, and the Adapter is a newly
created Adapter if a previously created one was not found... | [
"Creates",
"a",
"tuple",
"of",
"(",
"Context",
"Adapter",
")",
"based",
"on",
"the",
"options",
"specified",
"by",
"self",
".",
"options",
".",
"The",
"Context",
"is",
"the",
"pysyncml",
".",
"Context",
"created",
"for",
"the",
"storage",
"location",
"spec... | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L440-L607 | [
"def",
"_makeAdapter",
"(",
"self",
")",
":",
"self",
".",
"_callHooks",
"(",
"'adapter.create.init'",
")",
"# create a new pysyncml.Context. the main function that this provides is",
"# to give the Adapter a storage engine to store state information across",
"# synchronizations.",
"co... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | CommandLineSyncEngine.configure | Configures this engine based on the options array passed into
`argv`. If `argv` is ``None``, then ``sys.argv`` is used instead.
During configuration, the command line options are merged with
previously stored values. Then the logging subsystem and the
database model are initialized, and all storable set... | pysyncml/cli/base.py | def configure(self, argv=None):
'''
Configures this engine based on the options array passed into
`argv`. If `argv` is ``None``, then ``sys.argv`` is used instead.
During configuration, the command line options are merged with
previously stored values. Then the logging subsystem and the
database... | def configure(self, argv=None):
'''
Configures this engine based on the options array passed into
`argv`. If `argv` is ``None``, then ``sys.argv`` is used instead.
During configuration, the command line options are merged with
previously stored values. Then the logging subsystem and the
database... | [
"Configures",
"this",
"engine",
"based",
"on",
"the",
"options",
"array",
"passed",
"into",
"argv",
".",
"If",
"argv",
"is",
"None",
"then",
"sys",
".",
"argv",
"is",
"used",
"instead",
".",
"During",
"configuration",
"the",
"command",
"line",
"options",
"... | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L764-L778 | [
"def",
"configure",
"(",
"self",
",",
"argv",
"=",
"None",
")",
":",
"self",
".",
"_setupOptions",
"(",
")",
"self",
".",
"_parseOptions",
"(",
"argv",
")",
"self",
".",
"_setupLogging",
"(",
")",
"self",
".",
"_setupModel",
"(",
")",
"self",
".",
"d... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | CommandLineSyncEngine.run | Runs this SyncEngine by executing one of the following functions
(as controlled by command-line options or stored parameters):
* Display local pending changes.
* Describe local configuration.
* Run an HTTP server and engage server-side mode.
* Connect to a remote SyncML peer and engage client-side ... | pysyncml/cli/base.py | def run(self, stdout=sys.stdout, stderr=sys.stderr):
'''
Runs this SyncEngine by executing one of the following functions
(as controlled by command-line options or stored parameters):
* Display local pending changes.
* Describe local configuration.
* Run an HTTP server and engage server-side mo... | def run(self, stdout=sys.stdout, stderr=sys.stderr):
'''
Runs this SyncEngine by executing one of the following functions
(as controlled by command-line options or stored parameters):
* Display local pending changes.
* Describe local configuration.
* Run an HTTP server and engage server-side mo... | [
"Runs",
"this",
"SyncEngine",
"by",
"executing",
"one",
"of",
"the",
"following",
"functions",
"(",
"as",
"controlled",
"by",
"command",
"-",
"line",
"options",
"or",
"stored",
"parameters",
")",
":"
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/base.py#L781-L803 | [
"def",
"run",
"(",
"self",
",",
"stdout",
"=",
"sys",
".",
"stdout",
",",
"stderr",
"=",
"sys",
".",
"stderr",
")",
":",
"if",
"self",
".",
"options",
".",
"local",
"or",
"self",
".",
"options",
".",
"describe",
":",
"context",
",",
"adapter",
"=",... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | RawlBase._assemble_with_columns | Format a select statement with specific columns
:sql_str: An SQL string template
:columns: The columns to be selected and put into {0}
:*args: Arguments to use as query parameters.
:returns: Psycopg2 compiled query | rawl/__init__.py | def _assemble_with_columns(self, sql_str, columns, *args, **kwargs):
"""
Format a select statement with specific columns
:sql_str: An SQL string template
:columns: The columns to be selected and put into {0}
:*args: Arguments to use as query parameters.
:return... | def _assemble_with_columns(self, sql_str, columns, *args, **kwargs):
"""
Format a select statement with specific columns
:sql_str: An SQL string template
:columns: The columns to be selected and put into {0}
:*args: Arguments to use as query parameters.
:return... | [
"Format",
"a",
"select",
"statement",
"with",
"specific",
"columns"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L237-L266 | [
"def",
"_assemble_with_columns",
"(",
"self",
",",
"sql_str",
",",
"columns",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Handle any aliased columns we get (e.g. table_alias.column)",
"qcols",
"=",
"[",
"]",
"for",
"col",
"in",
"columns",
":",
"if",
... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase._assemble_select | Alias for _assemble_with_columns | rawl/__init__.py | def _assemble_select(self, sql_str, columns, *args, **kwargs):
""" Alias for _assemble_with_columns
"""
warnings.warn("_assemble_select has been depreciated for _assemble_with_columns. It will be removed in a future version.", DeprecationWarning)
return self._assemble_with_columns(sql_st... | def _assemble_select(self, sql_str, columns, *args, **kwargs):
""" Alias for _assemble_with_columns
"""
warnings.warn("_assemble_select has been depreciated for _assemble_with_columns. It will be removed in a future version.", DeprecationWarning)
return self._assemble_with_columns(sql_st... | [
"Alias",
"for",
"_assemble_with_columns"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L268-L272 | [
"def",
"_assemble_select",
"(",
"self",
",",
"sql_str",
",",
"columns",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"\"_assemble_select has been depreciated for _assemble_with_columns. It will be removed in a future version.\"",
",",... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase._assemble_simple | Format a select statement with specific columns
:sql_str: An SQL string template
:*args: Arguments to use as query parameters.
:returns: Psycopg2 compiled query | rawl/__init__.py | def _assemble_simple(self, sql_str, *args, **kwargs):
"""
Format a select statement with specific columns
:sql_str: An SQL string template
:*args: Arguments to use as query parameters.
:returns: Psycopg2 compiled query
"""
query_string = sql.SQ... | def _assemble_simple(self, sql_str, *args, **kwargs):
"""
Format a select statement with specific columns
:sql_str: An SQL string template
:*args: Arguments to use as query parameters.
:returns: Psycopg2 compiled query
"""
query_string = sql.SQ... | [
"Format",
"a",
"select",
"statement",
"with",
"specific",
"columns"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L274-L287 | [
"def",
"_assemble_simple",
"(",
"self",
",",
"sql_str",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"query_string",
"=",
"sql",
".",
"SQL",
"(",
"sql_str",
")",
".",
"format",
"(",
"*",
"[",
"sql",
".",
"Literal",
"(",
"a",
")",
"for",
"... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase._execute | Execute a query with provided parameters
Parameters
:query: SQL string with parameter placeholders
:commit: If True, the query will commit
:returns: List of rows | rawl/__init__.py | def _execute(self, query, commit=False, working_columns=None):
"""
Execute a query with provided parameters
Parameters
:query: SQL string with parameter placeholders
:commit: If True, the query will commit
:returns: List of rows
"""
log.debug(... | def _execute(self, query, commit=False, working_columns=None):
"""
Execute a query with provided parameters
Parameters
:query: SQL string with parameter placeholders
:commit: If True, the query will commit
:returns: List of rows
"""
log.debug(... | [
"Execute",
"a",
"query",
"with",
"provided",
"parameters"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L289-L352 | [
"def",
"_execute",
"(",
"self",
",",
"query",
",",
"commit",
"=",
"False",
",",
"working_columns",
"=",
"None",
")",
":",
"log",
".",
"debug",
"(",
"\"RawlBase._execute()\"",
")",
"result",
"=",
"[",
"]",
"if",
"working_columns",
"is",
"None",
":",
"work... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase.process_columns | Handle provided columns and if necessary, convert columns to a list for
internal strage.
:columns: A sequence of columns for the table. Can be list, comma
-delimited string, or IntEnum. | rawl/__init__.py | def process_columns(self, columns):
"""
Handle provided columns and if necessary, convert columns to a list for
internal strage.
:columns: A sequence of columns for the table. Can be list, comma
-delimited string, or IntEnum.
"""
if type(columns) == list:
... | def process_columns(self, columns):
"""
Handle provided columns and if necessary, convert columns to a list for
internal strage.
:columns: A sequence of columns for the table. Can be list, comma
-delimited string, or IntEnum.
"""
if type(columns) == list:
... | [
"Handle",
"provided",
"columns",
"and",
"if",
"necessary",
"convert",
"columns",
"to",
"a",
"list",
"for",
"internal",
"strage",
"."
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L354-L369 | [
"def",
"process_columns",
"(",
"self",
",",
"columns",
")",
":",
"if",
"type",
"(",
"columns",
")",
"==",
"list",
":",
"self",
".",
"columns",
"=",
"columns",
"elif",
"type",
"(",
"columns",
")",
"==",
"str",
":",
"self",
".",
"columns",
"=",
"[",
... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase.query | Execute a DML query
:sql_string: An SQL string template
:*args: Arguments to be passed for query parameters.
:commit: Whether or not to commit the transaction after the query
:returns: Psycopg2 result | rawl/__init__.py | def query(self, sql_string, *args, **kwargs):
"""
Execute a DML query
:sql_string: An SQL string template
:*args: Arguments to be passed for query parameters.
:commit: Whether or not to commit the transaction after the query
:returns: Psycopg2 r... | def query(self, sql_string, *args, **kwargs):
"""
Execute a DML query
:sql_string: An SQL string template
:*args: Arguments to be passed for query parameters.
:commit: Whether or not to commit the transaction after the query
:returns: Psycopg2 r... | [
"Execute",
"a",
"DML",
"query"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L371-L387 | [
"def",
"query",
"(",
"self",
",",
"sql_string",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"commit",
"=",
"None",
"columns",
"=",
"None",
"if",
"kwargs",
".",
"get",
"(",
"'commit'",
")",
"is",
"not",
"None",
":",
"commit",
"=",
"kwargs",... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase.select | Execute a SELECT statement
:sql_string: An SQL string template
:columns: A list of columns to be returned by the query
:*args: Arguments to be passed for query parameters.
:returns: Psycopg2 result | rawl/__init__.py | def select(self, sql_string, cols, *args, **kwargs):
"""
Execute a SELECT statement
:sql_string: An SQL string template
:columns: A list of columns to be returned by the query
:*args: Arguments to be passed for query parameters.
:returns: Psycopg... | def select(self, sql_string, cols, *args, **kwargs):
"""
Execute a SELECT statement
:sql_string: An SQL string template
:columns: A list of columns to be returned by the query
:*args: Arguments to be passed for query parameters.
:returns: Psycopg... | [
"Execute",
"a",
"SELECT",
"statement"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L389-L402 | [
"def",
"select",
"(",
"self",
",",
"sql_string",
",",
"cols",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"working_columns",
"=",
"None",
"if",
"kwargs",
".",
"get",
"(",
"'columns'",
")",
"is",
"not",
"None",
":",
"working_columns",
"=",
"k... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase.insert_dict | Execute an INSERT statement using a python dict
:value_dict: A dictionary representing all the columns(keys) and
values that should be part of the INSERT statement
:commit: Whether to automatically commit the transaction
:returns: Psycopg2 result | rawl/__init__.py | def insert_dict(self, value_dict, commit=False):
"""
Execute an INSERT statement using a python dict
:value_dict: A dictionary representing all the columns(keys) and
values that should be part of the INSERT statement
:commit: Whether to automatically commit the t... | def insert_dict(self, value_dict, commit=False):
"""
Execute an INSERT statement using a python dict
:value_dict: A dictionary representing all the columns(keys) and
values that should be part of the INSERT statement
:commit: Whether to automatically commit the t... | [
"Execute",
"an",
"INSERT",
"statement",
"using",
"a",
"python",
"dict"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L404-L453 | [
"def",
"insert_dict",
"(",
"self",
",",
"value_dict",
",",
"commit",
"=",
"False",
")",
":",
"# Sanity check the value_dict",
"for",
"key",
"in",
"value_dict",
".",
"keys",
"(",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"columns",
":",
"raise",
"V... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | RawlBase.get | Retreive a single record from the table. Lots of reasons this might be
best implemented in the model
:pk: The primary key ID for the record
:returns: List of single result | rawl/__init__.py | def get(self, pk):
"""
Retreive a single record from the table. Lots of reasons this might be
best implemented in the model
:pk: The primary key ID for the record
:returns: List of single result
"""
if type(pk) == str:
# Probably a... | def get(self, pk):
"""
Retreive a single record from the table. Lots of reasons this might be
best implemented in the model
:pk: The primary key ID for the record
:returns: List of single result
"""
if type(pk) == str:
# Probably a... | [
"Retreive",
"a",
"single",
"record",
"from",
"the",
"table",
".",
"Lots",
"of",
"reasons",
"this",
"might",
"be",
"best",
"implemented",
"in",
"the",
"model"
] | mikeshultz/rawl | python | https://github.com/mikeshultz/rawl/blob/818ebeabba5e051627d444c4849fde55947f94be/rawl/__init__.py#L455-L472 | [
"def",
"get",
"(",
"self",
",",
"pk",
")",
":",
"if",
"type",
"(",
"pk",
")",
"==",
"str",
":",
"# Probably an int, give it a shot",
"try",
":",
"pk",
"=",
"int",
"(",
"pk",
")",
"except",
"ValueError",
":",
"pass",
"return",
"self",
".",
"select",
"... | 818ebeabba5e051627d444c4849fde55947f94be |
valid | FileItem.dump | Serializes this FileItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``application/vnd.omads-file``. | pysyncml/items/file.py | def dump(self, stream, contentType=None, version=None):
'''
Serializes this FileItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``application/vnd.omads-file``.
'''
... | def dump(self, stream, contentType=None, version=None):
'''
Serializes this FileItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``application/vnd.omads-file``.
'''
... | [
"Serializes",
"this",
"FileItem",
"to",
"a",
"byte",
"-",
"stream",
"and",
"writes",
"it",
"to",
"the",
"file",
"-",
"like",
"object",
"stream",
".",
"contentType",
"and",
"version",
"must",
"be",
"one",
"of",
"the",
"supported",
"content",
"-",
"types",
... | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/items/file.py#L152-L195 | [
"def",
"dump",
"(",
"self",
",",
"stream",
",",
"contentType",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"if",
"contentType",
"is",
"None",
":",
"contentType",
"=",
"constants",
".",
"TYPE_OMADS_FILE",
"if",
"ctype",
".",
"getBaseType",
"(",
"c... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | FileItem.load | Reverses the effects of the :meth:`dump` method, creating a FileItem
from the specified file-like `stream` object. | pysyncml/items/file.py | def load(cls, stream, contentType=None, version=None):
'''
Reverses the effects of the :meth:`dump` method, creating a FileItem
from the specified file-like `stream` object.
'''
if contentType is None:
contentType = constants.TYPE_OMADS_FILE
if ctype.getBaseType(contentType) == constants.T... | def load(cls, stream, contentType=None, version=None):
'''
Reverses the effects of the :meth:`dump` method, creating a FileItem
from the specified file-like `stream` object.
'''
if contentType is None:
contentType = constants.TYPE_OMADS_FILE
if ctype.getBaseType(contentType) == constants.T... | [
"Reverses",
"the",
"effects",
"of",
"the",
":",
"meth",
":",
"dump",
"method",
"creating",
"a",
"FileItem",
"from",
"the",
"specified",
"file",
"-",
"like",
"stream",
"object",
"."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/items/file.py#L199-L240 | [
"def",
"load",
"(",
"cls",
",",
"stream",
",",
"contentType",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"if",
"contentType",
"is",
"None",
":",
"contentType",
"=",
"constants",
".",
"TYPE_OMADS_FILE",
"if",
"ctype",
".",
"getBaseType",
"(",
"co... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | Eternalblue.setup | This function will call msfvenom, nasm and git via subprocess to setup all the things.
Returns True if everything went well, otherwise returns False. | jackal/scripts/eternalblue.py | def setup(self):
"""
This function will call msfvenom, nasm and git via subprocess to setup all the things.
Returns True if everything went well, otherwise returns False.
"""
lport64 = self.port64
lport32 = self.port32
print_notification("Using ip: {}".for... | def setup(self):
"""
This function will call msfvenom, nasm and git via subprocess to setup all the things.
Returns True if everything went well, otherwise returns False.
"""
lport64 = self.port64
lport32 = self.port32
print_notification("Using ip: {}".for... | [
"This",
"function",
"will",
"call",
"msfvenom",
"nasm",
"and",
"git",
"via",
"subprocess",
"to",
"setup",
"all",
"the",
"things",
".",
"Returns",
"True",
"if",
"everything",
"went",
"well",
"otherwise",
"returns",
"False",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L30-L95 | [
"def",
"setup",
"(",
"self",
")",
":",
"lport64",
"=",
"self",
".",
"port64",
"lport32",
"=",
"self",
".",
"port32",
"print_notification",
"(",
"\"Using ip: {}\"",
".",
"format",
"(",
"self",
".",
"ip",
")",
")",
"print_notification",
"(",
"\"Generating meta... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | Eternalblue.create_payload | Creates the final payload based on the x86 and x64 meterpreters. | jackal/scripts/eternalblue.py | def create_payload(self, x86_file, x64_file, payload_file):
"""
Creates the final payload based on the x86 and x64 meterpreters.
"""
sc_x86 = open(os.path.join(self.datadir, x86_file), 'rb').read()
sc_x64 = open(os.path.join(self.datadir, x64_file), 'rb').read()
fp =... | def create_payload(self, x86_file, x64_file, payload_file):
"""
Creates the final payload based on the x86 and x64 meterpreters.
"""
sc_x86 = open(os.path.join(self.datadir, x86_file), 'rb').read()
sc_x64 = open(os.path.join(self.datadir, x64_file), 'rb').read()
fp =... | [
"Creates",
"the",
"final",
"payload",
"based",
"on",
"the",
"x86",
"and",
"x64",
"meterpreters",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L98-L109 | [
"def",
"create_payload",
"(",
"self",
",",
"x86_file",
",",
"x64_file",
",",
"payload_file",
")",
":",
"sc_x86",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"datadir",
",",
"x86_file",
")",
",",
"'rb'",
")",
".",
"read",
"(",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | Eternalblue.combine_files | Combines the files 1 and 2 into 3. | jackal/scripts/eternalblue.py | def combine_files(self, f1, f2, f3):
"""
Combines the files 1 and 2 into 3.
"""
with open(os.path.join(self.datadir, f3), 'wb') as new_file:
with open(os.path.join(self.datadir, f1), 'rb') as file_1:
new_file.write(file_1.read())
with open(os.p... | def combine_files(self, f1, f2, f3):
"""
Combines the files 1 and 2 into 3.
"""
with open(os.path.join(self.datadir, f3), 'wb') as new_file:
with open(os.path.join(self.datadir, f1), 'rb') as file_1:
new_file.write(file_1.read())
with open(os.p... | [
"Combines",
"the",
"files",
"1",
"and",
"2",
"into",
"3",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L112-L120 | [
"def",
"combine_files",
"(",
"self",
",",
"f1",
",",
"f2",
",",
"f3",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"datadir",
",",
"f3",
")",
",",
"'wb'",
")",
"as",
"new_file",
":",
"with",
"open",
"(",
"os"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | Eternalblue.detect_os | Runs the checker.py scripts to detect the os. | jackal/scripts/eternalblue.py | def detect_os(self, ip):
"""
Runs the checker.py scripts to detect the os.
"""
process = subprocess.run(['python2', os.path.join(self.datadir, 'MS17-010', 'checker.py'), str(ip)], stdout=subprocess.PIPE)
out = process.stdout.decode('utf-8').split('\n')
system_os = ''
... | def detect_os(self, ip):
"""
Runs the checker.py scripts to detect the os.
"""
process = subprocess.run(['python2', os.path.join(self.datadir, 'MS17-010', 'checker.py'), str(ip)], stdout=subprocess.PIPE)
out = process.stdout.decode('utf-8').split('\n')
system_os = ''
... | [
"Runs",
"the",
"checker",
".",
"py",
"scripts",
"to",
"detect",
"the",
"os",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L123-L134 | [
"def",
"detect_os",
"(",
"self",
",",
"ip",
")",
":",
"process",
"=",
"subprocess",
".",
"run",
"(",
"[",
"'python2'",
",",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"datadir",
",",
"'MS17-010'",
",",
"'checker.py'",
")",
",",
"str",
"(",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | Eternalblue.exploit | Starts the exploiting phase, you should run setup before running this function.
if auto is set, this function will fire the exploit to all systems. Otherwise a curses interface is shown. | jackal/scripts/eternalblue.py | def exploit(self):
"""
Starts the exploiting phase, you should run setup before running this function.
if auto is set, this function will fire the exploit to all systems. Otherwise a curses interface is shown.
"""
search = ServiceSearch()
host_search = HostSearch(... | def exploit(self):
"""
Starts the exploiting phase, you should run setup before running this function.
if auto is set, this function will fire the exploit to all systems. Otherwise a curses interface is shown.
"""
search = ServiceSearch()
host_search = HostSearch(... | [
"Starts",
"the",
"exploiting",
"phase",
"you",
"should",
"run",
"setup",
"before",
"running",
"this",
"function",
".",
"if",
"auto",
"is",
"set",
"this",
"function",
"will",
"fire",
"the",
"exploit",
"to",
"all",
"systems",
".",
"Otherwise",
"a",
"curses",
... | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L137-L179 | [
"def",
"exploit",
"(",
"self",
")",
":",
"search",
"=",
"ServiceSearch",
"(",
")",
"host_search",
"=",
"HostSearch",
"(",
")",
"services",
"=",
"search",
".",
"get_services",
"(",
"tags",
"=",
"[",
"'MS17-010'",
"]",
")",
"services",
"=",
"[",
"service",... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | Eternalblue.exploit_single | Exploits a single ip, exploit is based on the given operating system. | jackal/scripts/eternalblue.py | def exploit_single(self, ip, operating_system):
"""
Exploits a single ip, exploit is based on the given operating system.
"""
result = None
if "Windows Server 2008" in operating_system or "Windows 7" in operating_system:
result = subprocess.run(['python2', os.path... | def exploit_single(self, ip, operating_system):
"""
Exploits a single ip, exploit is based on the given operating system.
"""
result = None
if "Windows Server 2008" in operating_system or "Windows 7" in operating_system:
result = subprocess.run(['python2', os.path... | [
"Exploits",
"a",
"single",
"ip",
"exploit",
"is",
"based",
"on",
"the",
"given",
"operating",
"system",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/eternalblue.py#L189-L200 | [
"def",
"exploit_single",
"(",
"self",
",",
"ip",
",",
"operating_system",
")",
":",
"result",
"=",
"None",
"if",
"\"Windows Server 2008\"",
"in",
"operating_system",
"or",
"\"Windows 7\"",
"in",
"operating_system",
":",
"result",
"=",
"subprocess",
".",
"run",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | epoll_poller | A poller which uses epoll(), supported on Linux 2.5.44 and newer
Borrowed from here:
https://github.com/m13253/python-asyncore-epoll/blob/master/asyncore_epoll.py#L200 | asyncore_wsgi/__init__.py | def epoll_poller(timeout=0.0, map=None):
"""
A poller which uses epoll(), supported on Linux 2.5.44 and newer
Borrowed from here:
https://github.com/m13253/python-asyncore-epoll/blob/master/asyncore_epoll.py#L200
"""
if map is None:
map = asyncore.socket_map
pollster = select.epoll(... | def epoll_poller(timeout=0.0, map=None):
"""
A poller which uses epoll(), supported on Linux 2.5.44 and newer
Borrowed from here:
https://github.com/m13253/python-asyncore-epoll/blob/master/asyncore_epoll.py#L200
"""
if map is None:
map = asyncore.socket_map
pollster = select.epoll(... | [
"A",
"poller",
"which",
"uses",
"epoll",
"()",
"supported",
"on",
"Linux",
"2",
".",
"5",
".",
"44",
"and",
"newer"
] | romanvm/asyncore-wsgi | python | https://github.com/romanvm/asyncore-wsgi/blob/4203f64f17aa14728742358d34839618ed808a7c/asyncore_wsgi/__init__.py#L66-L98 | [
"def",
"epoll_poller",
"(",
"timeout",
"=",
"0.0",
",",
"map",
"=",
"None",
")",
":",
"if",
"map",
"is",
"None",
":",
"map",
"=",
"asyncore",
".",
"socket_map",
"pollster",
"=",
"select",
".",
"epoll",
"(",
")",
"if",
"map",
":",
"for",
"fd",
",",
... | 4203f64f17aa14728742358d34839618ed808a7c |
valid | get_poll_func | Get the best available socket poll function
:return: poller function | asyncore_wsgi/__init__.py | def get_poll_func():
"""Get the best available socket poll function
:return: poller function
"""
if hasattr(select, 'epoll'):
poll_func = epoll_poller
elif hasattr(select, 'poll'):
poll_func = asyncore.poll2
else:
poll_func = asyncore.poll
return poll_func | def get_poll_func():
"""Get the best available socket poll function
:return: poller function
"""
if hasattr(select, 'epoll'):
poll_func = epoll_poller
elif hasattr(select, 'poll'):
poll_func = asyncore.poll2
else:
poll_func = asyncore.poll
return poll_func | [
"Get",
"the",
"best",
"available",
"socket",
"poll",
"function",
":",
"return",
":",
"poller",
"function"
] | romanvm/asyncore-wsgi | python | https://github.com/romanvm/asyncore-wsgi/blob/4203f64f17aa14728742358d34839618ed808a7c/asyncore_wsgi/__init__.py#L101-L112 | [
"def",
"get_poll_func",
"(",
")",
":",
"if",
"hasattr",
"(",
"select",
",",
"'epoll'",
")",
":",
"poll_func",
"=",
"epoll_poller",
"elif",
"hasattr",
"(",
"select",
",",
"'poll'",
")",
":",
"poll_func",
"=",
"asyncore",
".",
"poll2",
"else",
":",
"poll_f... | 4203f64f17aa14728742358d34839618ed808a7c |
valid | make_server | Create server instance with an optional WebSocket handler
For pure WebSocket server ``app`` may be ``None`` but an attempt to access
any path other than ``ws_path`` will cause server error.
:param host: hostname or IP
:type host: str
:param port: server port
:type port: int
:param app:... | asyncore_wsgi/__init__.py | def make_server(host, port, app=None,
server_class=AsyncWsgiServer,
handler_class=AsyncWsgiHandler,
ws_handler_class=None,
ws_path='/ws'):
"""Create server instance with an optional WebSocket handler
For pure WebSocket server ``app`` may be ``None... | def make_server(host, port, app=None,
server_class=AsyncWsgiServer,
handler_class=AsyncWsgiHandler,
ws_handler_class=None,
ws_path='/ws'):
"""Create server instance with an optional WebSocket handler
For pure WebSocket server ``app`` may be ``None... | [
"Create",
"server",
"instance",
"with",
"an",
"optional",
"WebSocket",
"handler"
] | romanvm/asyncore-wsgi | python | https://github.com/romanvm/asyncore-wsgi/blob/4203f64f17aa14728742358d34839618ed808a7c/asyncore_wsgi/__init__.py#L348-L374 | [
"def",
"make_server",
"(",
"host",
",",
"port",
",",
"app",
"=",
"None",
",",
"server_class",
"=",
"AsyncWsgiServer",
",",
"handler_class",
"=",
"AsyncWsgiHandler",
",",
"ws_handler_class",
"=",
"None",
",",
"ws_path",
"=",
"'/ws'",
")",
":",
"handler_class",
... | 4203f64f17aa14728742358d34839618ed808a7c |
valid | AsyncWsgiServer.poll_once | Poll active sockets once
This method can be used to allow aborting server polling loop
on some condition.
:param timeout: polling timeout | asyncore_wsgi/__init__.py | def poll_once(self, timeout=0.0):
"""
Poll active sockets once
This method can be used to allow aborting server polling loop
on some condition.
:param timeout: polling timeout
"""
if self._map:
self._poll_func(timeout, self._map) | def poll_once(self, timeout=0.0):
"""
Poll active sockets once
This method can be used to allow aborting server polling loop
on some condition.
:param timeout: polling timeout
"""
if self._map:
self._poll_func(timeout, self._map) | [
"Poll",
"active",
"sockets",
"once"
] | romanvm/asyncore-wsgi | python | https://github.com/romanvm/asyncore-wsgi/blob/4203f64f17aa14728742358d34839618ed808a7c/asyncore_wsgi/__init__.py#L307-L317 | [
"def",
"poll_once",
"(",
"self",
",",
"timeout",
"=",
"0.0",
")",
":",
"if",
"self",
".",
"_map",
":",
"self",
".",
"_poll_func",
"(",
"timeout",
",",
"self",
".",
"_map",
")"
] | 4203f64f17aa14728742358d34839618ed808a7c |
valid | AsyncWsgiServer.serve_forever | Start serving HTTP requests
This method blocks the current thread.
:param poll_interval: polling timeout
:return: | asyncore_wsgi/__init__.py | def serve_forever(self, poll_interval=0.5):
"""
Start serving HTTP requests
This method blocks the current thread.
:param poll_interval: polling timeout
:return:
"""
logger.info('Starting server on {}:{}...'.format(
self.server_name, self.server_port... | def serve_forever(self, poll_interval=0.5):
"""
Start serving HTTP requests
This method blocks the current thread.
:param poll_interval: polling timeout
:return:
"""
logger.info('Starting server on {}:{}...'.format(
self.server_name, self.server_port... | [
"Start",
"serving",
"HTTP",
"requests"
] | romanvm/asyncore-wsgi | python | https://github.com/romanvm/asyncore-wsgi/blob/4203f64f17aa14728742358d34839618ed808a7c/asyncore_wsgi/__init__.py#L323-L341 | [
"def",
"serve_forever",
"(",
"self",
",",
"poll_interval",
"=",
"0.5",
")",
":",
"logger",
".",
"info",
"(",
"'Starting server on {}:{}...'",
".",
"format",
"(",
"self",
".",
"server_name",
",",
"self",
".",
"server_port",
")",
")",
"while",
"True",
":",
"... | 4203f64f17aa14728742358d34839618ed808a7c |
valid | read_labels | read label files. Format: ent label | kgekit/io.py | def read_labels(filename, delimiter=DEFAULT_DELIMITER):
"""read label files. Format: ent label"""
_assert_good_file(filename)
with open(filename) as f:
labels = [_label_processing(l, delimiter) for l in f]
return labels | def read_labels(filename, delimiter=DEFAULT_DELIMITER):
"""read label files. Format: ent label"""
_assert_good_file(filename)
with open(filename) as f:
labels = [_label_processing(l, delimiter) for l in f]
return labels | [
"read",
"label",
"files",
".",
"Format",
":",
"ent",
"label"
] | fantasticfears/kgekit | python | https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L60-L65 | [
"def",
"read_labels",
"(",
"filename",
",",
"delimiter",
"=",
"DEFAULT_DELIMITER",
")",
":",
"_assert_good_file",
"(",
"filename",
")",
"with",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"labels",
"=",
"[",
"_label_processing",
"(",
"l",
",",
"delimiter",... | 5e464e1fc3ae9c7e216f6dd94f879a967d065247 |
valid | write_index_translation | write triples into a translation file. | kgekit/io.py | def write_index_translation(translation_filename, entity_ids, relation_ids):
"""write triples into a translation file."""
translation = triple_pb.Translation()
entities = []
for name, index in entity_ids.items():
translation.entities.add(element=name, index=index)
relations = []
for name... | def write_index_translation(translation_filename, entity_ids, relation_ids):
"""write triples into a translation file."""
translation = triple_pb.Translation()
entities = []
for name, index in entity_ids.items():
translation.entities.add(element=name, index=index)
relations = []
for name... | [
"write",
"triples",
"into",
"a",
"translation",
"file",
"."
] | fantasticfears/kgekit | python | https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L67-L77 | [
"def",
"write_index_translation",
"(",
"translation_filename",
",",
"entity_ids",
",",
"relation_ids",
")",
":",
"translation",
"=",
"triple_pb",
".",
"Translation",
"(",
")",
"entities",
"=",
"[",
"]",
"for",
"name",
",",
"index",
"in",
"entity_ids",
".",
"it... | 5e464e1fc3ae9c7e216f6dd94f879a967d065247 |
valid | write_triples | write triples to file. | kgekit/io.py | def write_triples(filename, triples, delimiter=DEFAULT_DELIMITER, triple_order="hrt"):
"""write triples to file."""
with open(filename, 'w') as f:
for t in triples:
line = t.serialize(delimiter, triple_order)
f.write(line + "\n") | def write_triples(filename, triples, delimiter=DEFAULT_DELIMITER, triple_order="hrt"):
"""write triples to file."""
with open(filename, 'w') as f:
for t in triples:
line = t.serialize(delimiter, triple_order)
f.write(line + "\n") | [
"write",
"triples",
"to",
"file",
"."
] | fantasticfears/kgekit | python | https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L79-L84 | [
"def",
"write_triples",
"(",
"filename",
",",
"triples",
",",
"delimiter",
"=",
"DEFAULT_DELIMITER",
",",
"triple_order",
"=",
"\"hrt\"",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'w'",
")",
"as",
"f",
":",
"for",
"t",
"in",
"triples",
":",
"line"... | 5e464e1fc3ae9c7e216f6dd94f879a967d065247 |
valid | read_translation | Returns protobuf mapcontainer. Read from translation file. | kgekit/io.py | def read_translation(filename):
"""Returns protobuf mapcontainer. Read from translation file."""
translation = triple_pb.Translation()
with open(filename, "rb") as f:
translation.ParseFromString(f.read())
def unwrap_translation_units(units):
for u in units: yield u.element, u.index
... | def read_translation(filename):
"""Returns protobuf mapcontainer. Read from translation file."""
translation = triple_pb.Translation()
with open(filename, "rb") as f:
translation.ParseFromString(f.read())
def unwrap_translation_units(units):
for u in units: yield u.element, u.index
... | [
"Returns",
"protobuf",
"mapcontainer",
".",
"Read",
"from",
"translation",
"file",
"."
] | fantasticfears/kgekit | python | https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L86-L96 | [
"def",
"read_translation",
"(",
"filename",
")",
":",
"translation",
"=",
"triple_pb",
".",
"Translation",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"f",
":",
"translation",
".",
"ParseFromString",
"(",
"f",
".",
"read",
"(",
"... | 5e464e1fc3ae9c7e216f6dd94f879a967d065247 |
valid | read_openke_translation | Returns map with entity or relations from plain text. | kgekit/io.py | def read_openke_translation(filename, delimiter='\t', entity_first=True):
"""Returns map with entity or relations from plain text."""
result = {}
with open(filename, "r") as f:
_ = next(f) # pass the total entry number
for line in f:
line_slice = line.rstrip().split(delimiter)
... | def read_openke_translation(filename, delimiter='\t', entity_first=True):
"""Returns map with entity or relations from plain text."""
result = {}
with open(filename, "r") as f:
_ = next(f) # pass the total entry number
for line in f:
line_slice = line.rstrip().split(delimiter)
... | [
"Returns",
"map",
"with",
"entity",
"or",
"relations",
"from",
"plain",
"text",
"."
] | fantasticfears/kgekit | python | https://github.com/fantasticfears/kgekit/blob/5e464e1fc3ae9c7e216f6dd94f879a967d065247/kgekit/io.py#L98-L109 | [
"def",
"read_openke_translation",
"(",
"filename",
",",
"delimiter",
"=",
"'\\t'",
",",
"entity_first",
"=",
"True",
")",
":",
"result",
"=",
"{",
"}",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"_",
"=",
"next",
"(",
"f",
")... | 5e464e1fc3ae9c7e216f6dd94f879a967d065247 |
valid | overview | Prints an overview of the tags of the hosts. | jackal/scripts/hosts.py | def overview():
"""
Prints an overview of the tags of the hosts.
"""
doc = Host()
search = doc.search()
search.aggs.bucket('tag_count', 'terms', field='tags', order={'_count': 'desc'}, size=100)
response = search.execute()
print_line("{0:<25} {1}".format('Tag', 'Count'))
print_li... | def overview():
"""
Prints an overview of the tags of the hosts.
"""
doc = Host()
search = doc.search()
search.aggs.bucket('tag_count', 'terms', field='tags', order={'_count': 'desc'}, size=100)
response = search.execute()
print_line("{0:<25} {1}".format('Tag', 'Count'))
print_li... | [
"Prints",
"an",
"overview",
"of",
"the",
"tags",
"of",
"the",
"hosts",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/hosts.py#L31-L42 | [
"def",
"overview",
"(",
")",
":",
"doc",
"=",
"Host",
"(",
")",
"search",
"=",
"doc",
".",
"search",
"(",
")",
"search",
".",
"aggs",
".",
"bucket",
"(",
"'tag_count'",
",",
"'terms'",
",",
"field",
"=",
"'tags'",
",",
"order",
"=",
"{",
"'_count'"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | main | Main credentials tool | jackal/scripts/credentials.py | def main():
"""
Main credentials tool
"""
cred_search = CredentialSearch()
arg = argparse.ArgumentParser(parents=[cred_search.argparser], conflict_handler='resolve')
arg.add_argument('-c', '--count', help="Only show the number of results", action="store_true")
arguments = arg.parse_args(... | def main():
"""
Main credentials tool
"""
cred_search = CredentialSearch()
arg = argparse.ArgumentParser(parents=[cred_search.argparser], conflict_handler='resolve')
arg.add_argument('-c', '--count', help="Only show the number of results", action="store_true")
arguments = arg.parse_args(... | [
"Main",
"credentials",
"tool"
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/credentials.py#L6-L20 | [
"def",
"main",
"(",
")",
":",
"cred_search",
"=",
"CredentialSearch",
"(",
")",
"arg",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"parents",
"=",
"[",
"cred_search",
".",
"argparser",
"]",
",",
"conflict_handler",
"=",
"'resolve'",
")",
"arg",
".",
"add_... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | overview | Provides an overview of the duplicate credentials. | jackal/scripts/credentials.py | def overview():
"""
Provides an overview of the duplicate credentials.
"""
search = Credential.search()
search.aggs.bucket('password_count', 'terms', field='secret', order={'_count': 'desc'}, size=20)\
.metric('username_count', 'cardinality', field='username') \
.metric('host_cou... | def overview():
"""
Provides an overview of the duplicate credentials.
"""
search = Credential.search()
search.aggs.bucket('password_count', 'terms', field='secret', order={'_count': 'desc'}, size=20)\
.metric('username_count', 'cardinality', field='username') \
.metric('host_cou... | [
"Provides",
"an",
"overview",
"of",
"the",
"duplicate",
"credentials",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/credentials.py#L23-L40 | [
"def",
"overview",
"(",
")",
":",
"search",
"=",
"Credential",
".",
"search",
"(",
")",
"search",
".",
"aggs",
".",
"bucket",
"(",
"'password_count'",
",",
"'terms'",
",",
"field",
"=",
"'secret'",
",",
"order",
"=",
"{",
"'_count'",
":",
"'desc'",
"}"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | SimpleQuery.process | Register nemo and parses annotations
.. note:: Process parses the annotation and extends informations about the target URNs by retrieving resource in range
:param nemo: Nemo | flask_nemo/query/interface.py | def process(self, nemo):
""" Register nemo and parses annotations
.. note:: Process parses the annotation and extends informations about the target URNs by retrieving resource in range
:param nemo: Nemo
"""
self.__nemo__ = nemo
for annotation in self.__annotations__:
... | def process(self, nemo):
""" Register nemo and parses annotations
.. note:: Process parses the annotation and extends informations about the target URNs by retrieving resource in range
:param nemo: Nemo
"""
self.__nemo__ = nemo
for annotation in self.__annotations__:
... | [
"Register",
"nemo",
"and",
"parses",
"annotations"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/query/interface.py#L42-L56 | [
"def",
"process",
"(",
"self",
",",
"nemo",
")",
":",
"self",
".",
"__nemo__",
"=",
"nemo",
"for",
"annotation",
"in",
"self",
".",
"__annotations__",
":",
"annotation",
".",
"target",
".",
"expanded",
"=",
"frozenset",
"(",
"self",
".",
"__getinnerreffs__... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | pipe_worker | Starts the loop to provide the data from jackal. | jackal/scripts/named_pipes.py | def pipe_worker(pipename, filename, object_type, query, format_string, unique=False):
"""
Starts the loop to provide the data from jackal.
"""
print_notification("[{}] Starting pipe".format(pipename))
object_type = object_type()
try:
while True:
uniq = set()
#... | def pipe_worker(pipename, filename, object_type, query, format_string, unique=False):
"""
Starts the loop to provide the data from jackal.
"""
print_notification("[{}] Starting pipe".format(pipename))
object_type = object_type()
try:
while True:
uniq = set()
#... | [
"Starts",
"the",
"loop",
"to",
"provide",
"the",
"data",
"from",
"jackal",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/named_pipes.py#L13-L47 | [
"def",
"pipe_worker",
"(",
"pipename",
",",
"filename",
",",
"object_type",
",",
"query",
",",
"format_string",
",",
"unique",
"=",
"False",
")",
":",
"print_notification",
"(",
"\"[{}] Starting pipe\"",
".",
"format",
"(",
"pipename",
")",
")",
"object_type",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | create_query | Creates a search query based on the section of the config file. | jackal/scripts/named_pipes.py | def create_query(section):
"""
Creates a search query based on the section of the config file.
"""
query = {}
if 'ports' in section:
query['ports'] = [section['ports']]
if 'up' in section:
query['up'] = bool(section['up'])
if 'search' in section:
query['search'] ... | def create_query(section):
"""
Creates a search query based on the section of the config file.
"""
query = {}
if 'ports' in section:
query['ports'] = [section['ports']]
if 'up' in section:
query['up'] = bool(section['up'])
if 'search' in section:
query['search'] ... | [
"Creates",
"a",
"search",
"query",
"based",
"on",
"the",
"section",
"of",
"the",
"config",
"file",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/named_pipes.py#L50-L67 | [
"def",
"create_query",
"(",
"section",
")",
":",
"query",
"=",
"{",
"}",
"if",
"'ports'",
"in",
"section",
":",
"query",
"[",
"'ports'",
"]",
"=",
"[",
"section",
"[",
"'ports'",
"]",
"]",
"if",
"'up'",
"in",
"section",
":",
"query",
"[",
"'up'",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | create_pipe_workers | Creates the workers based on the given configfile to provide named pipes in the directory. | jackal/scripts/named_pipes.py | def create_pipe_workers(configfile, directory):
"""
Creates the workers based on the given configfile to provide named pipes in the directory.
"""
type_map = {'service': ServiceSearch,
'host': HostSearch, 'range': RangeSearch,
'user': UserSearch}
config = configpa... | def create_pipe_workers(configfile, directory):
"""
Creates the workers based on the given configfile to provide named pipes in the directory.
"""
type_map = {'service': ServiceSearch,
'host': HostSearch, 'range': RangeSearch,
'user': UserSearch}
config = configpa... | [
"Creates",
"the",
"workers",
"based",
"on",
"the",
"given",
"configfile",
"to",
"provide",
"named",
"pipes",
"in",
"the",
"directory",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/named_pipes.py#L70-L96 | [
"def",
"create_pipe_workers",
"(",
"configfile",
",",
"directory",
")",
":",
"type_map",
"=",
"{",
"'service'",
":",
"ServiceSearch",
",",
"'host'",
":",
"HostSearch",
",",
"'range'",
":",
"RangeSearch",
",",
"'user'",
":",
"UserSearch",
"}",
"config",
"=",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | main | Loads the config and handles the workers. | jackal/scripts/named_pipes.py | def main():
"""
Loads the config and handles the workers.
"""
config = Config()
pipes_dir = config.get('pipes', 'directory')
pipes_config = config.get('pipes', 'config_file')
pipes_config_path = os.path.join(config.config_dir, pipes_config)
if not os.path.exists(pipes_config_path):
... | def main():
"""
Loads the config and handles the workers.
"""
config = Config()
pipes_dir = config.get('pipes', 'directory')
pipes_config = config.get('pipes', 'config_file')
pipes_config_path = os.path.join(config.config_dir, pipes_config)
if not os.path.exists(pipes_config_path):
... | [
"Loads",
"the",
"config",
"and",
"handles",
"the",
"workers",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/named_pipes.py#L99-L123 | [
"def",
"main",
"(",
")",
":",
"config",
"=",
"Config",
"(",
")",
"pipes_dir",
"=",
"config",
".",
"get",
"(",
"'pipes'",
",",
"'directory'",
")",
"pipes_config",
"=",
"config",
".",
"get",
"(",
"'pipes'",
",",
"'config_file'",
")",
"pipes_config_path",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | f_i18n_iso | Replace isocode by its language equivalent
:param isocode: Three character long language code
:param lang: Lang in which to return the language name
:return: Full Text Language Name | flask_nemo/filters.py | def f_i18n_iso(isocode, lang="eng"):
""" Replace isocode by its language equivalent
:param isocode: Three character long language code
:param lang: Lang in which to return the language name
:return: Full Text Language Name
"""
if lang not in flask_nemo._data.AVAILABLE_TRANSLATIONS:
lang... | def f_i18n_iso(isocode, lang="eng"):
""" Replace isocode by its language equivalent
:param isocode: Three character long language code
:param lang: Lang in which to return the language name
:return: Full Text Language Name
"""
if lang not in flask_nemo._data.AVAILABLE_TRANSLATIONS:
lang... | [
"Replace",
"isocode",
"by",
"its",
"language",
"equivalent"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/filters.py#L28-L41 | [
"def",
"f_i18n_iso",
"(",
"isocode",
",",
"lang",
"=",
"\"eng\"",
")",
":",
"if",
"lang",
"not",
"in",
"flask_nemo",
".",
"_data",
".",
"AVAILABLE_TRANSLATIONS",
":",
"lang",
"=",
"\"eng\"",
"try",
":",
"return",
"flask_nemo",
".",
"_data",
".",
"ISOCODES"... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | f_hierarchical_passages | A function to construct a hierarchical dictionary representing the different citation layers of a text
:param reffs: passage references with human-readable equivalent
:type reffs: [(str, str)]
:param citation: Main Citation
:type citation: Citation
:return: nested dictionary representing where keys... | flask_nemo/filters.py | def f_hierarchical_passages(reffs, citation):
""" A function to construct a hierarchical dictionary representing the different citation layers of a text
:param reffs: passage references with human-readable equivalent
:type reffs: [(str, str)]
:param citation: Main Citation
:type citation: Citation
... | def f_hierarchical_passages(reffs, citation):
""" A function to construct a hierarchical dictionary representing the different citation layers of a text
:param reffs: passage references with human-readable equivalent
:type reffs: [(str, str)]
:param citation: Main Citation
:type citation: Citation
... | [
"A",
"function",
"to",
"construct",
"a",
"hierarchical",
"dictionary",
"representing",
"the",
"different",
"citation",
"layers",
"of",
"a",
"text"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/filters.py#L55-L71 | [
"def",
"f_hierarchical_passages",
"(",
"reffs",
",",
"citation",
")",
":",
"d",
"=",
"OrderedDict",
"(",
")",
"levels",
"=",
"[",
"x",
"for",
"x",
"in",
"citation",
"]",
"for",
"cit",
",",
"name",
"in",
"reffs",
":",
"ref",
"=",
"cit",
".",
"split",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | f_i18n_citation_type | Take a string of form %citation_type|passage% and format it for human
:param string: String of formation %citation_type|passage%
:param lang: Language to translate to
:return: Human Readable string
.. note :: To Do : Use i18n tools and provide real i18n | flask_nemo/filters.py | def f_i18n_citation_type(string, lang="eng"):
""" Take a string of form %citation_type|passage% and format it for human
:param string: String of formation %citation_type|passage%
:param lang: Language to translate to
:return: Human Readable string
.. note :: To Do : Use i18n tools and provide real... | def f_i18n_citation_type(string, lang="eng"):
""" Take a string of form %citation_type|passage% and format it for human
:param string: String of formation %citation_type|passage%
:param lang: Language to translate to
:return: Human Readable string
.. note :: To Do : Use i18n tools and provide real... | [
"Take",
"a",
"string",
"of",
"form",
"%citation_type|passage%",
"and",
"format",
"it",
"for",
"human"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/filters.py#L83-L93 | [
"def",
"f_i18n_citation_type",
"(",
"string",
",",
"lang",
"=",
"\"eng\"",
")",
":",
"s",
"=",
"\" \"",
".",
"join",
"(",
"string",
".",
"strip",
"(",
"\"%\"",
")",
".",
"split",
"(",
"\"|\"",
")",
")",
"return",
"s",
".",
"capitalize",
"(",
")"
] | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | f_annotation_filter | Annotation filtering filter
:param annotations: List of annotations
:type annotations: [AnnotationResource]
:param type_uri: URI Type on which to filter
:type type_uri: str
:param number: Number of the annotation to return
:type number: int
:return: Annotation(s) matching the request
:r... | flask_nemo/filters.py | def f_annotation_filter(annotations, type_uri, number):
""" Annotation filtering filter
:param annotations: List of annotations
:type annotations: [AnnotationResource]
:param type_uri: URI Type on which to filter
:type type_uri: str
:param number: Number of the annotation to return
:type nu... | def f_annotation_filter(annotations, type_uri, number):
""" Annotation filtering filter
:param annotations: List of annotations
:type annotations: [AnnotationResource]
:param type_uri: URI Type on which to filter
:type type_uri: str
:param number: Number of the annotation to return
:type nu... | [
"Annotation",
"filtering",
"filter"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/filters.py#L96-L117 | [
"def",
"f_annotation_filter",
"(",
"annotations",
",",
"type_uri",
",",
"number",
")",
":",
"filtered",
"=",
"[",
"annotation",
"for",
"annotation",
"in",
"annotations",
"if",
"annotation",
".",
"type_uri",
"==",
"type_uri",
"]",
"number",
"=",
"min",
"(",
"... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | NotesAgent.scan | Scans the local files for changes (either additions, modifications or
deletions) and reports them to the `store` object, which is expected to
implement the :class:`pysyncml.Store` interface. | pysyncml/cli/notes.py | def scan(self, store):
'''
Scans the local files for changes (either additions, modifications or
deletions) and reports them to the `store` object, which is expected to
implement the :class:`pysyncml.Store` interface.
'''
# steps:
# 1) generate a table of all store files, with filename,
... | def scan(self, store):
'''
Scans the local files for changes (either additions, modifications or
deletions) and reports them to the `store` object, which is expected to
implement the :class:`pysyncml.Store` interface.
'''
# steps:
# 1) generate a table of all store files, with filename,
... | [
"Scans",
"the",
"local",
"files",
"for",
"changes",
"(",
"either",
"additions",
"modifications",
"or",
"deletions",
")",
"and",
"reports",
"them",
"to",
"the",
"store",
"object",
"which",
"is",
"expected",
"to",
"implement",
"the",
":",
"class",
":",
"pysync... | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/cli/notes.py#L254-L369 | [
"def",
"scan",
"(",
"self",
",",
"store",
")",
":",
"# steps:",
"# 1) generate a table of all store files, with filename,",
"# inode, checksum",
"# 2) generate a table of all current files, with filename,",
"# inode, checksum",
"# 3) iterate over all stored values and find ... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | check_service | Connect to a service to see if it is a http or https server. | jackal/scripts/head_scanner.py | def check_service(service):
"""
Connect to a service to see if it is a http or https server.
"""
# Try HTTP
service.add_tag('header_scan')
http = False
try:
result = requests.head('http://{}:{}'.format(service.address, service.port), timeout=1)
print_success("Found http s... | def check_service(service):
"""
Connect to a service to see if it is a http or https server.
"""
# Try HTTP
service.add_tag('header_scan')
http = False
try:
result = requests.head('http://{}:{}'.format(service.address, service.port), timeout=1)
print_success("Found http s... | [
"Connect",
"to",
"a",
"service",
"to",
"see",
"if",
"it",
"is",
"a",
"http",
"or",
"https",
"server",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/head_scanner.py#L13-L44 | [
"def",
"check_service",
"(",
"service",
")",
":",
"# Try HTTP",
"service",
".",
"add_tag",
"(",
"'header_scan'",
")",
"http",
"=",
"False",
"try",
":",
"result",
"=",
"requests",
".",
"head",
"(",
"'http://{}:{}'",
".",
"format",
"(",
"service",
".",
"addr... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | main | Retrieves services starts check_service in a gevent pool of 100. | jackal/scripts/head_scanner.py | def main():
"""
Retrieves services starts check_service in a gevent pool of 100.
"""
search = ServiceSearch()
services = search.get_services(up=True, tags=['!header_scan'])
print_notification("Scanning {} services".format(len(services)))
# Disable the insecure request warning
urllib... | def main():
"""
Retrieves services starts check_service in a gevent pool of 100.
"""
search = ServiceSearch()
services = search.get_services(up=True, tags=['!header_scan'])
print_notification("Scanning {} services".format(len(services)))
# Disable the insecure request warning
urllib... | [
"Retrieves",
"services",
"starts",
"check_service",
"in",
"a",
"gevent",
"pool",
"of",
"100",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/head_scanner.py#L46-L66 | [
"def",
"main",
"(",
")",
":",
"search",
"=",
"ServiceSearch",
"(",
")",
"services",
"=",
"search",
".",
"get_services",
"(",
"up",
"=",
"True",
",",
"tags",
"=",
"[",
"'!header_scan'",
"]",
")",
"print_notification",
"(",
"\"Scanning {} services\"",
".",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | import_nmap | Imports the given nmap result. | jackal/scripts/nmap.py | def import_nmap(result, tag, check_function=all_hosts, import_services=False):
"""
Imports the given nmap result.
"""
host_search = HostSearch(arguments=False)
service_search = ServiceSearch()
parser = NmapParser()
report = parser.parse_fromstring(result)
imported_hosts = 0
impor... | def import_nmap(result, tag, check_function=all_hosts, import_services=False):
"""
Imports the given nmap result.
"""
host_search = HostSearch(arguments=False)
service_search = ServiceSearch()
parser = NmapParser()
report = parser.parse_fromstring(result)
imported_hosts = 0
impor... | [
"Imports",
"the",
"given",
"nmap",
"result",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L34-L84 | [
"def",
"import_nmap",
"(",
"result",
",",
"tag",
",",
"check_function",
"=",
"all_hosts",
",",
"import_services",
"=",
"False",
")",
":",
"host_search",
"=",
"HostSearch",
"(",
"arguments",
"=",
"False",
")",
"service_search",
"=",
"ServiceSearch",
"(",
")",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | nmap | Start an nmap process with the given args on the given ips. | jackal/scripts/nmap.py | def nmap(nmap_args, ips):
"""
Start an nmap process with the given args on the given ips.
"""
config = Config()
arguments = ['nmap', '-Pn']
arguments.extend(ips)
arguments.extend(nmap_args)
output_file = ''
now = datetime.datetime.now()
if not '-oA' in nmap_args:
outp... | def nmap(nmap_args, ips):
"""
Start an nmap process with the given args on the given ips.
"""
config = Config()
arguments = ['nmap', '-Pn']
arguments.extend(ips)
arguments.extend(nmap_args)
output_file = ''
now = datetime.datetime.now()
if not '-oA' in nmap_args:
outp... | [
"Start",
"an",
"nmap",
"process",
"with",
"the",
"given",
"args",
"on",
"the",
"given",
"ips",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L105-L130 | [
"def",
"nmap",
"(",
"nmap_args",
",",
"ips",
")",
":",
"config",
"=",
"Config",
"(",
")",
"arguments",
"=",
"[",
"'nmap'",
",",
"'-Pn'",
"]",
"arguments",
".",
"extend",
"(",
"ips",
")",
"arguments",
".",
"extend",
"(",
"nmap_args",
")",
"output_file",... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | nmap_discover | This function retrieves ranges from jackal
Uses two functions of nmap to find hosts:
ping: icmp / arp pinging of targets
lookup: reverse dns lookup | jackal/scripts/nmap.py | def nmap_discover():
"""
This function retrieves ranges from jackal
Uses two functions of nmap to find hosts:
ping: icmp / arp pinging of targets
lookup: reverse dns lookup
"""
rs = RangeSearch()
rs_parser = rs.argparser
arg = argparse.ArgumentParser(parents... | def nmap_discover():
"""
This function retrieves ranges from jackal
Uses two functions of nmap to find hosts:
ping: icmp / arp pinging of targets
lookup: reverse dns lookup
"""
rs = RangeSearch()
rs_parser = rs.argparser
arg = argparse.ArgumentParser(parents... | [
"This",
"function",
"retrieves",
"ranges",
"from",
"jackal",
"Uses",
"two",
"functions",
"of",
"nmap",
"to",
"find",
"hosts",
":",
"ping",
":",
"icmp",
"/",
"arp",
"pinging",
"of",
"targets",
"lookup",
":",
"reverse",
"dns",
"lookup"
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L133-L174 | [
"def",
"nmap_discover",
"(",
")",
":",
"rs",
"=",
"RangeSearch",
"(",
")",
"rs_parser",
"=",
"rs",
".",
"argparser",
"arg",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"parents",
"=",
"[",
"rs_parser",
"]",
",",
"conflict_handler",
"=",
"'resolve'",
")",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | nmap_scan | Scans the given hosts with nmap. | jackal/scripts/nmap.py | def nmap_scan():
"""
Scans the given hosts with nmap.
"""
# Create the search and config objects
hs = HostSearch()
config = Config()
# Static options to be able to figure out what options to use depending on the input the user gives.
nmap_types = ['top10', 'top100', 'custom', 'top10... | def nmap_scan():
"""
Scans the given hosts with nmap.
"""
# Create the search and config objects
hs = HostSearch()
config = Config()
# Static options to be able to figure out what options to use depending on the input the user gives.
nmap_types = ['top10', 'top100', 'custom', 'top10... | [
"Scans",
"the",
"given",
"hosts",
"with",
"nmap",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L177-L225 | [
"def",
"nmap_scan",
"(",
")",
":",
"# Create the search and config objects",
"hs",
"=",
"HostSearch",
"(",
")",
"config",
"=",
"Config",
"(",
")",
"# Static options to be able to figure out what options to use depending on the input the user gives.",
"nmap_types",
"=",
"[",
"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | nmap_smb_vulnscan | Scans available smb services in the database for smb signing and ms17-010. | jackal/scripts/nmap.py | def nmap_smb_vulnscan():
"""
Scans available smb services in the database for smb signing and ms17-010.
"""
service_search = ServiceSearch()
services = service_search.get_services(ports=['445'], tags=['!smb_vulnscan'], up=True)
services = [service for service in services]
service_dict = ... | def nmap_smb_vulnscan():
"""
Scans available smb services in the database for smb signing and ms17-010.
"""
service_search = ServiceSearch()
services = service_search.get_services(ports=['445'], tags=['!smb_vulnscan'], up=True)
services = [service for service in services]
service_dict = ... | [
"Scans",
"available",
"smb",
"services",
"in",
"the",
"database",
"for",
"smb",
"signing",
"and",
"ms17",
"-",
"010",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L228-L267 | [
"def",
"nmap_smb_vulnscan",
"(",
")",
":",
"service_search",
"=",
"ServiceSearch",
"(",
")",
"services",
"=",
"service_search",
".",
"get_services",
"(",
"ports",
"=",
"[",
"'445'",
"]",
",",
"tags",
"=",
"[",
"'!smb_vulnscan'",
"]",
",",
"up",
"=",
"True"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | os_discovery | Performs os (and domain) discovery of smb hosts. | jackal/scripts/nmap.py | def os_discovery():
"""
Performs os (and domain) discovery of smb hosts.
"""
hs = HostSearch()
hosts = hs.get_hosts(ports=[445], tags=['!nmap_os'])
# TODO fix filter for emtpy fields.
hosts = [host for host in hosts if not host.os]
host_dict = {}
for host in hosts:
hos... | def os_discovery():
"""
Performs os (and domain) discovery of smb hosts.
"""
hs = HostSearch()
hosts = hs.get_hosts(ports=[445], tags=['!nmap_os'])
# TODO fix filter for emtpy fields.
hosts = [host for host in hosts if not host.os]
host_dict = {}
for host in hosts:
hos... | [
"Performs",
"os",
"(",
"and",
"domain",
")",
"discovery",
"of",
"smb",
"hosts",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/nmap.py#L270-L314 | [
"def",
"os_discovery",
"(",
")",
":",
"hs",
"=",
"HostSearch",
"(",
")",
"hosts",
"=",
"hs",
".",
"get_hosts",
"(",
"ports",
"=",
"[",
"445",
"]",
",",
"tags",
"=",
"[",
"'!nmap_os'",
"]",
")",
"# TODO fix filter for emtpy fields.",
"hosts",
"=",
"[",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | overview | Function to create an overview of the services.
Will print a list of ports found an the number of times the port was seen. | jackal/scripts/services.py | def overview():
"""
Function to create an overview of the services.
Will print a list of ports found an the number of times the port was seen.
"""
search = Service.search()
search = search.filter("term", state='open')
search.aggs.bucket('port_count', 'terms', field='port', order={'_c... | def overview():
"""
Function to create an overview of the services.
Will print a list of ports found an the number of times the port was seen.
"""
search = Service.search()
search = search.filter("term", state='open')
search.aggs.bucket('port_count', 'terms', field='port', order={'_c... | [
"Function",
"to",
"create",
"an",
"overview",
"of",
"the",
"services",
".",
"Will",
"print",
"a",
"list",
"of",
"ports",
"found",
"an",
"the",
"number",
"of",
"times",
"the",
"port",
"was",
"seen",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/services.py#L21-L34 | [
"def",
"overview",
"(",
")",
":",
"search",
"=",
"Service",
".",
"search",
"(",
")",
"search",
"=",
"search",
".",
"filter",
"(",
"\"term\"",
",",
"state",
"=",
"'open'",
")",
"search",
".",
"aggs",
".",
"bucket",
"(",
"'port_count'",
",",
"'terms'",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | _plugin_endpoint_rename | Rename endpoint function name to avoid conflict when namespacing is set to true
:param fn_name: Name of the route function
:param instance: Instance bound to the function
:return: Name of the new namespaced function name | flask_nemo/__init__.py | def _plugin_endpoint_rename(fn_name, instance):
""" Rename endpoint function name to avoid conflict when namespacing is set to true
:param fn_name: Name of the route function
:param instance: Instance bound to the function
:return: Name of the new namespaced function name
"""
if instance and i... | def _plugin_endpoint_rename(fn_name, instance):
""" Rename endpoint function name to avoid conflict when namespacing is set to true
:param fn_name: Name of the route function
:param instance: Instance bound to the function
:return: Name of the new namespaced function name
"""
if instance and i... | [
"Rename",
"endpoint",
"function",
"name",
"to",
"avoid",
"conflict",
"when",
"namespacing",
"is",
"set",
"to",
"true"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L948-L958 | [
"def",
"_plugin_endpoint_rename",
"(",
"fn_name",
",",
"instance",
")",
":",
"if",
"instance",
"and",
"instance",
".",
"namespaced",
":",
"fn_name",
"=",
"\"r_{0}_{1}\"",
".",
"format",
"(",
"instance",
".",
"name",
",",
"fn_name",
"[",
"2",
":",
"]",
")",... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.get_locale | Retrieve the best matching locale using request headers
.. note:: Probably one of the thing to enhance quickly.
:rtype: str | flask_nemo/__init__.py | def get_locale(self):
""" Retrieve the best matching locale using request headers
.. note:: Probably one of the thing to enhance quickly.
:rtype: str
"""
best_match = request.accept_languages.best_match(['de', 'fr', 'en', 'la'])
if best_match is None:
if len... | def get_locale(self):
""" Retrieve the best matching locale using request headers
.. note:: Probably one of the thing to enhance quickly.
:rtype: str
"""
best_match = request.accept_languages.best_match(['de', 'fr', 'en', 'la'])
if best_match is None:
if len... | [
"Retrieve",
"the",
"best",
"matching",
"locale",
"using",
"request",
"headers"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L285-L307 | [
"def",
"get_locale",
"(",
"self",
")",
":",
"best_match",
"=",
"request",
".",
"accept_languages",
".",
"best_match",
"(",
"[",
"'de'",
",",
"'fr'",
",",
"'en'",
",",
"'la'",
"]",
")",
"if",
"best_match",
"is",
"None",
":",
"if",
"len",
"(",
"request",... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.transform | Transform input according to potentially registered XSLT
.. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called
.. note:: Due to XSLT not being able to be used twice, we rexsltise the xml at every call of xslt
.. warning:: Until a C libxslt er... | flask_nemo/__init__.py | def transform(self, work, xml, objectId, subreference=None):
""" Transform input according to potentially registered XSLT
.. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called
.. note:: Due to XSLT not being able to be used twice, we rexsltise... | def transform(self, work, xml, objectId, subreference=None):
""" Transform input according to potentially registered XSLT
.. note:: Since 1.0.0, transform takes an objectId parameter which represent the passage which is called
.. note:: Due to XSLT not being able to be used twice, we rexsltise... | [
"Transform",
"input",
"according",
"to",
"potentially",
"registered",
"XSLT"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L309-L351 | [
"def",
"transform",
"(",
"self",
",",
"work",
",",
"xml",
",",
"objectId",
",",
"subreference",
"=",
"None",
")",
":",
"# We check first that we don't have",
"if",
"str",
"(",
"objectId",
")",
"in",
"self",
".",
"_transform",
":",
"func",
"=",
"self",
".",... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.get_inventory | Request the api endpoint to retrieve information about the inventory
:return: Main Collection
:rtype: Collection | flask_nemo/__init__.py | def get_inventory(self):
""" Request the api endpoint to retrieve information about the inventory
:return: Main Collection
:rtype: Collection
"""
if self._inventory is not None:
return self._inventory
self._inventory = self.resolver.getMetadata()
ret... | def get_inventory(self):
""" Request the api endpoint to retrieve information about the inventory
:return: Main Collection
:rtype: Collection
"""
if self._inventory is not None:
return self._inventory
self._inventory = self.resolver.getMetadata()
ret... | [
"Request",
"the",
"api",
"endpoint",
"to",
"retrieve",
"information",
"about",
"the",
"inventory"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L353-L363 | [
"def",
"get_inventory",
"(",
"self",
")",
":",
"if",
"self",
".",
"_inventory",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_inventory",
"self",
".",
"_inventory",
"=",
"self",
".",
"resolver",
".",
"getMetadata",
"(",
")",
"return",
"self",
".",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.get_reffs | Retrieve and transform a list of references.
Returns the inventory collection object with its metadata and a callback function taking a level parameter \
and returning a list of strings.
:param objectId: Collection Identifier
:type objectId: str
:param subreference: Subreferenc... | flask_nemo/__init__.py | def get_reffs(self, objectId, subreference=None, collection=None, export_collection=False):
""" Retrieve and transform a list of references.
Returns the inventory collection object with its metadata and a callback function taking a level parameter \
and returning a list of strings.
:pa... | def get_reffs(self, objectId, subreference=None, collection=None, export_collection=False):
""" Retrieve and transform a list of references.
Returns the inventory collection object with its metadata and a callback function taking a level parameter \
and returning a list of strings.
:pa... | [
"Retrieve",
"and",
"transform",
"a",
"list",
"of",
"references",
"."
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L375-L402 | [
"def",
"get_reffs",
"(",
"self",
",",
"objectId",
",",
"subreference",
"=",
"None",
",",
"collection",
"=",
"None",
",",
"export_collection",
"=",
"False",
")",
":",
"if",
"collection",
"is",
"not",
"None",
":",
"text",
"=",
"collection",
"else",
":",
"t... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.get_passage | Retrieve the passage identified by the parameters
:param objectId: Collection Identifier
:type objectId: str
:param subreference: Subreference of the passage
:type subreference: str
:return: An object bearing metadata and its text
:rtype: InteractiveTextualNode | flask_nemo/__init__.py | def get_passage(self, objectId, subreference):
""" Retrieve the passage identified by the parameters
:param objectId: Collection Identifier
:type objectId: str
:param subreference: Subreference of the passage
:type subreference: str
:return: An object bearing metadata an... | def get_passage(self, objectId, subreference):
""" Retrieve the passage identified by the parameters
:param objectId: Collection Identifier
:type objectId: str
:param subreference: Subreference of the passage
:type subreference: str
:return: An object bearing metadata an... | [
"Retrieve",
"the",
"passage",
"identified",
"by",
"the",
"parameters"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L404-L419 | [
"def",
"get_passage",
"(",
"self",
",",
"objectId",
",",
"subreference",
")",
":",
"passage",
"=",
"self",
".",
"resolver",
".",
"getTextualNode",
"(",
"textId",
"=",
"objectId",
",",
"subreference",
"=",
"subreference",
",",
"metadata",
"=",
"True",
")",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.get_siblings | Get siblings of a browsed subreference
.. note:: Since 1.0.0c, there is no more prevnext dict. Nemo uses the list of original\
chunked references to retrieve next and previous, or simply relies on the resolver to get siblings\
when the subreference is not found in given original chunks.
... | flask_nemo/__init__.py | def get_siblings(self, objectId, subreference, passage):
""" Get siblings of a browsed subreference
.. note:: Since 1.0.0c, there is no more prevnext dict. Nemo uses the list of original\
chunked references to retrieve next and previous, or simply relies on the resolver to get siblings\
... | def get_siblings(self, objectId, subreference, passage):
""" Get siblings of a browsed subreference
.. note:: Since 1.0.0c, there is no more prevnext dict. Nemo uses the list of original\
chunked references to retrieve next and previous, or simply relies on the resolver to get siblings\
... | [
"Get",
"siblings",
"of",
"a",
"browsed",
"subreference"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L421-L447 | [
"def",
"get_siblings",
"(",
"self",
",",
"objectId",
",",
"subreference",
",",
"passage",
")",
":",
"reffs",
"=",
"[",
"reff",
"for",
"reff",
",",
"_",
"in",
"self",
".",
"get_reffs",
"(",
"objectId",
")",
"]",
"if",
"subreference",
"in",
"reffs",
":",... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.semantic | Generates a SEO friendly string for given collection
:param collection: Collection object to generate string for
:param parent: Current collection parent
:return: SEO/URL Friendly string | flask_nemo/__init__.py | def semantic(self, collection, parent=None):
""" Generates a SEO friendly string for given collection
:param collection: Collection object to generate string for
:param parent: Current collection parent
:return: SEO/URL Friendly string
"""
if parent is not None:
... | def semantic(self, collection, parent=None):
""" Generates a SEO friendly string for given collection
:param collection: Collection object to generate string for
:param parent: Current collection parent
:return: SEO/URL Friendly string
"""
if parent is not None:
... | [
"Generates",
"a",
"SEO",
"friendly",
"string",
"for",
"given",
"collection"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L449-L461 | [
"def",
"semantic",
"(",
"self",
",",
"collection",
",",
"parent",
"=",
"None",
")",
":",
"if",
"parent",
"is",
"not",
"None",
":",
"collections",
"=",
"parent",
".",
"parents",
"[",
":",
":",
"-",
"1",
"]",
"+",
"[",
"parent",
",",
"collection",
"]... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.make_coins | Creates a CoINS Title string from information
:param collection: Collection to create coins from
:param text: Text/Passage object
:param subreference: Subreference
:param lang: Locale information
:return: Coins HTML title value | flask_nemo/__init__.py | def make_coins(self, collection, text, subreference="", lang=None):
""" Creates a CoINS Title string from information
:param collection: Collection to create coins from
:param text: Text/Passage object
:param subreference: Subreference
:param lang: Locale information
:re... | def make_coins(self, collection, text, subreference="", lang=None):
""" Creates a CoINS Title string from information
:param collection: Collection to create coins from
:param text: Text/Passage object
:param subreference: Subreference
:param lang: Locale information
:re... | [
"Creates",
"a",
"CoINS",
"Title",
"string",
"from",
"information"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L463-L488 | [
"def",
"make_coins",
"(",
"self",
",",
"collection",
",",
"text",
",",
"subreference",
"=",
"\"\"",
",",
"lang",
"=",
"None",
")",
":",
"if",
"lang",
"is",
"None",
":",
"lang",
"=",
"self",
".",
"__default_lang__",
"return",
"\"url_ver=Z39.88-2004\"",
"\"&... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.expose_ancestors_or_children | Build an ancestor or descendant dict view based on selected information
:param member: Current Member to build for
:param collection: Collection from which we retrieved it
:param lang: Language to express data in
:return: | flask_nemo/__init__.py | def expose_ancestors_or_children(self, member, collection, lang=None):
""" Build an ancestor or descendant dict view based on selected information
:param member: Current Member to build for
:param collection: Collection from which we retrieved it
:param lang: Language to express data in... | def expose_ancestors_or_children(self, member, collection, lang=None):
""" Build an ancestor or descendant dict view based on selected information
:param member: Current Member to build for
:param collection: Collection from which we retrieved it
:param lang: Language to express data in... | [
"Build",
"an",
"ancestor",
"or",
"descendant",
"dict",
"view",
"based",
"on",
"selected",
"information"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L490-L508 | [
"def",
"expose_ancestors_or_children",
"(",
"self",
",",
"member",
",",
"collection",
",",
"lang",
"=",
"None",
")",
":",
"x",
"=",
"{",
"\"id\"",
":",
"member",
".",
"id",
",",
"\"label\"",
":",
"str",
"(",
"member",
".",
"get_label",
"(",
"lang",
")"... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.make_members | Build member list for given collection
:param collection: Collection to build dict view of for its members
:param lang: Language to express data in
:return: List of basic objects | flask_nemo/__init__.py | def make_members(self, collection, lang=None):
""" Build member list for given collection
:param collection: Collection to build dict view of for its members
:param lang: Language to express data in
:return: List of basic objects
"""
objects = sorted([
se... | def make_members(self, collection, lang=None):
""" Build member list for given collection
:param collection: Collection to build dict view of for its members
:param lang: Language to express data in
:return: List of basic objects
"""
objects = sorted([
se... | [
"Build",
"member",
"list",
"for",
"given",
"collection"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L510-L524 | [
"def",
"make_members",
"(",
"self",
",",
"collection",
",",
"lang",
"=",
"None",
")",
":",
"objects",
"=",
"sorted",
"(",
"[",
"self",
".",
"expose_ancestors_or_children",
"(",
"member",
",",
"collection",
",",
"lang",
"=",
"lang",
")",
"for",
"member",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.make_parents | Build parents list for given collection
:param collection: Collection to build dict view of for its members
:param lang: Language to express data in
:return: List of basic objects | flask_nemo/__init__.py | def make_parents(self, collection, lang=None):
""" Build parents list for given collection
:param collection: Collection to build dict view of for its members
:param lang: Language to express data in
:return: List of basic objects
"""
return [
{
... | def make_parents(self, collection, lang=None):
""" Build parents list for given collection
:param collection: Collection to build dict view of for its members
:param lang: Language to express data in
:return: List of basic objects
"""
return [
{
... | [
"Build",
"parents",
"list",
"for",
"given",
"collection"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L526-L543 | [
"def",
"make_parents",
"(",
"self",
",",
"collection",
",",
"lang",
"=",
"None",
")",
":",
"return",
"[",
"{",
"\"id\"",
":",
"member",
".",
"id",
",",
"\"label\"",
":",
"str",
"(",
"member",
".",
"get_label",
"(",
"lang",
")",
")",
",",
"\"model\"",... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.r_collections | Retrieve the top collections of the inventory
:param lang: Lang in which to express main data
:type lang: str
:return: Collections information and template
:rtype: {str: Any} | flask_nemo/__init__.py | def r_collections(self, lang=None):
""" Retrieve the top collections of the inventory
:param lang: Lang in which to express main data
:type lang: str
:return: Collections information and template
:rtype: {str: Any}
"""
collection = self.resolver.getMetadata()
... | def r_collections(self, lang=None):
""" Retrieve the top collections of the inventory
:param lang: Lang in which to express main data
:type lang: str
:return: Collections information and template
:rtype: {str: Any}
"""
collection = self.resolver.getMetadata()
... | [
"Retrieve",
"the",
"top",
"collections",
"of",
"the",
"inventory"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L553-L568 | [
"def",
"r_collections",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"collection",
"=",
"self",
".",
"resolver",
".",
"getMetadata",
"(",
")",
"return",
"{",
"\"template\"",
":",
"\"main::collection.html\"",
",",
"\"current_label\"",
":",
"collection",
"."... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.r_collection | Collection content browsing route function
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:return: Template and collections contained in given collection
:rtype: {str: Any} | flask_nemo/__init__.py | def r_collection(self, objectId, lang=None):
""" Collection content browsing route function
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:return: Template and collections contained in given col... | def r_collection(self, objectId, lang=None):
""" Collection content browsing route function
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:return: Template and collections contained in given col... | [
"Collection",
"content",
"browsing",
"route",
"function"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L570-L593 | [
"def",
"r_collection",
"(",
"self",
",",
"objectId",
",",
"lang",
"=",
"None",
")",
":",
"collection",
"=",
"self",
".",
"resolver",
".",
"getMetadata",
"(",
"objectId",
")",
"return",
"{",
"\"template\"",
":",
"\"main::collection.html\"",
",",
"\"collections\... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.r_references | Text exemplar references browsing route function
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:return: Template and required information about text with its references | flask_nemo/__init__.py | def r_references(self, objectId, lang=None):
""" Text exemplar references browsing route function
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:return: Template and required information about t... | def r_references(self, objectId, lang=None):
""" Text exemplar references browsing route function
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:return: Template and required information about t... | [
"Text",
"exemplar",
"references",
"browsing",
"route",
"function"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L595-L619 | [
"def",
"r_references",
"(",
"self",
",",
"objectId",
",",
"lang",
"=",
"None",
")",
":",
"collection",
",",
"reffs",
"=",
"self",
".",
"get_reffs",
"(",
"objectId",
"=",
"objectId",
",",
"export_collection",
"=",
"True",
")",
"return",
"{",
"\"template\"",... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.r_first_passage | Provides a redirect to the first passage of given objectId
:param objectId: Collection identifier
:type objectId: str
:return: Redirection to the first passage of given text | flask_nemo/__init__.py | def r_first_passage(self, objectId):
""" Provides a redirect to the first passage of given objectId
:param objectId: Collection identifier
:type objectId: str
:return: Redirection to the first passage of given text
"""
collection, reffs = self.get_reffs(objectId=objectId... | def r_first_passage(self, objectId):
""" Provides a redirect to the first passage of given objectId
:param objectId: Collection identifier
:type objectId: str
:return: Redirection to the first passage of given text
"""
collection, reffs = self.get_reffs(objectId=objectId... | [
"Provides",
"a",
"redirect",
"to",
"the",
"first",
"passage",
"of",
"given",
"objectId"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L621-L632 | [
"def",
"r_first_passage",
"(",
"self",
",",
"objectId",
")",
":",
"collection",
",",
"reffs",
"=",
"self",
".",
"get_reffs",
"(",
"objectId",
"=",
"objectId",
",",
"export_collection",
"=",
"True",
")",
"first",
",",
"_",
"=",
"reffs",
"[",
"0",
"]",
"... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | Nemo.r_passage | Retrieve the text of the passage
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:param subreference: Reference identifier
:type subreference: str
:return: Template, collections metadata a... | flask_nemo/__init__.py | def r_passage(self, objectId, subreference, lang=None):
""" Retrieve the text of the passage
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:param subreference: Reference identifier
:type... | def r_passage(self, objectId, subreference, lang=None):
""" Retrieve the text of the passage
:param objectId: Collection identifier
:type objectId: str
:param lang: Lang in which to express main data
:type lang: str
:param subreference: Reference identifier
:type... | [
"Retrieve",
"the",
"text",
"of",
"the",
"passage"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/__init__.py#L634-L676 | [
"def",
"r_passage",
"(",
"self",
",",
"objectId",
",",
"subreference",
",",
"lang",
"=",
"None",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"objectId",
")",
"if",
"isinstance",
"(",
"collection",
",",
"CtsWorkMetadata",
")",
":",
"edi... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.