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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
50,400 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_indices | def _py_indices(parameter, lparams, tab):
"""Returns the code to produce py ctypes for the indices of the specified parameter
that has D > 0.
"""
if parameter.D > 0 and ":" in parameter.dimension:
if "in" in parameter.direction:
indexstr = "{0}_{1:d} = c_int({0}_a.shape[{1:d}])"
... | python | def _py_indices(parameter, lparams, tab):
"""Returns the code to produce py ctypes for the indices of the specified parameter
that has D > 0.
"""
if parameter.D > 0 and ":" in parameter.dimension:
if "in" in parameter.direction:
indexstr = "{0}_{1:d} = c_int({0}_a.shape[{1:d}])"
... | [
"def",
"_py_indices",
"(",
"parameter",
",",
"lparams",
",",
"tab",
")",
":",
"if",
"parameter",
".",
"D",
">",
"0",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
":",
"if",
"\"in\"",
"in",
"parameter",
".",
"direction",
":",
"indexstr",
"=",
"\... | Returns the code to produce py ctypes for the indices of the specified parameter
that has D > 0. | [
"Returns",
"the",
"code",
"to",
"produce",
"py",
"ctypes",
"for",
"the",
"indices",
"of",
"the",
"specified",
"parameter",
"that",
"has",
"D",
">",
"0",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L692-L705 |
50,401 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_code_parameter | def _ctypes_code_parameter(lines, parameter, position):
"""Returns the code for the specified parameter being written into a subroutine wrapper.
:arg position: one of ['indices', 'variable', 'out', 'regular', 'saved', 'assign', 'clean']
"""
mdict = {
'indices': _ctypes_indices,
'variabl... | python | def _ctypes_code_parameter(lines, parameter, position):
"""Returns the code for the specified parameter being written into a subroutine wrapper.
:arg position: one of ['indices', 'variable', 'out', 'regular', 'saved', 'assign', 'clean']
"""
mdict = {
'indices': _ctypes_indices,
'variabl... | [
"def",
"_ctypes_code_parameter",
"(",
"lines",
",",
"parameter",
",",
"position",
")",
":",
"mdict",
"=",
"{",
"'indices'",
":",
"_ctypes_indices",
",",
"'variable'",
":",
"_ctypes_variables",
",",
"'out'",
":",
"_ctypes_out",
",",
"'regular'",
":",
"_ctypes_reg... | Returns the code for the specified parameter being written into a subroutine wrapper.
:arg position: one of ['indices', 'variable', 'out', 'regular', 'saved', 'assign', 'clean'] | [
"Returns",
"the",
"code",
"for",
"the",
"specified",
"parameter",
"being",
"written",
"into",
"a",
"subroutine",
"wrapper",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L707-L726 |
50,402 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_dtype | def _ctypes_dtype(parameter):
"""Determines the ISO_C data type to use for describing the specified parameter.
"""
ctype = parameter.ctype
if ctype is None:
if parameter.kind is not None:
return "{}({})".format(parameter.dtype, parameter.kind)
else:
return paramet... | python | def _ctypes_dtype(parameter):
"""Determines the ISO_C data type to use for describing the specified parameter.
"""
ctype = parameter.ctype
if ctype is None:
if parameter.kind is not None:
return "{}({})".format(parameter.dtype, parameter.kind)
else:
return paramet... | [
"def",
"_ctypes_dtype",
"(",
"parameter",
")",
":",
"ctype",
"=",
"parameter",
".",
"ctype",
"if",
"ctype",
"is",
"None",
":",
"if",
"parameter",
".",
"kind",
"is",
"not",
"None",
":",
"return",
"\"{}({})\"",
".",
"format",
"(",
"parameter",
".",
"dtype"... | Determines the ISO_C data type to use for describing the specified parameter. | [
"Determines",
"the",
"ISO_C",
"data",
"type",
"to",
"use",
"for",
"describing",
"the",
"specified",
"parameter",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L728-L738 |
50,403 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_splice | def _ctypes_splice(parameter):
"""Returns a list of variable names that define the size of each dimension.
"""
params = parameter.ctypes_parameter()
if parameter.direction == "(inout)" and ("allocatable" in parameter.modifiers or
"pointer" in parameter.modifi... | python | def _ctypes_splice(parameter):
"""Returns a list of variable names that define the size of each dimension.
"""
params = parameter.ctypes_parameter()
if parameter.direction == "(inout)" and ("allocatable" in parameter.modifiers or
"pointer" in parameter.modifi... | [
"def",
"_ctypes_splice",
"(",
"parameter",
")",
":",
"params",
"=",
"parameter",
".",
"ctypes_parameter",
"(",
")",
"if",
"parameter",
".",
"direction",
"==",
"\"(inout)\"",
"and",
"(",
"\"allocatable\"",
"in",
"parameter",
".",
"modifiers",
"or",
"\"pointer\"",... | Returns a list of variable names that define the size of each dimension. | [
"Returns",
"a",
"list",
"of",
"variable",
"names",
"that",
"define",
"the",
"size",
"of",
"each",
"dimension",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L740-L748 |
50,404 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_indices | def _ctypes_indices(parameter):
"""Returns code for parameter variable declarations specifying the size of each
dimension in the specified parameter.
"""
if (parameter.dimension is not None and ":" in parameter.dimension):
splice = _ctypes_splice(parameter)
if "out" in parameter.directio... | python | def _ctypes_indices(parameter):
"""Returns code for parameter variable declarations specifying the size of each
dimension in the specified parameter.
"""
if (parameter.dimension is not None and ":" in parameter.dimension):
splice = _ctypes_splice(parameter)
if "out" in parameter.directio... | [
"def",
"_ctypes_indices",
"(",
"parameter",
")",
":",
"if",
"(",
"parameter",
".",
"dimension",
"is",
"not",
"None",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
")",
":",
"splice",
"=",
"_ctypes_splice",
"(",
"parameter",
")",
"if",
"\"out\"",
"in... | Returns code for parameter variable declarations specifying the size of each
dimension in the specified parameter. | [
"Returns",
"code",
"for",
"parameter",
"variable",
"declarations",
"specifying",
"the",
"size",
"of",
"each",
"dimension",
"in",
"the",
"specified",
"parameter",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L750-L761 |
50,405 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_variables | def _ctypes_variables(parameter):
"""Returns the local parameter definition for implementing a Fortran wrapper subroutine
for this parameter's parent executable.
"""
if parameter.dimension is not None and ":" in parameter.dimension:
#For arrays that provide input (including 'inout'), we pass the... | python | def _ctypes_variables(parameter):
"""Returns the local parameter definition for implementing a Fortran wrapper subroutine
for this parameter's parent executable.
"""
if parameter.dimension is not None and ":" in parameter.dimension:
#For arrays that provide input (including 'inout'), we pass the... | [
"def",
"_ctypes_variables",
"(",
"parameter",
")",
":",
"if",
"parameter",
".",
"dimension",
"is",
"not",
"None",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
":",
"#For arrays that provide input (including 'inout'), we pass the output separately",
"#through a c-poi... | Returns the local parameter definition for implementing a Fortran wrapper subroutine
for this parameter's parent executable. | [
"Returns",
"the",
"local",
"parameter",
"definition",
"for",
"implementing",
"a",
"Fortran",
"wrapper",
"subroutine",
"for",
"this",
"parameter",
"s",
"parent",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L763-L796 |
50,406 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_out | def _ctypes_out(parameter):
"""Returns a parameter variable declaration for an output variable for the specified
parameter.
"""
if (parameter.dimension is not None and ":" in parameter.dimension
and "out" in parameter.direction and ("allocatable" in parameter.modifiers or
... | python | def _ctypes_out(parameter):
"""Returns a parameter variable declaration for an output variable for the specified
parameter.
"""
if (parameter.dimension is not None and ":" in parameter.dimension
and "out" in parameter.direction and ("allocatable" in parameter.modifiers or
... | [
"def",
"_ctypes_out",
"(",
"parameter",
")",
":",
"if",
"(",
"parameter",
".",
"dimension",
"is",
"not",
"None",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
"and",
"\"out\"",
"in",
"parameter",
".",
"direction",
"and",
"(",
"\"allocatable\"",
"in",
... | Returns a parameter variable declaration for an output variable for the specified
parameter. | [
"Returns",
"a",
"parameter",
"variable",
"declaration",
"for",
"an",
"output",
"variable",
"for",
"the",
"specified",
"parameter",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L798-L808 |
50,407 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_saved | def _ctypes_saved(parameter):
"""Returns local variable declarations that create allocatable variables that can persist
long enough to return their value through ctypes.
"""
if ("out" in parameter.direction and parameter.dimension is not None and
":" in parameter.dimension and ("allocatable" in ... | python | def _ctypes_saved(parameter):
"""Returns local variable declarations that create allocatable variables that can persist
long enough to return their value through ctypes.
"""
if ("out" in parameter.direction and parameter.dimension is not None and
":" in parameter.dimension and ("allocatable" in ... | [
"def",
"_ctypes_saved",
"(",
"parameter",
")",
":",
"if",
"(",
"\"out\"",
"in",
"parameter",
".",
"direction",
"and",
"parameter",
".",
"dimension",
"is",
"not",
"None",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
"and",
"(",
"\"allocatable\"",
"in"... | Returns local variable declarations that create allocatable variables that can persist
long enough to return their value through ctypes. | [
"Returns",
"local",
"variable",
"declarations",
"that",
"create",
"allocatable",
"variables",
"that",
"can",
"persist",
"long",
"enough",
"to",
"return",
"their",
"value",
"through",
"ctypes",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L818-L827 |
50,408 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_clean | def _ctypes_clean(parameter):
"""Returns the lines of code required to assign the correct values to the integers
representing the indices of the output arrays in the ctypes wrapper subroutine.
"""
if ("out" in parameter.direction and parameter.dimension is not None
and ":" in parameter.dimension... | python | def _ctypes_clean(parameter):
"""Returns the lines of code required to assign the correct values to the integers
representing the indices of the output arrays in the ctypes wrapper subroutine.
"""
if ("out" in parameter.direction and parameter.dimension is not None
and ":" in parameter.dimension... | [
"def",
"_ctypes_clean",
"(",
"parameter",
")",
":",
"if",
"(",
"\"out\"",
"in",
"parameter",
".",
"direction",
"and",
"parameter",
".",
"dimension",
"is",
"not",
"None",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
"and",
"(",
"\"pointer\"",
"in",
... | Returns the lines of code required to assign the correct values to the integers
representing the indices of the output arrays in the ctypes wrapper subroutine. | [
"Returns",
"the",
"lines",
"of",
"code",
"required",
"to",
"assign",
"the",
"correct",
"values",
"to",
"the",
"integers",
"representing",
"the",
"indices",
"of",
"the",
"output",
"arrays",
"in",
"the",
"ctypes",
"wrapper",
"subroutine",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L848-L888 |
50,409 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_ex_parameters | def _ctypes_ex_parameters(executable):
"""Returns a list of the parameters to form the wrapper executable to interact
with ctypes.
"""
result = []
for p in executable.ordered_parameters:
result.extend(p.ctypes_parameter())
if type(executable).__name__ == "Function":
result.exten... | python | def _ctypes_ex_parameters(executable):
"""Returns a list of the parameters to form the wrapper executable to interact
with ctypes.
"""
result = []
for p in executable.ordered_parameters:
result.extend(p.ctypes_parameter())
if type(executable).__name__ == "Function":
result.exten... | [
"def",
"_ctypes_ex_parameters",
"(",
"executable",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"executable",
".",
"ordered_parameters",
":",
"result",
".",
"extend",
"(",
"p",
".",
"ctypes_parameter",
"(",
")",
")",
"if",
"type",
"(",
"executable"... | Returns a list of the parameters to form the wrapper executable to interact
with ctypes. | [
"Returns",
"a",
"list",
"of",
"the",
"parameters",
"to",
"form",
"the",
"wrapper",
"executable",
"to",
"interact",
"with",
"ctypes",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L890-L901 |
50,410 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_ex_variables | def _ctypes_ex_variables(executable):
"""Returns a list of the local variable definitions required to construct the
ctypes interop wrapper.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "indices")
_ctypes_code_parameter(result, p, "variable... | python | def _ctypes_ex_variables(executable):
"""Returns a list of the local variable definitions required to construct the
ctypes interop wrapper.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "indices")
_ctypes_code_parameter(result, p, "variable... | [
"def",
"_ctypes_ex_variables",
"(",
"executable",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"executable",
".",
"ordered_parameters",
":",
"_ctypes_code_parameter",
"(",
"result",
",",
"p",
",",
"\"indices\"",
")",
"_ctypes_code_parameter",
"(",
"resul... | Returns a list of the local variable definitions required to construct the
ctypes interop wrapper. | [
"Returns",
"a",
"list",
"of",
"the",
"local",
"variable",
"definitions",
"required",
"to",
"construct",
"the",
"ctypes",
"interop",
"wrapper",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L903-L920 |
50,411 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_ex_compatvars | def _ctypes_ex_compatvars(executable):
"""Returns a list of code lines for signature matching variables, and
pointer saving variables.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "regular")
_ctypes_code_parameter(result, p, "saved")
... | python | def _ctypes_ex_compatvars(executable):
"""Returns a list of code lines for signature matching variables, and
pointer saving variables.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "regular")
_ctypes_code_parameter(result, p, "saved")
... | [
"def",
"_ctypes_ex_compatvars",
"(",
"executable",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"executable",
".",
"ordered_parameters",
":",
"_ctypes_code_parameter",
"(",
"result",
",",
"p",
",",
"\"regular\"",
")",
"_ctypes_code_parameter",
"(",
"resu... | Returns a list of code lines for signature matching variables, and
pointer saving variables. | [
"Returns",
"a",
"list",
"of",
"code",
"lines",
"for",
"signature",
"matching",
"variables",
"and",
"pointer",
"saving",
"variables",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L922-L935 |
50,412 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_ex_assign | def _ctypes_ex_assign(executable):
"""Return a list of code lines to allocate and assign the local parameter definitions
that match those in the signature of the wrapped executable.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "assign")
if ty... | python | def _ctypes_ex_assign(executable):
"""Return a list of code lines to allocate and assign the local parameter definitions
that match those in the signature of the wrapped executable.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "assign")
if ty... | [
"def",
"_ctypes_ex_assign",
"(",
"executable",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"executable",
".",
"ordered_parameters",
":",
"_ctypes_code_parameter",
"(",
"result",
",",
"p",
",",
"\"assign\"",
")",
"if",
"type",
"(",
"executable",
")",... | Return a list of code lines to allocate and assign the local parameter definitions
that match those in the signature of the wrapped executable. | [
"Return",
"a",
"list",
"of",
"code",
"lines",
"to",
"allocate",
"and",
"assign",
"the",
"local",
"parameter",
"definitions",
"that",
"match",
"those",
"in",
"the",
"signature",
"of",
"the",
"wrapped",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L937-L948 |
50,413 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _ctypes_ex_clean | def _ctypes_ex_clean(executable):
"""Return a list of code lines to take care of assigning pointers for output variables
interacting with ctypes.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "clean")
if type(executable).__name__ == "F... | python | def _ctypes_ex_clean(executable):
"""Return a list of code lines to take care of assigning pointers for output variables
interacting with ctypes.
"""
result = []
for p in executable.ordered_parameters:
_ctypes_code_parameter(result, p, "clean")
if type(executable).__name__ == "F... | [
"def",
"_ctypes_ex_clean",
"(",
"executable",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"executable",
".",
"ordered_parameters",
":",
"_ctypes_code_parameter",
"(",
"result",
",",
"p",
",",
"\"clean\"",
")",
"if",
"type",
"(",
"executable",
")",
... | Return a list of code lines to take care of assigning pointers for output variables
interacting with ctypes. | [
"Return",
"a",
"list",
"of",
"code",
"lines",
"to",
"take",
"care",
"of",
"assigning",
"pointers",
"for",
"output",
"variables",
"interacting",
"with",
"ctypes",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L950-L961 |
50,414 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule.libname | def libname(self):
"""Returns the name of the shared library file compiled for the wrapper
subroutines coded in fortran.
"""
if self.library is not None:
return "ftypes.{}.so".format(self.library)
else:
return "{}.so".format(self.name) | python | def libname(self):
"""Returns the name of the shared library file compiled for the wrapper
subroutines coded in fortran.
"""
if self.library is not None:
return "ftypes.{}.so".format(self.library)
else:
return "{}.so".format(self.name) | [
"def",
"libname",
"(",
"self",
")",
":",
"if",
"self",
".",
"library",
"is",
"not",
"None",
":",
"return",
"\"ftypes.{}.so\"",
".",
"format",
"(",
"self",
".",
"library",
")",
"else",
":",
"return",
"\"{}.so\"",
".",
"format",
"(",
"self",
".",
"name",... | Returns the name of the shared library file compiled for the wrapper
subroutines coded in fortran. | [
"Returns",
"the",
"name",
"of",
"the",
"shared",
"library",
"file",
"compiled",
"for",
"the",
"wrapper",
"subroutines",
"coded",
"in",
"fortran",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L54-L61 |
50,415 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._check_lib | def _check_lib(self, remake, compiler, debug, profile):
"""Makes sure that the linked library with the original code exists. If it doesn't
the library is compiled from scratch.
"""
from os import path
if self.link is None or not path.isfile(self.link):
self.makelib(re... | python | def _check_lib(self, remake, compiler, debug, profile):
"""Makes sure that the linked library with the original code exists. If it doesn't
the library is compiled from scratch.
"""
from os import path
if self.link is None or not path.isfile(self.link):
self.makelib(re... | [
"def",
"_check_lib",
"(",
"self",
",",
"remake",
",",
"compiler",
",",
"debug",
",",
"profile",
")",
":",
"from",
"os",
"import",
"path",
"if",
"self",
".",
"link",
"is",
"None",
"or",
"not",
"path",
".",
"isfile",
"(",
"self",
".",
"link",
")",
":... | Makes sure that the linked library with the original code exists. If it doesn't
the library is compiled from scratch. | [
"Makes",
"sure",
"that",
"the",
"linked",
"library",
"with",
"the",
"original",
"code",
"exists",
".",
"If",
"it",
"doesn",
"t",
"the",
"library",
"is",
"compiled",
"from",
"scratch",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L71-L77 |
50,416 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._compile | def _compile(self, dirpath, makename, compiler, debug, profile):
"""Compiles the makefile at the specified location with 'compiler'.
:arg dirpath: the full path to the directory where the makefile lives.
:arg compiler: one of ['ifort', 'gfortran'].
:arg makename: the name of the make fi... | python | def _compile(self, dirpath, makename, compiler, debug, profile):
"""Compiles the makefile at the specified location with 'compiler'.
:arg dirpath: the full path to the directory where the makefile lives.
:arg compiler: one of ['ifort', 'gfortran'].
:arg makename: the name of the make fi... | [
"def",
"_compile",
"(",
"self",
",",
"dirpath",
",",
"makename",
",",
"compiler",
",",
"debug",
",",
"profile",
")",
":",
"from",
"os",
"import",
"path",
"options",
"=",
"\"\"",
"if",
"debug",
":",
"options",
"+=",
"\" DEBUG=true\"",
"if",
"profile",
":"... | Compiles the makefile at the specified location with 'compiler'.
:arg dirpath: the full path to the directory where the makefile lives.
:arg compiler: one of ['ifort', 'gfortran'].
:arg makename: the name of the make file to compile. | [
"Compiles",
"the",
"makefile",
"at",
"the",
"specified",
"location",
"with",
"compiler",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L125-L167 |
50,417 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule.makelib | def makelib(self, remake=False, full=True, compiler="gfortran", debug=False, profile=False):
"""Generates a makefile for the code files that reside in the same directory as the source
that was parsed by the code parser.
:arg full: when True, the shared library is compiled for *all* the code fil... | python | def makelib(self, remake=False, full=True, compiler="gfortran", debug=False, profile=False):
"""Generates a makefile for the code files that reside in the same directory as the source
that was parsed by the code parser.
:arg full: when True, the shared library is compiled for *all* the code fil... | [
"def",
"makelib",
"(",
"self",
",",
"remake",
"=",
"False",
",",
"full",
"=",
"True",
",",
"compiler",
"=",
"\"gfortran\"",
",",
"debug",
"=",
"False",
",",
"profile",
"=",
"False",
")",
":",
"if",
"self",
".",
"link",
"is",
"None",
"or",
"remake",
... | Generates a makefile for the code files that reside in the same directory as the source
that was parsed by the code parser.
:arg full: when True, the shared library is compiled for *all* the code files in the directory
not just the one's that are dependencies of the source module. | [
"Generates",
"a",
"makefile",
"for",
"the",
"code",
"files",
"that",
"reside",
"in",
"the",
"same",
"directory",
"as",
"the",
"source",
"that",
"was",
"parsed",
"by",
"the",
"code",
"parser",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L169-L207 |
50,418 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._copy_so | def _copy_so(self, outpath):
"""Copies the shared library in self.so into the working directory for the wrapper
module if it doesn't already exist.
"""
from os import path
if not path.isfile(outpath) and path.isfile(self.link):
from shutil import copy
copy... | python | def _copy_so(self, outpath):
"""Copies the shared library in self.so into the working directory for the wrapper
module if it doesn't already exist.
"""
from os import path
if not path.isfile(outpath) and path.isfile(self.link):
from shutil import copy
copy... | [
"def",
"_copy_so",
"(",
"self",
",",
"outpath",
")",
":",
"from",
"os",
"import",
"path",
"if",
"not",
"path",
".",
"isfile",
"(",
"outpath",
")",
"and",
"path",
".",
"isfile",
"(",
"self",
".",
"link",
")",
":",
"from",
"shutil",
"import",
"copy",
... | Copies the shared library in self.so into the working directory for the wrapper
module if it doesn't already exist. | [
"Copies",
"the",
"shared",
"library",
"in",
"self",
".",
"so",
"into",
"the",
"working",
"directory",
"for",
"the",
"wrapper",
"module",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L209-L216 |
50,419 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._get_lib_modules | def _get_lib_modules(self, full):
"""Returns a list of the modules in the same folder as the one being wrapped for
compilation as a linked library.
:arg full: when True, all the code files in the source file's directory are considered
as dependencies; otherwise only those explicitly n... | python | def _get_lib_modules(self, full):
"""Returns a list of the modules in the same folder as the one being wrapped for
compilation as a linked library.
:arg full: when True, all the code files in the source file's directory are considered
as dependencies; otherwise only those explicitly n... | [
"def",
"_get_lib_modules",
"(",
"self",
",",
"full",
")",
":",
"#The only complication with the whole process is that we need to get the list of",
"#dependencies for the current module. For full lib, we compile *all* the files in",
"#the directory, otherwise only those that are explicitly requir... | Returns a list of the modules in the same folder as the one being wrapped for
compilation as a linked library.
:arg full: when True, all the code files in the source file's directory are considered
as dependencies; otherwise only those explicitly needed are kept. | [
"Returns",
"a",
"list",
"of",
"the",
"modules",
"in",
"the",
"same",
"folder",
"as",
"the",
"one",
"being",
"wrapped",
"for",
"compilation",
"as",
"a",
"linked",
"library",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L218-L243 |
50,420 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._get_dependencies | def _get_dependencies(self):
"""Gets a list of the module names that should be included in the shared lib compile
as dependencies for the current wrapper module.
"""
#The only complication with the whole process is that we need to get the list of
#dependencies for the current mod... | python | def _get_dependencies(self):
"""Gets a list of the module names that should be included in the shared lib compile
as dependencies for the current wrapper module.
"""
#The only complication with the whole process is that we need to get the list of
#dependencies for the current mod... | [
"def",
"_get_dependencies",
"(",
"self",
")",
":",
"#The only complication with the whole process is that we need to get the list of",
"#dependencies for the current module. For full lib, we compile *all* the files in",
"#the directory, otherwise only those that are explicitly required.",
"from",
... | Gets a list of the module names that should be included in the shared lib compile
as dependencies for the current wrapper module. | [
"Gets",
"a",
"list",
"of",
"the",
"module",
"names",
"that",
"should",
"be",
"included",
"in",
"the",
"shared",
"lib",
"compile",
"as",
"dependencies",
"for",
"the",
"current",
"wrapper",
"module",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L245-L263 |
50,421 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._find_executables | def _find_executables(self):
"""Finds the list of executables that pass the requirements necessary to have
a wrapper created for them.
"""
if len(self.needs) > 0:
return
for execname, executable in list(self.module.executables.items()):
skip = Fal... | python | def _find_executables(self):
"""Finds the list of executables that pass the requirements necessary to have
a wrapper created for them.
"""
if len(self.needs) > 0:
return
for execname, executable in list(self.module.executables.items()):
skip = Fal... | [
"def",
"_find_executables",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"needs",
")",
">",
"0",
":",
"return",
"for",
"execname",
",",
"executable",
"in",
"list",
"(",
"self",
".",
"module",
".",
"executables",
".",
"items",
"(",
")",
")",
... | Finds the list of executables that pass the requirements necessary to have
a wrapper created for them. | [
"Finds",
"the",
"list",
"of",
"executables",
"that",
"pass",
"the",
"requirements",
"necessary",
"to",
"have",
"a",
"wrapper",
"created",
"for",
"them",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L265-L288 |
50,422 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._check_dir | def _check_dir(self):
"""Makes sure that the working directory for the wrapper modules exists.
"""
from os import path, mkdir
if not path.isdir(self.dirpath):
mkdir(self.dirpath)
#Copy the ftypes.py module shipped with fortpy to the local directory.
ft... | python | def _check_dir(self):
"""Makes sure that the working directory for the wrapper modules exists.
"""
from os import path, mkdir
if not path.isdir(self.dirpath):
mkdir(self.dirpath)
#Copy the ftypes.py module shipped with fortpy to the local directory.
ft... | [
"def",
"_check_dir",
"(",
"self",
")",
":",
"from",
"os",
"import",
"path",
",",
"mkdir",
"if",
"not",
"path",
".",
"isdir",
"(",
"self",
".",
"dirpath",
")",
":",
"mkdir",
"(",
"self",
".",
"dirpath",
")",
"#Copy the ftypes.py module shipped with fortpy to ... | Makes sure that the working directory for the wrapper modules exists. | [
"Makes",
"sure",
"that",
"the",
"working",
"directory",
"for",
"the",
"wrapper",
"modules",
"exists",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L290-L312 |
50,423 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule.write_py | def write_py(self):
"""Writes a python module file to the current working directory for the library.
"""
self._check_dir()
#We make it so that the write py method can be called independently (as opposed
#to first needing the F90 write method to be called).
self._find_exec... | python | def write_py(self):
"""Writes a python module file to the current working directory for the library.
"""
self._check_dir()
#We make it so that the write py method can be called independently (as opposed
#to first needing the F90 write method to be called).
self._find_exec... | [
"def",
"write_py",
"(",
"self",
")",
":",
"self",
".",
"_check_dir",
"(",
")",
"#We make it so that the write py method can be called independently (as opposed",
"#to first needing the F90 write method to be called).",
"self",
".",
"_find_executables",
"(",
")",
"lines",
"=",
... | Writes a python module file to the current working directory for the library. | [
"Writes",
"a",
"python",
"module",
"file",
"to",
"the",
"current",
"working",
"directory",
"for",
"the",
"library",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L314-L339 |
50,424 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule.write_f90 | def write_f90(self):
"""Writes the F90 module file to the specified directory.
"""
from os import path
self._check_dir()
#Find the list of executables that we actually need to write wrappers for.
self._find_executables()
lines = []
lines.append("!... | python | def write_f90(self):
"""Writes the F90 module file to the specified directory.
"""
from os import path
self._check_dir()
#Find the list of executables that we actually need to write wrappers for.
self._find_executables()
lines = []
lines.append("!... | [
"def",
"write_f90",
"(",
"self",
")",
":",
"from",
"os",
"import",
"path",
"self",
".",
"_check_dir",
"(",
")",
"#Find the list of executables that we actually need to write wrappers for.",
"self",
".",
"_find_executables",
"(",
")",
"lines",
"=",
"[",
"]",
"lines",... | Writes the F90 module file to the specified directory. | [
"Writes",
"the",
"F90",
"module",
"file",
"to",
"the",
"specified",
"directory",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L424-L453 |
50,425 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._write_executable_f90 | def _write_executable_f90(self, execname, lines):
"""Appends the Fortran code to write the wrapper executable to the specified 'lines' list.
:arg execname: the name of the executable in the self.module.executables to write.
"""
executable = self.module.executables[execname]
... | python | def _write_executable_f90(self, execname, lines):
"""Appends the Fortran code to write the wrapper executable to the specified 'lines' list.
:arg execname: the name of the executable in the self.module.executables to write.
"""
executable = self.module.executables[execname]
... | [
"def",
"_write_executable_f90",
"(",
"self",
",",
"execname",
",",
"lines",
")",
":",
"executable",
"=",
"self",
".",
"module",
".",
"executables",
"[",
"execname",
"]",
"#The 14 in the formatting indent comes from 4 spaces, 2 from \"_c\", 1 from the spacing",
"#between 'su... | Appends the Fortran code to write the wrapper executable to the specified 'lines' list.
:arg execname: the name of the executable in the self.module.executables to write. | [
"Appends",
"the",
"Fortran",
"code",
"to",
"write",
"the",
"wrapper",
"executable",
"to",
"the",
"specified",
"lines",
"list",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L455-L486 |
50,426 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | WrapperModule._process_module_needs | def _process_module_needs(self, modules):
"""Adds the module and its dependencies to the result list in dependency order."""
result = list(modules)
for i, module in enumerate(modules):
#It is possible that the parser couldn't find it, if so
#we can't create the executable... | python | def _process_module_needs(self, modules):
"""Adds the module and its dependencies to the result list in dependency order."""
result = list(modules)
for i, module in enumerate(modules):
#It is possible that the parser couldn't find it, if so
#we can't create the executable... | [
"def",
"_process_module_needs",
"(",
"self",
",",
"modules",
")",
":",
"result",
"=",
"list",
"(",
"modules",
")",
"for",
"i",
",",
"module",
"in",
"enumerate",
"(",
"modules",
")",
":",
"#It is possible that the parser couldn't find it, if so",
"#we can't create th... | Adds the module and its dependencies to the result list in dependency order. | [
"Adds",
"the",
"module",
"and",
"its",
"dependencies",
"to",
"the",
"result",
"list",
"in",
"dependency",
"order",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L488-L513 |
50,427 | rosenbrockc/fortpy | fortpy/tramp.py | coderelpath | def coderelpath(coderoot, relpath):
"""Returns the absolute path of the 'relpath' relative to the specified code directory."""
from os import chdir, getcwd, path
cd = getcwd()
chdir(coderoot)
result = path.abspath(relpath)
chdir(cd)
return result | python | def coderelpath(coderoot, relpath):
"""Returns the absolute path of the 'relpath' relative to the specified code directory."""
from os import chdir, getcwd, path
cd = getcwd()
chdir(coderoot)
result = path.abspath(relpath)
chdir(cd)
return result | [
"def",
"coderelpath",
"(",
"coderoot",
",",
"relpath",
")",
":",
"from",
"os",
"import",
"chdir",
",",
"getcwd",
",",
"path",
"cd",
"=",
"getcwd",
"(",
")",
"chdir",
"(",
"coderoot",
")",
"result",
"=",
"path",
".",
"abspath",
"(",
"relpath",
")",
"c... | Returns the absolute path of the 'relpath' relative to the specified code directory. | [
"Returns",
"the",
"absolute",
"path",
"of",
"the",
"relpath",
"relative",
"to",
"the",
"specified",
"code",
"directory",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L8-L15 |
50,428 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport._setup_ssh | def _setup_ssh(self):
"""Initializes the connection to the server via SSH."""
global paramiko
if paramiko is none:
import paramiko
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(self.server, use... | python | def _setup_ssh(self):
"""Initializes the connection to the server via SSH."""
global paramiko
if paramiko is none:
import paramiko
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(self.server, use... | [
"def",
"_setup_ssh",
"(",
"self",
")",
":",
"global",
"paramiko",
"if",
"paramiko",
"is",
"none",
":",
"import",
"paramiko",
"self",
".",
"ssh",
"=",
"paramiko",
".",
"SSHClient",
"(",
")",
"self",
".",
"ssh",
".",
"set_missing_host_key_policy",
"(",
"para... | Initializes the connection to the server via SSH. | [
"Initializes",
"the",
"connection",
"to",
"the",
"server",
"via",
"SSH",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L29-L37 |
50,429 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.abspath | def abspath(self, path):
"""Returns the absolute path to the specified relative or user-relative
path. For ssh paths, just return the full ssh path."""
if self.is_ssh(path):
return path
else:
return os.path.abspath(path) | python | def abspath(self, path):
"""Returns the absolute path to the specified relative or user-relative
path. For ssh paths, just return the full ssh path."""
if self.is_ssh(path):
return path
else:
return os.path.abspath(path) | [
"def",
"abspath",
"(",
"self",
",",
"path",
")",
":",
"if",
"self",
".",
"is_ssh",
"(",
"path",
")",
":",
"return",
"path",
"else",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")"
] | Returns the absolute path to the specified relative or user-relative
path. For ssh paths, just return the full ssh path. | [
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"specified",
"relative",
"or",
"user",
"-",
"relative",
"path",
".",
"For",
"ssh",
"paths",
"just",
"return",
"the",
"full",
"ssh",
"path",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L60-L66 |
50,430 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.dirname | def dirname(self, path):
"""Returns the full path to the parent directory of the specified
file path."""
if self.is_ssh(path):
remotepath = self._get_remote(path)
remotedir = os.path.dirname(remotepath)
return self._get_tramp_path(remotedir)
else:
... | python | def dirname(self, path):
"""Returns the full path to the parent directory of the specified
file path."""
if self.is_ssh(path):
remotepath = self._get_remote(path)
remotedir = os.path.dirname(remotepath)
return self._get_tramp_path(remotedir)
else:
... | [
"def",
"dirname",
"(",
"self",
",",
"path",
")",
":",
"if",
"self",
".",
"is_ssh",
"(",
"path",
")",
":",
"remotepath",
"=",
"self",
".",
"_get_remote",
"(",
"path",
")",
"remotedir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"remotepath",
")",
... | Returns the full path to the parent directory of the specified
file path. | [
"Returns",
"the",
"full",
"path",
"to",
"the",
"parent",
"directory",
"of",
"the",
"specified",
"file",
"path",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L68-L76 |
50,431 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.touch | def touch(self, filepath):
"""Touches the specified file so that its modified time changes."""
if self.is_ssh(filepath):
self._check_ssh()
remotepath = self._get_remote(filepath)
stdin, stdout, stderr = self.ssh.exec_command("touch {}".format(remotepath))
... | python | def touch(self, filepath):
"""Touches the specified file so that its modified time changes."""
if self.is_ssh(filepath):
self._check_ssh()
remotepath = self._get_remote(filepath)
stdin, stdout, stderr = self.ssh.exec_command("touch {}".format(remotepath))
... | [
"def",
"touch",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"self",
".",
"is_ssh",
"(",
"filepath",
")",
":",
"self",
".",
"_check_ssh",
"(",
")",
"remotepath",
"=",
"self",
".",
"_get_remote",
"(",
"filepath",
")",
"stdin",
",",
"stdout",
",",
"st... | Touches the specified file so that its modified time changes. | [
"Touches",
"the",
"specified",
"file",
"so",
"that",
"its",
"modified",
"time",
"changes",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L78-L86 |
50,432 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.expanduser | def expanduser(self, filepath, ssh=False):
"""Replaces the user root ~ with the full path on the file system.
Works for local disks and remote servers. For remote servers, set
ssh=True."""
if ssh:
self._check_ssh()
stdin, stdout, stderr = self.ssh.exec_command("cd... | python | def expanduser(self, filepath, ssh=False):
"""Replaces the user root ~ with the full path on the file system.
Works for local disks and remote servers. For remote servers, set
ssh=True."""
if ssh:
self._check_ssh()
stdin, stdout, stderr = self.ssh.exec_command("cd... | [
"def",
"expanduser",
"(",
"self",
",",
"filepath",
",",
"ssh",
"=",
"False",
")",
":",
"if",
"ssh",
":",
"self",
".",
"_check_ssh",
"(",
")",
"stdin",
",",
"stdout",
",",
"stderr",
"=",
"self",
".",
"ssh",
".",
"exec_command",
"(",
"\"cd; pwd\"",
")"... | Replaces the user root ~ with the full path on the file system.
Works for local disks and remote servers. For remote servers, set
ssh=True. | [
"Replaces",
"the",
"user",
"root",
"~",
"with",
"the",
"full",
"path",
"on",
"the",
"file",
"system",
".",
"Works",
"for",
"local",
"disks",
"and",
"remote",
"servers",
".",
"For",
"remote",
"servers",
"set",
"ssh",
"=",
"True",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L88-L99 |
50,433 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.getmtime | def getmtime(self, filepath):
"""Gets the last time that the file was modified."""
if self.is_ssh(filepath):
self._check_ftp()
source = self._get_remote(filepath)
mtime = self.ftp.stat(source).st_mtime
else:
mtime = os.path.getmtime(filepath)
... | python | def getmtime(self, filepath):
"""Gets the last time that the file was modified."""
if self.is_ssh(filepath):
self._check_ftp()
source = self._get_remote(filepath)
mtime = self.ftp.stat(source).st_mtime
else:
mtime = os.path.getmtime(filepath)
... | [
"def",
"getmtime",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"self",
".",
"is_ssh",
"(",
"filepath",
")",
":",
"self",
".",
"_check_ftp",
"(",
")",
"source",
"=",
"self",
".",
"_get_remote",
"(",
"filepath",
")",
"mtime",
"=",
"self",
".",
"ftp",... | Gets the last time that the file was modified. | [
"Gets",
"the",
"last",
"time",
"that",
"the",
"file",
"was",
"modified",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L117-L126 |
50,434 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.read | def read(self, filepath):
"""Returns the entire file as a string even if it is on a remote
server."""
target = self._read_check(filepath)
if os.path.isfile(target):
with open(target) as f:
string = f.read()
#If we got this file via SSH, delete it... | python | def read(self, filepath):
"""Returns the entire file as a string even if it is on a remote
server."""
target = self._read_check(filepath)
if os.path.isfile(target):
with open(target) as f:
string = f.read()
#If we got this file via SSH, delete it... | [
"def",
"read",
"(",
"self",
",",
"filepath",
")",
":",
"target",
"=",
"self",
".",
"_read_check",
"(",
"filepath",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"target",
")",
":",
"with",
"open",
"(",
"target",
")",
"as",
"f",
":",
"string",
... | Returns the entire file as a string even if it is on a remote
server. | [
"Returns",
"the",
"entire",
"file",
"as",
"a",
"string",
"even",
"if",
"it",
"is",
"on",
"a",
"remote",
"server",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L128-L143 |
50,435 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.walk | def walk(self, dirpath):
"""Performs an os.walk on a local or SSH filepath."""
if self.is_ssh(dirpath):
self._check_ftp()
remotepath = self._get_remote(dirpath)
return self._sftp_walk(remotepath)
else:
return os.walk(dirpath) | python | def walk(self, dirpath):
"""Performs an os.walk on a local or SSH filepath."""
if self.is_ssh(dirpath):
self._check_ftp()
remotepath = self._get_remote(dirpath)
return self._sftp_walk(remotepath)
else:
return os.walk(dirpath) | [
"def",
"walk",
"(",
"self",
",",
"dirpath",
")",
":",
"if",
"self",
".",
"is_ssh",
"(",
"dirpath",
")",
":",
"self",
".",
"_check_ftp",
"(",
")",
"remotepath",
"=",
"self",
".",
"_get_remote",
"(",
"dirpath",
")",
"return",
"self",
".",
"_sftp_walk",
... | Performs an os.walk on a local or SSH filepath. | [
"Performs",
"an",
"os",
".",
"walk",
"on",
"a",
"local",
"or",
"SSH",
"filepath",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L180-L187 |
50,436 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport._sftp_walk | def _sftp_walk(self, remotepath):
"""Performs the same function as os.walk but over the SSH channel."""
#Get all the files and folders in the current directory over SFTP.
path = remotepath # We need this instance of path for the yield to work.
files=[]
folders=[]
for f in... | python | def _sftp_walk(self, remotepath):
"""Performs the same function as os.walk but over the SSH channel."""
#Get all the files and folders in the current directory over SFTP.
path = remotepath # We need this instance of path for the yield to work.
files=[]
folders=[]
for f in... | [
"def",
"_sftp_walk",
"(",
"self",
",",
"remotepath",
")",
":",
"#Get all the files and folders in the current directory over SFTP.",
"path",
"=",
"remotepath",
"# We need this instance of path for the yield to work.",
"files",
"=",
"[",
"]",
"folders",
"=",
"[",
"]",
"for",... | Performs the same function as os.walk but over the SSH channel. | [
"Performs",
"the",
"same",
"function",
"as",
"os",
".",
"walk",
"but",
"over",
"the",
"SSH",
"channel",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L189-L209 |
50,437 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport._get_hashed_path | def _get_hashed_path(self, path):
"""Returns an md5 hash for the specified file path."""
return self._get_path('%s.pkl' % hashlib.md5(path.encode("utf-8")).hexdigest()) | python | def _get_hashed_path(self, path):
"""Returns an md5 hash for the specified file path."""
return self._get_path('%s.pkl' % hashlib.md5(path.encode("utf-8")).hexdigest()) | [
"def",
"_get_hashed_path",
"(",
"self",
",",
"path",
")",
":",
"return",
"self",
".",
"_get_path",
"(",
"'%s.pkl'",
"%",
"hashlib",
".",
"md5",
"(",
"path",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
".",
"hexdigest",
"(",
")",
")"
] | Returns an md5 hash for the specified file path. | [
"Returns",
"an",
"md5",
"hash",
"for",
"the",
"specified",
"file",
"path",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L221-L223 |
50,438 | rosenbrockc/fortpy | fortpy/tramp.py | FileSupport.pkey | def pkey(self):
"""Returns the private key for quick authentication on the SSH server."""
if self._pkey is None:
self._pkey = self._get_pkey()
return self._pkey | python | def pkey(self):
"""Returns the private key for quick authentication on the SSH server."""
if self._pkey is None:
self._pkey = self._get_pkey()
return self._pkey | [
"def",
"pkey",
"(",
"self",
")",
":",
"if",
"self",
".",
"_pkey",
"is",
"None",
":",
"self",
".",
"_pkey",
"=",
"self",
".",
"_get_pkey",
"(",
")",
"return",
"self",
".",
"_pkey"
] | Returns the private key for quick authentication on the SSH server. | [
"Returns",
"the",
"private",
"key",
"for",
"quick",
"authentication",
"on",
"the",
"SSH",
"server",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/tramp.py#L253-L258 |
50,439 | hyde/commando | commando/application.py | metarator.metarate | def metarate(self, func, name='values'):
"""
Set the values object to the function object's namespace
"""
setattr(func, name, self.values)
return func | python | def metarate(self, func, name='values'):
"""
Set the values object to the function object's namespace
"""
setattr(func, name, self.values)
return func | [
"def",
"metarate",
"(",
"self",
",",
"func",
",",
"name",
"=",
"'values'",
")",
":",
"setattr",
"(",
"func",
",",
"name",
",",
"self",
".",
"values",
")",
"return",
"func"
] | Set the values object to the function object's namespace | [
"Set",
"the",
"values",
"object",
"to",
"the",
"function",
"object",
"s",
"namespace"
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/application.py#L118-L123 |
50,440 | hyde/commando | commando/application.py | Application.exit | def exit(self, status=0, message=None):
"""
Delegates to `ArgumentParser.exit`
"""
if status:
self.logger.error(message)
if self.__parser__: # pylint: disable-msg=E1101
self.__parser__.exit(status, message) # pylint: disable-msg=E1101
else:
... | python | def exit(self, status=0, message=None):
"""
Delegates to `ArgumentParser.exit`
"""
if status:
self.logger.error(message)
if self.__parser__: # pylint: disable-msg=E1101
self.__parser__.exit(status, message) # pylint: disable-msg=E1101
else:
... | [
"def",
"exit",
"(",
"self",
",",
"status",
"=",
"0",
",",
"message",
"=",
"None",
")",
":",
"if",
"status",
":",
"self",
".",
"logger",
".",
"error",
"(",
"message",
")",
"if",
"self",
".",
"__parser__",
":",
"# pylint: disable-msg=E1101",
"self",
".",... | Delegates to `ArgumentParser.exit` | [
"Delegates",
"to",
"ArgumentParser",
".",
"exit"
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/application.py#L247-L256 |
50,441 | hyde/commando | commando/application.py | Application.error | def error(self, message=None):
"""
Delegates to `ArgumentParser.error`
"""
if self.__parser__: # pylint: disable-msg=E1101
self.__parser__.error(message) # pylint: disable-msg=E1101
else:
self.logger.error(message)
sys.exit(2) | python | def error(self, message=None):
"""
Delegates to `ArgumentParser.error`
"""
if self.__parser__: # pylint: disable-msg=E1101
self.__parser__.error(message) # pylint: disable-msg=E1101
else:
self.logger.error(message)
sys.exit(2) | [
"def",
"error",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"if",
"self",
".",
"__parser__",
":",
"# pylint: disable-msg=E1101",
"self",
".",
"__parser__",
".",
"error",
"(",
"message",
")",
"# pylint: disable-msg=E1101",
"else",
":",
"self",
".",
"l... | Delegates to `ArgumentParser.error` | [
"Delegates",
"to",
"ArgumentParser",
".",
"error"
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/application.py#L258-L266 |
50,442 | hyde/commando | commando/application.py | Application.run | def run(self, args=None):
"""
Runs the main command or sub command based on user input
"""
if not args:
args = self.parse(sys.argv[1:])
if getattr(args, 'verbose', False):
self.logger.setLevel(logging.DEBUG)
try:
if hasattr(args, 'ru... | python | def run(self, args=None):
"""
Runs the main command or sub command based on user input
"""
if not args:
args = self.parse(sys.argv[1:])
if getattr(args, 'verbose', False):
self.logger.setLevel(logging.DEBUG)
try:
if hasattr(args, 'ru... | [
"def",
"run",
"(",
"self",
",",
"args",
"=",
"None",
")",
":",
"if",
"not",
"args",
":",
"args",
"=",
"self",
".",
"parse",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
")",
"if",
"getattr",
"(",
"args",
",",
"'verbose'",
",",
"False",
")",
"... | Runs the main command or sub command based on user input | [
"Runs",
"the",
"main",
"command",
"or",
"sub",
"command",
"based",
"on",
"user",
"input"
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/application.py#L296-L318 |
50,443 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateLine.nvalues | def nvalues(self):
"""Returns the number of values recorded on this single line. If the
number is variable, it returns -1."""
if self._nvalues is None:
self._nvalues = 0
for val in self.values:
if type(val) == type(int):
self._nvalues +... | python | def nvalues(self):
"""Returns the number of values recorded on this single line. If the
number is variable, it returns -1."""
if self._nvalues is None:
self._nvalues = 0
for val in self.values:
if type(val) == type(int):
self._nvalues +... | [
"def",
"nvalues",
"(",
"self",
")",
":",
"if",
"self",
".",
"_nvalues",
"is",
"None",
":",
"self",
".",
"_nvalues",
"=",
"0",
"for",
"val",
"in",
"self",
".",
"values",
":",
"if",
"type",
"(",
"val",
")",
"==",
"type",
"(",
"int",
")",
":",
"se... | Returns the number of values recorded on this single line. If the
number is variable, it returns -1. | [
"Returns",
"the",
"number",
"of",
"values",
"recorded",
"on",
"this",
"single",
"line",
".",
"If",
"the",
"number",
"is",
"variable",
"it",
"returns",
"-",
"1",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L74-L86 |
50,444 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateLine.write | def write(self, valuedict):
"""Returns the lines that this template line should add to the input file."""
if self.identifier in valuedict:
value = valuedict[self.identifier]
elif self.default is not None:
value = self.default
elif self.fromtag is not None and self... | python | def write(self, valuedict):
"""Returns the lines that this template line should add to the input file."""
if self.identifier in valuedict:
value = valuedict[self.identifier]
elif self.default is not None:
value = self.default
elif self.fromtag is not None and self... | [
"def",
"write",
"(",
"self",
",",
"valuedict",
")",
":",
"if",
"self",
".",
"identifier",
"in",
"valuedict",
":",
"value",
"=",
"valuedict",
"[",
"self",
".",
"identifier",
"]",
"elif",
"self",
".",
"default",
"is",
"not",
"None",
":",
"value",
"=",
... | Returns the lines that this template line should add to the input file. | [
"Returns",
"the",
"lines",
"that",
"this",
"template",
"line",
"should",
"add",
"to",
"the",
"input",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L88-L125 |
50,445 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateLine.parse | def parse(self, element):
"""Parses the contents of the specified XML element using template info.
:arg element: the XML element from the input file being converted.
"""
result = []
if element.text is not None and element.tag == self.identifier:
l, k = (0, 0)
... | python | def parse(self, element):
"""Parses the contents of the specified XML element using template info.
:arg element: the XML element from the input file being converted.
"""
result = []
if element.text is not None and element.tag == self.identifier:
l, k = (0, 0)
... | [
"def",
"parse",
"(",
"self",
",",
"element",
")",
":",
"result",
"=",
"[",
"]",
"if",
"element",
".",
"text",
"is",
"not",
"None",
"and",
"element",
".",
"tag",
"==",
"self",
".",
"identifier",
":",
"l",
",",
"k",
"=",
"(",
"0",
",",
"0",
")",
... | Parses the contents of the specified XML element using template info.
:arg element: the XML element from the input file being converted. | [
"Parses",
"the",
"contents",
"of",
"the",
"specified",
"XML",
"element",
"using",
"template",
"info",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L127-L152 |
50,446 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateLine._cast_int | def _cast_int(self, value):
"""Returns the specified value as int if possible."""
try:
return int(value)
except ValueError:
msg.err("Cannot convert {} to int for line {}.".format(value, self.identifier))
exit(1) | python | def _cast_int(self, value):
"""Returns the specified value as int if possible."""
try:
return int(value)
except ValueError:
msg.err("Cannot convert {} to int for line {}.".format(value, self.identifier))
exit(1) | [
"def",
"_cast_int",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"return",
"int",
"(",
"value",
")",
"except",
"ValueError",
":",
"msg",
".",
"err",
"(",
"\"Cannot convert {} to int for line {}.\"",
".",
"format",
"(",
"value",
",",
"self",
".",
"ident... | Returns the specified value as int if possible. | [
"Returns",
"the",
"specified",
"value",
"as",
"int",
"if",
"possible",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L154-L160 |
50,447 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateLine._cast_float | def _cast_float(self, value):
"""Returns the specified value as float if possible."""
try:
return float(value)
except ValueError:
msg.err("Cannot convert {} to float for line {}.".format(value, self.identifier))
exit(1) | python | def _cast_float(self, value):
"""Returns the specified value as float if possible."""
try:
return float(value)
except ValueError:
msg.err("Cannot convert {} to float for line {}.".format(value, self.identifier))
exit(1) | [
"def",
"_cast_float",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"return",
"float",
"(",
"value",
")",
"except",
"ValueError",
":",
"msg",
".",
"err",
"(",
"\"Cannot convert {} to float for line {}.\"",
".",
"format",
"(",
"value",
",",
"self",
".",
... | Returns the specified value as float if possible. | [
"Returns",
"the",
"specified",
"value",
"as",
"float",
"if",
"possible",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L162-L168 |
50,448 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateGroup._load | def _load(self, element, commentchar):
"""Loads all the child line elements from the XML group element."""
for child in element:
if "id" in child.attrib:
tline = TemplateLine(child, self, commentchar)
self.order.append(tline.identifier)
... | python | def _load(self, element, commentchar):
"""Loads all the child line elements from the XML group element."""
for child in element:
if "id" in child.attrib:
tline = TemplateLine(child, self, commentchar)
self.order.append(tline.identifier)
... | [
"def",
"_load",
"(",
"self",
",",
"element",
",",
"commentchar",
")",
":",
"for",
"child",
"in",
"element",
":",
"if",
"\"id\"",
"in",
"child",
".",
"attrib",
":",
"tline",
"=",
"TemplateLine",
"(",
"child",
",",
"self",
",",
"commentchar",
")",
"self"... | Loads all the child line elements from the XML group element. | [
"Loads",
"all",
"the",
"child",
"line",
"elements",
"from",
"the",
"XML",
"group",
"element",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L193-L201 |
50,449 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateGroup.parse | def parse(self, element):
"""Extracts the values from the specified XML element that is being converted."""
#All the children of this element are what we are trying to parse.
result = []
for child in element:
if child.tag in self.lines:
values = { child.tag: s... | python | def parse(self, element):
"""Extracts the values from the specified XML element that is being converted."""
#All the children of this element are what we are trying to parse.
result = []
for child in element:
if child.tag in self.lines:
values = { child.tag: s... | [
"def",
"parse",
"(",
"self",
",",
"element",
")",
":",
"#All the children of this element are what we are trying to parse.",
"result",
"=",
"[",
"]",
"for",
"child",
"in",
"element",
":",
"if",
"child",
".",
"tag",
"in",
"self",
".",
"lines",
":",
"values",
"=... | Extracts the values from the specified XML element that is being converted. | [
"Extracts",
"the",
"values",
"from",
"the",
"specified",
"XML",
"element",
"that",
"is",
"being",
"converted",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L203-L212 |
50,450 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateGroup.write | def write(self, valuedict):
"""Generates the lines for the converted input file using the specified
value dictionary."""
result = []
if self.identifier in valuedict:
values = valuedict[self.identifier]
else:
return result
if self.comment != "":
... | python | def write(self, valuedict):
"""Generates the lines for the converted input file using the specified
value dictionary."""
result = []
if self.identifier in valuedict:
values = valuedict[self.identifier]
else:
return result
if self.comment != "":
... | [
"def",
"write",
"(",
"self",
",",
"valuedict",
")",
":",
"result",
"=",
"[",
"]",
"if",
"self",
".",
"identifier",
"in",
"valuedict",
":",
"values",
"=",
"valuedict",
"[",
"self",
".",
"identifier",
"]",
"else",
":",
"return",
"result",
"if",
"self",
... | Generates the lines for the converted input file using the specified
value dictionary. | [
"Generates",
"the",
"lines",
"for",
"the",
"converted",
"input",
"file",
"using",
"the",
"specified",
"value",
"dictionary",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L214-L240 |
50,451 | rosenbrockc/fortpy | fortpy/interop/converter.py | TemplateGroup._write_iterate | def _write_iterate(self, values):
"""Generates the lines for a single pass through the group."""
result = []
for key in self.order:
result.append(self.lines[key].write(values))
if len(result) > 1:
return result
else:
return result[0] | python | def _write_iterate(self, values):
"""Generates the lines for a single pass through the group."""
result = []
for key in self.order:
result.append(self.lines[key].write(values))
if len(result) > 1:
return result
else:
return result[0] | [
"def",
"_write_iterate",
"(",
"self",
",",
"values",
")",
":",
"result",
"=",
"[",
"]",
"for",
"key",
"in",
"self",
".",
"order",
":",
"result",
".",
"append",
"(",
"self",
".",
"lines",
"[",
"key",
"]",
".",
"write",
"(",
"values",
")",
")",
"if... | Generates the lines for a single pass through the group. | [
"Generates",
"the",
"lines",
"for",
"a",
"single",
"pass",
"through",
"the",
"group",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L242-L251 |
50,452 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileTemplate._load | def _load(self):
"""Extracts the XML template data from the file."""
if os.path.exists(self.path):
root = ET.parse(self.path).getroot()
if (root.tag == "fortpy" and "mode" in root.attrib and
root.attrib["mode"] == "template" and "direction" in root.attrib and
... | python | def _load(self):
"""Extracts the XML template data from the file."""
if os.path.exists(self.path):
root = ET.parse(self.path).getroot()
if (root.tag == "fortpy" and "mode" in root.attrib and
root.attrib["mode"] == "template" and "direction" in root.attrib and
... | [
"def",
"_load",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"path",
")",
":",
"root",
"=",
"ET",
".",
"parse",
"(",
"self",
".",
"path",
")",
".",
"getroot",
"(",
")",
"if",
"(",
"root",
".",
"tag",
"==",
... | Extracts the XML template data from the file. | [
"Extracts",
"the",
"XML",
"template",
"data",
"from",
"the",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L281-L305 |
50,453 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileTemplate.write | def write(self, valuedict, version):
"""Generates the lines for the converted input file from the valuedict.
:arg valuedict: a dictionary of values where the keys are ids in the
template and the values obey their template rules.
:arg version: the target version of the output file.
... | python | def write(self, valuedict, version):
"""Generates the lines for the converted input file from the valuedict.
:arg valuedict: a dictionary of values where the keys are ids in the
template and the values obey their template rules.
:arg version: the target version of the output file.
... | [
"def",
"write",
"(",
"self",
",",
"valuedict",
",",
"version",
")",
":",
"result",
"=",
"[",
"]",
"if",
"version",
"in",
"self",
".",
"versions",
":",
"for",
"tag",
"in",
"self",
".",
"versions",
"[",
"version",
"]",
".",
"order",
":",
"entry",
"="... | Generates the lines for the converted input file from the valuedict.
:arg valuedict: a dictionary of values where the keys are ids in the
template and the values obey their template rules.
:arg version: the target version of the output file. | [
"Generates",
"the",
"lines",
"for",
"the",
"converted",
"input",
"file",
"from",
"the",
"valuedict",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L327-L341 |
50,454 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileTemplate._load_entries | def _load_entries(self, root):
"""Loads all the child entries of the input template from the
specified root element."""
mdict = {
"comments": self._comment,
"line": self._line,
"group": self._group
}
for entry in root:
mdict[entry.... | python | def _load_entries(self, root):
"""Loads all the child entries of the input template from the
specified root element."""
mdict = {
"comments": self._comment,
"line": self._line,
"group": self._group
}
for entry in root:
mdict[entry.... | [
"def",
"_load_entries",
"(",
"self",
",",
"root",
")",
":",
"mdict",
"=",
"{",
"\"comments\"",
":",
"self",
".",
"_comment",
",",
"\"line\"",
":",
"self",
".",
"_line",
",",
"\"group\"",
":",
"self",
".",
"_group",
"}",
"for",
"entry",
"in",
"root",
... | Loads all the child entries of the input template from the
specified root element. | [
"Loads",
"all",
"the",
"child",
"entries",
"of",
"the",
"input",
"template",
"from",
"the",
"specified",
"root",
"element",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L343-L352 |
50,455 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileTemplate._comment | def _comment(self, element):
"""Extracts the character to use for comments in the input file."""
for v in _get_xml_version(element):
self.versions[v].comment = element.text | python | def _comment(self, element):
"""Extracts the character to use for comments in the input file."""
for v in _get_xml_version(element):
self.versions[v].comment = element.text | [
"def",
"_comment",
"(",
"self",
",",
"element",
")",
":",
"for",
"v",
"in",
"_get_xml_version",
"(",
"element",
")",
":",
"self",
".",
"versions",
"[",
"v",
"]",
".",
"comment",
"=",
"element",
".",
"text"
] | Extracts the character to use for comments in the input file. | [
"Extracts",
"the",
"character",
"to",
"use",
"for",
"comments",
"in",
"the",
"input",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L354-L357 |
50,456 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileTemplate._line | def _line(self, element):
"""Parses the XML element as a single line entry in the input file."""
for v in _get_xml_version(element):
if "id" in element.attrib:
tline = TemplateLine(element, None, self.versions[v].comment)
self.versions[v].entries[tline.identif... | python | def _line(self, element):
"""Parses the XML element as a single line entry in the input file."""
for v in _get_xml_version(element):
if "id" in element.attrib:
tline = TemplateLine(element, None, self.versions[v].comment)
self.versions[v].entries[tline.identif... | [
"def",
"_line",
"(",
"self",
",",
"element",
")",
":",
"for",
"v",
"in",
"_get_xml_version",
"(",
"element",
")",
":",
"if",
"\"id\"",
"in",
"element",
".",
"attrib",
":",
"tline",
"=",
"TemplateLine",
"(",
"element",
",",
"None",
",",
"self",
".",
"... | Parses the XML element as a single line entry in the input file. | [
"Parses",
"the",
"XML",
"element",
"as",
"a",
"single",
"line",
"entry",
"in",
"the",
"input",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L359-L367 |
50,457 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileConverter.convert | def convert(self, path, version, target = None):
"""Converts the specified file using the relevant template.
:arg path: the full path to the file to convert.
:arg version: the new version of the file.
:arg target: the optional path to save the file under. If not
specified, the... | python | def convert(self, path, version, target = None):
"""Converts the specified file using the relevant template.
:arg path: the full path to the file to convert.
:arg version: the new version of the file.
:arg target: the optional path to save the file under. If not
specified, the... | [
"def",
"convert",
"(",
"self",
",",
"path",
",",
"version",
",",
"target",
"=",
"None",
")",
":",
"#Get the template and values out of the XML input file and",
"#write them in the format of the keywordless file.",
"values",
",",
"template",
"=",
"self",
".",
"parse",
"(... | Converts the specified file using the relevant template.
:arg path: the full path to the file to convert.
:arg version: the new version of the file.
:arg target: the optional path to save the file under. If not
specified, the file is saved based on the template file name. | [
"Converts",
"the",
"specified",
"file",
"using",
"the",
"relevant",
"template",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L398-L416 |
50,458 | rosenbrockc/fortpy | fortpy/interop/converter.py | FileConverter.parse | def parse(self, path):
"""Extracts a dictionary of values from the XML file at the specified path."""
#Load the template that will be used for parsing the values.
expath, template, root = self._load_template(path)
if expath is not None:
values = template.parse(root)
... | python | def parse(self, path):
"""Extracts a dictionary of values from the XML file at the specified path."""
#Load the template that will be used for parsing the values.
expath, template, root = self._load_template(path)
if expath is not None:
values = template.parse(root)
... | [
"def",
"parse",
"(",
"self",
",",
"path",
")",
":",
"#Load the template that will be used for parsing the values.",
"expath",
",",
"template",
",",
"root",
"=",
"self",
".",
"_load_template",
"(",
"path",
")",
"if",
"expath",
"is",
"not",
"None",
":",
"values",
... | Extracts a dictionary of values from the XML file at the specified path. | [
"Extracts",
"a",
"dictionary",
"of",
"values",
"from",
"the",
"XML",
"file",
"at",
"the",
"specified",
"path",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L418-L425 |
50,459 | rosenbrockc/fortpy | fortpy/interop/converter.py | OutputConverter.convert | def convert(self, path, version, target):
"""Converts the specified source file to a new version number."""
source = self.comparer.get_representation(path)
lines = [ '# <fortpy version="{}"></fortpy>\n'.format(version) ]
for line in self.comparer.template.contents[version].preamble:
... | python | def convert(self, path, version, target):
"""Converts the specified source file to a new version number."""
source = self.comparer.get_representation(path)
lines = [ '# <fortpy version="{}"></fortpy>\n'.format(version) ]
for line in self.comparer.template.contents[version].preamble:
... | [
"def",
"convert",
"(",
"self",
",",
"path",
",",
"version",
",",
"target",
")",
":",
"source",
"=",
"self",
".",
"comparer",
".",
"get_representation",
"(",
"path",
")",
"lines",
"=",
"[",
"'# <fortpy version=\"{}\"></fortpy>\\n'",
".",
"format",
"(",
"versi... | Converts the specified source file to a new version number. | [
"Converts",
"the",
"specified",
"source",
"file",
"to",
"a",
"new",
"version",
"number",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/converter.py#L432-L445 |
50,460 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext.cachedstr | def cachedstr(self):
"""Returns the full string of the file contents from the cache for
the file that we are currently providing intellisense for."""
if self._cachedstr is None:
if self.module is not None:
refstring = self.module.refstring
self._cached... | python | def cachedstr(self):
"""Returns the full string of the file contents from the cache for
the file that we are currently providing intellisense for."""
if self._cachedstr is None:
if self.module is not None:
refstring = self.module.refstring
self._cached... | [
"def",
"cachedstr",
"(",
"self",
")",
":",
"if",
"self",
".",
"_cachedstr",
"is",
"None",
":",
"if",
"self",
".",
"module",
"is",
"not",
"None",
":",
"refstring",
"=",
"self",
".",
"module",
".",
"refstring",
"self",
".",
"_cachedstr",
"=",
"refstring"... | Returns the full string of the file contents from the cache for
the file that we are currently providing intellisense for. | [
"Returns",
"the",
"full",
"string",
"of",
"the",
"file",
"contents",
"from",
"the",
"cache",
"for",
"the",
"file",
"that",
"we",
"are",
"currently",
"providing",
"intellisense",
"for",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L79-L89 |
50,461 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext.exact_match | def exact_match(self):
"""Returns the symbol under the cursor looking both directions as part
of a definition lookup for an exact match.
"""
#We don't have to worry about grouping or anything else fancy. Just
#loop through forward and back until we hit a character that can't be
... | python | def exact_match(self):
"""Returns the symbol under the cursor looking both directions as part
of a definition lookup for an exact match.
"""
#We don't have to worry about grouping or anything else fancy. Just
#loop through forward and back until we hit a character that can't be
... | [
"def",
"exact_match",
"(",
"self",
")",
":",
"#We don't have to worry about grouping or anything else fancy. Just",
"#loop through forward and back until we hit a character that can't be",
"#part of a variable or function name.",
"if",
"self",
".",
"_exact_match",
"is",
"None",
":",
... | Returns the symbol under the cursor looking both directions as part
of a definition lookup for an exact match. | [
"Returns",
"the",
"symbol",
"under",
"the",
"cursor",
"looking",
"both",
"directions",
"as",
"part",
"of",
"a",
"definition",
"lookup",
"for",
"an",
"exact",
"match",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L97-L123 |
50,462 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext.short_full_symbol | def short_full_symbol(self):
"""Gets the full symbol excluding the character under the cursor."""
if self._short_full_symbol is None:
self._short_full_symbol = self._symbol_extract(cache.RE_FULL_CURSOR,
False, True)
return s... | python | def short_full_symbol(self):
"""Gets the full symbol excluding the character under the cursor."""
if self._short_full_symbol is None:
self._short_full_symbol = self._symbol_extract(cache.RE_FULL_CURSOR,
False, True)
return s... | [
"def",
"short_full_symbol",
"(",
"self",
")",
":",
"if",
"self",
".",
"_short_full_symbol",
"is",
"None",
":",
"self",
".",
"_short_full_symbol",
"=",
"self",
".",
"_symbol_extract",
"(",
"cache",
".",
"RE_FULL_CURSOR",
",",
"False",
",",
"True",
")",
"retur... | Gets the full symbol excluding the character under the cursor. | [
"Gets",
"the",
"full",
"symbol",
"excluding",
"the",
"character",
"under",
"the",
"cursor",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L135-L141 |
50,463 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext.symbol | def symbol(self):
"""Gets the symbol under the current cursor."""
if self._symbol is None:
self._symbol = self._symbol_extract(cache.RE_CURSOR)
return self._symbol | python | def symbol(self):
"""Gets the symbol under the current cursor."""
if self._symbol is None:
self._symbol = self._symbol_extract(cache.RE_CURSOR)
return self._symbol | [
"def",
"symbol",
"(",
"self",
")",
":",
"if",
"self",
".",
"_symbol",
"is",
"None",
":",
"self",
".",
"_symbol",
"=",
"self",
".",
"_symbol_extract",
"(",
"cache",
".",
"RE_CURSOR",
")",
"return",
"self",
".",
"_symbol"
] | Gets the symbol under the current cursor. | [
"Gets",
"the",
"symbol",
"under",
"the",
"current",
"cursor",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L144-L149 |
50,464 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext.full_symbol | def full_symbol(self):
"""Returns the symbol under the cursor AND additional contextual
symbols in the case of %-separated lists of type members."""
if self._full_symbol is None:
self._full_symbol = self._symbol_extract(cache.RE_FULL_CURSOR, brackets=True)
return self._full_... | python | def full_symbol(self):
"""Returns the symbol under the cursor AND additional contextual
symbols in the case of %-separated lists of type members."""
if self._full_symbol is None:
self._full_symbol = self._symbol_extract(cache.RE_FULL_CURSOR, brackets=True)
return self._full_... | [
"def",
"full_symbol",
"(",
"self",
")",
":",
"if",
"self",
".",
"_full_symbol",
"is",
"None",
":",
"self",
".",
"_full_symbol",
"=",
"self",
".",
"_symbol_extract",
"(",
"cache",
".",
"RE_FULL_CURSOR",
",",
"brackets",
"=",
"True",
")",
"return",
"self",
... | Returns the symbol under the cursor AND additional contextual
symbols in the case of %-separated lists of type members. | [
"Returns",
"the",
"symbol",
"under",
"the",
"cursor",
"AND",
"additional",
"contextual",
"symbols",
"in",
"the",
"case",
"of",
"%",
"-",
"separated",
"lists",
"of",
"type",
"members",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L152-L158 |
50,465 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._symbol_extract | def _symbol_extract(self, regex, plus = True, brackets=False):
"""Extracts a symbol or full symbol from the current line,
optionally including the character under the cursor.
:arg regex: the compiled regular expression to use for extraction.
:arg plus: when true, the character under th... | python | def _symbol_extract(self, regex, plus = True, brackets=False):
"""Extracts a symbol or full symbol from the current line,
optionally including the character under the cursor.
:arg regex: the compiled regular expression to use for extraction.
:arg plus: when true, the character under th... | [
"def",
"_symbol_extract",
"(",
"self",
",",
"regex",
",",
"plus",
"=",
"True",
",",
"brackets",
"=",
"False",
")",
":",
"charplus",
"=",
"self",
".",
"pos",
"[",
"1",
"]",
"+",
"(",
"1",
"if",
"plus",
"else",
"-",
"1",
")",
"consider",
"=",
"self... | Extracts a symbol or full symbol from the current line,
optionally including the character under the cursor.
:arg regex: the compiled regular expression to use for extraction.
:arg plus: when true, the character under the cursor *is* included.
:arg brackets: when true, matching pairs o... | [
"Extracts",
"a",
"symbol",
"or",
"full",
"symbol",
"from",
"the",
"current",
"line",
"optionally",
"including",
"the",
"character",
"under",
"the",
"cursor",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L160-L192 |
50,466 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext.call_arg_index | def call_arg_index(self):
"""Determines the index of the parameter in a call list using
string manipulation and context information."""
#The function name we are calling should be in el_name by now
if self._call_index is None:
if (self.el_section == "body" and
... | python | def call_arg_index(self):
"""Determines the index of the parameter in a call list using
string manipulation and context information."""
#The function name we are calling should be in el_name by now
if self._call_index is None:
if (self.el_section == "body" and
... | [
"def",
"call_arg_index",
"(",
"self",
")",
":",
"#The function name we are calling should be in el_name by now",
"if",
"self",
".",
"_call_index",
"is",
"None",
":",
"if",
"(",
"self",
".",
"el_section",
"==",
"\"body\"",
"and",
"self",
".",
"el_call",
"in",
"[",
... | Determines the index of the parameter in a call list using
string manipulation and context information. | [
"Determines",
"the",
"index",
"of",
"the",
"parameter",
"in",
"a",
"call",
"list",
"using",
"string",
"manipulation",
"and",
"context",
"information",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L195-L232 |
50,467 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._setup_regex | def _setup_regex(self):
"""Sets up the constant regex strings etc. that can be used to
parse the strings for determining context."""
self.RE_COMMENTS = cache.RE_COMMENTS
self.RE_MODULE = cache.RE_MODULE
self.RE_TYPE = cache.RE_TYPE
self.RE_EXEC = cache.RE_EXEC
sel... | python | def _setup_regex(self):
"""Sets up the constant regex strings etc. that can be used to
parse the strings for determining context."""
self.RE_COMMENTS = cache.RE_COMMENTS
self.RE_MODULE = cache.RE_MODULE
self.RE_TYPE = cache.RE_TYPE
self.RE_EXEC = cache.RE_EXEC
sel... | [
"def",
"_setup_regex",
"(",
"self",
")",
":",
"self",
".",
"RE_COMMENTS",
"=",
"cache",
".",
"RE_COMMENTS",
"self",
".",
"RE_MODULE",
"=",
"cache",
".",
"RE_MODULE",
"self",
".",
"RE_TYPE",
"=",
"cache",
".",
"RE_TYPE",
"self",
".",
"RE_EXEC",
"=",
"cach... | Sets up the constant regex strings etc. that can be used to
parse the strings for determining context. | [
"Sets",
"up",
"the",
"constant",
"regex",
"strings",
"etc",
".",
"that",
"can",
"be",
"used",
"to",
"parse",
"the",
"strings",
"for",
"determining",
"context",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L234-L242 |
50,468 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._contextualize | def _contextualize(self):
"""Finds values for all the important attributes that determine the
user's context."""
line, column = self.pos
#Get the module top-level information
self._get_module(line)
if self.module is None:
return
#Use the posi... | python | def _contextualize(self):
"""Finds values for all the important attributes that determine the
user's context."""
line, column = self.pos
#Get the module top-level information
self._get_module(line)
if self.module is None:
return
#Use the posi... | [
"def",
"_contextualize",
"(",
"self",
")",
":",
"line",
",",
"column",
"=",
"self",
".",
"pos",
"#Get the module top-level information",
"self",
".",
"_get_module",
"(",
"line",
")",
"if",
"self",
".",
"module",
"is",
"None",
":",
"return",
"#Use the position ... | Finds values for all the important attributes that determine the
user's context. | [
"Finds",
"values",
"for",
"all",
"the",
"important",
"attributes",
"that",
"determine",
"the",
"user",
"s",
"context",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L244-L259 |
50,469 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._get_module | def _get_module(self, line):
"""Finds the name of the module and retrieves it from the parser cache."""
#Finding the module name is trivial; start at the beginning of
#the module and iterate lines until we find the module.
for sline in self._source:
if len(sline) > 0 and slin... | python | def _get_module(self, line):
"""Finds the name of the module and retrieves it from the parser cache."""
#Finding the module name is trivial; start at the beginning of
#the module and iterate lines until we find the module.
for sline in self._source:
if len(sline) > 0 and slin... | [
"def",
"_get_module",
"(",
"self",
",",
"line",
")",
":",
"#Finding the module name is trivial; start at the beginning of",
"#the module and iterate lines until we find the module.",
"for",
"sline",
"in",
"self",
".",
"_source",
":",
"if",
"len",
"(",
"sline",
")",
">",
... | Finds the name of the module and retrieves it from the parser cache. | [
"Finds",
"the",
"name",
"of",
"the",
"module",
"and",
"retrieves",
"it",
"from",
"the",
"parser",
"cache",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L261-L282 |
50,470 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._deep_match | def _deep_match(self, line, column):
"""Checks the contents of executables, types and modules for member
definitions and updates the context."""
#Now we just try each of the possibilities for the current line
if self._match_member(line, column):
self.el_section = "vars"
... | python | def _deep_match(self, line, column):
"""Checks the contents of executables, types and modules for member
definitions and updates the context."""
#Now we just try each of the possibilities for the current line
if self._match_member(line, column):
self.el_section = "vars"
... | [
"def",
"_deep_match",
"(",
"self",
",",
"line",
",",
"column",
")",
":",
"#Now we just try each of the possibilities for the current line",
"if",
"self",
".",
"_match_member",
"(",
"line",
",",
"column",
")",
":",
"self",
".",
"el_section",
"=",
"\"vars\"",
"self"... | Checks the contents of executables, types and modules for member
definitions and updates the context. | [
"Checks",
"the",
"contents",
"of",
"executables",
"types",
"and",
"modules",
"for",
"member",
"definitions",
"and",
"updates",
"the",
"context",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L287-L346 |
50,471 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._match_exec | def _match_exec(self, i):
"""Looks at line 'i' for a subroutine or function definition."""
self.col_match = self.RE_EXEC.match(self._source[i])
if self.col_match is not None:
if self.col_match.group("codetype") == "function":
self.el_type = Function
else:
... | python | def _match_exec(self, i):
"""Looks at line 'i' for a subroutine or function definition."""
self.col_match = self.RE_EXEC.match(self._source[i])
if self.col_match is not None:
if self.col_match.group("codetype") == "function":
self.el_type = Function
else:
... | [
"def",
"_match_exec",
"(",
"self",
",",
"i",
")",
":",
"self",
".",
"col_match",
"=",
"self",
".",
"RE_EXEC",
".",
"match",
"(",
"self",
".",
"_source",
"[",
"i",
"]",
")",
"if",
"self",
".",
"col_match",
"is",
"not",
"None",
":",
"if",
"self",
"... | Looks at line 'i' for a subroutine or function definition. | [
"Looks",
"at",
"line",
"i",
"for",
"a",
"subroutine",
"or",
"function",
"definition",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L348-L360 |
50,472 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._match_member | def _match_member(self, i, column):
"""Looks at line 'i' to see if the line matches a module member def."""
self.col_match = self.RE_MEMBERS.match(self._source[i])
if self.col_match is not None:
if column < self._source[i].index(":"):
self.el_call = "name"
... | python | def _match_member(self, i, column):
"""Looks at line 'i' to see if the line matches a module member def."""
self.col_match = self.RE_MEMBERS.match(self._source[i])
if self.col_match is not None:
if column < self._source[i].index(":"):
self.el_call = "name"
... | [
"def",
"_match_member",
"(",
"self",
",",
"i",
",",
"column",
")",
":",
"self",
".",
"col_match",
"=",
"self",
".",
"RE_MEMBERS",
".",
"match",
"(",
"self",
".",
"_source",
"[",
"i",
"]",
")",
"if",
"self",
".",
"col_match",
"is",
"not",
"None",
":... | Looks at line 'i' to see if the line matches a module member def. | [
"Looks",
"at",
"line",
"i",
"to",
"see",
"if",
"the",
"line",
"matches",
"a",
"module",
"member",
"def",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L362-L373 |
50,473 | rosenbrockc/fortpy | fortpy/isense/context.py | UserContext._match_type | def _match_type(self, i):
"""Looks at line 'i' to see if the line matches a module user type def."""
self.col_match = self.RE_TYPE.match(self._source[i])
if self.col_match is not None:
self.section = "types"
self.el_type = CustomType
self.el_name = self.col_ma... | python | def _match_type(self, i):
"""Looks at line 'i' to see if the line matches a module user type def."""
self.col_match = self.RE_TYPE.match(self._source[i])
if self.col_match is not None:
self.section = "types"
self.el_type = CustomType
self.el_name = self.col_ma... | [
"def",
"_match_type",
"(",
"self",
",",
"i",
")",
":",
"self",
".",
"col_match",
"=",
"self",
".",
"RE_TYPE",
".",
"match",
"(",
"self",
".",
"_source",
"[",
"i",
"]",
")",
"if",
"self",
".",
"col_match",
"is",
"not",
"None",
":",
"self",
".",
"s... | Looks at line 'i' to see if the line matches a module user type def. | [
"Looks",
"at",
"line",
"i",
"to",
"see",
"if",
"the",
"line",
"matches",
"a",
"module",
"user",
"type",
"def",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/context.py#L375-L385 |
50,474 | ROGUE-JCTD/rogue_geonode | pavement.py | upgradedb | def upgradedb(options):
"""
Add 'fake' data migrations for existing tables from legacy GeoNode versions
"""
version = options.get('version')
if version in ['1.1', '1.2']:
sh("python manage.py migrate maps 0001 --fake")
sh("python manage.py migrate avatar 0001 --fake")
elif versio... | python | def upgradedb(options):
"""
Add 'fake' data migrations for existing tables from legacy GeoNode versions
"""
version = options.get('version')
if version in ['1.1', '1.2']:
sh("python manage.py migrate maps 0001 --fake")
sh("python manage.py migrate avatar 0001 --fake")
elif versio... | [
"def",
"upgradedb",
"(",
"options",
")",
":",
"version",
"=",
"options",
".",
"get",
"(",
"'version'",
")",
"if",
"version",
"in",
"[",
"'1.1'",
",",
"'1.2'",
"]",
":",
"sh",
"(",
"\"python manage.py migrate maps 0001 --fake\"",
")",
"sh",
"(",
"\"python man... | Add 'fake' data migrations for existing tables from legacy GeoNode versions | [
"Add",
"fake",
"data",
"migrations",
"for",
"existing",
"tables",
"from",
"legacy",
"GeoNode",
"versions"
] | 6b1c29ca6f7125a00148da64b4709bd800cc0935 | https://github.com/ROGUE-JCTD/rogue_geonode/blob/6b1c29ca6f7125a00148da64b4709bd800cc0935/pavement.py#L149-L160 |
50,475 | ROGUE-JCTD/rogue_geonode | pavement.py | package | def package(options):
"""
Creates a tarball to use for building the system elsewhere
"""
import pkg_resources
import tarfile
import geonode
version = geonode.get_version()
# Use GeoNode's version for the package name.
pkgname = 'GeoNode-%s-all' % version
# Create the output dir... | python | def package(options):
"""
Creates a tarball to use for building the system elsewhere
"""
import pkg_resources
import tarfile
import geonode
version = geonode.get_version()
# Use GeoNode's version for the package name.
pkgname = 'GeoNode-%s-all' % version
# Create the output dir... | [
"def",
"package",
"(",
"options",
")",
":",
"import",
"pkg_resources",
"import",
"tarfile",
"import",
"geonode",
"version",
"=",
"geonode",
".",
"get_version",
"(",
")",
"# Use GeoNode's version for the package name.",
"pkgname",
"=",
"'GeoNode-%s-all'",
"%",
"version... | Creates a tarball to use for building the system elsewhere | [
"Creates",
"a",
"tarball",
"to",
"use",
"for",
"building",
"the",
"system",
"elsewhere"
] | 6b1c29ca6f7125a00148da64b4709bd800cc0935 | https://github.com/ROGUE-JCTD/rogue_geonode/blob/6b1c29ca6f7125a00148da64b4709bd800cc0935/pavement.py#L174-L237 |
50,476 | ROGUE-JCTD/rogue_geonode | pavement.py | deb | def deb(options):
"""
Creates debian packages.
Example uses:
paver deb
paver deb -k 12345
paver deb -k 12345 -p geonode/testing
"""
key = options.get('key', None)
ppa = options.get('ppa', None)
version, simple_version = versions()
info('Creating package for Geo... | python | def deb(options):
"""
Creates debian packages.
Example uses:
paver deb
paver deb -k 12345
paver deb -k 12345 -p geonode/testing
"""
key = options.get('key', None)
ppa = options.get('ppa', None)
version, simple_version = versions()
info('Creating package for Geo... | [
"def",
"deb",
"(",
"options",
")",
":",
"key",
"=",
"options",
".",
"get",
"(",
"'key'",
",",
"None",
")",
"ppa",
"=",
"options",
".",
"get",
"(",
"'ppa'",
",",
"None",
")",
"version",
",",
"simple_version",
"=",
"versions",
"(",
")",
"info",
"(",
... | Creates debian packages.
Example uses:
paver deb
paver deb -k 12345
paver deb -k 12345 -p geonode/testing | [
"Creates",
"debian",
"packages",
"."
] | 6b1c29ca6f7125a00148da64b4709bd800cc0935 | https://github.com/ROGUE-JCTD/rogue_geonode/blob/6b1c29ca6f7125a00148da64b4709bd800cc0935/pavement.py#L435-L488 |
50,477 | mommermi/callhorizons | callhorizons/callhorizons.py | query.parse_comet | def parse_comet(self):
"""Parse `targetname` as if it were a comet.
:return: (string or None, int or None, string or None);
The designation, number and prefix, and name of the comet as derived
from `self.targetname` are extracted into a tuple; each element that
does not ex... | python | def parse_comet(self):
"""Parse `targetname` as if it were a comet.
:return: (string or None, int or None, string or None);
The designation, number and prefix, and name of the comet as derived
from `self.targetname` are extracted into a tuple; each element that
does not ex... | [
"def",
"parse_comet",
"(",
"self",
")",
":",
"import",
"re",
"pat",
"=",
"(",
"'^(([1-9]+[PDCXAI](-[A-Z]{1,2})?)|[PDCXAI]/)'",
"+",
"# prefix [0,1,2]",
"'|([-]?[0-9]{3,4}[ _][A-Z]{1,2}([0-9]{1,3})?(-[1-9A-Z]{0,2})?)'",
"+",
"# designation [3,4]",
"(",
"'|(([A-Z][a-z]?[A-Z]*[a-z]*... | Parse `targetname` as if it were a comet.
:return: (string or None, int or None, string or None);
The designation, number and prefix, and name of the comet as derived
from `self.targetname` are extracted into a tuple; each element that
does not exist is set to `None`. Parenthesis ... | [
"Parse",
"targetname",
"as",
"if",
"it",
"were",
"a",
"comet",
"."
] | fdd7ad9e87cac107c1b7f88e594d118210da3b1a | https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L100-L178 |
50,478 | mommermi/callhorizons | callhorizons/callhorizons.py | query.isorbit_record | def isorbit_record(self):
"""`True` if `targetname` appears to be a comet orbit record number.
NAIF record numbers are 6 digits, begin with a '9' and can
change at any time.
"""
import re
test = re.match('^9[0-9]{5}$', self.targetname.strip()) is not None
retur... | python | def isorbit_record(self):
"""`True` if `targetname` appears to be a comet orbit record number.
NAIF record numbers are 6 digits, begin with a '9' and can
change at any time.
"""
import re
test = re.match('^9[0-9]{5}$', self.targetname.strip()) is not None
retur... | [
"def",
"isorbit_record",
"(",
"self",
")",
":",
"import",
"re",
"test",
"=",
"re",
".",
"match",
"(",
"'^9[0-9]{5}$'",
",",
"self",
".",
"targetname",
".",
"strip",
"(",
")",
")",
"is",
"not",
"None",
"return",
"test"
] | `True` if `targetname` appears to be a comet orbit record number.
NAIF record numbers are 6 digits, begin with a '9' and can
change at any time. | [
"True",
"if",
"targetname",
"appears",
"to",
"be",
"a",
"comet",
"orbit",
"record",
"number",
"."
] | fdd7ad9e87cac107c1b7f88e594d118210da3b1a | https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L315-L325 |
50,479 | mommermi/callhorizons | callhorizons/callhorizons.py | query.iscomet | def iscomet(self):
"""`True` if `targetname` appears to be a comet. """
# treat this object as comet if there is a prefix/number
if self.comet is not None:
return self.comet
elif self.asteroid is not None:
return not self.asteroid
else:
return... | python | def iscomet(self):
"""`True` if `targetname` appears to be a comet. """
# treat this object as comet if there is a prefix/number
if self.comet is not None:
return self.comet
elif self.asteroid is not None:
return not self.asteroid
else:
return... | [
"def",
"iscomet",
"(",
"self",
")",
":",
"# treat this object as comet if there is a prefix/number",
"if",
"self",
".",
"comet",
"is",
"not",
"None",
":",
"return",
"self",
".",
"comet",
"elif",
"self",
".",
"asteroid",
"is",
"not",
"None",
":",
"return",
"not... | `True` if `targetname` appears to be a comet. | [
"True",
"if",
"targetname",
"appears",
"to",
"be",
"a",
"comet",
"."
] | fdd7ad9e87cac107c1b7f88e594d118210da3b1a | https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L327-L337 |
50,480 | mommermi/callhorizons | callhorizons/callhorizons.py | query.isasteroid | def isasteroid(self):
"""`True` if `targetname` appears to be an asteroid."""
if self.asteroid is not None:
return self.asteroid
elif self.comet is not None:
return not self.comet
else:
return any(self.parse_asteroid()) is not None | python | def isasteroid(self):
"""`True` if `targetname` appears to be an asteroid."""
if self.asteroid is not None:
return self.asteroid
elif self.comet is not None:
return not self.comet
else:
return any(self.parse_asteroid()) is not None | [
"def",
"isasteroid",
"(",
"self",
")",
":",
"if",
"self",
".",
"asteroid",
"is",
"not",
"None",
":",
"return",
"self",
".",
"asteroid",
"elif",
"self",
".",
"comet",
"is",
"not",
"None",
":",
"return",
"not",
"self",
".",
"comet",
"else",
":",
"retur... | `True` if `targetname` appears to be an asteroid. | [
"True",
"if",
"targetname",
"appears",
"to",
"be",
"an",
"asteroid",
"."
] | fdd7ad9e87cac107c1b7f88e594d118210da3b1a | https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L339-L346 |
50,481 | mommermi/callhorizons | callhorizons/callhorizons.py | query.set_epochrange | def set_epochrange(self, start_epoch, stop_epoch, step_size):
"""Set a range of epochs, all times are UT
:param start_epoch: str;
start epoch of the format 'YYYY-MM-DD [HH-MM-SS]'
:param stop_epoch: str;
final epoch of the format 'YYYY-MM-DD [HH-MM-SS]'
:param step... | python | def set_epochrange(self, start_epoch, stop_epoch, step_size):
"""Set a range of epochs, all times are UT
:param start_epoch: str;
start epoch of the format 'YYYY-MM-DD [HH-MM-SS]'
:param stop_epoch: str;
final epoch of the format 'YYYY-MM-DD [HH-MM-SS]'
:param step... | [
"def",
"set_epochrange",
"(",
"self",
",",
"start_epoch",
",",
"stop_epoch",
",",
"step_size",
")",
":",
"self",
".",
"start_epoch",
"=",
"start_epoch",
"self",
".",
"stop_epoch",
"=",
"stop_epoch",
"self",
".",
"step_size",
"=",
"step_size",
"return",
"None"
... | Set a range of epochs, all times are UT
:param start_epoch: str;
start epoch of the format 'YYYY-MM-DD [HH-MM-SS]'
:param stop_epoch: str;
final epoch of the format 'YYYY-MM-DD [HH-MM-SS]'
:param step_size: str;
epoch step size, e.g., '1d' for 1 day, '10m' for 1... | [
"Set",
"a",
"range",
"of",
"epochs",
"all",
"times",
"are",
"UT"
] | fdd7ad9e87cac107c1b7f88e594d118210da3b1a | https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L350-L370 |
50,482 | mommermi/callhorizons | callhorizons/callhorizons.py | query.set_discreteepochs | def set_discreteepochs(self, discreteepochs):
"""Set a list of discrete epochs, epochs have to be given as Julian
Dates
:param discreteepochs: array_like
list or 1D array of floats or strings
:return: None
:example: >>> import callhorizons
>>> ceres ... | python | def set_discreteepochs(self, discreteepochs):
"""Set a list of discrete epochs, epochs have to be given as Julian
Dates
:param discreteepochs: array_like
list or 1D array of floats or strings
:return: None
:example: >>> import callhorizons
>>> ceres ... | [
"def",
"set_discreteepochs",
"(",
"self",
",",
"discreteepochs",
")",
":",
"if",
"not",
"isinstance",
"(",
"discreteepochs",
",",
"(",
"list",
",",
"np",
".",
"ndarray",
")",
")",
":",
"discreteepochs",
"=",
"[",
"discreteepochs",
"]",
"self",
".",
"discre... | Set a list of discrete epochs, epochs have to be given as Julian
Dates
:param discreteepochs: array_like
list or 1D array of floats or strings
:return: None
:example: >>> import callhorizons
>>> ceres = callhorizons.query('Ceres')
>>> ceres... | [
"Set",
"a",
"list",
"of",
"discrete",
"epochs",
"epochs",
"have",
"to",
"be",
"given",
"as",
"Julian",
"Dates"
] | fdd7ad9e87cac107c1b7f88e594d118210da3b1a | https://github.com/mommermi/callhorizons/blob/fdd7ad9e87cac107c1b7f88e594d118210da3b1a/callhorizons/callhorizons.py#L372-L386 |
50,483 | ROGUE-JCTD/rogue_geonode | geoshape/fileservice/api.py | FileItemResource.prepend_urls | def prepend_urls(self):
""" Add the following array of urls to the resource base urls """
return [
url(r"^(?P<resource_name>%s)/view/(?P<name>[\w\d_.-]+)%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('view'), name="api_fileitem_view"),
url(r"^... | python | def prepend_urls(self):
""" Add the following array of urls to the resource base urls """
return [
url(r"^(?P<resource_name>%s)/view/(?P<name>[\w\d_.-]+)%s$" % (self._meta.resource_name, trailing_slash()),
self.wrap_view('view'), name="api_fileitem_view"),
url(r"^... | [
"def",
"prepend_urls",
"(",
"self",
")",
":",
"return",
"[",
"url",
"(",
"r\"^(?P<resource_name>%s)/view/(?P<name>[\\w\\d_.-]+)%s$\"",
"%",
"(",
"self",
".",
"_meta",
".",
"resource_name",
",",
"trailing_slash",
"(",
")",
")",
",",
"self",
".",
"wrap_view",
"(",... | Add the following array of urls to the resource base urls | [
"Add",
"the",
"following",
"array",
"of",
"urls",
"to",
"the",
"resource",
"base",
"urls"
] | 6b1c29ca6f7125a00148da64b4709bd800cc0935 | https://github.com/ROGUE-JCTD/rogue_geonode/blob/6b1c29ca6f7125a00148da64b4709bd800cc0935/geoshape/fileservice/api.py#L129-L149 |
50,484 | shaldengeki/python-mal | myanimelist/base.py | Base.set | def set(self, attr_dict):
"""Sets attributes of this user object.
:type attr_dict: dict
:param attr_dict: Parameters to set, with attribute keys.
:rtype: :class:`.Base`
:return: The current object.
"""
for key in attr_dict:
if key == self._id_attribute:
setattr(self, self._i... | python | def set(self, attr_dict):
"""Sets attributes of this user object.
:type attr_dict: dict
:param attr_dict: Parameters to set, with attribute keys.
:rtype: :class:`.Base`
:return: The current object.
"""
for key in attr_dict:
if key == self._id_attribute:
setattr(self, self._i... | [
"def",
"set",
"(",
"self",
",",
"attr_dict",
")",
":",
"for",
"key",
"in",
"attr_dict",
":",
"if",
"key",
"==",
"self",
".",
"_id_attribute",
":",
"setattr",
"(",
"self",
",",
"self",
".",
"_id_attribute",
",",
"attr_dict",
"[",
"key",
"]",
")",
"els... | Sets attributes of this user object.
:type attr_dict: dict
:param attr_dict: Parameters to set, with attribute keys.
:rtype: :class:`.Base`
:return: The current object. | [
"Sets",
"attributes",
"of",
"this",
"user",
"object",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/base.py#L121-L136 |
50,485 | ROGUE-JCTD/rogue_geonode | geoshape/core/context_processors.py | security_warnings | def security_warnings(request, PROXY_ALLOWED_HOSTS=()):
""" Detects insecure settings and reports them to the client-side context. """
warnings = []
PROXY_ALLOWED_HOSTS = PROXY_ALLOWED_HOSTS or getattr(settings, 'PROXY_ALLOWED_HOSTS', ())
if PROXY_ALLOWED_HOSTS and '*' in PROXY_ALLOWED_HOSTS:
... | python | def security_warnings(request, PROXY_ALLOWED_HOSTS=()):
""" Detects insecure settings and reports them to the client-side context. """
warnings = []
PROXY_ALLOWED_HOSTS = PROXY_ALLOWED_HOSTS or getattr(settings, 'PROXY_ALLOWED_HOSTS', ())
if PROXY_ALLOWED_HOSTS and '*' in PROXY_ALLOWED_HOSTS:
... | [
"def",
"security_warnings",
"(",
"request",
",",
"PROXY_ALLOWED_HOSTS",
"=",
"(",
")",
")",
":",
"warnings",
"=",
"[",
"]",
"PROXY_ALLOWED_HOSTS",
"=",
"PROXY_ALLOWED_HOSTS",
"or",
"getattr",
"(",
"settings",
",",
"'PROXY_ALLOWED_HOSTS'",
",",
"(",
")",
")",
"... | Detects insecure settings and reports them to the client-side context. | [
"Detects",
"insecure",
"settings",
"and",
"reports",
"them",
"to",
"the",
"client",
"-",
"side",
"context",
"."
] | 6b1c29ca6f7125a00148da64b4709bd800cc0935 | https://github.com/ROGUE-JCTD/rogue_geonode/blob/6b1c29ca6f7125a00148da64b4709bd800cc0935/geoshape/core/context_processors.py#L6-L17 |
50,486 | ronniedada/tabula | tabula/section.py | conv_units | def conv_units(val, meta):
"""
Format and convert units to be more human readable
@return new val with converted units
"""
if not val or not meta:
return val
try:
val = float(val)
except ValueError:
logging.error("unable to apply convert units for %s" % val)
... | python | def conv_units(val, meta):
"""
Format and convert units to be more human readable
@return new val with converted units
"""
if not val or not meta:
return val
try:
val = float(val)
except ValueError:
logging.error("unable to apply convert units for %s" % val)
... | [
"def",
"conv_units",
"(",
"val",
",",
"meta",
")",
":",
"if",
"not",
"val",
"or",
"not",
"meta",
":",
"return",
"val",
"try",
":",
"val",
"=",
"float",
"(",
"val",
")",
"except",
"ValueError",
":",
"logging",
".",
"error",
"(",
"\"unable to apply conve... | Format and convert units to be more human readable
@return new val with converted units | [
"Format",
"and",
"convert",
"units",
"to",
"be",
"more",
"human",
"readable"
] | ba18bb2f7db75972256b950711415031dc5421c7 | https://github.com/ronniedada/tabula/blob/ba18bb2f7db75972256b950711415031dc5421c7/tabula/section.py#L12-L32 |
50,487 | ronniedada/tabula | tabula/section.py | Section.align | def align(self, arr):
"""
Align columns, including column headers
"""
if arr is None:
return arr
c_hdrs = self._get_col_hdrs()
if self.show_col_hdr_in_cell:
for hdr in c_hdrs:
arr[hdr] = map(lambda col: ":".join([hdr, str(col)]), ... | python | def align(self, arr):
"""
Align columns, including column headers
"""
if arr is None:
return arr
c_hdrs = self._get_col_hdrs()
if self.show_col_hdr_in_cell:
for hdr in c_hdrs:
arr[hdr] = map(lambda col: ":".join([hdr, str(col)]), ... | [
"def",
"align",
"(",
"self",
",",
"arr",
")",
":",
"if",
"arr",
"is",
"None",
":",
"return",
"arr",
"c_hdrs",
"=",
"self",
".",
"_get_col_hdrs",
"(",
")",
"if",
"self",
".",
"show_col_hdr_in_cell",
":",
"for",
"hdr",
"in",
"c_hdrs",
":",
"arr",
"[",
... | Align columns, including column headers | [
"Align",
"columns",
"including",
"column",
"headers"
] | ba18bb2f7db75972256b950711415031dc5421c7 | https://github.com/ronniedada/tabula/blob/ba18bb2f7db75972256b950711415031dc5421c7/tabula/section.py#L109-L138 |
50,488 | ronniedada/tabula | tabula/section.py | Section.wrap | def wrap(self, string, width):
"""
Wrap lines according to width
Place '\n' whenever necessary
"""
if not string or width <= 0:
logging.error("invalid string: %s or width: %s" % (string, width))
return False
tmp = ""
for line in string.spl... | python | def wrap(self, string, width):
"""
Wrap lines according to width
Place '\n' whenever necessary
"""
if not string or width <= 0:
logging.error("invalid string: %s or width: %s" % (string, width))
return False
tmp = ""
for line in string.spl... | [
"def",
"wrap",
"(",
"self",
",",
"string",
",",
"width",
")",
":",
"if",
"not",
"string",
"or",
"width",
"<=",
"0",
":",
"logging",
".",
"error",
"(",
"\"invalid string: %s or width: %s\"",
"%",
"(",
"string",
",",
"width",
")",
")",
"return",
"False",
... | Wrap lines according to width
Place '\n' whenever necessary | [
"Wrap",
"lines",
"according",
"to",
"width",
"Place",
"\\",
"n",
"whenever",
"necessary"
] | ba18bb2f7db75972256b950711415031dc5421c7 | https://github.com/ronniedada/tabula/blob/ba18bb2f7db75972256b950711415031dc5421c7/tabula/section.py#L191-L214 |
50,489 | ronniedada/tabula | tabula/section.py | Section._get_meta | def _get_meta(self, row, col):
"""
Get metadata for a particular cell
"""
if self.meta is None:
logging.error("unable to get meta: empty section")
return {}
if not row in self._get_row_hdrs() or\
not col in self._get_col_hdrs():
lo... | python | def _get_meta(self, row, col):
"""
Get metadata for a particular cell
"""
if self.meta is None:
logging.error("unable to get meta: empty section")
return {}
if not row in self._get_row_hdrs() or\
not col in self._get_col_hdrs():
lo... | [
"def",
"_get_meta",
"(",
"self",
",",
"row",
",",
"col",
")",
":",
"if",
"self",
".",
"meta",
"is",
"None",
":",
"logging",
".",
"error",
"(",
"\"unable to get meta: empty section\"",
")",
"return",
"{",
"}",
"if",
"not",
"row",
"in",
"self",
".",
"_ge... | Get metadata for a particular cell | [
"Get",
"metadata",
"for",
"a",
"particular",
"cell"
] | ba18bb2f7db75972256b950711415031dc5421c7 | https://github.com/ronniedada/tabula/blob/ba18bb2f7db75972256b950711415031dc5421c7/tabula/section.py#L340-L363 |
50,490 | rosenbrockc/fortpy | fortpy/isense/__init__.py | Script.in_function_call | def in_function_call(self):
"""Return either completion information or a call signature for
the function definition that we are on currently."""
#The last thing to do before we can form completions etc. is perform
#a real-time update of the in-memory versions of the modules.
if s... | python | def in_function_call(self):
"""Return either completion information or a call signature for
the function definition that we are on currently."""
#The last thing to do before we can form completions etc. is perform
#a real-time update of the in-memory versions of the modules.
if s... | [
"def",
"in_function_call",
"(",
"self",
")",
":",
"#The last thing to do before we can form completions etc. is perform",
"#a real-time update of the in-memory versions of the modules.",
"if",
"settings",
".",
"real_time_update",
":",
"cache",
".",
"rt",
".",
"update",
"(",
"se... | Return either completion information or a call signature for
the function definition that we are on currently. | [
"Return",
"either",
"completion",
"information",
"or",
"a",
"call",
"signature",
"for",
"the",
"function",
"definition",
"that",
"we",
"are",
"on",
"currently",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/__init__.py#L92-L100 |
50,491 | rosenbrockc/fortpy | fortpy/isense/__init__.py | Script.goto_definitions | def goto_definitions(self):
"""
Return the definition of a the symbol under the cursor via exact match.
Goes to that definition with a buffer.
"""
element = self._evaluator.get_definition()
if element is not None:
return BaseDefinition(self._user_context, elem... | python | def goto_definitions(self):
"""
Return the definition of a the symbol under the cursor via exact match.
Goes to that definition with a buffer.
"""
element = self._evaluator.get_definition()
if element is not None:
return BaseDefinition(self._user_context, elem... | [
"def",
"goto_definitions",
"(",
"self",
")",
":",
"element",
"=",
"self",
".",
"_evaluator",
".",
"get_definition",
"(",
")",
"if",
"element",
"is",
"not",
"None",
":",
"return",
"BaseDefinition",
"(",
"self",
".",
"_user_context",
",",
"element",
")",
"el... | Return the definition of a the symbol under the cursor via exact match.
Goes to that definition with a buffer. | [
"Return",
"the",
"definition",
"of",
"a",
"the",
"symbol",
"under",
"the",
"cursor",
"via",
"exact",
"match",
".",
"Goes",
"to",
"that",
"definition",
"with",
"a",
"buffer",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/__init__.py#L116-L125 |
50,492 | rosenbrockc/fortpy | fortpy/code.py | order_module_dependencies | def order_module_dependencies(modules, parser):
"""Orders the specified list of modules based on their inter-dependencies."""
result = []
for modk in modules:
if modk not in result:
result.append(modk)
#We also need to look up the dependencies of each of these modules
re... | python | def order_module_dependencies(modules, parser):
"""Orders the specified list of modules based on their inter-dependencies."""
result = []
for modk in modules:
if modk not in result:
result.append(modk)
#We also need to look up the dependencies of each of these modules
re... | [
"def",
"order_module_dependencies",
"(",
"modules",
",",
"parser",
")",
":",
"result",
"=",
"[",
"]",
"for",
"modk",
"in",
"modules",
":",
"if",
"modk",
"not",
"in",
"result",
":",
"result",
".",
"append",
"(",
"modk",
")",
"#We also need to look up the depe... | Orders the specified list of modules based on their inter-dependencies. | [
"Orders",
"the",
"specified",
"list",
"of",
"modules",
"based",
"on",
"their",
"inter",
"-",
"dependencies",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L523-L536 |
50,493 | rosenbrockc/fortpy | fortpy/code.py | _process_module_order | def _process_module_order(parser, module, i, result):
"""Adds the module and its dependencies to the result list."""
#Some code might decide to use the fortpy module methods for general
#development, ignore it since we know it will be present in the end.
if module == "fortpy" or module == "fpy_auxiliary... | python | def _process_module_order(parser, module, i, result):
"""Adds the module and its dependencies to the result list."""
#Some code might decide to use the fortpy module methods for general
#development, ignore it since we know it will be present in the end.
if module == "fortpy" or module == "fpy_auxiliary... | [
"def",
"_process_module_order",
"(",
"parser",
",",
"module",
",",
"i",
",",
"result",
")",
":",
"#Some code might decide to use the fortpy module methods for general",
"#development, ignore it since we know it will be present in the end.",
"if",
"module",
"==",
"\"fortpy\"",
"or... | Adds the module and its dependencies to the result list. | [
"Adds",
"the",
"module",
"and",
"its",
"dependencies",
"to",
"the",
"result",
"list",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L538-L569 |
50,494 | rosenbrockc/fortpy | fortpy/code.py | CodeParser.list_dependencies | def list_dependencies(self, module, result):
"""Lists the names of all the modules that the specified module depends
on."""
if result is None:
result = {}
#We will try at least once to load each module that we don't have
if module not in self.modules:
self... | python | def list_dependencies(self, module, result):
"""Lists the names of all the modules that the specified module depends
on."""
if result is None:
result = {}
#We will try at least once to load each module that we don't have
if module not in self.modules:
self... | [
"def",
"list_dependencies",
"(",
"self",
",",
"module",
",",
"result",
")",
":",
"if",
"result",
"is",
"None",
":",
"result",
"=",
"{",
"}",
"#We will try at least once to load each module that we don't have",
"if",
"module",
"not",
"in",
"self",
".",
"modules",
... | Lists the names of all the modules that the specified module depends
on. | [
"Lists",
"the",
"names",
"of",
"all",
"the",
"modules",
"that",
"the",
"specified",
"module",
"depends",
"on",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L82-L98 |
50,495 | rosenbrockc/fortpy | fortpy/code.py | CodeParser._parse_dependencies | def _parse_dependencies(self, pmodules, dependencies, recursive, greedy):
"""Parses the dependencies of the modules in the list pmodules.
:arg pmodules: a list of modules that were parsed from a *.f90 file.
:arg dependencies: when true, the dependency's dependencies will be loaded.
:arg... | python | def _parse_dependencies(self, pmodules, dependencies, recursive, greedy):
"""Parses the dependencies of the modules in the list pmodules.
:arg pmodules: a list of modules that were parsed from a *.f90 file.
:arg dependencies: when true, the dependency's dependencies will be loaded.
:arg... | [
"def",
"_parse_dependencies",
"(",
"self",
",",
"pmodules",
",",
"dependencies",
",",
"recursive",
",",
"greedy",
")",
":",
"#See if we need to also load dependencies for the modules",
"if",
"dependencies",
":",
"allkeys",
"=",
"[",
"module",
".",
"name",
".",
"lowe... | Parses the dependencies of the modules in the list pmodules.
:arg pmodules: a list of modules that were parsed from a *.f90 file.
:arg dependencies: when true, the dependency's dependencies will be loaded.
:arg recursive: specifies whether to continue loading dependencies to
completi... | [
"Parses",
"the",
"dependencies",
"of",
"the",
"modules",
"in",
"the",
"list",
"pmodules",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L100-L118 |
50,496 | rosenbrockc/fortpy | fortpy/code.py | CodeParser._parse_docstrings | def _parse_docstrings(self, filepath):
"""Looks for additional docstring specifications in the correctly named
XML files in the same directory as the module."""
xmlpath = self.get_xmldoc_path(filepath)
if self.tramp.exists(xmlpath):
xmlstring = self.tramp.read(xmlpath... | python | def _parse_docstrings(self, filepath):
"""Looks for additional docstring specifications in the correctly named
XML files in the same directory as the module."""
xmlpath = self.get_xmldoc_path(filepath)
if self.tramp.exists(xmlpath):
xmlstring = self.tramp.read(xmlpath... | [
"def",
"_parse_docstrings",
"(",
"self",
",",
"filepath",
")",
":",
"xmlpath",
"=",
"self",
".",
"get_xmldoc_path",
"(",
"filepath",
")",
"if",
"self",
".",
"tramp",
".",
"exists",
"(",
"xmlpath",
")",
":",
"xmlstring",
"=",
"self",
".",
"tramp",
".",
... | Looks for additional docstring specifications in the correctly named
XML files in the same directory as the module. | [
"Looks",
"for",
"additional",
"docstring",
"specifications",
"in",
"the",
"correctly",
"named",
"XML",
"files",
"in",
"the",
"same",
"directory",
"as",
"the",
"module",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L120-L126 |
50,497 | rosenbrockc/fortpy | fortpy/code.py | CodeParser.get_xmldoc_path | def get_xmldoc_path(self, filepath):
"""Returns the full path to a possible XML documentation file for the
specified code filepath."""
segs = filepath.split(".")
segs.pop()
return ".".join(segs) + ".xml" | python | def get_xmldoc_path(self, filepath):
"""Returns the full path to a possible XML documentation file for the
specified code filepath."""
segs = filepath.split(".")
segs.pop()
return ".".join(segs) + ".xml" | [
"def",
"get_xmldoc_path",
"(",
"self",
",",
"filepath",
")",
":",
"segs",
"=",
"filepath",
".",
"split",
"(",
"\".\"",
")",
"segs",
".",
"pop",
"(",
")",
"return",
"\".\"",
".",
"join",
"(",
"segs",
")",
"+",
"\".xml\""
] | Returns the full path to a possible XML documentation file for the
specified code filepath. | [
"Returns",
"the",
"full",
"path",
"to",
"a",
"possible",
"XML",
"documentation",
"file",
"for",
"the",
"specified",
"code",
"filepath",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L128-L133 |
50,498 | rosenbrockc/fortpy | fortpy/code.py | CodeParser._get_mod_mtime | def _get_mod_mtime(self, filepath):
"""Gets the modified time of the file or its accompanying XML file,
whichever is greater.
"""
file_mtime = self.tramp.getmtime(filepath)
xmlpath = self.get_xmldoc_path(filepath)
if self.tramp.exists(xmlpath):
xml_mti... | python | def _get_mod_mtime(self, filepath):
"""Gets the modified time of the file or its accompanying XML file,
whichever is greater.
"""
file_mtime = self.tramp.getmtime(filepath)
xmlpath = self.get_xmldoc_path(filepath)
if self.tramp.exists(xmlpath):
xml_mti... | [
"def",
"_get_mod_mtime",
"(",
"self",
",",
"filepath",
")",
":",
"file_mtime",
"=",
"self",
".",
"tramp",
".",
"getmtime",
"(",
"filepath",
")",
"xmlpath",
"=",
"self",
".",
"get_xmldoc_path",
"(",
"filepath",
")",
"if",
"self",
".",
"tramp",
".",
"exist... | Gets the modified time of the file or its accompanying XML file,
whichever is greater. | [
"Gets",
"the",
"modified",
"time",
"of",
"the",
"file",
"or",
"its",
"accompanying",
"XML",
"file",
"whichever",
"is",
"greater",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L135-L146 |
50,499 | rosenbrockc/fortpy | fortpy/code.py | CodeParser._check_parse_modtime | def _check_parse_modtime(self, filepath, fname):
"""Checks whether the modules in the specified file path need
to be reparsed because the file was changed since it was
last loaded."""
#We also want to perform a reparse if the XML documentation file for the
#module changed,... | python | def _check_parse_modtime(self, filepath, fname):
"""Checks whether the modules in the specified file path need
to be reparsed because the file was changed since it was
last loaded."""
#We also want to perform a reparse if the XML documentation file for the
#module changed,... | [
"def",
"_check_parse_modtime",
"(",
"self",
",",
"filepath",
",",
"fname",
")",
":",
"#We also want to perform a reparse if the XML documentation file for the",
"#module changed, since the docs are also cached.",
"file_mtime",
"=",
"self",
".",
"_get_mod_mtime",
"(",
"filepath",
... | Checks whether the modules in the specified file path need
to be reparsed because the file was changed since it was
last loaded. | [
"Checks",
"whether",
"the",
"modules",
"in",
"the",
"specified",
"file",
"path",
"need",
"to",
"be",
"reparsed",
"because",
"the",
"file",
"was",
"changed",
"since",
"it",
"was",
"last",
"loaded",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/code.py#L173-L214 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.