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 51 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
251,800 | nchopin/particles | book/mle/malikpitt_interpolation.py | interpoled_resampling | def interpoled_resampling(W, x):
"""Resampling based on an interpolated CDF, as described in Malik and Pitt.
Parameters
----------
W: (N,) array
weights
x: (N,) array
particles
Returns
-------
xrs: (N,) array
the resampled particles
"""
N = W.shape[... | python | def interpoled_resampling(W, x):
N = W.shape[0]
idx = np.argsort(x)
xs = x[idx]
ws = W[idx]
cs = np.cumsum(avg_n_nplusone(ws))
u = random.rand(N)
xrs = np.empty(N)
where = np.searchsorted(cs, u)
# costs O(N log(N)) but algorithm has O(N log(N)) complexity anyway
for n in range... | [
"def",
"interpoled_resampling",
"(",
"W",
",",
"x",
")",
":",
"N",
"=",
"W",
".",
"shape",
"[",
"0",
"]",
"idx",
"=",
"np",
".",
"argsort",
"(",
"x",
")",
"xs",
"=",
"x",
"[",
"idx",
"]",
"ws",
"=",
"W",
"[",
"idx",
"]",
"cs",
"=",
"np",
... | Resampling based on an interpolated CDF, as described in Malik and Pitt.
Parameters
----------
W: (N,) array
weights
x: (N,) array
particles
Returns
-------
xrs: (N,) array
the resampled particles | [
"Resampling",
"based",
"on",
"an",
"interpolated",
"CDF",
"as",
"described",
"in",
"Malik",
"and",
"Pitt",
"."
] | 3faa97a1073db45c5889eef3e015dd76ef350b52 | https://github.com/nchopin/particles/blob/3faa97a1073db45c5889eef3e015dd76ef350b52/book/mle/malikpitt_interpolation.py#L26-L59 |
251,801 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | sort_items | def sort_items(self,items,args=False):
"""
Sort the `self`'s contents, as contained in the list `items` as
specified in `self`'s meta-data.
"""
if self.settings['sort'].lower() == 'src': return
def alpha(i):
return i.name
def permission(i):
if args:
if i.intent ==... | python | def sort_items(self,items,args=False):
if self.settings['sort'].lower() == 'src': return
def alpha(i):
return i.name
def permission(i):
if args:
if i.intent == 'in': return 'b'
if i.intent == 'inout': return 'c'
if i.intent == 'out': return 'd'
... | [
"def",
"sort_items",
"(",
"self",
",",
"items",
",",
"args",
"=",
"False",
")",
":",
"if",
"self",
".",
"settings",
"[",
"'sort'",
"]",
".",
"lower",
"(",
")",
"==",
"'src'",
":",
"return",
"def",
"alpha",
"(",
"i",
")",
":",
"return",
"i",
".",
... | Sort the `self`'s contents, as contained in the list `items` as
specified in `self`'s meta-data. | [
"Sort",
"the",
"self",
"s",
"contents",
"as",
"contained",
"in",
"the",
"list",
"items",
"as",
"specified",
"in",
"self",
"s",
"meta",
"-",
"data",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L2402-L2451 |
251,802 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | FortranBase.contents_size | def contents_size(self):
'''
Returns the number of different categories to be shown in the
contents side-bar in the HTML documentation.
'''
count = 0
if hasattr(self,'variables'): count += 1
if hasattr(self,'types'): count += 1
if hasattr(self,'modules'): ... | python | def contents_size(self):
'''
Returns the number of different categories to be shown in the
contents side-bar in the HTML documentation.
'''
count = 0
if hasattr(self,'variables'): count += 1
if hasattr(self,'types'): count += 1
if hasattr(self,'modules'): ... | [
"def",
"contents_size",
"(",
"self",
")",
":",
"count",
"=",
"0",
"if",
"hasattr",
"(",
"self",
",",
"'variables'",
")",
":",
"count",
"+=",
"1",
"if",
"hasattr",
"(",
"self",
",",
"'types'",
")",
":",
"count",
"+=",
"1",
"if",
"hasattr",
"(",
"sel... | Returns the number of different categories to be shown in the
contents side-bar in the HTML documentation. | [
"Returns",
"the",
"number",
"of",
"different",
"categories",
"to",
"be",
"shown",
"in",
"the",
"contents",
"side",
"-",
"bar",
"in",
"the",
"HTML",
"documentation",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L267-L292 |
251,803 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | FortranBase.sort | def sort(self):
'''
Sorts components of the object.
'''
if hasattr(self,'variables'):
sort_items(self,self.variables)
if hasattr(self,'modules'):
sort_items(self,self.modules)
if hasattr(self,'submodules'):
sort_items(self,self.submodul... | python | def sort(self):
'''
Sorts components of the object.
'''
if hasattr(self,'variables'):
sort_items(self,self.variables)
if hasattr(self,'modules'):
sort_items(self,self.modules)
if hasattr(self,'submodules'):
sort_items(self,self.submodul... | [
"def",
"sort",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'variables'",
")",
":",
"sort_items",
"(",
"self",
",",
"self",
".",
"variables",
")",
"if",
"hasattr",
"(",
"self",
",",
"'modules'",
")",
":",
"sort_items",
"(",
"self",
",",... | Sorts components of the object. | [
"Sorts",
"components",
"of",
"the",
"object",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L417-L451 |
251,804 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | FortranBase.make_links | def make_links(self, project):
"""
Process intra-site links to documentation of other parts of the program.
"""
self.doc = ford.utils.sub_links(self.doc,project)
if 'summary' in self.meta:
self.meta['summary'] = ford.utils.sub_links(self.meta['summary'],project)
... | python | def make_links(self, project):
self.doc = ford.utils.sub_links(self.doc,project)
if 'summary' in self.meta:
self.meta['summary'] = ford.utils.sub_links(self.meta['summary'],project)
# Create links in the project
for item in self.iterator('variables', 'types', 'enums', 'modul... | [
"def",
"make_links",
"(",
"self",
",",
"project",
")",
":",
"self",
".",
"doc",
"=",
"ford",
".",
"utils",
".",
"sub_links",
"(",
"self",
".",
"doc",
",",
"project",
")",
"if",
"'summary'",
"in",
"self",
".",
"meta",
":",
"self",
".",
"meta",
"[",
... | Process intra-site links to documentation of other parts of the program. | [
"Process",
"intra",
"-",
"site",
"links",
"to",
"documentation",
"of",
"other",
"parts",
"of",
"the",
"program",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L454-L475 |
251,805 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | FortranBase.iterator | def iterator(self, *argv):
""" Iterator returning any list of elements via attribute lookup in `self`
This iterator retains the order of the arguments """
for arg in argv:
if hasattr(self, arg):
for item in getattr(self, arg):
yield item | python | def iterator(self, *argv):
for arg in argv:
if hasattr(self, arg):
for item in getattr(self, arg):
yield item | [
"def",
"iterator",
"(",
"self",
",",
"*",
"argv",
")",
":",
"for",
"arg",
"in",
"argv",
":",
"if",
"hasattr",
"(",
"self",
",",
"arg",
")",
":",
"for",
"item",
"in",
"getattr",
"(",
"self",
",",
"arg",
")",
":",
"yield",
"item"
] | Iterator returning any list of elements via attribute lookup in `self`
This iterator retains the order of the arguments | [
"Iterator",
"returning",
"any",
"list",
"of",
"elements",
"via",
"attribute",
"lookup",
"in",
"self"
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L486-L493 |
251,806 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | FortranModule.get_used_entities | def get_used_entities(self,use_specs):
"""
Returns the entities which are imported by a use statement. These
are contained in dicts.
"""
if len(use_specs.strip()) == 0:
return (self.pub_procs, self.pub_absints, self.pub_types, self.pub_vars)
only = bool(self.O... | python | def get_used_entities(self,use_specs):
if len(use_specs.strip()) == 0:
return (self.pub_procs, self.pub_absints, self.pub_types, self.pub_vars)
only = bool(self.ONLY_RE.match(use_specs))
use_specs = self.ONLY_RE.sub('',use_specs)
ulist = self.SPLIT_RE.split(use_specs)
... | [
"def",
"get_used_entities",
"(",
"self",
",",
"use_specs",
")",
":",
"if",
"len",
"(",
"use_specs",
".",
"strip",
"(",
")",
")",
"==",
"0",
":",
"return",
"(",
"self",
".",
"pub_procs",
",",
"self",
".",
"pub_absints",
",",
"self",
".",
"pub_types",
... | Returns the entities which are imported by a use statement. These
are contained in dicts. | [
"Returns",
"the",
"entities",
"which",
"are",
"imported",
"by",
"a",
"use",
"statement",
".",
"These",
"are",
"contained",
"in",
"dicts",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L1138-L1188 |
251,807 | Fortran-FOSS-Programmers/ford | ford/sourceform.py | NameSelector.get_name | def get_name(self,item):
"""
Return the name for this item registered with this NameSelector.
If no name has previously been registered, then generate a new
one.
"""
if not isinstance(item,ford.sourceform.FortranBase):
raise Exception('{} is not of a type deri... | python | def get_name(self,item):
if not isinstance(item,ford.sourceform.FortranBase):
raise Exception('{} is not of a type derived from FortranBase'.format(str(item)))
if item in self._items:
return self._items[item]
else:
if item.get_dir() not in self._counts:
... | [
"def",
"get_name",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"isinstance",
"(",
"item",
",",
"ford",
".",
"sourceform",
".",
"FortranBase",
")",
":",
"raise",
"Exception",
"(",
"'{} is not of a type derived from FortranBase'",
".",
"format",
"(",
"str",... | Return the name for this item registered with this NameSelector.
If no name has previously been registered, then generate a new
one. | [
"Return",
"the",
"name",
"for",
"this",
"item",
"registered",
"with",
"this",
"NameSelector",
".",
"If",
"no",
"name",
"has",
"previously",
"been",
"registered",
"then",
"generate",
"a",
"new",
"one",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/sourceform.py#L2466-L2493 |
251,808 | Fortran-FOSS-Programmers/ford | ford/__init__.py | main | def main(proj_data,proj_docs,md):
"""
Main driver of FORD.
"""
if proj_data['relative']: proj_data['project_url'] = '.'
# Parse the files in your project
project = ford.fortran_project.Project(proj_data)
if len(project.files) < 1:
print("Error: No source files with appropriate extens... | python | def main(proj_data,proj_docs,md):
if proj_data['relative']: proj_data['project_url'] = '.'
# Parse the files in your project
project = ford.fortran_project.Project(proj_data)
if len(project.files) < 1:
print("Error: No source files with appropriate extension found in specified directory.")
... | [
"def",
"main",
"(",
"proj_data",
",",
"proj_docs",
",",
"md",
")",
":",
"if",
"proj_data",
"[",
"'relative'",
"]",
":",
"proj_data",
"[",
"'project_url'",
"]",
"=",
"'.'",
"# Parse the files in your project",
"project",
"=",
"ford",
".",
"fortran_project",
"."... | Main driver of FORD. | [
"Main",
"driver",
"of",
"FORD",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/__init__.py#L337-L382 |
251,809 | Fortran-FOSS-Programmers/ford | ford/fixed2free2.py | convertToFree | def convertToFree(stream, length_limit=True):
"""Convert stream from fixed source form to free source form."""
linestack = []
for line in stream:
convline = FortranLine(line, length_limit)
if convline.is_regular:
if convline.isContinuation and linestack:
... | python | def convertToFree(stream, length_limit=True):
linestack = []
for line in stream:
convline = FortranLine(line, length_limit)
if convline.is_regular:
if convline.isContinuation and linestack:
linestack[0].continueLine()
for l in linestack:... | [
"def",
"convertToFree",
"(",
"stream",
",",
"length_limit",
"=",
"True",
")",
":",
"linestack",
"=",
"[",
"]",
"for",
"line",
"in",
"stream",
":",
"convline",
"=",
"FortranLine",
"(",
"line",
",",
"length_limit",
")",
"if",
"convline",
".",
"is_regular",
... | Convert stream from fixed source form to free source form. | [
"Convert",
"stream",
"from",
"fixed",
"source",
"form",
"to",
"free",
"source",
"form",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/fixed2free2.py#L110-L127 |
251,810 | Fortran-FOSS-Programmers/ford | ford/fixed2free2.py | FortranLine.continueLine | def continueLine(self):
"""Insert line continuation symbol at end of line."""
if not (self.isLong and self.is_regular):
self.line_conv = self.line_conv.rstrip() + " &\n"
else:
temp = self.line_conv[:72].rstrip() + " &"
self.line_conv = temp.ljust(72) + self.e... | python | def continueLine(self):
if not (self.isLong and self.is_regular):
self.line_conv = self.line_conv.rstrip() + " &\n"
else:
temp = self.line_conv[:72].rstrip() + " &"
self.line_conv = temp.ljust(72) + self.excess_line | [
"def",
"continueLine",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"isLong",
"and",
"self",
".",
"is_regular",
")",
":",
"self",
".",
"line_conv",
"=",
"self",
".",
"line_conv",
".",
"rstrip",
"(",
")",
"+",
"\" &\\n\"",
"else",
":",
"temp"... | Insert line continuation symbol at end of line. | [
"Insert",
"line",
"continuation",
"symbol",
"at",
"end",
"of",
"line",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/fixed2free2.py#L52-L59 |
251,811 | Fortran-FOSS-Programmers/ford | ford/fortran_project.py | id_mods | def id_mods(obj,modlist,intrinsic_mods={},submodlist=[]):
"""
Match USE statements up with the right modules
"""
for i in range(len(obj.uses)):
for candidate in modlist:
if obj.uses[i][0].lower() == candidate.name.lower():
obj.uses[i] = [candidate, obj.uses[i][1]]
... | python | def id_mods(obj,modlist,intrinsic_mods={},submodlist=[]):
for i in range(len(obj.uses)):
for candidate in modlist:
if obj.uses[i][0].lower() == candidate.name.lower():
obj.uses[i] = [candidate, obj.uses[i][1]]
break
else:
if obj.uses[i][0].lowe... | [
"def",
"id_mods",
"(",
"obj",
",",
"modlist",
",",
"intrinsic_mods",
"=",
"{",
"}",
",",
"submodlist",
"=",
"[",
"]",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"obj",
".",
"uses",
")",
")",
":",
"for",
"candidate",
"in",
"modlist",
":... | Match USE statements up with the right modules | [
"Match",
"USE",
"statements",
"up",
"with",
"the",
"right",
"modules"
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/fortran_project.py#L338-L366 |
251,812 | Fortran-FOSS-Programmers/ford | ford/fortran_project.py | Project.allfiles | def allfiles(self):
""" Instead of duplicating files, it is much more efficient to create the itterator on the fly """
for f in self.files:
yield f
for f in self.extra_files:
yield f | python | def allfiles(self):
for f in self.files:
yield f
for f in self.extra_files:
yield f | [
"def",
"allfiles",
"(",
"self",
")",
":",
"for",
"f",
"in",
"self",
".",
"files",
":",
"yield",
"f",
"for",
"f",
"in",
"self",
".",
"extra_files",
":",
"yield",
"f"
] | Instead of duplicating files, it is much more efficient to create the itterator on the fly | [
"Instead",
"of",
"duplicating",
"files",
"it",
"is",
"much",
"more",
"efficient",
"to",
"create",
"the",
"itterator",
"on",
"the",
"fly"
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/fortran_project.py#L124-L129 |
251,813 | Fortran-FOSS-Programmers/ford | ford/fortran_project.py | Project.make_links | def make_links(self,base_url='..'):
"""
Substitute intrasite links to documentation for other parts of
the program.
"""
ford.sourceform.set_base_url(base_url)
for src in self.allfiles:
src.make_links(self) | python | def make_links(self,base_url='..'):
ford.sourceform.set_base_url(base_url)
for src in self.allfiles:
src.make_links(self) | [
"def",
"make_links",
"(",
"self",
",",
"base_url",
"=",
"'..'",
")",
":",
"ford",
".",
"sourceform",
".",
"set_base_url",
"(",
"base_url",
")",
"for",
"src",
"in",
"self",
".",
"allfiles",
":",
"src",
".",
"make_links",
"(",
"self",
")"
] | Substitute intrasite links to documentation for other parts of
the program. | [
"Substitute",
"intrasite",
"links",
"to",
"documentation",
"for",
"other",
"parts",
"of",
"the",
"program",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/fortran_project.py#L305-L312 |
251,814 | Fortran-FOSS-Programmers/ford | ford/utils.py | sub_notes | def sub_notes(docs):
"""
Substitutes the special controls for notes, warnings, todos, and bugs with
the corresponding div.
"""
def substitute(match):
ret = "</p><div class=\"alert alert-{}\" role=\"alert\"><h4>{}</h4>" \
"<p>{}</p></div>".format(NOTE_TYPE[match.group(1).lower()... | python | def sub_notes(docs):
def substitute(match):
ret = "</p><div class=\"alert alert-{}\" role=\"alert\"><h4>{}</h4>" \
"<p>{}</p></div>".format(NOTE_TYPE[match.group(1).lower()],
match.group(1).capitalize(), match.group(2))
if len(match.groups()) >= 4... | [
"def",
"sub_notes",
"(",
"docs",
")",
":",
"def",
"substitute",
"(",
"match",
")",
":",
"ret",
"=",
"\"</p><div class=\\\"alert alert-{}\\\" role=\\\"alert\\\"><h4>{}</h4>\"",
"\"<p>{}</p></div>\"",
".",
"format",
"(",
"NOTE_TYPE",
"[",
"match",
".",
"group",
"(",
"... | Substitutes the special controls for notes, warnings, todos, and bugs with
the corresponding div. | [
"Substitutes",
"the",
"special",
"controls",
"for",
"notes",
"warnings",
"todos",
"and",
"bugs",
"with",
"the",
"corresponding",
"div",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/utils.py#L42-L55 |
251,815 | Fortran-FOSS-Programmers/ford | ford/utils.py | paren_split | def paren_split(sep,string):
"""
Splits the string into pieces divided by sep, when sep is outside of parentheses.
"""
if len(sep) != 1: raise Exception("Separation string must be one character long")
retlist = []
level = 0
blevel = 0
left = 0
for i in range(len(string)):
if ... | python | def paren_split(sep,string):
if len(sep) != 1: raise Exception("Separation string must be one character long")
retlist = []
level = 0
blevel = 0
left = 0
for i in range(len(string)):
if string[i] == "(": level += 1
elif string[i] == ")": level -= 1
elif string[i] == "[": ... | [
"def",
"paren_split",
"(",
"sep",
",",
"string",
")",
":",
"if",
"len",
"(",
"sep",
")",
"!=",
"1",
":",
"raise",
"Exception",
"(",
"\"Separation string must be one character long\"",
")",
"retlist",
"=",
"[",
"]",
"level",
"=",
"0",
"blevel",
"=",
"0",
... | Splits the string into pieces divided by sep, when sep is outside of parentheses. | [
"Splits",
"the",
"string",
"into",
"pieces",
"divided",
"by",
"sep",
"when",
"sep",
"is",
"outside",
"of",
"parentheses",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/utils.py#L88-L106 |
251,816 | Fortran-FOSS-Programmers/ford | ford/utils.py | quote_split | def quote_split(sep,string):
"""
Splits the strings into pieces divided by sep, when sep in not inside quotes.
"""
if len(sep) != 1: raise Exception("Separation string must be one character long")
retlist = []
squote = False
dquote = False
left = 0
i = 0
while i < len(string):
... | python | def quote_split(sep,string):
if len(sep) != 1: raise Exception("Separation string must be one character long")
retlist = []
squote = False
dquote = False
left = 0
i = 0
while i < len(string):
if string[i] == '"' and not dquote:
if not squote:
squote = True... | [
"def",
"quote_split",
"(",
"sep",
",",
"string",
")",
":",
"if",
"len",
"(",
"sep",
")",
"!=",
"1",
":",
"raise",
"Exception",
"(",
"\"Separation string must be one character long\"",
")",
"retlist",
"=",
"[",
"]",
"squote",
"=",
"False",
"dquote",
"=",
"F... | Splits the strings into pieces divided by sep, when sep in not inside quotes. | [
"Splits",
"the",
"strings",
"into",
"pieces",
"divided",
"by",
"sep",
"when",
"sep",
"in",
"not",
"inside",
"quotes",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/utils.py#L110-L140 |
251,817 | Fortran-FOSS-Programmers/ford | ford/utils.py | split_path | def split_path(path):
'''
Splits the argument into its constituent directories and returns them as
a list.
'''
def recurse_path(path,retlist):
if len(retlist) > 100:
fullpath = os.path.join(*([ path, ] + retlist))
print("Directory '{}' contains too many levels".format... | python | def split_path(path):
'''
Splits the argument into its constituent directories and returns them as
a list.
'''
def recurse_path(path,retlist):
if len(retlist) > 100:
fullpath = os.path.join(*([ path, ] + retlist))
print("Directory '{}' contains too many levels".format... | [
"def",
"split_path",
"(",
"path",
")",
":",
"def",
"recurse_path",
"(",
"path",
",",
"retlist",
")",
":",
"if",
"len",
"(",
"retlist",
")",
">",
"100",
":",
"fullpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"*",
"(",
"[",
"path",
",",
"]",
... | Splits the argument into its constituent directories and returns them as
a list. | [
"Splits",
"the",
"argument",
"into",
"its",
"constituent",
"directories",
"and",
"returns",
"them",
"as",
"a",
"list",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/utils.py#L143-L167 |
251,818 | Fortran-FOSS-Programmers/ford | ford/utils.py | sub_macros | def sub_macros(string,base_url):
'''
Replaces macros in documentation with their appropriate values. These macros
are used for things like providing URLs.
'''
macros = { '|url|': base_url,
'|media|': os.path.join(base_url,'media'),
'|page|': os.path.join(base_url,'page'... | python | def sub_macros(string,base_url):
'''
Replaces macros in documentation with their appropriate values. These macros
are used for things like providing URLs.
'''
macros = { '|url|': base_url,
'|media|': os.path.join(base_url,'media'),
'|page|': os.path.join(base_url,'page'... | [
"def",
"sub_macros",
"(",
"string",
",",
"base_url",
")",
":",
"macros",
"=",
"{",
"'|url|'",
":",
"base_url",
",",
"'|media|'",
":",
"os",
".",
"path",
".",
"join",
"(",
"base_url",
",",
"'media'",
")",
",",
"'|page|'",
":",
"os",
".",
"path",
".",
... | Replaces macros in documentation with their appropriate values. These macros
are used for things like providing URLs. | [
"Replaces",
"macros",
"in",
"documentation",
"with",
"their",
"appropriate",
"values",
".",
"These",
"macros",
"are",
"used",
"for",
"things",
"like",
"providing",
"URLs",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/utils.py#L279-L290 |
251,819 | Fortran-FOSS-Programmers/ford | ford/output.py | copytree | def copytree(src, dst):
"""Replaces shutil.copytree to avoid problems on certain file systems.
shutil.copytree() and shutil.copystat() invoke os.setxattr(), which seems
to fail when called for directories on at least one NFS file system.
The current routine is a simple replacement, which should be good... | python | def copytree(src, dst):
def touch(path):
now = time.time()
try:
# assume it's there
os.utime(path, (now, now))
except os.error:
# if it isn't, try creating the directory,
# a file with that name
os.makedirs(os.path.dirname(path))
... | [
"def",
"copytree",
"(",
"src",
",",
"dst",
")",
":",
"def",
"touch",
"(",
"path",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"try",
":",
"# assume it's there",
"os",
".",
"utime",
"(",
"path",
",",
"(",
"now",
",",
"now",
")",
")",
"e... | Replaces shutil.copytree to avoid problems on certain file systems.
shutil.copytree() and shutil.copystat() invoke os.setxattr(), which seems
to fail when called for directories on at least one NFS file system.
The current routine is a simple replacement, which should be good enough for
Ford. | [
"Replaces",
"shutil",
".",
"copytree",
"to",
"avoid",
"problems",
"on",
"certain",
"file",
"systems",
"."
] | d46a44eae20d99205292c31785f936fbed47070f | https://github.com/Fortran-FOSS-Programmers/ford/blob/d46a44eae20d99205292c31785f936fbed47070f/ford/output.py#L520-L551 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.