id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
49,900 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.run | def run(self, args):
"""
Setup the environment, and run pylint.
@param args: arguments will be passed to pylint
@type args: list of string
"""
# set output stream.
if self.outputStream:
self.linter.reporter.set_output(self.outputStream)
try:
... | python | def run(self, args):
"""
Setup the environment, and run pylint.
@param args: arguments will be passed to pylint
@type args: list of string
"""
# set output stream.
if self.outputStream:
self.linter.reporter.set_output(self.outputStream)
try:
... | [
"def",
"run",
"(",
"self",
",",
"args",
")",
":",
"# set output stream.",
"if",
"self",
".",
"outputStream",
":",
"self",
".",
"linter",
".",
"reporter",
".",
"set_output",
"(",
"self",
".",
"outputStream",
")",
"try",
":",
"args",
"=",
"self",
".",
"l... | Setup the environment, and run pylint.
@param args: arguments will be passed to pylint
@type args: list of string | [
"Setup",
"the",
"environment",
"and",
"run",
"pylint",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L280-L323 |
49,901 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.prepareDiff | def prepareDiff(self):
"""
Prepare to run the checker and get diff results.
"""
self.streamForDiff = NativeStringIO()
self.linter.reporter.set_output(self.streamForDiff) | python | def prepareDiff(self):
"""
Prepare to run the checker and get diff results.
"""
self.streamForDiff = NativeStringIO()
self.linter.reporter.set_output(self.streamForDiff) | [
"def",
"prepareDiff",
"(",
"self",
")",
":",
"self",
".",
"streamForDiff",
"=",
"NativeStringIO",
"(",
")",
"self",
".",
"linter",
".",
"reporter",
".",
"set_output",
"(",
"self",
".",
"streamForDiff",
")"
] | Prepare to run the checker and get diff results. | [
"Prepare",
"to",
"run",
"the",
"checker",
"and",
"get",
"diff",
"results",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L326-L331 |
49,902 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.showDiffResults | def showDiffResults(self):
"""
Show results when diff option on.
"""
try:
oldWarnings = self.parseWarnings(self._readDiffFile())
except:
sys.stderr.write(self.errorResultRead % self.diffOption)
return 1
newWarnings = self.parseWarnings... | python | def showDiffResults(self):
"""
Show results when diff option on.
"""
try:
oldWarnings = self.parseWarnings(self._readDiffFile())
except:
sys.stderr.write(self.errorResultRead % self.diffOption)
return 1
newWarnings = self.parseWarnings... | [
"def",
"showDiffResults",
"(",
"self",
")",
":",
"try",
":",
"oldWarnings",
"=",
"self",
".",
"parseWarnings",
"(",
"self",
".",
"_readDiffFile",
"(",
")",
")",
"except",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"self",
".",
"errorResultRead",
"%",
... | Show results when diff option on. | [
"Show",
"results",
"when",
"diff",
"option",
"on",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L334-L353 |
49,903 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner._readDiffFile | def _readDiffFile(self):
"""
Read content of diff file.
This is here to help with testing.
@return: File content.
@rtype: c{str}
"""
with open(self.diffOption) as f:
content = f.read()
return content | python | def _readDiffFile(self):
"""
Read content of diff file.
This is here to help with testing.
@return: File content.
@rtype: c{str}
"""
with open(self.diffOption) as f:
content = f.read()
return content | [
"def",
"_readDiffFile",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"diffOption",
")",
"as",
"f",
":",
"content",
"=",
"f",
".",
"read",
"(",
")",
"return",
"content"
] | Read content of diff file.
This is here to help with testing.
@return: File content.
@rtype: c{str} | [
"Read",
"content",
"of",
"diff",
"file",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L355-L366 |
49,904 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.generateDiff | def generateDiff(self, oldWarnings, newWarnings):
"""
Generate diff between given two lists of warnings.
@param oldWarnings: parsed old warnings
@param newWarnings: parsed new warnings
@return: a dict object of diff
"""
diffWarnings = {}
for modulename i... | python | def generateDiff(self, oldWarnings, newWarnings):
"""
Generate diff between given two lists of warnings.
@param oldWarnings: parsed old warnings
@param newWarnings: parsed new warnings
@return: a dict object of diff
"""
diffWarnings = {}
for modulename i... | [
"def",
"generateDiff",
"(",
"self",
",",
"oldWarnings",
",",
"newWarnings",
")",
":",
"diffWarnings",
"=",
"{",
"}",
"for",
"modulename",
"in",
"newWarnings",
":",
"diffInModule",
"=",
"(",
"newWarnings",
"[",
"modulename",
"]",
"-",
"oldWarnings",
".",
"get... | Generate diff between given two lists of warnings.
@param oldWarnings: parsed old warnings
@param newWarnings: parsed new warnings
@return: a dict object of diff | [
"Generate",
"diff",
"between",
"given",
"two",
"lists",
"of",
"warnings",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L368-L385 |
49,905 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.parseWarnings | def parseWarnings(self, result):
"""
Transform result in string to a dict object.
@param result: a list of warnings in string
@return: a dict of warnings
"""
warnings = {}
currentModule = None
warningsCurrentModule = []
for line in result.splitlin... | python | def parseWarnings(self, result):
"""
Transform result in string to a dict object.
@param result: a list of warnings in string
@return: a dict of warnings
"""
warnings = {}
currentModule = None
warningsCurrentModule = []
for line in result.splitlin... | [
"def",
"parseWarnings",
"(",
"self",
",",
"result",
")",
":",
"warnings",
"=",
"{",
"}",
"currentModule",
"=",
"None",
"warningsCurrentModule",
"=",
"[",
"]",
"for",
"line",
"in",
"result",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"startswith... | Transform result in string to a dict object.
@param result: a list of warnings in string
@return: a dict of warnings | [
"Transform",
"result",
"in",
"string",
"to",
"a",
"dict",
"object",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L388-L415 |
49,906 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.formatWarnings | def formatWarnings(self, warnings):
"""
Format warnings to a list of results.
@param warnings: a dict of warnings produced by parseWarnings
@return: a list of warnings in string
"""
lines = []
for modulename in sorted(warnings):
lines.append(self.pref... | python | def formatWarnings(self, warnings):
"""
Format warnings to a list of results.
@param warnings: a dict of warnings produced by parseWarnings
@return: a list of warnings in string
"""
lines = []
for modulename in sorted(warnings):
lines.append(self.pref... | [
"def",
"formatWarnings",
"(",
"self",
",",
"warnings",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"modulename",
"in",
"sorted",
"(",
"warnings",
")",
":",
"lines",
".",
"append",
"(",
"self",
".",
"prefixModuleName",
"+",
"modulename",
")",
"lines",
".",
... | Format warnings to a list of results.
@param warnings: a dict of warnings produced by parseWarnings
@return: a list of warnings in string | [
"Format",
"warnings",
"to",
"a",
"list",
"of",
"results",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L418-L431 |
49,907 | wdecoster/nanomath | nanomath/nanomath.py | get_N50 | def get_N50(readlengths):
"""Calculate read length N50.
Based on https://github.com/PapenfussLab/Mungo/blob/master/bin/fasta_stats.py
"""
return readlengths[np.where(np.cumsum(readlengths) >= 0.5 * np.sum(readlengths))[0][0]] | python | def get_N50(readlengths):
"""Calculate read length N50.
Based on https://github.com/PapenfussLab/Mungo/blob/master/bin/fasta_stats.py
"""
return readlengths[np.where(np.cumsum(readlengths) >= 0.5 * np.sum(readlengths))[0][0]] | [
"def",
"get_N50",
"(",
"readlengths",
")",
":",
"return",
"readlengths",
"[",
"np",
".",
"where",
"(",
"np",
".",
"cumsum",
"(",
"readlengths",
")",
">=",
"0.5",
"*",
"np",
".",
"sum",
"(",
"readlengths",
")",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"... | Calculate read length N50.
Based on https://github.com/PapenfussLab/Mungo/blob/master/bin/fasta_stats.py | [
"Calculate",
"read",
"length",
"N50",
"."
] | 38ede9f957d5c53e2ba3648641e4f23e93b49132 | https://github.com/wdecoster/nanomath/blob/38ede9f957d5c53e2ba3648641e4f23e93b49132/nanomath/nanomath.py#L54-L59 |
49,908 | wdecoster/nanomath | nanomath/nanomath.py | remove_length_outliers | def remove_length_outliers(df, columnname):
"""Remove records with length-outliers above 3 standard deviations from the median."""
return df[df[columnname] < (np.median(df[columnname]) + 3 * np.std(df[columnname]))] | python | def remove_length_outliers(df, columnname):
"""Remove records with length-outliers above 3 standard deviations from the median."""
return df[df[columnname] < (np.median(df[columnname]) + 3 * np.std(df[columnname]))] | [
"def",
"remove_length_outliers",
"(",
"df",
",",
"columnname",
")",
":",
"return",
"df",
"[",
"df",
"[",
"columnname",
"]",
"<",
"(",
"np",
".",
"median",
"(",
"df",
"[",
"columnname",
"]",
")",
"+",
"3",
"*",
"np",
".",
"std",
"(",
"df",
"[",
"c... | Remove records with length-outliers above 3 standard deviations from the median. | [
"Remove",
"records",
"with",
"length",
"-",
"outliers",
"above",
"3",
"standard",
"deviations",
"from",
"the",
"median",
"."
] | 38ede9f957d5c53e2ba3648641e4f23e93b49132 | https://github.com/wdecoster/nanomath/blob/38ede9f957d5c53e2ba3648641e4f23e93b49132/nanomath/nanomath.py#L62-L64 |
49,909 | wdecoster/nanomath | nanomath/nanomath.py | ave_qual | def ave_qual(quals, qround=False, tab=errs_tab(128)):
"""Calculate average basecall quality of a read.
Receive the integer quality scores of a read and return the average quality for that read
First convert Phred scores to probabilities,
calculate average error probability
convert average back to P... | python | def ave_qual(quals, qround=False, tab=errs_tab(128)):
"""Calculate average basecall quality of a read.
Receive the integer quality scores of a read and return the average quality for that read
First convert Phred scores to probabilities,
calculate average error probability
convert average back to P... | [
"def",
"ave_qual",
"(",
"quals",
",",
"qround",
"=",
"False",
",",
"tab",
"=",
"errs_tab",
"(",
"128",
")",
")",
":",
"if",
"quals",
":",
"mq",
"=",
"-",
"10",
"*",
"log",
"(",
"sum",
"(",
"[",
"tab",
"[",
"q",
"]",
"for",
"q",
"in",
"quals",... | Calculate average basecall quality of a read.
Receive the integer quality scores of a read and return the average quality for that read
First convert Phred scores to probabilities,
calculate average error probability
convert average back to Phred scale | [
"Calculate",
"average",
"basecall",
"quality",
"of",
"a",
"read",
"."
] | 38ede9f957d5c53e2ba3648641e4f23e93b49132 | https://github.com/wdecoster/nanomath/blob/38ede9f957d5c53e2ba3648641e4f23e93b49132/nanomath/nanomath.py#L76-L91 |
49,910 | wdecoster/nanomath | nanomath/nanomath.py | write_stats | def write_stats(datadfs, outputfile, names=[]):
"""Call calculation functions and write stats file.
This function takes a list of DataFrames,
and will create a column for each in the tab separated output.
"""
if outputfile == 'stdout':
output = sys.stdout
else:
output = open(out... | python | def write_stats(datadfs, outputfile, names=[]):
"""Call calculation functions and write stats file.
This function takes a list of DataFrames,
and will create a column for each in the tab separated output.
"""
if outputfile == 'stdout':
output = sys.stdout
else:
output = open(out... | [
"def",
"write_stats",
"(",
"datadfs",
",",
"outputfile",
",",
"names",
"=",
"[",
"]",
")",
":",
"if",
"outputfile",
"==",
"'stdout'",
":",
"output",
"=",
"sys",
".",
"stdout",
"else",
":",
"output",
"=",
"open",
"(",
"outputfile",
",",
"'wt'",
")",
"... | Call calculation functions and write stats file.
This function takes a list of DataFrames,
and will create a column for each in the tab separated output. | [
"Call",
"calculation",
"functions",
"and",
"write",
"stats",
"file",
"."
] | 38ede9f957d5c53e2ba3648641e4f23e93b49132 | https://github.com/wdecoster/nanomath/blob/38ede9f957d5c53e2ba3648641e4f23e93b49132/nanomath/nanomath.py#L131-L185 |
49,911 | twisted/twistedchecker | twistedchecker/checkers/pycodestyleformat.py | PyCodeStyleWarningRecorder.errorRecorder | def errorRecorder(self, lineNumber, offset, text, check):
"""
A function to override report_error in pycodestyle.
And record output warnings.
@param lineNumber: line number
@param offset: column offset
@param text: warning message
@param check: check object in py... | python | def errorRecorder(self, lineNumber, offset, text, check):
"""
A function to override report_error in pycodestyle.
And record output warnings.
@param lineNumber: line number
@param offset: column offset
@param text: warning message
@param check: check object in py... | [
"def",
"errorRecorder",
"(",
"self",
",",
"lineNumber",
",",
"offset",
",",
"text",
",",
"check",
")",
":",
"code",
"=",
"text",
".",
"split",
"(",
"\" \"",
")",
"[",
"0",
"]",
"lineOffset",
"=",
"self",
".",
"report",
".",
"line_offset",
"self",
"."... | A function to override report_error in pycodestyle.
And record output warnings.
@param lineNumber: line number
@param offset: column offset
@param text: warning message
@param check: check object in pycodestyle | [
"A",
"function",
"to",
"override",
"report_error",
"in",
"pycodestyle",
".",
"And",
"record",
"output",
"warnings",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/pycodestyleformat.py#L53-L67 |
49,912 | twisted/twistedchecker | twistedchecker/checkers/pycodestyleformat.py | PyCodeStyleWarningRecorder.run | def run(self):
"""
Run pycodestyle checker and record warnings.
"""
# Set a stream to replace stdout, and get results in it
stdoutBak = sys.stdout
streamResult = StringIO()
sys.stdout = streamResult
try:
pycodestyle.Checker.check_all(self)
... | python | def run(self):
"""
Run pycodestyle checker and record warnings.
"""
# Set a stream to replace stdout, and get results in it
stdoutBak = sys.stdout
streamResult = StringIO()
sys.stdout = streamResult
try:
pycodestyle.Checker.check_all(self)
... | [
"def",
"run",
"(",
"self",
")",
":",
"# Set a stream to replace stdout, and get results in it",
"stdoutBak",
"=",
"sys",
".",
"stdout",
"streamResult",
"=",
"StringIO",
"(",
")",
"sys",
".",
"stdout",
"=",
"streamResult",
"try",
":",
"pycodestyle",
".",
"Checker",... | Run pycodestyle checker and record warnings. | [
"Run",
"pycodestyle",
"checker",
"and",
"record",
"warnings",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/pycodestyleformat.py#L70-L81 |
49,913 | twisted/twistedchecker | twistedchecker/checkers/pycodestyleformat.py | PyCodeStyleChecker._outputMessages | def _outputMessages(self, warnings, node):
"""
Map pycodestyle results to messages in pylint, then output them.
@param warnings: it should be a list of tuple including
line number and message id
"""
if not warnings:
# No warnings were found
return... | python | def _outputMessages(self, warnings, node):
"""
Map pycodestyle results to messages in pylint, then output them.
@param warnings: it should be a list of tuple including
line number and message id
"""
if not warnings:
# No warnings were found
return... | [
"def",
"_outputMessages",
"(",
"self",
",",
"warnings",
",",
"node",
")",
":",
"if",
"not",
"warnings",
":",
"# No warnings were found",
"return",
"for",
"warning",
"in",
"warnings",
":",
"linenum",
",",
"offset",
",",
"msgidInPyCodeStyle",
",",
"text",
"=",
... | Map pycodestyle results to messages in pylint, then output them.
@param warnings: it should be a list of tuple including
line number and message id | [
"Map",
"pycodestyle",
"results",
"to",
"messages",
"in",
"pylint",
"then",
"output",
"them",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/pycodestyleformat.py#L186-L214 |
49,914 | candango/firenado | firenado/config.py | log_level_from_string | def log_level_from_string(str_level):
""" Returns the proper log level core based on a given string
:param str_level: Log level string
:return: The log level code
"""
levels = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
'WARNING': logging.WARNING,
'INFO':... | python | def log_level_from_string(str_level):
""" Returns the proper log level core based on a given string
:param str_level: Log level string
:return: The log level code
"""
levels = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
'WARNING': logging.WARNING,
'INFO':... | [
"def",
"log_level_from_string",
"(",
"str_level",
")",
":",
"levels",
"=",
"{",
"'CRITICAL'",
":",
"logging",
".",
"CRITICAL",
",",
"'ERROR'",
":",
"logging",
".",
"ERROR",
",",
"'WARNING'",
":",
"logging",
".",
"WARNING",
",",
"'INFO'",
":",
"logging",
".... | Returns the proper log level core based on a given string
:param str_level: Log level string
:return: The log level code | [
"Returns",
"the",
"proper",
"log",
"level",
"core",
"based",
"on",
"a",
"given",
"string"
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L21-L42 |
49,915 | candango/firenado | firenado/config.py | get_config_from_package | def get_config_from_package(package):
""" Breaks a package string in module and class.
:param package: A package string.
:return: A config dict with class and module.
"""
package_x = package.split('.')
package_conf = {}
package_conf['class'] = package_x[-1]
package_conf['module'] = '.'.... | python | def get_config_from_package(package):
""" Breaks a package string in module and class.
:param package: A package string.
:return: A config dict with class and module.
"""
package_x = package.split('.')
package_conf = {}
package_conf['class'] = package_x[-1]
package_conf['module'] = '.'.... | [
"def",
"get_config_from_package",
"(",
"package",
")",
":",
"package_x",
"=",
"package",
".",
"split",
"(",
"'.'",
")",
"package_conf",
"=",
"{",
"}",
"package_conf",
"[",
"'class'",
"]",
"=",
"package_x",
"[",
"-",
"1",
"]",
"package_conf",
"[",
"'module'... | Breaks a package string in module and class.
:param package: A package string.
:return: A config dict with class and module. | [
"Breaks",
"a",
"package",
"string",
"in",
"module",
"and",
"class",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L45-L55 |
49,916 | candango/firenado | firenado/config.py | get_class_from_module | def get_class_from_module(module, class_name):
""" Returns a class from a module and a class name parameters.
This function is used by get_class_from_config and get_class_from_name.
Example:
>>> get_class_from_module("my.module", "MyClass")
:param basestring module: The module name.
:param bas... | python | def get_class_from_module(module, class_name):
""" Returns a class from a module and a class name parameters.
This function is used by get_class_from_config and get_class_from_name.
Example:
>>> get_class_from_module("my.module", "MyClass")
:param basestring module: The module name.
:param bas... | [
"def",
"get_class_from_module",
"(",
"module",
",",
"class_name",
")",
":",
"import",
"importlib",
"module",
"=",
"importlib",
".",
"import_module",
"(",
"module",
")",
"return",
"getattr",
"(",
"module",
",",
"class_name",
")"
] | Returns a class from a module and a class name parameters.
This function is used by get_class_from_config and get_class_from_name.
Example:
>>> get_class_from_module("my.module", "MyClass")
:param basestring module: The module name.
:param basestring class_name: The class name.
:return: The cl... | [
"Returns",
"a",
"class",
"from",
"a",
"module",
"and",
"a",
"class",
"name",
"parameters",
".",
"This",
"function",
"is",
"used",
"by",
"get_class_from_config",
"and",
"get_class_from_name",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L75-L88 |
49,917 | candango/firenado | firenado/config.py | load_yaml_config_file | def load_yaml_config_file(path):
""" Returns the parsed structure from a yaml config file.
:param path: Path where the yaml file is located.
:return: The yaml configuration represented by the yaml file.
"""
result = None
with open(path, 'r') as steam:
result = yaml.safe_load(steam)
... | python | def load_yaml_config_file(path):
""" Returns the parsed structure from a yaml config file.
:param path: Path where the yaml file is located.
:return: The yaml configuration represented by the yaml file.
"""
result = None
with open(path, 'r') as steam:
result = yaml.safe_load(steam)
... | [
"def",
"load_yaml_config_file",
"(",
"path",
")",
":",
"result",
"=",
"None",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"steam",
":",
"result",
"=",
"yaml",
".",
"safe_load",
"(",
"steam",
")",
"return",
"result"
] | Returns the parsed structure from a yaml config file.
:param path: Path where the yaml file is located.
:return: The yaml configuration represented by the yaml file. | [
"Returns",
"the",
"parsed",
"structure",
"from",
"a",
"yaml",
"config",
"file",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L112-L121 |
49,918 | candango/firenado | firenado/config.py | process_config | def process_config(config, config_data):
""" Populates config with data from the configuration data dict. It handles
components, data, log, management and session sections from the
configuration data.
:param config: The config reference of the object that will hold the
configuration data from the c... | python | def process_config(config, config_data):
""" Populates config with data from the configuration data dict. It handles
components, data, log, management and session sections from the
configuration data.
:param config: The config reference of the object that will hold the
configuration data from the c... | [
"def",
"process_config",
"(",
"config",
",",
"config_data",
")",
":",
"if",
"'components'",
"in",
"config_data",
":",
"process_components_config_section",
"(",
"config",
",",
"config_data",
"[",
"'components'",
"]",
")",
"if",
"'data'",
"in",
"config_data",
":",
... | Populates config with data from the configuration data dict. It handles
components, data, log, management and session sections from the
configuration data.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param config_data: The configura... | [
"Populates",
"config",
"with",
"data",
"from",
"the",
"configuration",
"data",
"dict",
".",
"It",
"handles",
"components",
"data",
"log",
"management",
"and",
"session",
"sections",
"from",
"the",
"configuration",
"data",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L124-L143 |
49,919 | candango/firenado | firenado/config.py | process_app_config | def process_app_config(config, config_data):
""" Populates config with data from the configuration data dict. It handles
everything that process_config does plus application section.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param... | python | def process_app_config(config, config_data):
""" Populates config with data from the configuration data dict. It handles
everything that process_config does plus application section.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param... | [
"def",
"process_app_config",
"(",
"config",
",",
"config_data",
")",
":",
"process_config",
"(",
"config",
",",
"config_data",
")",
"# If apps is on config data, this is running o multi app mode",
"if",
"'apps'",
"in",
"config_data",
":",
"config",
".",
"app",
"[",
"'... | Populates config with data from the configuration data dict. It handles
everything that process_config does plus application section.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param config_data: The configuration data loaded from a co... | [
"Populates",
"config",
"with",
"data",
"from",
"the",
"configuration",
"data",
"dict",
".",
"It",
"handles",
"everything",
"that",
"process_config",
"does",
"plus",
"application",
"section",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L146-L164 |
49,920 | candango/firenado | firenado/config.py | process_app_config_section | def process_app_config_section(config, app_config):
""" Processes the app section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param app_config: App section from a config data dict.
"""
if 'address... | python | def process_app_config_section(config, app_config):
""" Processes the app section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param app_config: App section from a config data dict.
"""
if 'address... | [
"def",
"process_app_config_section",
"(",
"config",
",",
"app_config",
")",
":",
"if",
"'addresses'",
"in",
"app_config",
":",
"config",
".",
"app",
"[",
"'addresses'",
"]",
"=",
"app_config",
"[",
"'addresses'",
"]",
"if",
"'component'",
"in",
"app_config",
"... | Processes the app section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param app_config: App section from a config data dict. | [
"Processes",
"the",
"app",
"section",
"from",
"a",
"configuration",
"data",
"dict",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L172-L223 |
49,921 | candango/firenado | firenado/config.py | process_components_config_section | def process_components_config_section(config, components_config):
""" Processes the components section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param components_config: Data section from a config data ... | python | def process_components_config_section(config, components_config):
""" Processes the components section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param components_config: Data section from a config data ... | [
"def",
"process_components_config_section",
"(",
"config",
",",
"components_config",
")",
":",
"for",
"component_config",
"in",
"components_config",
":",
"if",
"'id'",
"not",
"in",
"component_config",
":",
"raise",
"Exception",
"(",
"'The component %s was defined without ... | Processes the components section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param components_config: Data section from a config data dict. | [
"Processes",
"the",
"components",
"section",
"from",
"a",
"configuration",
"data",
"dict",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L226-L249 |
49,922 | candango/firenado | firenado/config.py | process_data_config_section | def process_data_config_section(config, data_config):
""" Processes the data configuration section from the configuration
data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param data_config: Data configuration section from a co... | python | def process_data_config_section(config, data_config):
""" Processes the data configuration section from the configuration
data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param data_config: Data configuration section from a co... | [
"def",
"process_data_config_section",
"(",
"config",
",",
"data_config",
")",
":",
"if",
"'connectors'",
"in",
"data_config",
":",
"for",
"connector",
"in",
"data_config",
"[",
"'connectors'",
"]",
":",
"config",
".",
"data",
"[",
"'connectors'",
"]",
"[",
"co... | Processes the data configuration section from the configuration
data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param data_config: Data configuration section from a config data dict. | [
"Processes",
"the",
"data",
"configuration",
"section",
"from",
"the",
"configuration",
"data",
"dict",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L252-L269 |
49,923 | candango/firenado | firenado/config.py | process_log_config_section | def process_log_config_section(config, log_config):
""" Processes the log section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param log_config: Log section from a config data dict.
"""
if 'format... | python | def process_log_config_section(config, log_config):
""" Processes the log section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param log_config: Log section from a config data dict.
"""
if 'format... | [
"def",
"process_log_config_section",
"(",
"config",
",",
"log_config",
")",
":",
"if",
"'format'",
"in",
"log_config",
":",
"config",
".",
"log",
"[",
"'format'",
"]",
"=",
"log_config",
"[",
"'format'",
"]",
"if",
"'level'",
"in",
"log_config",
":",
"config... | Processes the log section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param log_config: Log section from a config data dict. | [
"Processes",
"the",
"log",
"section",
"from",
"a",
"configuration",
"data",
"dict",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L272-L282 |
49,924 | candango/firenado | firenado/config.py | process_management_config_section | def process_management_config_section(config, management_config):
""" Processes the management section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param management_config: Management section from a config... | python | def process_management_config_section(config, management_config):
""" Processes the management section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param management_config: Management section from a config... | [
"def",
"process_management_config_section",
"(",
"config",
",",
"management_config",
")",
":",
"if",
"'commands'",
"in",
"management_config",
":",
"for",
"command",
"in",
"management_config",
"[",
"'commands'",
"]",
":",
"config",
".",
"management",
"[",
"'commands'... | Processes the management section from a configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param management_config: Management section from a config data dict. | [
"Processes",
"the",
"management",
"section",
"from",
"a",
"configuration",
"data",
"dict",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L285-L294 |
49,925 | candango/firenado | firenado/config.py | process_session_config_section | def process_session_config_section(config, session_config):
""" Processes the session section from the configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param session_config: Session configuration section from a confi... | python | def process_session_config_section(config, session_config):
""" Processes the session section from the configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param session_config: Session configuration section from a confi... | [
"def",
"process_session_config_section",
"(",
"config",
",",
"session_config",
")",
":",
"# Setting session type as file by default",
"config",
".",
"session",
"[",
"'type'",
"]",
"=",
"'file'",
"if",
"'enabled'",
"in",
"session_config",
":",
"config",
".",
"session",... | Processes the session section from the configuration data dict.
:param config: The config reference of the object that will hold the
configuration data from the config_data.
:param session_config: Session configuration section from a config data
dict. | [
"Processes",
"the",
"session",
"section",
"from",
"the",
"configuration",
"data",
"dict",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/config.py#L297-L350 |
49,926 | orb-framework/orb | orb/core/connection_types/sql/mysql/mysqlconnection.py | MySQLConnection._open | def _open(self, db, writeAccess=False):
"""
Handles simple, SQL specific connection creation. This will not
have to manage thread information as it is already managed within
the main open method for the SQLBase class.
:param db | <orb.Database>
:return <varian... | python | def _open(self, db, writeAccess=False):
"""
Handles simple, SQL specific connection creation. This will not
have to manage thread information as it is already managed within
the main open method for the SQLBase class.
:param db | <orb.Database>
:return <varian... | [
"def",
"_open",
"(",
"self",
",",
"db",
",",
"writeAccess",
"=",
"False",
")",
":",
"if",
"not",
"pymysql",
":",
"raise",
"orb",
".",
"errors",
".",
"BackendNotFound",
"(",
"'psycopg2 is not installed.'",
")",
"# create the python connection",
"try",
":",
"ret... | Handles simple, SQL specific connection creation. This will not
have to manage thread information as it is already managed within
the main open method for the SQLBase class.
:param db | <orb.Database>
:return <variant> | backend specific database connection | [
"Handles",
"simple",
"SQL",
"specific",
"connection",
"creation",
".",
"This",
"will",
"not",
"have",
"to",
"manage",
"thread",
"information",
"as",
"it",
"is",
"already",
"managed",
"within",
"the",
"main",
"open",
"method",
"for",
"the",
"SQLBase",
"class",
... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/mysql/mysqlconnection.py#L107-L130 |
49,927 | candango/firenado | firenado/util/sqlalchemy_util.py | run_script | def run_script(script_path, session, handle_command=None, handle_line=None):
""" Run a script file using a valid sqlalchemy session.
Based on https://bit.ly/2CToAhY.
See also sqlalchemy transaction control: https://bit.ly/2yKso0A
:param script_path: The path where the script is located
:param sess... | python | def run_script(script_path, session, handle_command=None, handle_line=None):
""" Run a script file using a valid sqlalchemy session.
Based on https://bit.ly/2CToAhY.
See also sqlalchemy transaction control: https://bit.ly/2yKso0A
:param script_path: The path where the script is located
:param sess... | [
"def",
"run_script",
"(",
"script_path",
",",
"session",
",",
"handle_command",
"=",
"None",
",",
"handle_line",
"=",
"None",
")",
":",
"logger",
".",
"debug",
"(",
"\"Opening script %s.\"",
"%",
"script_path",
")",
"with",
"open",
"(",
"script_path",
",",
"... | Run a script file using a valid sqlalchemy session.
Based on https://bit.ly/2CToAhY.
See also sqlalchemy transaction control: https://bit.ly/2yKso0A
:param script_path: The path where the script is located
:param session: A sqlalchemy session to execute the sql commands from the
script
:param ... | [
"Run",
"a",
"script",
"file",
"using",
"a",
"valid",
"sqlalchemy",
"session",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/sqlalchemy_util.py#L30-L71 |
49,928 | candango/firenado | firenado/management/management.py | run_from_command_line | def run_from_command_line():
""" Run Firenado's management commands from a command line
"""
for commands_conf in firenado.conf.management['commands']:
logger.debug("Loading %s commands from %s." % (
commands_conf['name'],
commands_conf['module']
))
exec('impor... | python | def run_from_command_line():
""" Run Firenado's management commands from a command line
"""
for commands_conf in firenado.conf.management['commands']:
logger.debug("Loading %s commands from %s." % (
commands_conf['name'],
commands_conf['module']
))
exec('impor... | [
"def",
"run_from_command_line",
"(",
")",
":",
"for",
"commands_conf",
"in",
"firenado",
".",
"conf",
".",
"management",
"[",
"'commands'",
"]",
":",
"logger",
".",
"debug",
"(",
"\"Loading %s commands from %s.\"",
"%",
"(",
"commands_conf",
"[",
"'name'",
"]",
... | Run Firenado's management commands from a command line | [
"Run",
"Firenado",
"s",
"management",
"commands",
"from",
"a",
"command",
"line"
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/management/management.py#L37-L63 |
49,929 | candango/firenado | firenado/management/management.py | get_command_header | def get_command_header(parser, usage_message="", usage=False):
""" Return the command line header
:param parser:
:param usage_message:
:param usage:
:return: The command header
"""
loader = template.Loader(os.path.join(
firenado.conf.ROOT, 'management', 'templates', 'help'))
ret... | python | def get_command_header(parser, usage_message="", usage=False):
""" Return the command line header
:param parser:
:param usage_message:
:param usage:
:return: The command header
"""
loader = template.Loader(os.path.join(
firenado.conf.ROOT, 'management', 'templates', 'help'))
ret... | [
"def",
"get_command_header",
"(",
"parser",
",",
"usage_message",
"=",
"\"\"",
",",
"usage",
"=",
"False",
")",
":",
"loader",
"=",
"template",
".",
"Loader",
"(",
"os",
".",
"path",
".",
"join",
"(",
"firenado",
".",
"conf",
".",
"ROOT",
",",
"'manage... | Return the command line header
:param parser:
:param usage_message:
:param usage:
:return: The command header | [
"Return",
"the",
"command",
"line",
"header"
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/management/management.py#L66-L79 |
49,930 | candango/firenado | firenado/management/management.py | show_command_line_usage | def show_command_line_usage(parser, usage=False):
""" Show the command line help
"""
help_header_message = get_command_header(parser, "command", usage)
loader = template.Loader(os.path.join(
firenado.conf.ROOT, 'management', 'templates', 'help'))
command_template = " {0.name:15}{0.descripti... | python | def show_command_line_usage(parser, usage=False):
""" Show the command line help
"""
help_header_message = get_command_header(parser, "command", usage)
loader = template.Loader(os.path.join(
firenado.conf.ROOT, 'management', 'templates', 'help'))
command_template = " {0.name:15}{0.descripti... | [
"def",
"show_command_line_usage",
"(",
"parser",
",",
"usage",
"=",
"False",
")",
":",
"help_header_message",
"=",
"get_command_header",
"(",
"parser",
",",
"\"command\"",
",",
"usage",
")",
"loader",
"=",
"template",
".",
"Loader",
"(",
"os",
".",
"path",
"... | Show the command line help | [
"Show",
"the",
"command",
"line",
"help"
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/management/management.py#L82-L94 |
49,931 | candango/firenado | firenado/management/management.py | command_exists | def command_exists(command):
""" Check if the given command was registered. In another words if it
exists.
"""
for category, commands in iteritems(command_categories):
for existing_command in commands:
if existing_command.match(command):
return True
return False | python | def command_exists(command):
""" Check if the given command was registered. In another words if it
exists.
"""
for category, commands in iteritems(command_categories):
for existing_command in commands:
if existing_command.match(command):
return True
return False | [
"def",
"command_exists",
"(",
"command",
")",
":",
"for",
"category",
",",
"commands",
"in",
"iteritems",
"(",
"command_categories",
")",
":",
"for",
"existing_command",
"in",
"commands",
":",
"if",
"existing_command",
".",
"match",
"(",
"command",
")",
":",
... | Check if the given command was registered. In another words if it
exists. | [
"Check",
"if",
"the",
"given",
"command",
"was",
"registered",
".",
"In",
"another",
"words",
"if",
"it",
"exists",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/management/management.py#L97-L105 |
49,932 | candango/firenado | firenado/management/management.py | run_command | def run_command(command, args):
""" Run all tasks registered in a command.
"""
for category, commands in iteritems(command_categories):
for existing_command in commands:
if existing_command.match(command):
existing_command.run(args) | python | def run_command(command, args):
""" Run all tasks registered in a command.
"""
for category, commands in iteritems(command_categories):
for existing_command in commands:
if existing_command.match(command):
existing_command.run(args) | [
"def",
"run_command",
"(",
"command",
",",
"args",
")",
":",
"for",
"category",
",",
"commands",
"in",
"iteritems",
"(",
"command_categories",
")",
":",
"for",
"existing_command",
"in",
"commands",
":",
"if",
"existing_command",
".",
"match",
"(",
"command",
... | Run all tasks registered in a command. | [
"Run",
"all",
"tasks",
"registered",
"in",
"a",
"command",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/management/management.py#L108-L114 |
49,933 | prechelt/typecheck-decorator | typecheck/typing_predicates.py | TypeVarChecker.check | def check(self, value, namespace):
"""
See whether the TypeVar is bound for the first time
or is met with _exactly_ the same type as previously.
That type must also obey the TypeVar's bound, if any.
Everything else is a type error.
"""
return namespace.is_compatib... | python | def check(self, value, namespace):
"""
See whether the TypeVar is bound for the first time
or is met with _exactly_ the same type as previously.
That type must also obey the TypeVar's bound, if any.
Everything else is a type error.
"""
return namespace.is_compatib... | [
"def",
"check",
"(",
"self",
",",
"value",
",",
"namespace",
")",
":",
"return",
"namespace",
".",
"is_compatible",
"(",
"self",
".",
"typevar",
",",
"type",
"(",
"value",
")",
")"
] | See whether the TypeVar is bound for the first time
or is met with _exactly_ the same type as previously.
That type must also obey the TypeVar's bound, if any.
Everything else is a type error. | [
"See",
"whether",
"the",
"TypeVar",
"is",
"bound",
"for",
"the",
"first",
"time",
"or",
"is",
"met",
"with",
"_exactly_",
"the",
"same",
"type",
"as",
"previously",
".",
"That",
"type",
"must",
"also",
"obey",
"the",
"TypeVar",
"s",
"bound",
"if",
"any",... | 4aa5a7f17235c70b5b787c9e80bb1f24d3f15933 | https://github.com/prechelt/typecheck-decorator/blob/4aa5a7f17235c70b5b787c9e80bb1f24d3f15933/typecheck/typing_predicates.py#L99-L106 |
49,934 | twisted/twistedchecker | twistedchecker/checkers/patch_pylint_format.py | check_lines | def check_lines(self, lines, i):
"""
check lines have less than a maximum number of characters.
It ignored lines with long URLs.
"""
maxChars = self.config.max_line_length
for line in lines.splitlines():
if len(line) > maxChars:
if 'http://' in line or 'https://' in line:
... | python | def check_lines(self, lines, i):
"""
check lines have less than a maximum number of characters.
It ignored lines with long URLs.
"""
maxChars = self.config.max_line_length
for line in lines.splitlines():
if len(line) > maxChars:
if 'http://' in line or 'https://' in line:
... | [
"def",
"check_lines",
"(",
"self",
",",
"lines",
",",
"i",
")",
":",
"maxChars",
"=",
"self",
".",
"config",
".",
"max_line_length",
"for",
"line",
"in",
"lines",
".",
"splitlines",
"(",
")",
":",
"if",
"len",
"(",
"line",
")",
">",
"maxChars",
":",
... | check lines have less than a maximum number of characters.
It ignored lines with long URLs. | [
"check",
"lines",
"have",
"less",
"than",
"a",
"maximum",
"number",
"of",
"characters",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/patch_pylint_format.py#L7-L19 |
49,935 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/fields.py | ModelPermissionsField.to_representation | def to_representation(self, obj):
""" Represent data for the field. """
many = isinstance(obj, collections.Iterable) \
or isinstance(obj, models.Manager) \
and not isinstance(obj, dict)
assert self.serializer is not None \
and issubclass(self.serializer, seri... | python | def to_representation(self, obj):
""" Represent data for the field. """
many = isinstance(obj, collections.Iterable) \
or isinstance(obj, models.Manager) \
and not isinstance(obj, dict)
assert self.serializer is not None \
and issubclass(self.serializer, seri... | [
"def",
"to_representation",
"(",
"self",
",",
"obj",
")",
":",
"many",
"=",
"isinstance",
"(",
"obj",
",",
"collections",
".",
"Iterable",
")",
"or",
"isinstance",
"(",
"obj",
",",
"models",
".",
"Manager",
")",
"and",
"not",
"isinstance",
"(",
"obj",
... | Represent data for the field. | [
"Represent",
"data",
"for",
"the",
"field",
"."
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/fields.py#L53-L71 |
49,936 | orb-framework/orb | orb/core/reverselookup.py | ReverseLookup.setRemoveAction | def setRemoveAction(self, action):
"""
Sets the remove action that should be taken when a model is removed from the collection generated by
this reverse lookup. Valid actions are "unset" or "delete", any other values will raise an exception.
:param action: <str>
"""
if ... | python | def setRemoveAction(self, action):
"""
Sets the remove action that should be taken when a model is removed from the collection generated by
this reverse lookup. Valid actions are "unset" or "delete", any other values will raise an exception.
:param action: <str>
"""
if ... | [
"def",
"setRemoveAction",
"(",
"self",
",",
"action",
")",
":",
"if",
"action",
"not",
"in",
"(",
"'unset'",
",",
"'delete'",
")",
":",
"raise",
"orb",
".",
"errors",
".",
"ValidationError",
"(",
"'The remove action must be either \"unset\" or \"delete\"'",
")",
... | Sets the remove action that should be taken when a model is removed from the collection generated by
this reverse lookup. Valid actions are "unset" or "delete", any other values will raise an exception.
:param action: <str> | [
"Sets",
"the",
"remove",
"action",
"that",
"should",
"be",
"taken",
"when",
"a",
"model",
"is",
"removed",
"from",
"the",
"collection",
"generated",
"by",
"this",
"reverse",
"lookup",
".",
"Valid",
"actions",
"are",
"unset",
"or",
"delete",
"any",
"other",
... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/reverselookup.py#L71-L81 |
49,937 | prechelt/typecheck-decorator | typecheck/framework.py | TypeVarNamespace.bind | def bind(self, typevar, its_type):
"""
Binds typevar to the type its_type.
Binding occurs on the instance if the typevar is a TypeVar of the
generic type of the instance, on call level otherwise.
"""
assert type(typevar) == tg.TypeVar
if self.is_generic_in(typevar... | python | def bind(self, typevar, its_type):
"""
Binds typevar to the type its_type.
Binding occurs on the instance if the typevar is a TypeVar of the
generic type of the instance, on call level otherwise.
"""
assert type(typevar) == tg.TypeVar
if self.is_generic_in(typevar... | [
"def",
"bind",
"(",
"self",
",",
"typevar",
",",
"its_type",
")",
":",
"assert",
"type",
"(",
"typevar",
")",
"==",
"tg",
".",
"TypeVar",
"if",
"self",
".",
"is_generic_in",
"(",
"typevar",
")",
":",
"self",
".",
"bind_to_instance",
"(",
"typevar",
","... | Binds typevar to the type its_type.
Binding occurs on the instance if the typevar is a TypeVar of the
generic type of the instance, on call level otherwise. | [
"Binds",
"typevar",
"to",
"the",
"type",
"its_type",
".",
"Binding",
"occurs",
"on",
"the",
"instance",
"if",
"the",
"typevar",
"is",
"a",
"TypeVar",
"of",
"the",
"generic",
"type",
"of",
"the",
"instance",
"on",
"call",
"level",
"otherwise",
"."
] | 4aa5a7f17235c70b5b787c9e80bb1f24d3f15933 | https://github.com/prechelt/typecheck-decorator/blob/4aa5a7f17235c70b5b787c9e80bb1f24d3f15933/typecheck/framework.py#L59-L69 |
49,938 | prechelt/typecheck-decorator | typecheck/framework.py | TypeVarNamespace.binding_of | def binding_of(self, typevar):
"""Returns the type the typevar is bound to, or None."""
if typevar in self._ns:
return self._ns[typevar]
if self._instance_ns and typevar in self._instance_ns:
return self._instance_ns[typevar]
return None | python | def binding_of(self, typevar):
"""Returns the type the typevar is bound to, or None."""
if typevar in self._ns:
return self._ns[typevar]
if self._instance_ns and typevar in self._instance_ns:
return self._instance_ns[typevar]
return None | [
"def",
"binding_of",
"(",
"self",
",",
"typevar",
")",
":",
"if",
"typevar",
"in",
"self",
".",
"_ns",
":",
"return",
"self",
".",
"_ns",
"[",
"typevar",
"]",
"if",
"self",
".",
"_instance_ns",
"and",
"typevar",
"in",
"self",
".",
"_instance_ns",
":",
... | Returns the type the typevar is bound to, or None. | [
"Returns",
"the",
"type",
"the",
"typevar",
"is",
"bound",
"to",
"or",
"None",
"."
] | 4aa5a7f17235c70b5b787c9e80bb1f24d3f15933 | https://github.com/prechelt/typecheck-decorator/blob/4aa5a7f17235c70b5b787c9e80bb1f24d3f15933/typecheck/framework.py#L88-L94 |
49,939 | twisted/twistedchecker | twistedchecker/checkers/header.py | HeaderChecker._checkCopyright | def _checkCopyright(self, text, node):
"""
Check whether the module has copyright header.
@param text: codes of the module
@param node: node of the module
"""
if not re.search(br"%s\s*\n\s*%s" % self.commentsCopyright, text):
self.add_message('W9001', node=no... | python | def _checkCopyright(self, text, node):
"""
Check whether the module has copyright header.
@param text: codes of the module
@param node: node of the module
"""
if not re.search(br"%s\s*\n\s*%s" % self.commentsCopyright, text):
self.add_message('W9001', node=no... | [
"def",
"_checkCopyright",
"(",
"self",
",",
"text",
",",
"node",
")",
":",
"if",
"not",
"re",
".",
"search",
"(",
"br\"%s\\s*\\n\\s*%s\"",
"%",
"self",
".",
"commentsCopyright",
",",
"text",
")",
":",
"self",
".",
"add_message",
"(",
"'W9001'",
",",
"nod... | Check whether the module has copyright header.
@param text: codes of the module
@param node: node of the module | [
"Check",
"whether",
"the",
"module",
"has",
"copyright",
"header",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/header.py#L52-L60 |
49,940 | twisted/twistedchecker | twistedchecker/reporters/limited.py | LimitedReporter.handle_message | def handle_message(self, msg):
"""
Manage message of different type and in the context of path.
"""
if msg.msg_id in self.messagesAllowed:
super(LimitedReporter, self).handle_message(msg) | python | def handle_message(self, msg):
"""
Manage message of different type and in the context of path.
"""
if msg.msg_id in self.messagesAllowed:
super(LimitedReporter, self).handle_message(msg) | [
"def",
"handle_message",
"(",
"self",
",",
"msg",
")",
":",
"if",
"msg",
".",
"msg_id",
"in",
"self",
".",
"messagesAllowed",
":",
"super",
"(",
"LimitedReporter",
",",
"self",
")",
".",
"handle_message",
"(",
"msg",
")"
] | Manage message of different type and in the context of path. | [
"Manage",
"message",
"of",
"different",
"type",
"and",
"in",
"the",
"context",
"of",
"path",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/reporters/limited.py#L30-L35 |
49,941 | orb-framework/orb | orb/core/system.py | System.unregister | def unregister(self, obj=None):
"""
Unregisters the object from the system. If None is supplied, then
all objects will be unregistered
:param obj: <str> or <orb.Database> or <orb.Schema> or None
"""
if obj is None:
self.__databases.clear()
self._... | python | def unregister(self, obj=None):
"""
Unregisters the object from the system. If None is supplied, then
all objects will be unregistered
:param obj: <str> or <orb.Database> or <orb.Schema> or None
"""
if obj is None:
self.__databases.clear()
self._... | [
"def",
"unregister",
"(",
"self",
",",
"obj",
"=",
"None",
")",
":",
"if",
"obj",
"is",
"None",
":",
"self",
".",
"__databases",
".",
"clear",
"(",
")",
"self",
".",
"__schemas",
".",
"clear",
"(",
")",
"elif",
"isinstance",
"(",
"obj",
",",
"orb",... | Unregisters the object from the system. If None is supplied, then
all objects will be unregistered
:param obj: <str> or <orb.Database> or <orb.Schema> or None | [
"Unregisters",
"the",
"object",
"from",
"the",
"system",
".",
"If",
"None",
"is",
"supplied",
"then",
"all",
"objects",
"will",
"be",
"unregistered"
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/system.py#L141-L160 |
49,942 | orb-framework/orb | orb/core/collection.py | Collection.page | def page(self, number, **context):
"""
Returns the records for the current page, or the specified page number.
If a page size is not specified, then this record sets page size will
be used.
:param pageno | <int>
pageSize | <int>
:return <o... | python | def page(self, number, **context):
"""
Returns the records for the current page, or the specified page number.
If a page size is not specified, then this record sets page size will
be used.
:param pageno | <int>
pageSize | <int>
:return <o... | [
"def",
"page",
"(",
"self",
",",
"number",
",",
"*",
"*",
"context",
")",
":",
"size",
"=",
"max",
"(",
"0",
",",
"self",
".",
"context",
"(",
"*",
"*",
"context",
")",
".",
"pageSize",
")",
"if",
"not",
"size",
":",
"return",
"self",
".",
"cop... | Returns the records for the current page, or the specified page number.
If a page size is not specified, then this record sets page size will
be used.
:param pageno | <int>
pageSize | <int>
:return <orb.RecordSet> | [
"Returns",
"the",
"records",
"for",
"the",
"current",
"page",
"or",
"the",
"specified",
"page",
"number",
".",
"If",
"a",
"page",
"size",
"is",
"not",
"specified",
"then",
"this",
"record",
"sets",
"page",
"size",
"will",
"be",
"used",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/collection.py#L521-L536 |
49,943 | orb-framework/orb | orb/core/model.py | Model._load | def _load(self, event):
"""
Processes a load event by setting the properties of this record
to the data restored from the database.
:param event: <orb.events.LoadEvent>
"""
if not event.data:
return
context = self.context()
schema = self.sche... | python | def _load(self, event):
"""
Processes a load event by setting the properties of this record
to the data restored from the database.
:param event: <orb.events.LoadEvent>
"""
if not event.data:
return
context = self.context()
schema = self.sche... | [
"def",
"_load",
"(",
"self",
",",
"event",
")",
":",
"if",
"not",
"event",
".",
"data",
":",
"return",
"context",
"=",
"self",
".",
"context",
"(",
")",
"schema",
"=",
"self",
".",
"schema",
"(",
")",
"dbname",
"=",
"schema",
".",
"dbname",
"(",
... | Processes a load event by setting the properties of this record
to the data restored from the database.
:param event: <orb.events.LoadEvent> | [
"Processes",
"a",
"load",
"event",
"by",
"setting",
"the",
"properties",
"of",
"this",
"record",
"to",
"the",
"data",
"restored",
"from",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L305-L353 |
49,944 | orb-framework/orb | orb/core/model.py | Model.changes | def changes(self, columns=None, recurse=True, flags=0, inflated=False):
"""
Returns a dictionary of changes that have been made
to the data from this record.
:return { <orb.Column>: ( <variant> old, <variant> new), .. }
"""
output = {}
is_record = self.isReco... | python | def changes(self, columns=None, recurse=True, flags=0, inflated=False):
"""
Returns a dictionary of changes that have been made
to the data from this record.
:return { <orb.Column>: ( <variant> old, <variant> new), .. }
"""
output = {}
is_record = self.isReco... | [
"def",
"changes",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"recurse",
"=",
"True",
",",
"flags",
"=",
"0",
",",
"inflated",
"=",
"False",
")",
":",
"output",
"=",
"{",
"}",
"is_record",
"=",
"self",
".",
"isRecord",
"(",
")",
"schema",
"=",
... | Returns a dictionary of changes that have been made
to the data from this record.
:return { <orb.Column>: ( <variant> old, <variant> new), .. } | [
"Returns",
"a",
"dictionary",
"of",
"changes",
"that",
"have",
"been",
"made",
"to",
"the",
"data",
"from",
"this",
"record",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L387-L419 |
49,945 | orb-framework/orb | orb/core/model.py | Model.context | def context(self, **context):
"""
Returns the lookup options for this record. This will track the options that were
used when looking this record up from the database.
:return <orb.LookupOptions>
"""
output = orb.Context(context=self.__context) if self.__context is ... | python | def context(self, **context):
"""
Returns the lookup options for this record. This will track the options that were
used when looking this record up from the database.
:return <orb.LookupOptions>
"""
output = orb.Context(context=self.__context) if self.__context is ... | [
"def",
"context",
"(",
"self",
",",
"*",
"*",
"context",
")",
":",
"output",
"=",
"orb",
".",
"Context",
"(",
"context",
"=",
"self",
".",
"__context",
")",
"if",
"self",
".",
"__context",
"is",
"not",
"None",
"else",
"orb",
".",
"Context",
"(",
")... | Returns the lookup options for this record. This will track the options that were
used when looking this record up from the database.
:return <orb.LookupOptions> | [
"Returns",
"the",
"lookup",
"options",
"for",
"this",
"record",
".",
"This",
"will",
"track",
"the",
"options",
"that",
"were",
"used",
"when",
"looking",
"this",
"record",
"up",
"from",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L428-L437 |
49,946 | orb-framework/orb | orb/core/model.py | Model.delete | def delete(self, **context):
"""
Removes this record from the database. If the dryRun \
flag is specified then the command will be logged and \
not executed.
:note From version 0.6.0 on, this method now accepts a mutable
keyword dictionary of values. ... | python | def delete(self, **context):
"""
Removes this record from the database. If the dryRun \
flag is specified then the command will be logged and \
not executed.
:note From version 0.6.0 on, this method now accepts a mutable
keyword dictionary of values. ... | [
"def",
"delete",
"(",
"self",
",",
"*",
"*",
"context",
")",
":",
"if",
"not",
"self",
".",
"isRecord",
"(",
")",
":",
"return",
"0",
"event",
"=",
"orb",
".",
"events",
".",
"DeleteEvent",
"(",
"record",
"=",
"self",
",",
"context",
"=",
"self",
... | Removes this record from the database. If the dryRun \
flag is specified then the command will be logged and \
not executed.
:note From version 0.6.0 on, this method now accepts a mutable
keyword dictionary of values. You can supply any member
val... | [
"Removes",
"this",
"record",
"from",
"the",
"database",
".",
"If",
"the",
"dryRun",
"\\",
"flag",
"is",
"specified",
"then",
"the",
"command",
"will",
"be",
"logged",
"and",
"\\",
"not",
"executed",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L439-L481 |
49,947 | orb-framework/orb | orb/core/model.py | Model.markLoaded | def markLoaded(self, *columns):
"""
Tells the model to treat the given columns as though they had been loaded from the database.
:param columns: (<str>, ..)
"""
schema = self.schema()
columns = {schema.column(col) for col in columns}
column_names = {col.name() f... | python | def markLoaded(self, *columns):
"""
Tells the model to treat the given columns as though they had been loaded from the database.
:param columns: (<str>, ..)
"""
schema = self.schema()
columns = {schema.column(col) for col in columns}
column_names = {col.name() f... | [
"def",
"markLoaded",
"(",
"self",
",",
"*",
"columns",
")",
":",
"schema",
"=",
"self",
".",
"schema",
"(",
")",
"columns",
"=",
"{",
"schema",
".",
"column",
"(",
"col",
")",
"for",
"col",
"in",
"columns",
"}",
"column_names",
"=",
"{",
"col",
"."... | Tells the model to treat the given columns as though they had been loaded from the database.
:param columns: (<str>, ..) | [
"Tells",
"the",
"model",
"to",
"treat",
"the",
"given",
"columns",
"as",
"though",
"they",
"had",
"been",
"loaded",
"from",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L625-L641 |
49,948 | orb-framework/orb | orb/core/model.py | Model.isRecord | def isRecord(self, db=None):
"""
Returns whether or not this database table record exists
in the database.
:return <bool>
"""
if db is not None:
same_db = db == self.context().db
if db is None or same_db:
col = self.schema().idColumn(... | python | def isRecord(self, db=None):
"""
Returns whether or not this database table record exists
in the database.
:return <bool>
"""
if db is not None:
same_db = db == self.context().db
if db is None or same_db:
col = self.schema().idColumn(... | [
"def",
"isRecord",
"(",
"self",
",",
"db",
"=",
"None",
")",
":",
"if",
"db",
"is",
"not",
"None",
":",
"same_db",
"=",
"db",
"==",
"self",
".",
"context",
"(",
")",
".",
"db",
"if",
"db",
"is",
"None",
"or",
"same_db",
":",
"col",
"=",
"self",... | Returns whether or not this database table record exists
in the database.
:return <bool> | [
"Returns",
"whether",
"or",
"not",
"this",
"database",
"table",
"record",
"exists",
"in",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L652-L667 |
49,949 | orb-framework/orb | orb/core/model.py | Model.save | def save(self, values=None, after=None, before=None, **context):
"""
Commits the current change set information to the database,
or inserts this object as a new record into the database.
This method will only update the database if the record
has any local changes to it, otherwis... | python | def save(self, values=None, after=None, before=None, **context):
"""
Commits the current change set information to the database,
or inserts this object as a new record into the database.
This method will only update the database if the record
has any local changes to it, otherwis... | [
"def",
"save",
"(",
"self",
",",
"values",
"=",
"None",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
",",
"*",
"*",
"context",
")",
":",
"# specify that this save call should be performed after the save of",
"# another record, useful for chaining events",
"i... | Commits the current change set information to the database,
or inserts this object as a new record into the database.
This method will only update the database if the record
has any local changes to it, otherwise, no commit will
take place. If the dryRun flag is set, then the SQL
... | [
"Commits",
"the",
"current",
"change",
"set",
"information",
"to",
"the",
"database",
"or",
"inserts",
"this",
"object",
"as",
"a",
"new",
"record",
"into",
"the",
"database",
".",
"This",
"method",
"will",
"only",
"update",
"the",
"database",
"if",
"the",
... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L672-L754 |
49,950 | orb-framework/orb | orb/core/model.py | Model.update | def update(self, values, **context):
"""
Updates the model with the given dictionary of values.
:param values: <dict>
:param context: <orb.Context>
:return: <int>
"""
schema = self.schema()
column_updates = {}
other_updates = {}
for key, ... | python | def update(self, values, **context):
"""
Updates the model with the given dictionary of values.
:param values: <dict>
:param context: <orb.Context>
:return: <int>
"""
schema = self.schema()
column_updates = {}
other_updates = {}
for key, ... | [
"def",
"update",
"(",
"self",
",",
"values",
",",
"*",
"*",
"context",
")",
":",
"schema",
"=",
"self",
".",
"schema",
"(",
")",
"column_updates",
"=",
"{",
"}",
"other_updates",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"values",
".",
"item... | Updates the model with the given dictionary of values.
:param values: <dict>
:param context: <orb.Context>
:return: <int> | [
"Updates",
"the",
"model",
"with",
"the",
"given",
"dictionary",
"of",
"values",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L867-L896 |
49,951 | orb-framework/orb | orb/core/model.py | Model.validate | def validate(self, columns=None):
"""
Validates the current record object to make sure it is ok to commit to the database. If
the optional override dictionary is passed in, then it will use the given values vs. the one
stored with this record object which can be useful to check to see i... | python | def validate(self, columns=None):
"""
Validates the current record object to make sure it is ok to commit to the database. If
the optional override dictionary is passed in, then it will use the given values vs. the one
stored with this record object which can be useful to check to see i... | [
"def",
"validate",
"(",
"self",
",",
"columns",
"=",
"None",
")",
":",
"schema",
"=",
"self",
".",
"schema",
"(",
")",
"if",
"not",
"columns",
":",
"ignore_flags",
"=",
"orb",
".",
"Column",
".",
"Flags",
".",
"Virtual",
"|",
"orb",
".",
"Column",
... | Validates the current record object to make sure it is ok to commit to the database. If
the optional override dictionary is passed in, then it will use the given values vs. the one
stored with this record object which can be useful to check to see if the record will be valid before
it is commit... | [
"Validates",
"the",
"current",
"record",
"object",
"to",
"make",
"sure",
"it",
"is",
"ok",
"to",
"commit",
"to",
"the",
"database",
".",
"If",
"the",
"optional",
"override",
"dictionary",
"is",
"passed",
"in",
"then",
"it",
"will",
"use",
"the",
"given",
... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L898-L929 |
49,952 | orb-framework/orb | orb/core/model.py | Model.addCallback | def addCallback(cls, eventType, func, record=None, once=False):
"""
Adds a callback method to the class. When an event of the given type is triggered, any registered
callback will be executed.
:param eventType: <str>
:param func: <callable>
"""
callbacks = cls... | python | def addCallback(cls, eventType, func, record=None, once=False):
"""
Adds a callback method to the class. When an event of the given type is triggered, any registered
callback will be executed.
:param eventType: <str>
:param func: <callable>
"""
callbacks = cls... | [
"def",
"addCallback",
"(",
"cls",
",",
"eventType",
",",
"func",
",",
"record",
"=",
"None",
",",
"once",
"=",
"False",
")",
":",
"callbacks",
"=",
"cls",
".",
"callbacks",
"(",
")",
"callbacks",
".",
"setdefault",
"(",
"eventType",
",",
"[",
"]",
")... | Adds a callback method to the class. When an event of the given type is triggered, any registered
callback will be executed.
:param eventType: <str>
:param func: <callable> | [
"Adds",
"a",
"callback",
"method",
"to",
"the",
"class",
".",
"When",
"an",
"event",
"of",
"the",
"given",
"type",
"is",
"triggered",
"any",
"registered",
"callback",
"will",
"be",
"executed",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L974-L984 |
49,953 | orb-framework/orb | orb/core/model.py | Model.callbacks | def callbacks(cls, eventType=None):
"""
Returns a list of callback methods that can be invoked whenever an event is processed.
:return: {subclass of <Event>: <list>, ..}
"""
key = '_{0}__callbacks'.format(cls.__name__)
try:
callbacks = getattr(cls, key)
... | python | def callbacks(cls, eventType=None):
"""
Returns a list of callback methods that can be invoked whenever an event is processed.
:return: {subclass of <Event>: <list>, ..}
"""
key = '_{0}__callbacks'.format(cls.__name__)
try:
callbacks = getattr(cls, key)
... | [
"def",
"callbacks",
"(",
"cls",
",",
"eventType",
"=",
"None",
")",
":",
"key",
"=",
"'_{0}__callbacks'",
".",
"format",
"(",
"cls",
".",
"__name__",
")",
"try",
":",
"callbacks",
"=",
"getattr",
"(",
"cls",
",",
"key",
")",
"except",
"AttributeError",
... | Returns a list of callback methods that can be invoked whenever an event is processed.
:return: {subclass of <Event>: <list>, ..} | [
"Returns",
"a",
"list",
"of",
"callback",
"methods",
"that",
"can",
"be",
"invoked",
"whenever",
"an",
"event",
"is",
"processed",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1011-L1024 |
49,954 | orb-framework/orb | orb/core/model.py | Model.create | def create(cls, values, **context):
"""
Shortcut for creating a new record for this table.
:param values | <dict>
:return <orb.Table>
"""
schema = cls.schema()
model = cls
# check for creating inherited classes from a sub class
polymorphi... | python | def create(cls, values, **context):
"""
Shortcut for creating a new record for this table.
:param values | <dict>
:return <orb.Table>
"""
schema = cls.schema()
model = cls
# check for creating inherited classes from a sub class
polymorphi... | [
"def",
"create",
"(",
"cls",
",",
"values",
",",
"*",
"*",
"context",
")",
":",
"schema",
"=",
"cls",
".",
"schema",
"(",
")",
"model",
"=",
"cls",
"# check for creating inherited classes from a sub class",
"polymorphic_columns",
"=",
"schema",
".",
"columns",
... | Shortcut for creating a new record for this table.
:param values | <dict>
:return <orb.Table> | [
"Shortcut",
"for",
"creating",
"a",
"new",
"record",
"for",
"this",
"table",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1027-L1068 |
49,955 | orb-framework/orb | orb/core/model.py | Model.ensureExists | def ensureExists(cls, values, defaults=None, **context):
"""
Defines a new record for the given class based on the
inputted set of keywords. If a record already exists for
the query, the first found record is returned, otherwise
a new record is created and returned.
:pa... | python | def ensureExists(cls, values, defaults=None, **context):
"""
Defines a new record for the given class based on the
inputted set of keywords. If a record already exists for
the query, the first found record is returned, otherwise
a new record is created and returned.
:pa... | [
"def",
"ensureExists",
"(",
"cls",
",",
"values",
",",
"defaults",
"=",
"None",
",",
"*",
"*",
"context",
")",
":",
"# require at least some arguments to be set",
"if",
"not",
"values",
":",
"return",
"cls",
"(",
")",
"# lookup the record from the database",
"q",
... | Defines a new record for the given class based on the
inputted set of keywords. If a record already exists for
the query, the first found record is returned, otherwise
a new record is created and returned.
:param values | <dict> | [
"Defines",
"a",
"new",
"record",
"for",
"the",
"given",
"class",
"based",
"on",
"the",
"inputted",
"set",
"of",
"keywords",
".",
"If",
"a",
"record",
"already",
"exists",
"for",
"the",
"query",
"the",
"first",
"found",
"record",
"is",
"returned",
"otherwis... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1071-L1109 |
49,956 | orb-framework/orb | orb/core/model.py | Model.processEvent | def processEvent(cls, event):
"""
Processes the given event by dispatching it to any waiting callbacks.
:param event: <orb.Event>
"""
callbacks = cls.callbacks(type(event))
keep_going = True
remove_callbacks = []
for callback, record, once in callbacks:
... | python | def processEvent(cls, event):
"""
Processes the given event by dispatching it to any waiting callbacks.
:param event: <orb.Event>
"""
callbacks = cls.callbacks(type(event))
keep_going = True
remove_callbacks = []
for callback, record, once in callbacks:
... | [
"def",
"processEvent",
"(",
"cls",
",",
"event",
")",
":",
"callbacks",
"=",
"cls",
".",
"callbacks",
"(",
"type",
"(",
"event",
")",
")",
"keep_going",
"=",
"True",
"remove_callbacks",
"=",
"[",
"]",
"for",
"callback",
",",
"record",
",",
"once",
"in"... | Processes the given event by dispatching it to any waiting callbacks.
:param event: <orb.Event> | [
"Processes",
"the",
"given",
"event",
"by",
"dispatching",
"it",
"to",
"any",
"waiting",
"callbacks",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1112-L1137 |
49,957 | orb-framework/orb | orb/core/model.py | Model.fetch | def fetch(cls, key, **context):
"""
Looks up a record based on the given key. This will use the
default id field, as well as any keyable properties if the
given key is a string.
:param key: <variant>
:param context: <orb.Context>
:return: <orb.Model> || None
... | python | def fetch(cls, key, **context):
"""
Looks up a record based on the given key. This will use the
default id field, as well as any keyable properties if the
given key is a string.
:param key: <variant>
:param context: <orb.Context>
:return: <orb.Model> || None
... | [
"def",
"fetch",
"(",
"cls",
",",
"key",
",",
"*",
"*",
"context",
")",
":",
"# include any keyable columns for lookup",
"if",
"isinstance",
"(",
"key",
",",
"basestring",
")",
"and",
"not",
"key",
".",
"isdigit",
"(",
")",
":",
"keyable_columns",
"=",
"cls... | Looks up a record based on the given key. This will use the
default id field, as well as any keyable properties if the
given key is a string.
:param key: <variant>
:param context: <orb.Context>
:return: <orb.Model> || None | [
"Looks",
"up",
"a",
"record",
"based",
"on",
"the",
"given",
"key",
".",
"This",
"will",
"use",
"the",
"default",
"id",
"field",
"as",
"well",
"as",
"any",
"keyable",
"properties",
"if",
"the",
"given",
"key",
"is",
"a",
"string",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1140-L1169 |
49,958 | orb-framework/orb | orb/core/model.py | Model.inflate | def inflate(cls, values, **context):
"""
Returns a new record instance for the given class with the values
defined from the database.
:param cls | <subclass of orb.Table>
values | <dict> values
:return <orb.Table>
"""
context = ... | python | def inflate(cls, values, **context):
"""
Returns a new record instance for the given class with the values
defined from the database.
:param cls | <subclass of orb.Table>
values | <dict> values
:return <orb.Table>
"""
context = ... | [
"def",
"inflate",
"(",
"cls",
",",
"values",
",",
"*",
"*",
"context",
")",
":",
"context",
"=",
"orb",
".",
"Context",
"(",
"*",
"*",
"context",
")",
"# inflate values from the database into the given class type",
"if",
"isinstance",
"(",
"values",
",",
"Mode... | Returns a new record instance for the given class with the values
defined from the database.
:param cls | <subclass of orb.Table>
values | <dict> values
:return <orb.Table> | [
"Returns",
"a",
"new",
"record",
"instance",
"for",
"the",
"given",
"class",
"with",
"the",
"values",
"defined",
"from",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1172-L1211 |
49,959 | orb-framework/orb | orb/core/model.py | Model.removeCallback | def removeCallback(cls, eventType, func, record=None):
"""
Removes a callback from the model's event callbacks.
:param eventType: <str>
:param func: <callable>
"""
callbacks = cls.callbacks()
callbacks.setdefault(eventType, [])
for i in xrange(len(callb... | python | def removeCallback(cls, eventType, func, record=None):
"""
Removes a callback from the model's event callbacks.
:param eventType: <str>
:param func: <callable>
"""
callbacks = cls.callbacks()
callbacks.setdefault(eventType, [])
for i in xrange(len(callb... | [
"def",
"removeCallback",
"(",
"cls",
",",
"eventType",
",",
"func",
",",
"record",
"=",
"None",
")",
":",
"callbacks",
"=",
"cls",
".",
"callbacks",
"(",
")",
"callbacks",
".",
"setdefault",
"(",
"eventType",
",",
"[",
"]",
")",
"for",
"i",
"in",
"xr... | Removes a callback from the model's event callbacks.
:param eventType: <str>
:param func: <callable> | [
"Removes",
"a",
"callback",
"from",
"the",
"model",
"s",
"event",
"callbacks",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1225-L1238 |
49,960 | orb-framework/orb | orb/core/model.py | Model.select | def select(cls, **context):
"""
Selects records for the class based on the inputted \
options. If no db is specified, then the current \
global database will be used. If the inflated flag is specified, then \
the results will be inflated to class instances.
If the flag... | python | def select(cls, **context):
"""
Selects records for the class based on the inputted \
options. If no db is specified, then the current \
global database will be used. If the inflated flag is specified, then \
the results will be inflated to class instances.
If the flag... | [
"def",
"select",
"(",
"cls",
",",
"*",
"*",
"context",
")",
":",
"rset_type",
"=",
"getattr",
"(",
"cls",
",",
"'Collection'",
",",
"orb",
".",
"Collection",
")",
"return",
"rset_type",
"(",
"model",
"=",
"cls",
",",
"*",
"*",
"context",
")"
] | Selects records for the class based on the inputted \
options. If no db is specified, then the current \
global database will be used. If the inflated flag is specified, then \
the results will be inflated to class instances.
If the flag is left as None, then results will be auto-infl... | [
"Selects",
"records",
"for",
"the",
"class",
"based",
"on",
"the",
"inputted",
"\\",
"options",
".",
"If",
"no",
"db",
"is",
"specified",
"then",
"the",
"current",
"\\",
"global",
"database",
"will",
"be",
"used",
".",
"If",
"the",
"inflated",
"flag",
"i... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/model.py#L1256-L1281 |
49,961 | priestc/giotto | giotto/views/__init__.py | jinja_template | def jinja_template(template_name, name='data', mimetype="text/html"):
"""
Meta-renderer for rendering jinja templates
"""
def jinja_renderer(result, errors):
template = get_jinja_template(template_name)
context = {name: result or Mock(), 'errors': errors, 'enumerate': enumerate}
... | python | def jinja_template(template_name, name='data', mimetype="text/html"):
"""
Meta-renderer for rendering jinja templates
"""
def jinja_renderer(result, errors):
template = get_jinja_template(template_name)
context = {name: result or Mock(), 'errors': errors, 'enumerate': enumerate}
... | [
"def",
"jinja_template",
"(",
"template_name",
",",
"name",
"=",
"'data'",
",",
"mimetype",
"=",
"\"text/html\"",
")",
":",
"def",
"jinja_renderer",
"(",
"result",
",",
"errors",
")",
":",
"template",
"=",
"get_jinja_template",
"(",
"template_name",
")",
"cont... | Meta-renderer for rendering jinja templates | [
"Meta",
"-",
"renderer",
"for",
"rendering",
"jinja",
"templates"
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/views/__init__.py#L219-L228 |
49,962 | priestc/giotto | giotto/views/__init__.py | partial_jinja_template | def partial_jinja_template(template_name, name='data', mimetype="text/html"):
"""
Partial render of jinja templates. This is useful if you want to re-render
the template in the output middleware phase.
These templates are rendered in a way that all undefined variables will be
kept in the emplate in... | python | def partial_jinja_template(template_name, name='data', mimetype="text/html"):
"""
Partial render of jinja templates. This is useful if you want to re-render
the template in the output middleware phase.
These templates are rendered in a way that all undefined variables will be
kept in the emplate in... | [
"def",
"partial_jinja_template",
"(",
"template_name",
",",
"name",
"=",
"'data'",
",",
"mimetype",
"=",
"\"text/html\"",
")",
":",
"def",
"partial_jinja_renderer",
"(",
"result",
",",
"errors",
")",
":",
"template",
"=",
"get_jinja_template",
"(",
"template_name"... | Partial render of jinja templates. This is useful if you want to re-render
the template in the output middleware phase.
These templates are rendered in a way that all undefined variables will be
kept in the emplate intact. | [
"Partial",
"render",
"of",
"jinja",
"templates",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"re",
"-",
"render",
"the",
"template",
"in",
"the",
"output",
"middleware",
"phase",
".",
"These",
"templates",
"are",
"rendered",
"in",
"a",
"way",
... | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/views/__init__.py#L231-L246 |
49,963 | priestc/giotto | giotto/views/__init__.py | lazy_jinja_template | def lazy_jinja_template(template_name, name='data', mimetype='text/html'):
"""
Jinja template renderer that does not render the template at all.
Instead of returns the context and template object blended together.
Make sure to add ``giotto.middleware.RenderLazytemplate`` to the output
middleware str... | python | def lazy_jinja_template(template_name, name='data', mimetype='text/html'):
"""
Jinja template renderer that does not render the template at all.
Instead of returns the context and template object blended together.
Make sure to add ``giotto.middleware.RenderLazytemplate`` to the output
middleware str... | [
"def",
"lazy_jinja_template",
"(",
"template_name",
",",
"name",
"=",
"'data'",
",",
"mimetype",
"=",
"'text/html'",
")",
":",
"def",
"lazy_jinja_renderer",
"(",
"result",
",",
"errors",
")",
":",
"template",
"=",
"get_jinja_template",
"(",
"template_name",
")",... | Jinja template renderer that does not render the template at all.
Instead of returns the context and template object blended together.
Make sure to add ``giotto.middleware.RenderLazytemplate`` to the output
middleware stread of any program that uses this renderer. | [
"Jinja",
"template",
"renderer",
"that",
"does",
"not",
"render",
"the",
"template",
"at",
"all",
".",
"Instead",
"of",
"returns",
"the",
"context",
"and",
"template",
"object",
"blended",
"together",
".",
"Make",
"sure",
"to",
"add",
"giotto",
".",
"middlew... | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/views/__init__.py#L249-L261 |
49,964 | priestc/giotto | giotto/views/__init__.py | GiottoView._register_renderers | def _register_renderers(self, attrs):
"""
Go through the passed in list of attributes and register those renderers
in the render map.
"""
for method in attrs:
func = getattr(self, method)
mimetypes = getattr(func, 'mimetypes', [])
for mimetype ... | python | def _register_renderers(self, attrs):
"""
Go through the passed in list of attributes and register those renderers
in the render map.
"""
for method in attrs:
func = getattr(self, method)
mimetypes = getattr(func, 'mimetypes', [])
for mimetype ... | [
"def",
"_register_renderers",
"(",
"self",
",",
"attrs",
")",
":",
"for",
"method",
"in",
"attrs",
":",
"func",
"=",
"getattr",
"(",
"self",
",",
"method",
")",
"mimetypes",
"=",
"getattr",
"(",
"func",
",",
"'mimetypes'",
",",
"[",
"]",
")",
"for",
... | Go through the passed in list of attributes and register those renderers
in the render map. | [
"Go",
"through",
"the",
"passed",
"in",
"list",
"of",
"attributes",
"and",
"register",
"those",
"renderers",
"in",
"the",
"render",
"map",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/views/__init__.py#L46-L65 |
49,965 | priestc/giotto | giotto/views/__init__.py | GiottoView.render | def render(self, result, mimetype, errors=None):
"""
Render a model result into `mimetype` format.
"""
available_mimetypes = [x for x in self.render_map.keys() if '/' in x]
render_func = None
if '/' not in mimetype:
# naked superformat (does not correspond to... | python | def render(self, result, mimetype, errors=None):
"""
Render a model result into `mimetype` format.
"""
available_mimetypes = [x for x in self.render_map.keys() if '/' in x]
render_func = None
if '/' not in mimetype:
# naked superformat (does not correspond to... | [
"def",
"render",
"(",
"self",
",",
"result",
",",
"mimetype",
",",
"errors",
"=",
"None",
")",
":",
"available_mimetypes",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"render_map",
".",
"keys",
"(",
")",
"if",
"'/'",
"in",
"x",
"]",
"render_func",
... | Render a model result into `mimetype` format. | [
"Render",
"a",
"model",
"result",
"into",
"mimetype",
"format",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/views/__init__.py#L80-L138 |
49,966 | priestc/giotto | giotto/views/__init__.py | BasicView.generic_html | def generic_html(self, result, errors):
"""
Try to display any object in sensible HTML.
"""
h1 = htmlize(type(result))
out = []
result = pre_process_json(result)
if not hasattr(result, 'items'):
# result is a non-container
header = "<tr><t... | python | def generic_html(self, result, errors):
"""
Try to display any object in sensible HTML.
"""
h1 = htmlize(type(result))
out = []
result = pre_process_json(result)
if not hasattr(result, 'items'):
# result is a non-container
header = "<tr><t... | [
"def",
"generic_html",
"(",
"self",
",",
"result",
",",
"errors",
")",
":",
"h1",
"=",
"htmlize",
"(",
"type",
"(",
"result",
")",
")",
"out",
"=",
"[",
"]",
"result",
"=",
"pre_process_json",
"(",
"result",
")",
"if",
"not",
"hasattr",
"(",
"result"... | Try to display any object in sensible HTML. | [
"Try",
"to",
"display",
"any",
"object",
"in",
"sensible",
"HTML",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/views/__init__.py#L149-L178 |
49,967 | shaunduncan/smokesignal | smokesignal.py | install_twisted | def install_twisted():
"""
If twisted is available, make `emit' return a DeferredList
This has been successfully tested with Twisted 14.0 and later.
"""
global emit, _call_partial
try:
from twisted.internet import defer
emit = _emit_twisted
_call_partial = defer.maybeDef... | python | def install_twisted():
"""
If twisted is available, make `emit' return a DeferredList
This has been successfully tested with Twisted 14.0 and later.
"""
global emit, _call_partial
try:
from twisted.internet import defer
emit = _emit_twisted
_call_partial = defer.maybeDef... | [
"def",
"install_twisted",
"(",
")",
":",
"global",
"emit",
",",
"_call_partial",
"try",
":",
"from",
"twisted",
".",
"internet",
"import",
"defer",
"emit",
"=",
"_emit_twisted",
"_call_partial",
"=",
"defer",
".",
"maybeDeferred",
"return",
"True",
"except",
"... | If twisted is available, make `emit' return a DeferredList
This has been successfully tested with Twisted 14.0 and later. | [
"If",
"twisted",
"is",
"available",
"make",
"emit",
"return",
"a",
"DeferredList"
] | 7906ad0e469b5d4121377c9ee67f77d2f140f2b9 | https://github.com/shaunduncan/smokesignal/blob/7906ad0e469b5d4121377c9ee67f77d2f140f2b9/smokesignal.py#L20-L34 |
49,968 | shaunduncan/smokesignal | smokesignal.py | _call | def _call(callback, args=[], kwargs={}):
"""
Calls a callback with optional args and keyword args lists. This method exists so
we can inspect the `_max_calls` attribute that's set by `_on`. If this value is None,
the callback is considered to have no limit. Otherwise, an integer value is expected
an... | python | def _call(callback, args=[], kwargs={}):
"""
Calls a callback with optional args and keyword args lists. This method exists so
we can inspect the `_max_calls` attribute that's set by `_on`. If this value is None,
the callback is considered to have no limit. Otherwise, an integer value is expected
an... | [
"def",
"_call",
"(",
"callback",
",",
"args",
"=",
"[",
"]",
",",
"kwargs",
"=",
"{",
"}",
")",
":",
"if",
"not",
"hasattr",
"(",
"callback",
",",
"'_max_calls'",
")",
":",
"callback",
".",
"_max_calls",
"=",
"None",
"# None implies no callback limit",
"... | Calls a callback with optional args and keyword args lists. This method exists so
we can inspect the `_max_calls` attribute that's set by `_on`. If this value is None,
the callback is considered to have no limit. Otherwise, an integer value is expected
and decremented until there are no remaining calls | [
"Calls",
"a",
"callback",
"with",
"optional",
"args",
"and",
"keyword",
"args",
"lists",
".",
"This",
"method",
"exists",
"so",
"we",
"can",
"inspect",
"the",
"_max_calls",
"attribute",
"that",
"s",
"set",
"by",
"_on",
".",
"If",
"this",
"value",
"is",
"... | 7906ad0e469b5d4121377c9ee67f77d2f140f2b9 | https://github.com/shaunduncan/smokesignal/blob/7906ad0e469b5d4121377c9ee67f77d2f140f2b9/smokesignal.py#L83-L103 |
49,969 | shaunduncan/smokesignal | smokesignal.py | _on | def _on(on_signals, callback, max_calls=None):
"""
Proxy for `smokesignal.on`, which is compatible as both a function call and
a decorator. This method cannot be used as a decorator
:param signals: A single signal or list/tuple of signals that callback should respond to
:param callback: A callable ... | python | def _on(on_signals, callback, max_calls=None):
"""
Proxy for `smokesignal.on`, which is compatible as both a function call and
a decorator. This method cannot be used as a decorator
:param signals: A single signal or list/tuple of signals that callback should respond to
:param callback: A callable ... | [
"def",
"_on",
"(",
"on_signals",
",",
"callback",
",",
"max_calls",
"=",
"None",
")",
":",
"if",
"not",
"callable",
"(",
"callback",
")",
":",
"raise",
"AssertionError",
"(",
"'Signal callbacks must be callable'",
")",
"# Support for lists of signals",
"if",
"not"... | Proxy for `smokesignal.on`, which is compatible as both a function call and
a decorator. This method cannot be used as a decorator
:param signals: A single signal or list/tuple of signals that callback should respond to
:param callback: A callable that should repond to supplied signal(s)
:param max_cal... | [
"Proxy",
"for",
"smokesignal",
".",
"on",
"which",
"is",
"compatible",
"as",
"both",
"a",
"function",
"call",
"and",
"a",
"decorator",
".",
"This",
"method",
"cannot",
"be",
"used",
"as",
"a",
"decorator"
] | 7906ad0e469b5d4121377c9ee67f77d2f140f2b9 | https://github.com/shaunduncan/smokesignal/blob/7906ad0e469b5d4121377c9ee67f77d2f140f2b9/smokesignal.py#L159-L197 |
49,970 | shaunduncan/smokesignal | smokesignal.py | disconnect_from | def disconnect_from(callback, signals):
"""
Removes a callback from specified signal registries and prevents it from responding
to any emitted signal.
:param callback: A callable registered with smokesignal
:param signals: A single signal or list/tuple of signals
"""
# Support for lists of ... | python | def disconnect_from(callback, signals):
"""
Removes a callback from specified signal registries and prevents it from responding
to any emitted signal.
:param callback: A callable registered with smokesignal
:param signals: A single signal or list/tuple of signals
"""
# Support for lists of ... | [
"def",
"disconnect_from",
"(",
"callback",
",",
"signals",
")",
":",
"# Support for lists of signals",
"if",
"not",
"isinstance",
"(",
"signals",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"signals",
"=",
"[",
"signals",
"]",
"# Remove callback from receiver... | Removes a callback from specified signal registries and prevents it from responding
to any emitted signal.
:param callback: A callable registered with smokesignal
:param signals: A single signal or list/tuple of signals | [
"Removes",
"a",
"callback",
"from",
"specified",
"signal",
"registries",
"and",
"prevents",
"it",
"from",
"responding",
"to",
"any",
"emitted",
"signal",
"."
] | 7906ad0e469b5d4121377c9ee67f77d2f140f2b9 | https://github.com/shaunduncan/smokesignal/blob/7906ad0e469b5d4121377c9ee67f77d2f140f2b9/smokesignal.py#L224-L239 |
49,971 | shaunduncan/smokesignal | smokesignal.py | clear | def clear(*signals):
"""
Clears all callbacks for a particular signal or signals
"""
signals = signals if signals else receivers.keys()
for signal in signals:
receivers[signal].clear() | python | def clear(*signals):
"""
Clears all callbacks for a particular signal or signals
"""
signals = signals if signals else receivers.keys()
for signal in signals:
receivers[signal].clear() | [
"def",
"clear",
"(",
"*",
"signals",
")",
":",
"signals",
"=",
"signals",
"if",
"signals",
"else",
"receivers",
".",
"keys",
"(",
")",
"for",
"signal",
"in",
"signals",
":",
"receivers",
"[",
"signal",
"]",
".",
"clear",
"(",
")"
] | Clears all callbacks for a particular signal or signals | [
"Clears",
"all",
"callbacks",
"for",
"a",
"particular",
"signal",
"or",
"signals"
] | 7906ad0e469b5d4121377c9ee67f77d2f140f2b9 | https://github.com/shaunduncan/smokesignal/blob/7906ad0e469b5d4121377c9ee67f77d2f140f2b9/smokesignal.py#L242-L249 |
49,972 | orb-framework/orb | orb/core/index.py | Index.validate | def validate(self, record, values):
"""
Validates whether or not this index's requirements are satisfied by the inputted record and
values. If this index fails validation, a ValidationError will be raised.
:param record | subclass of <orb.Table>
values | {<orb.... | python | def validate(self, record, values):
"""
Validates whether or not this index's requirements are satisfied by the inputted record and
values. If this index fails validation, a ValidationError will be raised.
:param record | subclass of <orb.Table>
values | {<orb.... | [
"def",
"validate",
"(",
"self",
",",
"record",
",",
"values",
")",
":",
"schema",
"=",
"record",
".",
"schema",
"(",
")",
"columns",
"=",
"self",
".",
"columns",
"(",
")",
"try",
":",
"column_values",
"=",
"[",
"values",
"[",
"col",
"]",
"for",
"co... | Validates whether or not this index's requirements are satisfied by the inputted record and
values. If this index fails validation, a ValidationError will be raised.
:param record | subclass of <orb.Table>
values | {<orb.Column>: <variant>, ..}
:return <bool> | [
"Validates",
"whether",
"or",
"not",
"this",
"index",
"s",
"requirements",
"are",
"satisfied",
"by",
"the",
"inputted",
"record",
"and",
"values",
".",
"If",
"this",
"index",
"fails",
"validation",
"a",
"ValidationError",
"will",
"be",
"raised",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/index.py#L151-L179 |
49,973 | priestc/giotto | giotto/contrib/static/programs.py | StaticServe | def StaticServe(base_path='/views/static/'):
"""
Meta program for serving any file based on the path
"""
def get_file(path=RAW_INVOCATION_ARGS):
fullpath = get_config('project_path') + os.path.join(base_path, path)
try:
mime, encoding = mimetypes.guess_type(fullpath)
... | python | def StaticServe(base_path='/views/static/'):
"""
Meta program for serving any file based on the path
"""
def get_file(path=RAW_INVOCATION_ARGS):
fullpath = get_config('project_path') + os.path.join(base_path, path)
try:
mime, encoding = mimetypes.guess_type(fullpath)
... | [
"def",
"StaticServe",
"(",
"base_path",
"=",
"'/views/static/'",
")",
":",
"def",
"get_file",
"(",
"path",
"=",
"RAW_INVOCATION_ARGS",
")",
":",
"fullpath",
"=",
"get_config",
"(",
"'project_path'",
")",
"+",
"os",
".",
"path",
".",
"join",
"(",
"base_path",... | Meta program for serving any file based on the path | [
"Meta",
"program",
"for",
"serving",
"any",
"file",
"based",
"on",
"the",
"path"
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/contrib/static/programs.py#L24-L41 |
49,974 | priestc/giotto | giotto/contrib/static/programs.py | SingleStaticServe | def SingleStaticServe(file_path):
"""
Meta program for serving a single file. Useful for favicon.ico and robots.txt
"""
def get_file():
mime, encoding = mimetypes.guess_type(file_path)
fullpath = os.path.join(get_config('project_path'), file_path)
return open(fullpath, 'rb'), mim... | python | def SingleStaticServe(file_path):
"""
Meta program for serving a single file. Useful for favicon.ico and robots.txt
"""
def get_file():
mime, encoding = mimetypes.guess_type(file_path)
fullpath = os.path.join(get_config('project_path'), file_path)
return open(fullpath, 'rb'), mim... | [
"def",
"SingleStaticServe",
"(",
"file_path",
")",
":",
"def",
"get_file",
"(",
")",
":",
"mime",
",",
"encoding",
"=",
"mimetypes",
".",
"guess_type",
"(",
"file_path",
")",
"fullpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"get_config",
"(",
"'proj... | Meta program for serving a single file. Useful for favicon.ico and robots.txt | [
"Meta",
"program",
"for",
"serving",
"a",
"single",
"file",
".",
"Useful",
"for",
"favicon",
".",
"ico",
"and",
"robots",
".",
"txt"
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/contrib/static/programs.py#L43-L57 |
49,975 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.onSync | def onSync(self, event):
"""
Initializes the database by defining any additional structures that are required during selection.
"""
SETUP = self.statement('SETUP')
if SETUP:
sql, data = SETUP(self.database())
if event.context.dryRun:
print ... | python | def onSync(self, event):
"""
Initializes the database by defining any additional structures that are required during selection.
"""
SETUP = self.statement('SETUP')
if SETUP:
sql, data = SETUP(self.database())
if event.context.dryRun:
print ... | [
"def",
"onSync",
"(",
"self",
",",
"event",
")",
":",
"SETUP",
"=",
"self",
".",
"statement",
"(",
"'SETUP'",
")",
"if",
"SETUP",
":",
"sql",
",",
"data",
"=",
"SETUP",
"(",
"self",
".",
"database",
"(",
")",
")",
"if",
"event",
".",
"context",
"... | Initializes the database by defining any additional structures that are required during selection. | [
"Initializes",
"the",
"database",
"by",
"defining",
"any",
"additional",
"structures",
"that",
"are",
"required",
"during",
"selection",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L45-L55 |
49,976 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.close | def close(self):
"""
Closes the connection to the database for this connection.
:return <bool> closed
"""
for pool in self.__pool.values():
while not pool.empty():
conn = pool.get_nowait()
try:
self._close(conn)... | python | def close(self):
"""
Closes the connection to the database for this connection.
:return <bool> closed
"""
for pool in self.__pool.values():
while not pool.empty():
conn = pool.get_nowait()
try:
self._close(conn)... | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"pool",
"in",
"self",
".",
"__pool",
".",
"values",
"(",
")",
":",
"while",
"not",
"pool",
".",
"empty",
"(",
")",
":",
"conn",
"=",
"pool",
".",
"get_nowait",
"(",
")",
"try",
":",
"self",
".",
"_c... | Closes the connection to the database for this connection.
:return <bool> closed | [
"Closes",
"the",
"connection",
"to",
"the",
"database",
"for",
"this",
"connection",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L161-L176 |
49,977 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.count | def count(self, model, context):
"""
Returns the count of records that will be loaded for the inputted
information.
:param model | <subclass of orb.Model>
context | <orb.Context>
:return <int>
"""
SELECT_COUNT = self.statement('SEL... | python | def count(self, model, context):
"""
Returns the count of records that will be loaded for the inputted
information.
:param model | <subclass of orb.Model>
context | <orb.Context>
:return <int>
"""
SELECT_COUNT = self.statement('SEL... | [
"def",
"count",
"(",
"self",
",",
"model",
",",
"context",
")",
":",
"SELECT_COUNT",
"=",
"self",
".",
"statement",
"(",
"'SELECT COUNT'",
")",
"try",
":",
"sql",
",",
"data",
"=",
"SELECT_COUNT",
"(",
"model",
",",
"context",
")",
"except",
"orb",
"."... | Returns the count of records that will be loaded for the inputted
information.
:param model | <subclass of orb.Model>
context | <orb.Context>
:return <int> | [
"Returns",
"the",
"count",
"of",
"records",
"that",
"will",
"be",
"loaded",
"for",
"the",
"inputted",
"information",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L178-L204 |
49,978 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.commit | def commit(self):
"""
Commits the changes to the current database connection.
:return <bool> success
"""
with self.native(writeAccess=True) as conn:
if not self._closed(conn):
return self._commit(conn) | python | def commit(self):
"""
Commits the changes to the current database connection.
:return <bool> success
"""
with self.native(writeAccess=True) as conn:
if not self._closed(conn):
return self._commit(conn) | [
"def",
"commit",
"(",
"self",
")",
":",
"with",
"self",
".",
"native",
"(",
"writeAccess",
"=",
"True",
")",
"as",
"conn",
":",
"if",
"not",
"self",
".",
"_closed",
"(",
"conn",
")",
":",
"return",
"self",
".",
"_commit",
"(",
"conn",
")"
] | Commits the changes to the current database connection.
:return <bool> success | [
"Commits",
"the",
"changes",
"to",
"the",
"current",
"database",
"connection",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L206-L214 |
49,979 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.createModel | def createModel(self, model, context, owner='', includeReferences=True):
"""
Creates a new table in the database based cff the inputted
schema information. If the dryRun flag is specified, then
the SQLConnection will only be logged to the current logger, and not
actually execute... | python | def createModel(self, model, context, owner='', includeReferences=True):
"""
Creates a new table in the database based cff the inputted
schema information. If the dryRun flag is specified, then
the SQLConnection will only be logged to the current logger, and not
actually execute... | [
"def",
"createModel",
"(",
"self",
",",
"model",
",",
"context",
",",
"owner",
"=",
"''",
",",
"includeReferences",
"=",
"True",
")",
":",
"CREATE",
"=",
"self",
".",
"statement",
"(",
"'CREATE'",
")",
"sql",
",",
"data",
"=",
"CREATE",
"(",
"model",
... | Creates a new table in the database based cff the inputted
schema information. If the dryRun flag is specified, then
the SQLConnection will only be logged to the current logger, and not
actually executed in the database.
:param model | <orb.Model>
context ... | [
"Creates",
"a",
"new",
"table",
"in",
"the",
"database",
"based",
"cff",
"the",
"inputted",
"schema",
"information",
".",
"If",
"the",
"dryRun",
"flag",
"is",
"specified",
"then",
"the",
"SQLConnection",
"will",
"only",
"be",
"logged",
"to",
"the",
"current"... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L216-L240 |
49,980 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.delete | def delete(self, records, context):
"""
Removes the inputted record from the database.
:param records | <orb.Collection>
context | <orb.Context>
:return <int> number of rows removed
"""
# include various schema records to remove
DE... | python | def delete(self, records, context):
"""
Removes the inputted record from the database.
:param records | <orb.Collection>
context | <orb.Context>
:return <int> number of rows removed
"""
# include various schema records to remove
DE... | [
"def",
"delete",
"(",
"self",
",",
"records",
",",
"context",
")",
":",
"# include various schema records to remove",
"DELETE",
"=",
"self",
".",
"statement",
"(",
"'DELETE'",
")",
"sql",
",",
"data",
"=",
"DELETE",
"(",
"records",
",",
"context",
")",
"if",... | Removes the inputted record from the database.
:param records | <orb.Collection>
context | <orb.Context>
:return <int> number of rows removed | [
"Removes",
"the",
"inputted",
"record",
"from",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L242-L259 |
49,981 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.insert | def insert(self, records, context):
"""
Inserts the table instance into the database. If the
dryRun flag is specified, then the command will be
logged but not executed.
:param records | <orb.Table>
lookup | <orb.LookupOptions>
opt... | python | def insert(self, records, context):
"""
Inserts the table instance into the database. If the
dryRun flag is specified, then the command will be
logged but not executed.
:param records | <orb.Table>
lookup | <orb.LookupOptions>
opt... | [
"def",
"insert",
"(",
"self",
",",
"records",
",",
"context",
")",
":",
"INSERT",
"=",
"self",
".",
"statement",
"(",
"'INSERT'",
")",
"sql",
",",
"data",
"=",
"INSERT",
"(",
"records",
")",
"if",
"context",
".",
"dryRun",
":",
"print",
"sql",
",",
... | Inserts the table instance into the database. If the
dryRun flag is specified, then the command will be
logged but not executed.
:param records | <orb.Table>
lookup | <orb.LookupOptions>
options | <orb.Context>
:return <dict> change... | [
"Inserts",
"the",
"table",
"instance",
"into",
"the",
"database",
".",
"If",
"the",
"dryRun",
"flag",
"is",
"specified",
"then",
"the",
"command",
"will",
"be",
"logged",
"but",
"not",
"executed",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L338-L356 |
49,982 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.isConnected | def isConnected(self):
"""
Returns whether or not this connection is currently
active.
:return <bool> connected
"""
for pool in self.__pool.values():
if not pool.empty():
return True
return False | python | def isConnected(self):
"""
Returns whether or not this connection is currently
active.
:return <bool> connected
"""
for pool in self.__pool.values():
if not pool.empty():
return True
return False | [
"def",
"isConnected",
"(",
"self",
")",
":",
"for",
"pool",
"in",
"self",
".",
"__pool",
".",
"values",
"(",
")",
":",
"if",
"not",
"pool",
".",
"empty",
"(",
")",
":",
"return",
"True",
"return",
"False"
] | Returns whether or not this connection is currently
active.
:return <bool> connected | [
"Returns",
"whether",
"or",
"not",
"this",
"connection",
"is",
"currently",
"active",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L367-L377 |
49,983 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.native | def native(self, writeAccess=False, isolation_level=None):
"""
Opens a new database connection to the database defined
by the inputted database.
:return <varaint> native connection
"""
host = self.database().writeHost() if writeAccess else self.database().host()
... | python | def native(self, writeAccess=False, isolation_level=None):
"""
Opens a new database connection to the database defined
by the inputted database.
:return <varaint> native connection
"""
host = self.database().writeHost() if writeAccess else self.database().host()
... | [
"def",
"native",
"(",
"self",
",",
"writeAccess",
"=",
"False",
",",
"isolation_level",
"=",
"None",
")",
":",
"host",
"=",
"self",
".",
"database",
"(",
")",
".",
"writeHost",
"(",
")",
"if",
"writeAccess",
"else",
"self",
".",
"database",
"(",
")",
... | Opens a new database connection to the database defined
by the inputted database.
:return <varaint> native connection | [
"Opens",
"a",
"new",
"database",
"connection",
"to",
"the",
"database",
"defined",
"by",
"the",
"inputted",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L380-L410 |
49,984 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.open | def open(self, writeAccess=False):
"""
Returns the sqlite database for the current thread.
:return <variant> || None
"""
host = self.database().writeHost() if writeAccess else self.database().host()
pool = self.__pool[host]
if self.__poolSize[host] >= self._... | python | def open(self, writeAccess=False):
"""
Returns the sqlite database for the current thread.
:return <variant> || None
"""
host = self.database().writeHost() if writeAccess else self.database().host()
pool = self.__pool[host]
if self.__poolSize[host] >= self._... | [
"def",
"open",
"(",
"self",
",",
"writeAccess",
"=",
"False",
")",
":",
"host",
"=",
"self",
".",
"database",
"(",
")",
".",
"writeHost",
"(",
")",
"if",
"writeAccess",
"else",
"self",
".",
"database",
"(",
")",
".",
"host",
"(",
")",
"pool",
"=",
... | Returns the sqlite database for the current thread.
:return <variant> || None | [
"Returns",
"the",
"sqlite",
"database",
"for",
"the",
"current",
"thread",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L412-L441 |
49,985 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.rollback | def rollback(self):
"""
Rolls back changes to this database.
"""
with self.native(writeAccess=True) as conn:
return self._rollback(conn) | python | def rollback(self):
"""
Rolls back changes to this database.
"""
with self.native(writeAccess=True) as conn:
return self._rollback(conn) | [
"def",
"rollback",
"(",
"self",
")",
":",
"with",
"self",
".",
"native",
"(",
"writeAccess",
"=",
"True",
")",
"as",
"conn",
":",
"return",
"self",
".",
"_rollback",
"(",
"conn",
")"
] | Rolls back changes to this database. | [
"Rolls",
"back",
"changes",
"to",
"this",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L443-L448 |
49,986 | orb-framework/orb | orb/core/connection_types/sql/sqlconnection.py | SQLConnection.update | def update(self, records, context):
"""
Updates the modified data in the database for the
inputted record. If the dryRun flag is specified then
the command will be logged but not executed.
:param record | <orb.Table>
lookup | <orb.LookupOptions>
... | python | def update(self, records, context):
"""
Updates the modified data in the database for the
inputted record. If the dryRun flag is specified then
the command will be logged but not executed.
:param record | <orb.Table>
lookup | <orb.LookupOptions>
... | [
"def",
"update",
"(",
"self",
",",
"records",
",",
"context",
")",
":",
"UPDATE",
"=",
"self",
".",
"statement",
"(",
"'UPDATE'",
")",
"sql",
",",
"data",
"=",
"UPDATE",
"(",
"records",
")",
"if",
"context",
".",
"dryRun",
":",
"print",
"sql",
",",
... | Updates the modified data in the database for the
inputted record. If the dryRun flag is specified then
the command will be logged but not executed.
:param record | <orb.Table>
lookup | <orb.LookupOptions>
options | <orb.Context>
:retu... | [
"Updates",
"the",
"modified",
"data",
"in",
"the",
"database",
"for",
"the",
"inputted",
"record",
".",
"If",
"the",
"dryRun",
"flag",
"is",
"specified",
"then",
"the",
"command",
"will",
"be",
"logged",
"but",
"not",
"executed",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlconnection.py#L479-L497 |
49,987 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.type | def type(self):
"""
Type of a valid object.
Type may be a JSON type name or a list of such names. Valid JSON type
names are ``string``, ``number``, ``integer``, ``boolean``, ``object``,
``array``, ``any`` (default).
"""
value = self._schema.get("type", "any")
... | python | def type(self):
"""
Type of a valid object.
Type may be a JSON type name or a list of such names. Valid JSON type
names are ``string``, ``number``, ``integer``, ``boolean``, ``object``,
``array``, ``any`` (default).
"""
value = self._schema.get("type", "any")
... | [
"def",
"type",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"type\"",
",",
"\"any\"",
")",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"basestring",
",",
"dict",
",",
"list",
")",
")",
":",
"raise",
"Schema... | Type of a valid object.
Type may be a JSON type name or a list of such names. Valid JSON type
names are ``string``, ``number``, ``integer``, ``boolean``, ``object``,
``array``, ``any`` (default). | [
"Type",
"of",
"a",
"valid",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L56-L98 |
49,988 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.properties | def properties(self):
"""Schema for particular properties of the object."""
value = self._schema.get("properties", {})
if not isinstance(value, dict):
raise SchemaError(
"properties value {0!r} is not an object".format(value))
return value | python | def properties(self):
"""Schema for particular properties of the object."""
value = self._schema.get("properties", {})
if not isinstance(value, dict):
raise SchemaError(
"properties value {0!r} is not an object".format(value))
return value | [
"def",
"properties",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"properties\"",
",",
"{",
"}",
")",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"raise",
"SchemaError",
"(",
"\"properties value {0!r... | Schema for particular properties of the object. | [
"Schema",
"for",
"particular",
"properties",
"of",
"the",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L101-L107 |
49,989 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.items | def items(self):
"""
Schema or a list of schemas describing particular elements of the object.
A single schema applies to all the elements. Each element of the object
must match that schema. A list of schemas describes particular elements
of the object.
"""
value... | python | def items(self):
"""
Schema or a list of schemas describing particular elements of the object.
A single schema applies to all the elements. Each element of the object
must match that schema. A list of schemas describes particular elements
of the object.
"""
value... | [
"def",
"items",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"items\"",
",",
"{",
"}",
")",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"dict",
")",
")",
":",
"raise",
"SchemaError",
"(",
"\"... | Schema or a list of schemas describing particular elements of the object.
A single schema applies to all the elements. Each element of the object
must match that schema. A list of schemas describes particular elements
of the object. | [
"Schema",
"or",
"a",
"list",
"of",
"schemas",
"describing",
"particular",
"elements",
"of",
"the",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L110-L123 |
49,990 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.optional | def optional(self):
"""Flag indicating an optional property."""
value = self._schema.get("optional", False)
if value is not False and value is not True:
raise SchemaError(
"optional value {0!r} is not a boolean".format(value))
return value | python | def optional(self):
"""Flag indicating an optional property."""
value = self._schema.get("optional", False)
if value is not False and value is not True:
raise SchemaError(
"optional value {0!r} is not a boolean".format(value))
return value | [
"def",
"optional",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"optional\"",
",",
"False",
")",
"if",
"value",
"is",
"not",
"False",
"and",
"value",
"is",
"not",
"True",
":",
"raise",
"SchemaError",
"(",
"\"optional ... | Flag indicating an optional property. | [
"Flag",
"indicating",
"an",
"optional",
"property",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L126-L132 |
49,991 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.additionalProperties | def additionalProperties(self):
"""Schema for all additional properties, or False."""
value = self._schema.get("additionalProperties", {})
if not isinstance(value, dict) and value is not False:
raise SchemaError(
"additionalProperties value {0!r} is neither false nor"... | python | def additionalProperties(self):
"""Schema for all additional properties, or False."""
value = self._schema.get("additionalProperties", {})
if not isinstance(value, dict) and value is not False:
raise SchemaError(
"additionalProperties value {0!r} is neither false nor"... | [
"def",
"additionalProperties",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"additionalProperties\"",
",",
"{",
"}",
")",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
"and",
"value",
"is",
"not",
"False",
... | Schema for all additional properties, or False. | [
"Schema",
"for",
"all",
"additional",
"properties",
"or",
"False",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L135-L142 |
49,992 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.requires | def requires(self):
"""Additional object or objects required by this object."""
# NOTE: spec says this can also be a list of strings
value = self._schema.get("requires", {})
if not isinstance(value, (basestring, dict)):
raise SchemaError(
"requires value {0!r}... | python | def requires(self):
"""Additional object or objects required by this object."""
# NOTE: spec says this can also be a list of strings
value = self._schema.get("requires", {})
if not isinstance(value, (basestring, dict)):
raise SchemaError(
"requires value {0!r}... | [
"def",
"requires",
"(",
"self",
")",
":",
"# NOTE: spec says this can also be a list of strings",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"requires\"",
",",
"{",
"}",
")",
"if",
"not",
"isinstance",
"(",
"value",
",",
"(",
"basestring",
",",
... | Additional object or objects required by this object. | [
"Additional",
"object",
"or",
"objects",
"required",
"by",
"this",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L145-L153 |
49,993 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.maximum | def maximum(self):
"""Maximum value of the object."""
value = self._schema.get("maximum", None)
if value is None:
return
if not isinstance(value, NUMERIC_TYPES):
raise SchemaError(
"maximum value {0!r} is not a numeric type".format(
... | python | def maximum(self):
"""Maximum value of the object."""
value = self._schema.get("maximum", None)
if value is None:
return
if not isinstance(value, NUMERIC_TYPES):
raise SchemaError(
"maximum value {0!r} is not a numeric type".format(
... | [
"def",
"maximum",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"maximum\"",
",",
"None",
")",
"if",
"value",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"value",
",",
"NUMERIC_TYPES",
")",
":",
"rai... | Maximum value of the object. | [
"Maximum",
"value",
"of",
"the",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L168-L177 |
49,994 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.minimumCanEqual | def minimumCanEqual(self):
"""Flag indicating if maximum value is inclusive or exclusive."""
if self.minimum is None:
raise SchemaError("minimumCanEqual requires presence of minimum")
value = self._schema.get("minimumCanEqual", True)
if value is not True and value is not Fals... | python | def minimumCanEqual(self):
"""Flag indicating if maximum value is inclusive or exclusive."""
if self.minimum is None:
raise SchemaError("minimumCanEqual requires presence of minimum")
value = self._schema.get("minimumCanEqual", True)
if value is not True and value is not Fals... | [
"def",
"minimumCanEqual",
"(",
"self",
")",
":",
"if",
"self",
".",
"minimum",
"is",
"None",
":",
"raise",
"SchemaError",
"(",
"\"minimumCanEqual requires presence of minimum\"",
")",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"minimumCanEqual\"",
... | Flag indicating if maximum value is inclusive or exclusive. | [
"Flag",
"indicating",
"if",
"maximum",
"value",
"is",
"inclusive",
"or",
"exclusive",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L180-L189 |
49,995 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.maximumCanEqual | def maximumCanEqual(self):
"""Flag indicating if the minimum value is inclusive or exclusive."""
if self.maximum is None:
raise SchemaError("maximumCanEqual requires presence of maximum")
value = self._schema.get("maximumCanEqual", True)
if value is not True and value is not ... | python | def maximumCanEqual(self):
"""Flag indicating if the minimum value is inclusive or exclusive."""
if self.maximum is None:
raise SchemaError("maximumCanEqual requires presence of maximum")
value = self._schema.get("maximumCanEqual", True)
if value is not True and value is not ... | [
"def",
"maximumCanEqual",
"(",
"self",
")",
":",
"if",
"self",
".",
"maximum",
"is",
"None",
":",
"raise",
"SchemaError",
"(",
"\"maximumCanEqual requires presence of maximum\"",
")",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"maximumCanEqual\"",
... | Flag indicating if the minimum value is inclusive or exclusive. | [
"Flag",
"indicating",
"if",
"the",
"minimum",
"value",
"is",
"inclusive",
"or",
"exclusive",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L192-L201 |
49,996 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.pattern | def pattern(self):
"""
Regular expression describing valid objects.
.. note::
JSON schema specifications says that this value SHOULD
follow the ``EMCA 262/Perl 5`` format. We cannot support
this so we support python regular expressions instead. This
... | python | def pattern(self):
"""
Regular expression describing valid objects.
.. note::
JSON schema specifications says that this value SHOULD
follow the ``EMCA 262/Perl 5`` format. We cannot support
this so we support python regular expressions instead. This
... | [
"def",
"pattern",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"pattern\"",
",",
"None",
")",
"if",
"value",
"is",
"None",
":",
"return",
"try",
":",
"return",
"re",
".",
"compile",
"(",
"value",
")",
"except",
"r... | Regular expression describing valid objects.
.. note::
JSON schema specifications says that this value SHOULD
follow the ``EMCA 262/Perl 5`` format. We cannot support
this so we support python regular expressions instead. This
is still valid but should be noted f... | [
"Regular",
"expression",
"describing",
"valid",
"objects",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L236-L257 |
49,997 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.maxLength | def maxLength(self):
"""Maximum length of object."""
value = self._schema.get("maxLength", None)
if value is None:
return
if not isinstance(value, int):
raise SchemaError(
"maxLength value {0!r} is not an integer".format(value))
return valu... | python | def maxLength(self):
"""Maximum length of object."""
value = self._schema.get("maxLength", None)
if value is None:
return
if not isinstance(value, int):
raise SchemaError(
"maxLength value {0!r} is not an integer".format(value))
return valu... | [
"def",
"maxLength",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"maxLength\"",
",",
"None",
")",
"if",
"value",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"value",
",",
"int",
")",
":",
"raise",
... | Maximum length of object. | [
"Maximum",
"length",
"of",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L272-L280 |
49,998 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.enum | def enum(self):
"""
Enumeration of allowed object values.
The enumeration must not contain duplicates.
"""
value = self._schema.get("enum", None)
if value is None:
return
if not isinstance(value, list):
raise SchemaError(
"... | python | def enum(self):
"""
Enumeration of allowed object values.
The enumeration must not contain duplicates.
"""
value = self._schema.get("enum", None)
if value is None:
return
if not isinstance(value, list):
raise SchemaError(
"... | [
"def",
"enum",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"enum\"",
",",
"None",
")",
"if",
"value",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"raise",
"SchemaE... | Enumeration of allowed object values.
The enumeration must not contain duplicates. | [
"Enumeration",
"of",
"allowed",
"object",
"values",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L283-L307 |
49,999 | zyga/json-schema-validator | json_schema_validator/schema.py | Schema.title | def title(self):
"""
Title of the object.
This schema element is purely informative.
"""
value = self._schema.get("title", None)
if value is None:
return
if not isinstance(value, basestring):
raise SchemaError(
"title value... | python | def title(self):
"""
Title of the object.
This schema element is purely informative.
"""
value = self._schema.get("title", None)
if value is None:
return
if not isinstance(value, basestring):
raise SchemaError(
"title value... | [
"def",
"title",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_schema",
".",
"get",
"(",
"\"title\"",
",",
"None",
")",
"if",
"value",
"is",
"None",
":",
"return",
"if",
"not",
"isinstance",
"(",
"value",
",",
"basestring",
")",
":",
"raise",
... | Title of the object.
This schema element is purely informative. | [
"Title",
"of",
"the",
"object",
"."
] | 0504605da5c0a9a5b5b05c41b37661aec9652144 | https://github.com/zyga/json-schema-validator/blob/0504605da5c0a9a5b5b05c41b37661aec9652144/json_schema_validator/schema.py#L310-L322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.