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,300 | rosenbrockc/fortpy | fortpy/templates/ftypes.py | Ftype.clean | def clean(self):
"""Deallocates the fortran-managed memory that this ctype references.
"""
if not self.deallocated:
#Release/deallocate the pointer in fortran.
method = self._deallocator()
if method is not None:
dealloc = static_symbol("ftypes_... | python | def clean(self):
"""Deallocates the fortran-managed memory that this ctype references.
"""
if not self.deallocated:
#Release/deallocate the pointer in fortran.
method = self._deallocator()
if method is not None:
dealloc = static_symbol("ftypes_... | [
"def",
"clean",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"deallocated",
":",
"#Release/deallocate the pointer in fortran.",
"method",
"=",
"self",
".",
"_deallocator",
"(",
")",
"if",
"method",
"is",
"not",
"None",
":",
"dealloc",
"=",
"static_symbol",... | Deallocates the fortran-managed memory that this ctype references. | [
"Deallocates",
"the",
"fortran",
"-",
"managed",
"memory",
"that",
"this",
"ctype",
"references",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/templates/ftypes.py#L116-L131 |
50,301 | rosenbrockc/fortpy | fortpy/templates/ftypes.py | Ftype._deallocator | def _deallocator(self):
"""Returns the name of the subroutine in ftypes_dealloc.f90 that can
deallocate the array for this Ftype's pointer.
:arg ctype: the string c-type of the variable.
"""
lookup = {
"c_bool": "logical",
"c_double": "double",
... | python | def _deallocator(self):
"""Returns the name of the subroutine in ftypes_dealloc.f90 that can
deallocate the array for this Ftype's pointer.
:arg ctype: the string c-type of the variable.
"""
lookup = {
"c_bool": "logical",
"c_double": "double",
... | [
"def",
"_deallocator",
"(",
"self",
")",
":",
"lookup",
"=",
"{",
"\"c_bool\"",
":",
"\"logical\"",
",",
"\"c_double\"",
":",
"\"double\"",
",",
"\"c_double_complex\"",
":",
"\"complex\"",
",",
"\"c_char\"",
":",
"\"char\"",
",",
"\"c_int\"",
":",
"\"int\"",
"... | Returns the name of the subroutine in ftypes_dealloc.f90 that can
deallocate the array for this Ftype's pointer.
:arg ctype: the string c-type of the variable. | [
"Returns",
"the",
"name",
"of",
"the",
"subroutine",
"in",
"ftypes_dealloc",
".",
"f90",
"that",
"can",
"deallocate",
"the",
"array",
"for",
"this",
"Ftype",
"s",
"pointer",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/templates/ftypes.py#L133-L153 |
50,302 | rosenbrockc/fortpy | fortpy/templates/ftypes.py | FtypesResult.add | def add(self, varname, result, pointer=None):
"""Adds the specified python-typed result and an optional Ftype pointer
to use when cleaning up this object.
:arg result: a python-typed representation of the result.
:arg pointer: an instance of Ftype with pointer information for deallocati... | python | def add(self, varname, result, pointer=None):
"""Adds the specified python-typed result and an optional Ftype pointer
to use when cleaning up this object.
:arg result: a python-typed representation of the result.
:arg pointer: an instance of Ftype with pointer information for deallocati... | [
"def",
"add",
"(",
"self",
",",
"varname",
",",
"result",
",",
"pointer",
"=",
"None",
")",
":",
"self",
".",
"result",
"[",
"varname",
"]",
"=",
"result",
"setattr",
"(",
"self",
",",
"varname",
",",
"result",
")",
"if",
"pointer",
"is",
"not",
"N... | Adds the specified python-typed result and an optional Ftype pointer
to use when cleaning up this object.
:arg result: a python-typed representation of the result.
:arg pointer: an instance of Ftype with pointer information for deallocating
the c-pointer. | [
"Adds",
"the",
"specified",
"python",
"-",
"typed",
"result",
"and",
"an",
"optional",
"Ftype",
"pointer",
"to",
"use",
"when",
"cleaning",
"up",
"this",
"object",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/templates/ftypes.py#L204-L215 |
50,303 | hyde/commando | commando/util.py | load_python_object | def load_python_object(name):
"""
Loads a python module from string
"""
logger = getLoggerWithNullHandler('commando.load_python_object')
(module_name, _, object_name) = name.rpartition(".")
if module_name == '':
(module_name, object_name) = (object_name, module_name)
try:
log... | python | def load_python_object(name):
"""
Loads a python module from string
"""
logger = getLoggerWithNullHandler('commando.load_python_object')
(module_name, _, object_name) = name.rpartition(".")
if module_name == '':
(module_name, object_name) = (object_name, module_name)
try:
log... | [
"def",
"load_python_object",
"(",
"name",
")",
":",
"logger",
"=",
"getLoggerWithNullHandler",
"(",
"'commando.load_python_object'",
")",
"(",
"module_name",
",",
"_",
",",
"object_name",
")",
"=",
"name",
".",
"rpartition",
"(",
"\".\"",
")",
"if",
"module_name... | Loads a python module from string | [
"Loads",
"a",
"python",
"module",
"from",
"string"
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/util.py#L21-L57 |
50,304 | hyde/commando | commando/util.py | getLoggerWithConsoleHandler | def getLoggerWithConsoleHandler(logger_name=None):
"""
Gets a logger object with a pre-initialized console handler.
"""
logger = logging.getLogger(logger_name)
logger.setLevel(logging.INFO)
if not logger.handlers:
handler = logging.StreamHandler(sys.stdout)
if sys.platform == 'wi... | python | def getLoggerWithConsoleHandler(logger_name=None):
"""
Gets a logger object with a pre-initialized console handler.
"""
logger = logging.getLogger(logger_name)
logger.setLevel(logging.INFO)
if not logger.handlers:
handler = logging.StreamHandler(sys.stdout)
if sys.platform == 'wi... | [
"def",
"getLoggerWithConsoleHandler",
"(",
"logger_name",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"logger_name",
")",
"logger",
".",
"setLevel",
"(",
"logging",
".",
"INFO",
")",
"if",
"not",
"logger",
".",
"handlers",
":",
... | Gets a logger object with a pre-initialized console handler. | [
"Gets",
"a",
"logger",
"object",
"with",
"a",
"pre",
"-",
"initialized",
"console",
"handler",
"."
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/util.py#L106-L124 |
50,305 | hyde/commando | commando/util.py | getLoggerWithNullHandler | def getLoggerWithNullHandler(logger_name):
"""
Gets the logger initialized with the `logger_name`
and a NullHandler.
"""
logger = logging.getLogger(logger_name)
if not logger.handlers:
logger.addHandler(NullHandler())
return logger | python | def getLoggerWithNullHandler(logger_name):
"""
Gets the logger initialized with the `logger_name`
and a NullHandler.
"""
logger = logging.getLogger(logger_name)
if not logger.handlers:
logger.addHandler(NullHandler())
return logger | [
"def",
"getLoggerWithNullHandler",
"(",
"logger_name",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"logger_name",
")",
"if",
"not",
"logger",
".",
"handlers",
":",
"logger",
".",
"addHandler",
"(",
"NullHandler",
"(",
")",
")",
"return",
"logg... | Gets the logger initialized with the `logger_name`
and a NullHandler. | [
"Gets",
"the",
"logger",
"initialized",
"with",
"the",
"logger_name",
"and",
"a",
"NullHandler",
"."
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/util.py#L127-L135 |
50,306 | hyde/commando | commando/util.py | ShellCommand.call | def call(self, *args, **kwargs):
"""
Delegates to `subprocess.check_call`.
"""
args, kwargs = self.__process__(*args, **kwargs)
return check_call(args, **kwargs) | python | def call(self, *args, **kwargs):
"""
Delegates to `subprocess.check_call`.
"""
args, kwargs = self.__process__(*args, **kwargs)
return check_call(args, **kwargs) | [
"def",
"call",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
",",
"kwargs",
"=",
"self",
".",
"__process__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"check_call",
"(",
"args",
",",
"*",
"*",
"kwargs",... | Delegates to `subprocess.check_call`. | [
"Delegates",
"to",
"subprocess",
".",
"check_call",
"."
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/util.py#L84-L89 |
50,307 | hyde/commando | commando/util.py | ShellCommand.get | def get(self, *args, **kwargs):
"""
Delegates to `subprocess.check_output`.
"""
args, kwargs = self.__process__(*args, **kwargs)
return check_output(args, **kwargs) | python | def get(self, *args, **kwargs):
"""
Delegates to `subprocess.check_output`.
"""
args, kwargs = self.__process__(*args, **kwargs)
return check_output(args, **kwargs) | [
"def",
"get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
",",
"kwargs",
"=",
"self",
".",
"__process__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"check_output",
"(",
"args",
",",
"*",
"*",
"kwargs"... | Delegates to `subprocess.check_output`. | [
"Delegates",
"to",
"subprocess",
".",
"check_output",
"."
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/util.py#L91-L96 |
50,308 | hyde/commando | commando/util.py | ShellCommand.open | def open(self, *args, **kwargs):
"""
Delegates to `subprocess.Popen`.
"""
args, kwargs = self.__process__(*args, **kwargs)
return Popen(args, **kwargs) | python | def open(self, *args, **kwargs):
"""
Delegates to `subprocess.Popen`.
"""
args, kwargs = self.__process__(*args, **kwargs)
return Popen(args, **kwargs) | [
"def",
"open",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
",",
"kwargs",
"=",
"self",
".",
"__process__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"Popen",
"(",
"args",
",",
"*",
"*",
"kwargs",
")... | Delegates to `subprocess.Popen`. | [
"Delegates",
"to",
"subprocess",
".",
"Popen",
"."
] | 78dc9f2f329d806049f090e04411bea90129ee4f | https://github.com/hyde/commando/blob/78dc9f2f329d806049f090e04411bea90129ee4f/commando/util.py#L98-L103 |
50,309 | grantmcconnaughey/django-lazy-tags | lazy_tags/views.py | tag | def tag(request, tag_id=None):
"""
The view used to render a tag after the page has loaded.
"""
html = get_tag_html(tag_id)
t = template.Template(html)
c = template.RequestContext(request)
return HttpResponse(t.render(c)) | python | def tag(request, tag_id=None):
"""
The view used to render a tag after the page has loaded.
"""
html = get_tag_html(tag_id)
t = template.Template(html)
c = template.RequestContext(request)
return HttpResponse(t.render(c)) | [
"def",
"tag",
"(",
"request",
",",
"tag_id",
"=",
"None",
")",
":",
"html",
"=",
"get_tag_html",
"(",
"tag_id",
")",
"t",
"=",
"template",
".",
"Template",
"(",
"html",
")",
"c",
"=",
"template",
".",
"RequestContext",
"(",
"request",
")",
"return",
... | The view used to render a tag after the page has loaded. | [
"The",
"view",
"used",
"to",
"render",
"a",
"tag",
"after",
"the",
"page",
"has",
"loaded",
"."
] | c24872c1d9f198abd20669c77380a923092374c2 | https://github.com/grantmcconnaughey/django-lazy-tags/blob/c24872c1d9f198abd20669c77380a923092374c2/lazy_tags/views.py#L7-L15 |
50,310 | PixelwarStudio/PyTree | Tree/draw.py | Drawer._get_color | def _get_color(self, age):
"""Get the fill color depending on age.
Args:
age (int): The age of the branch/es
Returns:
tuple: (r, g, b)
"""
if age == self.tree.age:
return self.leaf_color
color = self.stem_color
tree = self.tre... | python | def _get_color(self, age):
"""Get the fill color depending on age.
Args:
age (int): The age of the branch/es
Returns:
tuple: (r, g, b)
"""
if age == self.tree.age:
return self.leaf_color
color = self.stem_color
tree = self.tre... | [
"def",
"_get_color",
"(",
"self",
",",
"age",
")",
":",
"if",
"age",
"==",
"self",
".",
"tree",
".",
"age",
":",
"return",
"self",
".",
"leaf_color",
"color",
"=",
"self",
".",
"stem_color",
"tree",
"=",
"self",
".",
"tree",
"if",
"len",
"(",
"colo... | Get the fill color depending on age.
Args:
age (int): The age of the branch/es
Returns:
tuple: (r, g, b) | [
"Get",
"the",
"fill",
"color",
"depending",
"on",
"age",
"."
] | f14b25ea145da6b00d836e34251d2a4c823766dc | https://github.com/PixelwarStudio/PyTree/blob/f14b25ea145da6b00d836e34251d2a4c823766dc/Tree/draw.py#L42-L62 |
50,311 | PixelwarStudio/PyTree | Tree/draw.py | Drawer.draw | def draw(self):
"""Draws the tree.
Args:
ages (array): Contains the ages you want to draw.
"""
for age, level in enumerate(self.tree.get_branches()):
if age in self.ages:
thickness = self._get_thickness(age)
color = self._get_color... | python | def draw(self):
"""Draws the tree.
Args:
ages (array): Contains the ages you want to draw.
"""
for age, level in enumerate(self.tree.get_branches()):
if age in self.ages:
thickness = self._get_thickness(age)
color = self._get_color... | [
"def",
"draw",
"(",
"self",
")",
":",
"for",
"age",
",",
"level",
"in",
"enumerate",
"(",
"self",
".",
"tree",
".",
"get_branches",
"(",
")",
")",
":",
"if",
"age",
"in",
"self",
".",
"ages",
":",
"thickness",
"=",
"self",
".",
"_get_thickness",
"(... | Draws the tree.
Args:
ages (array): Contains the ages you want to draw. | [
"Draws",
"the",
"tree",
"."
] | f14b25ea145da6b00d836e34251d2a4c823766dc | https://github.com/PixelwarStudio/PyTree/blob/f14b25ea145da6b00d836e34251d2a4c823766dc/Tree/draw.py#L75-L86 |
50,312 | kofrasa/migrate | migrate.py | Migrate._cmd_create | def _cmd_create(self):
"""Create a migration in the current or new revision folder
"""
assert self._message, "need to supply a message for the \"create\" command"
if not self._revisions:
self._revisions.append("1")
# get the migration folder
rev_folder = self... | python | def _cmd_create(self):
"""Create a migration in the current or new revision folder
"""
assert self._message, "need to supply a message for the \"create\" command"
if not self._revisions:
self._revisions.append("1")
# get the migration folder
rev_folder = self... | [
"def",
"_cmd_create",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_message",
",",
"\"need to supply a message for the \\\"create\\\" command\"",
"if",
"not",
"self",
".",
"_revisions",
":",
"self",
".",
"_revisions",
".",
"append",
"(",
"\"1\"",
")",
"# get the... | Create a migration in the current or new revision folder | [
"Create",
"a",
"migration",
"in",
"the",
"current",
"or",
"new",
"revision",
"folder"
] | b53b7168f8ac27e4c557de6e62ad85fe00d99566 | https://github.com/kofrasa/migrate/blob/b53b7168f8ac27e4c557de6e62ad85fe00d99566/migrate.py#L83-L120 |
50,313 | kofrasa/migrate | migrate.py | Migrate._cmd_up | def _cmd_up(self):
"""Upgrade to a revision"""
revision = self._get_revision()
if not self._rev:
self._log(0, "upgrading current revision")
else:
self._log(0, "upgrading from revision %s" % revision)
for rev in self._revisions[int(revision) - 1:]:
... | python | def _cmd_up(self):
"""Upgrade to a revision"""
revision = self._get_revision()
if not self._rev:
self._log(0, "upgrading current revision")
else:
self._log(0, "upgrading from revision %s" % revision)
for rev in self._revisions[int(revision) - 1:]:
... | [
"def",
"_cmd_up",
"(",
"self",
")",
":",
"revision",
"=",
"self",
".",
"_get_revision",
"(",
")",
"if",
"not",
"self",
".",
"_rev",
":",
"self",
".",
"_log",
"(",
"0",
",",
"\"upgrading current revision\"",
")",
"else",
":",
"self",
".",
"_log",
"(",
... | Upgrade to a revision | [
"Upgrade",
"to",
"a",
"revision"
] | b53b7168f8ac27e4c557de6e62ad85fe00d99566 | https://github.com/kofrasa/migrate/blob/b53b7168f8ac27e4c557de6e62ad85fe00d99566/migrate.py#L122-L133 |
50,314 | kofrasa/migrate | migrate.py | Migrate._cmd_down | def _cmd_down(self):
"""Downgrade to a revision"""
revision = self._get_revision()
if not self._rev:
self._log(0, "downgrading current revision")
else:
self._log(0, "downgrading to revision %s" % revision)
# execute from latest to oldest revision
f... | python | def _cmd_down(self):
"""Downgrade to a revision"""
revision = self._get_revision()
if not self._rev:
self._log(0, "downgrading current revision")
else:
self._log(0, "downgrading to revision %s" % revision)
# execute from latest to oldest revision
f... | [
"def",
"_cmd_down",
"(",
"self",
")",
":",
"revision",
"=",
"self",
".",
"_get_revision",
"(",
")",
"if",
"not",
"self",
".",
"_rev",
":",
"self",
".",
"_log",
"(",
"0",
",",
"\"downgrading current revision\"",
")",
"else",
":",
"self",
".",
"_log",
"(... | Downgrade to a revision | [
"Downgrade",
"to",
"a",
"revision"
] | b53b7168f8ac27e4c557de6e62ad85fe00d99566 | https://github.com/kofrasa/migrate/blob/b53b7168f8ac27e4c557de6e62ad85fe00d99566/migrate.py#L135-L147 |
50,315 | kofrasa/migrate | migrate.py | Migrate._get_revision | def _get_revision(self):
"""Validate and return the revision to use for current command
"""
assert self._revisions, "no migration revision exist"
revision = self._rev or self._revisions[-1]
# revision count must be less or equal since revisions are ordered
assert revision... | python | def _get_revision(self):
"""Validate and return the revision to use for current command
"""
assert self._revisions, "no migration revision exist"
revision = self._rev or self._revisions[-1]
# revision count must be less or equal since revisions are ordered
assert revision... | [
"def",
"_get_revision",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_revisions",
",",
"\"no migration revision exist\"",
"revision",
"=",
"self",
".",
"_rev",
"or",
"self",
".",
"_revisions",
"[",
"-",
"1",
"]",
"# revision count must be less or equal since revis... | Validate and return the revision to use for current command | [
"Validate",
"and",
"return",
"the",
"revision",
"to",
"use",
"for",
"current",
"command"
] | b53b7168f8ac27e4c557de6e62ad85fe00d99566 | https://github.com/kofrasa/migrate/blob/b53b7168f8ac27e4c557de6e62ad85fe00d99566/migrate.py#L154-L161 |
50,316 | shaldengeki/python-mal | myanimelist/media.py | Media.newest | def newest(cls, session):
"""Fetches the latest media added to MAL.
:type session: :class:`myanimelist.session.Session`
:param session: A valid MAL session
:rtype: :class:`.Media`
:return: the newest media on MAL
:raises: :class:`.MalformedMediaPageError`
"""
media_type = cls.__name_... | python | def newest(cls, session):
"""Fetches the latest media added to MAL.
:type session: :class:`myanimelist.session.Session`
:param session: A valid MAL session
:rtype: :class:`.Media`
:return: the newest media on MAL
:raises: :class:`.MalformedMediaPageError`
"""
media_type = cls.__name_... | [
"def",
"newest",
"(",
"cls",
",",
"session",
")",
":",
"media_type",
"=",
"cls",
".",
"__name__",
".",
"lower",
"(",
")",
"p",
"=",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/'",
"+",
"media_type",
"+",
"'.php?o=9&c[]=a&c[]=d&cv=2&... | Fetches the latest media added to MAL.
:type session: :class:`myanimelist.session.Session`
:param session: A valid MAL session
:rtype: :class:`.Media`
:return: the newest media on MAL
:raises: :class:`.MalformedMediaPageError` | [
"Fetches",
"the",
"latest",
"media",
"added",
"to",
"MAL",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/media.py#L48-L67 |
50,317 | shaldengeki/python-mal | myanimelist/media.py | Media.parse | def parse(self, media_page):
"""Parses the DOM and returns media attributes in the main-content area.
:type media_page: :class:`bs4.BeautifulSoup`
:param media_page: MAL media page's DOM
:rtype: dict
:return: media attributes.
"""
media_info = self.parse_sidebar(media_page)
try:
... | python | def parse(self, media_page):
"""Parses the DOM and returns media attributes in the main-content area.
:type media_page: :class:`bs4.BeautifulSoup`
:param media_page: MAL media page's DOM
:rtype: dict
:return: media attributes.
"""
media_info = self.parse_sidebar(media_page)
try:
... | [
"def",
"parse",
"(",
"self",
",",
"media_page",
")",
":",
"media_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"media_page",
")",
"try",
":",
"synopsis_elt",
"=",
"media_page",
".",
"find",
"(",
"u'h2'",
",",
"text",
"=",
"u'Synopsis'",
")",
".",
"paren... | Parses the DOM and returns media attributes in the main-content area.
:type media_page: :class:`bs4.BeautifulSoup`
:param media_page: MAL media page's DOM
:rtype: dict
:return: media attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"media",
"attributes",
"in",
"the",
"main",
"-",
"content",
"area",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/media.py#L255-L319 |
50,318 | shaldengeki/python-mal | myanimelist/media.py | Media.parse_characters | def parse_characters(self, character_page):
"""Parses the DOM and returns media character attributes in the sidebar.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: character attributes.
"""
media_info = self.parse_sid... | python | def parse_characters(self, character_page):
"""Parses the DOM and returns media character attributes in the sidebar.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: character attributes.
"""
media_info = self.parse_sid... | [
"def",
"parse_characters",
"(",
"self",
",",
"character_page",
")",
":",
"media_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"character_page",
")",
"try",
":",
"character_title",
"=",
"filter",
"(",
"lambda",
"x",
":",
"u'Characters'",
"in",
"x",
".",
"tex... | Parses the DOM and returns media character attributes in the sidebar.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: character attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"media",
"character",
"attributes",
"in",
"the",
"sidebar",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/media.py#L412-L446 |
50,319 | shaldengeki/python-mal | myanimelist/media.py | Media.load | def load(self):
"""Fetches the MAL media page and sets the current media's attributes.
:rtype: :class:`.Media`
:return: current media object.
"""
media_page = self.session.session.get(u'http://myanimelist.net/' + self.__class__.__name__.lower() + u'/' + str(self.id)).text
self.set(self.parse(u... | python | def load(self):
"""Fetches the MAL media page and sets the current media's attributes.
:rtype: :class:`.Media`
:return: current media object.
"""
media_page = self.session.session.get(u'http://myanimelist.net/' + self.__class__.__name__.lower() + u'/' + str(self.id)).text
self.set(self.parse(u... | [
"def",
"load",
"(",
"self",
")",
":",
"media_page",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/'",
"+",
"self",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
"+",
"u'/'",
"+",
"str",
"(",
"self"... | Fetches the MAL media page and sets the current media's attributes.
:rtype: :class:`.Media`
:return: current media object. | [
"Fetches",
"the",
"MAL",
"media",
"page",
"and",
"sets",
"the",
"current",
"media",
"s",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/media.py#L448-L457 |
50,320 | shaldengeki/python-mal | myanimelist/media.py | Media.load_stats | def load_stats(self):
"""Fetches the MAL media statistics page and sets the current media's statistics attributes.
:rtype: :class:`.Media`
:return: current media object.
"""
stats_page = self.session.session.get(u'http://myanimelist.net/' + self.__class__.__name__.lower() + u'/' + str(self.id) + u... | python | def load_stats(self):
"""Fetches the MAL media statistics page and sets the current media's statistics attributes.
:rtype: :class:`.Media`
:return: current media object.
"""
stats_page = self.session.session.get(u'http://myanimelist.net/' + self.__class__.__name__.lower() + u'/' + str(self.id) + u... | [
"def",
"load_stats",
"(",
"self",
")",
":",
"stats_page",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/'",
"+",
"self",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
"+",
"u'/'",
"+",
"str",
"(",
... | Fetches the MAL media statistics page and sets the current media's statistics attributes.
:rtype: :class:`.Media`
:return: current media object. | [
"Fetches",
"the",
"MAL",
"media",
"statistics",
"page",
"and",
"sets",
"the",
"current",
"media",
"s",
"statistics",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/media.py#L459-L468 |
50,321 | shaldengeki/python-mal | myanimelist/media.py | Media.load_characters | def load_characters(self):
"""Fetches the MAL media characters page and sets the current media's character attributes.
:rtype: :class:`.Media`
:return: current media object.
"""
characters_page = self.session.session.get(u'http://myanimelist.net/' + self.__class__.__name__.lower() + u'/' + str(sel... | python | def load_characters(self):
"""Fetches the MAL media characters page and sets the current media's character attributes.
:rtype: :class:`.Media`
:return: current media object.
"""
characters_page = self.session.session.get(u'http://myanimelist.net/' + self.__class__.__name__.lower() + u'/' + str(sel... | [
"def",
"load_characters",
"(",
"self",
")",
":",
"characters_page",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/'",
"+",
"self",
".",
"__class__",
".",
"__name__",
".",
"lower",
"(",
")",
"+",
"u'/'",
"+",
"str",... | Fetches the MAL media characters page and sets the current media's character attributes.
:rtype: :class:`.Media`
:return: current media object. | [
"Fetches",
"the",
"MAL",
"media",
"characters",
"page",
"and",
"sets",
"the",
"current",
"media",
"s",
"character",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/media.py#L470-L479 |
50,322 | rosenbrockc/fortpy | fortpy/isense/builtin.py | load | def load(parser, serializer):
"""Returns a dictionary of builtin functions for Fortran. Checks the
cache first to see if we have a serialized version. If we don't, it
loads it from the XML file.
:arg parser: the DocParser instance for parsing the XML tags.
:arg serializer: a Serializer instance fro... | python | def load(parser, serializer):
"""Returns a dictionary of builtin functions for Fortran. Checks the
cache first to see if we have a serialized version. If we don't, it
loads it from the XML file.
:arg parser: the DocParser instance for parsing the XML tags.
:arg serializer: a Serializer instance fro... | [
"def",
"load",
"(",
"parser",
",",
"serializer",
")",
":",
"fortdir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fortpy",
".",
"__file__",
")",
"xmlpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"fortdir",
",",
"\"isense\"",
",",
"\"builtin.xml\""... | Returns a dictionary of builtin functions for Fortran. Checks the
cache first to see if we have a serialized version. If we don't, it
loads it from the XML file.
:arg parser: the DocParser instance for parsing the XML tags.
:arg serializer: a Serializer instance from the CodeParser to cache
the l... | [
"Returns",
"a",
"dictionary",
"of",
"builtin",
"functions",
"for",
"Fortran",
".",
"Checks",
"the",
"cache",
"first",
"to",
"see",
"if",
"we",
"have",
"a",
"serialized",
"version",
".",
"If",
"we",
"don",
"t",
"it",
"loads",
"it",
"from",
"the",
"XML",
... | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/builtin.py#L11-L33 |
50,323 | rosenbrockc/fortpy | fortpy/isense/builtin.py | _load_builtin_xml | def _load_builtin_xml(xmlpath, parser):
"""Loads the builtin function specifications from the builtin.xml file.
:arg parser: the DocParser instance for parsing the XML tags.
"""
#First we need to get hold of the fortpy directory so we can locate
#the isense/builtin.xml file.
result = {}
el... | python | def _load_builtin_xml(xmlpath, parser):
"""Loads the builtin function specifications from the builtin.xml file.
:arg parser: the DocParser instance for parsing the XML tags.
"""
#First we need to get hold of the fortpy directory so we can locate
#the isense/builtin.xml file.
result = {}
el... | [
"def",
"_load_builtin_xml",
"(",
"xmlpath",
",",
"parser",
")",
":",
"#First we need to get hold of the fortpy directory so we can locate",
"#the isense/builtin.xml file.",
"result",
"=",
"{",
"}",
"el",
"=",
"ET",
".",
"parse",
"(",
"xmlpath",
")",
".",
"getroot",
"(... | Loads the builtin function specifications from the builtin.xml file.
:arg parser: the DocParser instance for parsing the XML tags. | [
"Loads",
"the",
"builtin",
"function",
"specifications",
"from",
"the",
"builtin",
".",
"xml",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/builtin.py#L48-L63 |
50,324 | rosenbrockc/fortpy | fortpy/isense/builtin.py | _parse_xml | def _parse_xml(child, parser):
"""Parses the specified child XML tag and creates a Subroutine or
Function object out of it."""
name, modifiers, dtype, kind = _parse_common(child)
#Handle the symbol modification according to the isense settings.
name = _isense_builtin_symbol(name)
if child.tag ... | python | def _parse_xml(child, parser):
"""Parses the specified child XML tag and creates a Subroutine or
Function object out of it."""
name, modifiers, dtype, kind = _parse_common(child)
#Handle the symbol modification according to the isense settings.
name = _isense_builtin_symbol(name)
if child.tag ... | [
"def",
"_parse_xml",
"(",
"child",
",",
"parser",
")",
":",
"name",
",",
"modifiers",
",",
"dtype",
",",
"kind",
"=",
"_parse_common",
"(",
"child",
")",
"#Handle the symbol modification according to the isense settings.",
"name",
"=",
"_isense_builtin_symbol",
"(",
... | Parses the specified child XML tag and creates a Subroutine or
Function object out of it. | [
"Parses",
"the",
"specified",
"child",
"XML",
"tag",
"and",
"creates",
"a",
"Subroutine",
"or",
"Function",
"object",
"out",
"of",
"it",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/isense/builtin.py#L65-L87 |
50,325 | ROGUE-JCTD/rogue_geonode | geoshape/core/management/commands/geogit-sync.py | Command.make_request | def make_request(self, url, params, auth=None):
"""
Prepares a request from a url, params, and optionally authentication.
"""
req = urllib2.Request(url + urllib.urlencode(params))
if auth:
req.add_header('AUTHORIZATION', 'Basic ' + auth)
return urllib2.urlop... | python | def make_request(self, url, params, auth=None):
"""
Prepares a request from a url, params, and optionally authentication.
"""
req = urllib2.Request(url + urllib.urlencode(params))
if auth:
req.add_header('AUTHORIZATION', 'Basic ' + auth)
return urllib2.urlop... | [
"def",
"make_request",
"(",
"self",
",",
"url",
",",
"params",
",",
"auth",
"=",
"None",
")",
":",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"url",
"+",
"urllib",
".",
"urlencode",
"(",
"params",
")",
")",
"if",
"auth",
":",
"req",
".",
"add_head... | Prepares a request from a url, params, and optionally authentication. | [
"Prepares",
"a",
"request",
"from",
"a",
"url",
"params",
"and",
"optionally",
"authentication",
"."
] | 6b1c29ca6f7125a00148da64b4709bd800cc0935 | https://github.com/ROGUE-JCTD/rogue_geonode/blob/6b1c29ca6f7125a00148da64b4709bd800cc0935/geoshape/core/management/commands/geogit-sync.py#L51-L60 |
50,326 | rosenbrockc/fortpy | fortpy/templates/genf90.py | fpy_interface | def fpy_interface(fpy, static, interface, typedict):
"""Splices the full list of subroutines and the module procedure list
into the static.f90 file.
:arg static: the string contents of the static.f90 file.
:arg interface: the name of the interface *field* being replaced.
:arg typedict: the dictiona... | python | def fpy_interface(fpy, static, interface, typedict):
"""Splices the full list of subroutines and the module procedure list
into the static.f90 file.
:arg static: the string contents of the static.f90 file.
:arg interface: the name of the interface *field* being replaced.
:arg typedict: the dictiona... | [
"def",
"fpy_interface",
"(",
"fpy",
",",
"static",
",",
"interface",
",",
"typedict",
")",
":",
"modprocs",
"=",
"[",
"]",
"subtext",
"=",
"[",
"]",
"for",
"dtype",
",",
"combos",
"in",
"list",
"(",
"typedict",
".",
"items",
"(",
")",
")",
":",
"fo... | Splices the full list of subroutines and the module procedure list
into the static.f90 file.
:arg static: the string contents of the static.f90 file.
:arg interface: the name of the interface *field* being replaced.
:arg typedict: the dictionary of dtypes and their kind and suffix combos. | [
"Splices",
"the",
"full",
"list",
"of",
"subroutines",
"and",
"the",
"module",
"procedure",
"list",
"into",
"the",
"static",
".",
"f90",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/templates/genf90.py#L366-L388 |
50,327 | rosenbrockc/fortpy | fortpy/scripts/ftypes.py | _parse | def _parse():
"""Parses the specified Fortran source file from which the wrappers will
be constructed for ctypes.
"""
if not args["reparse"]:
settings.use_filesystem_cache = False
c = CodeParser()
if args["verbose"]:
c.verbose = True
if args["reparse"]:
c.repars... | python | def _parse():
"""Parses the specified Fortran source file from which the wrappers will
be constructed for ctypes.
"""
if not args["reparse"]:
settings.use_filesystem_cache = False
c = CodeParser()
if args["verbose"]:
c.verbose = True
if args["reparse"]:
c.repars... | [
"def",
"_parse",
"(",
")",
":",
"if",
"not",
"args",
"[",
"\"reparse\"",
"]",
":",
"settings",
".",
"use_filesystem_cache",
"=",
"False",
"c",
"=",
"CodeParser",
"(",
")",
"if",
"args",
"[",
"\"verbose\"",
"]",
":",
"c",
".",
"verbose",
"=",
"True",
... | Parses the specified Fortran source file from which the wrappers will
be constructed for ctypes. | [
"Parses",
"the",
"specified",
"Fortran",
"source",
"file",
"from",
"which",
"the",
"wrappers",
"will",
"be",
"constructed",
"for",
"ctypes",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/scripts/ftypes.py#L6-L22 |
50,328 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser.setup_regex | def setup_regex(self):
"""Sets up compiled regex objects for parsing code elements."""
#Regex for extracting modules from the code
self._RX_MODULE = r"(\n|^)\s*module\s+(?P<name>[a-z0-9_]+)(?P<contents>.+?)end\s*module"
self.RE_MODULE = re.compile(self._RX_MODULE, re.I | re.DOTALL)
... | python | def setup_regex(self):
"""Sets up compiled regex objects for parsing code elements."""
#Regex for extracting modules from the code
self._RX_MODULE = r"(\n|^)\s*module\s+(?P<name>[a-z0-9_]+)(?P<contents>.+?)end\s*module"
self.RE_MODULE = re.compile(self._RX_MODULE, re.I | re.DOTALL)
... | [
"def",
"setup_regex",
"(",
"self",
")",
":",
"#Regex for extracting modules from the code",
"self",
".",
"_RX_MODULE",
"=",
"r\"(\\n|^)\\s*module\\s+(?P<name>[a-z0-9_]+)(?P<contents>.+?)end\\s*module\"",
"self",
".",
"RE_MODULE",
"=",
"re",
".",
"compile",
"(",
"self",
".",... | Sets up compiled regex objects for parsing code elements. | [
"Sets",
"up",
"compiled",
"regex",
"objects",
"for",
"parsing",
"code",
"elements",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L19-L41 |
50,329 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser._parse_programs | def _parse_programs(self, string, parent, filepath=None):
"""Extracts a PROGRAM from the specified fortran code file."""
#First, get hold of the docstrings for all the modules so that we can
#attach them as we parse them.
moddocs = self.docparser.parse_docs(string)
#Now look for... | python | def _parse_programs(self, string, parent, filepath=None):
"""Extracts a PROGRAM from the specified fortran code file."""
#First, get hold of the docstrings for all the modules so that we can
#attach them as we parse them.
moddocs = self.docparser.parse_docs(string)
#Now look for... | [
"def",
"_parse_programs",
"(",
"self",
",",
"string",
",",
"parent",
",",
"filepath",
"=",
"None",
")",
":",
"#First, get hold of the docstrings for all the modules so that we can",
"#attach them as we parse them.",
"moddocs",
"=",
"self",
".",
"docparser",
".",
"parse_d... | Extracts a PROGRAM from the specified fortran code file. | [
"Extracts",
"a",
"PROGRAM",
"from",
"the",
"specified",
"fortran",
"code",
"file",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L133-L151 |
50,330 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser._process_publics | def _process_publics(self, contents):
"""Extracts a list of public members, types and executables that were declared using
the public keyword instead of a decoration."""
matches = self.RE_PUBLIC.finditer(contents)
result = {}
start = 0
for public in matches:
m... | python | def _process_publics(self, contents):
"""Extracts a list of public members, types and executables that were declared using
the public keyword instead of a decoration."""
matches = self.RE_PUBLIC.finditer(contents)
result = {}
start = 0
for public in matches:
m... | [
"def",
"_process_publics",
"(",
"self",
",",
"contents",
")",
":",
"matches",
"=",
"self",
".",
"RE_PUBLIC",
".",
"finditer",
"(",
"contents",
")",
"result",
"=",
"{",
"}",
"start",
"=",
"0",
"for",
"public",
"in",
"matches",
":",
"methods",
"=",
"publ... | Extracts a list of public members, types and executables that were declared using
the public keyword instead of a decoration. | [
"Extracts",
"a",
"list",
"of",
"public",
"members",
"types",
"and",
"executables",
"that",
"were",
"declared",
"using",
"the",
"public",
"keyword",
"instead",
"of",
"a",
"decoration",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L177-L196 |
50,331 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser._process_module | def _process_module(self, name, contents, parent, match, filepath=None):
"""Processes a regex match for a module to create a CodeElement."""
#First, get hold of the name and contents of the module so that we can process the other
#parts of the module.
modifiers = []
#We need to ... | python | def _process_module(self, name, contents, parent, match, filepath=None):
"""Processes a regex match for a module to create a CodeElement."""
#First, get hold of the name and contents of the module so that we can process the other
#parts of the module.
modifiers = []
#We need to ... | [
"def",
"_process_module",
"(",
"self",
",",
"name",
",",
"contents",
",",
"parent",
",",
"match",
",",
"filepath",
"=",
"None",
")",
":",
"#First, get hold of the name and contents of the module so that we can process the other",
"#parts of the module.",
"modifiers",
"=",
... | Processes a regex match for a module to create a CodeElement. | [
"Processes",
"a",
"regex",
"match",
"for",
"a",
"module",
"to",
"create",
"a",
"CodeElement",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L198-L239 |
50,332 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser._parse_use | def _parse_use(self, string):
"""Extracts use dependencies from the innertext of a module."""
result = {}
for ruse in self.RE_USE.finditer(string):
#We also handle comments for individual use cases, the "only" section
#won't pick up any comments.
name = ruse.g... | python | def _parse_use(self, string):
"""Extracts use dependencies from the innertext of a module."""
result = {}
for ruse in self.RE_USE.finditer(string):
#We also handle comments for individual use cases, the "only" section
#won't pick up any comments.
name = ruse.g... | [
"def",
"_parse_use",
"(",
"self",
",",
"string",
")",
":",
"result",
"=",
"{",
"}",
"for",
"ruse",
"in",
"self",
".",
"RE_USE",
".",
"finditer",
"(",
"string",
")",
":",
"#We also handle comments for individual use cases, the \"only\" section",
"#won't pick up any c... | Extracts use dependencies from the innertext of a module. | [
"Extracts",
"use",
"dependencies",
"from",
"the",
"innertext",
"of",
"a",
"module",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L241-L258 |
50,333 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser._dict_increment | def _dict_increment(self, dictionary, key):
"""Increments the value of the dictionary at the specified key."""
if key in dictionary:
dictionary[key] += 1
else:
dictionary[key] = 1 | python | def _dict_increment(self, dictionary, key):
"""Increments the value of the dictionary at the specified key."""
if key in dictionary:
dictionary[key] += 1
else:
dictionary[key] = 1 | [
"def",
"_dict_increment",
"(",
"self",
",",
"dictionary",
",",
"key",
")",
":",
"if",
"key",
"in",
"dictionary",
":",
"dictionary",
"[",
"key",
"]",
"+=",
"1",
"else",
":",
"dictionary",
"[",
"key",
"]",
"=",
"1"
] | Increments the value of the dictionary at the specified key. | [
"Increments",
"the",
"value",
"of",
"the",
"dictionary",
"at",
"the",
"specified",
"key",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L260-L265 |
50,334 | rosenbrockc/fortpy | fortpy/parsers/module.py | ModuleParser._parse_members | def _parse_members(self, contents, module):
"""Extracts any module-level members from the code. They must appear before
any type declalations."""
#We need to get hold of the text before the module's main CONTAINS keyword
#so that we don't find variables from executables and claim them as... | python | def _parse_members(self, contents, module):
"""Extracts any module-level members from the code. They must appear before
any type declalations."""
#We need to get hold of the text before the module's main CONTAINS keyword
#so that we don't find variables from executables and claim them as... | [
"def",
"_parse_members",
"(",
"self",
",",
"contents",
",",
"module",
")",
":",
"#We need to get hold of the text before the module's main CONTAINS keyword",
"#so that we don't find variables from executables and claim them as",
"#belonging to the module.",
"icontains",
"=",
"module",
... | Extracts any module-level members from the code. They must appear before
any type declalations. | [
"Extracts",
"any",
"module",
"-",
"level",
"members",
"from",
"the",
"code",
".",
"They",
"must",
"appear",
"before",
"any",
"type",
"declalations",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/module.py#L267-L313 |
50,335 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser.setup_regex | def setup_regex(self):
"""Sets up compiled regex objects for parsing the executables from a module."""
self._RX_CONTAINS = r"^\s*contains[^\n]*?$"
self.RE_CONTAINS = re.compile(self._RX_CONTAINS, re.M | re.I)
#Setup a regex that can extract information about both functions and subroutin... | python | def setup_regex(self):
"""Sets up compiled regex objects for parsing the executables from a module."""
self._RX_CONTAINS = r"^\s*contains[^\n]*?$"
self.RE_CONTAINS = re.compile(self._RX_CONTAINS, re.M | re.I)
#Setup a regex that can extract information about both functions and subroutin... | [
"def",
"setup_regex",
"(",
"self",
")",
":",
"self",
".",
"_RX_CONTAINS",
"=",
"r\"^\\s*contains[^\\n]*?$\"",
"self",
".",
"RE_CONTAINS",
"=",
"re",
".",
"compile",
"(",
"self",
".",
"_RX_CONTAINS",
",",
"re",
".",
"M",
"|",
"re",
".",
"I",
")",
"#Setup ... | Sets up compiled regex objects for parsing the executables from a module. | [
"Sets",
"up",
"compiled",
"regex",
"objects",
"for",
"parsing",
"the",
"executables",
"from",
"a",
"module",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L18-L53 |
50,336 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser.parse | def parse(self, module):
"""Extracts all the subroutine and function definitions from the specified module."""
#Because of embedded types, we have to examine the entire module for
#executable definitions.
self.parse_block(module.refstring, module, module, 0)
#Now we can set the ... | python | def parse(self, module):
"""Extracts all the subroutine and function definitions from the specified module."""
#Because of embedded types, we have to examine the entire module for
#executable definitions.
self.parse_block(module.refstring, module, module, 0)
#Now we can set the ... | [
"def",
"parse",
"(",
"self",
",",
"module",
")",
":",
"#Because of embedded types, we have to examine the entire module for",
"#executable definitions.",
"self",
".",
"parse_block",
"(",
"module",
".",
"refstring",
",",
"module",
",",
"module",
",",
"0",
")",
"#Now we... | Extracts all the subroutine and function definitions from the specified module. | [
"Extracts",
"all",
"the",
"subroutine",
"and",
"function",
"definitions",
"from",
"the",
"specified",
"module",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L128-L141 |
50,337 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser.parse_block | def parse_block(self, contents, parent, module, depth):
"""Extracts all executable definitions from the specified string and adds
them to the specified parent."""
for anexec in self.RE_EXEC.finditer(contents):
x = self._process_execs(anexec, parent, module)
parent.executa... | python | def parse_block(self, contents, parent, module, depth):
"""Extracts all executable definitions from the specified string and adds
them to the specified parent."""
for anexec in self.RE_EXEC.finditer(contents):
x = self._process_execs(anexec, parent, module)
parent.executa... | [
"def",
"parse_block",
"(",
"self",
",",
"contents",
",",
"parent",
",",
"module",
",",
"depth",
")",
":",
"for",
"anexec",
"in",
"self",
".",
"RE_EXEC",
".",
"finditer",
"(",
"contents",
")",
":",
"x",
"=",
"self",
".",
"_process_execs",
"(",
"anexec",... | Extracts all executable definitions from the specified string and adds
them to the specified parent. | [
"Extracts",
"all",
"executable",
"definitions",
"from",
"the",
"specified",
"string",
"and",
"adds",
"them",
"to",
"the",
"specified",
"parent",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L143-L183 |
50,338 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._process_execs | def _process_execs(self, execmatch, parent, module):
"""Processes the regex match of an executable from the match object."""
#Get the matches that must be present for every executable.
name = execmatch.group("name").strip()
modifiers = execmatch.group("modifiers")
if modifiers is... | python | def _process_execs(self, execmatch, parent, module):
"""Processes the regex match of an executable from the match object."""
#Get the matches that must be present for every executable.
name = execmatch.group("name").strip()
modifiers = execmatch.group("modifiers")
if modifiers is... | [
"def",
"_process_execs",
"(",
"self",
",",
"execmatch",
",",
"parent",
",",
"module",
")",
":",
"#Get the matches that must be present for every executable.",
"name",
"=",
"execmatch",
".",
"group",
"(",
"\"name\"",
")",
".",
"strip",
"(",
")",
"modifiers",
"=",
... | Processes the regex match of an executable from the match object. | [
"Processes",
"the",
"regex",
"match",
"of",
"an",
"executable",
"from",
"the",
"match",
"object",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L185-L234 |
50,339 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._process_assignments | def _process_assignments(self, anexec, contents, mode="insert"):
"""Extracts all variable assignments from the body of the executable.
:arg mode: for real-time update; either 'insert', 'delete' or 'replace'.
"""
for assign in self.RE_ASSIGN.finditer(contents):
assignee = ass... | python | def _process_assignments(self, anexec, contents, mode="insert"):
"""Extracts all variable assignments from the body of the executable.
:arg mode: for real-time update; either 'insert', 'delete' or 'replace'.
"""
for assign in self.RE_ASSIGN.finditer(contents):
assignee = ass... | [
"def",
"_process_assignments",
"(",
"self",
",",
"anexec",
",",
"contents",
",",
"mode",
"=",
"\"insert\"",
")",
":",
"for",
"assign",
"in",
"self",
".",
"RE_ASSIGN",
".",
"finditer",
"(",
"contents",
")",
":",
"assignee",
"=",
"assign",
".",
"group",
"(... | Extracts all variable assignments from the body of the executable.
:arg mode: for real-time update; either 'insert', 'delete' or 'replace'. | [
"Extracts",
"all",
"variable",
"assignments",
"from",
"the",
"body",
"of",
"the",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L236-L262 |
50,340 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._process_dependencies | def _process_dependencies(self, anexec, contents, mode="insert"):
"""Extracts a list of subroutines and functions that are called from
within this executable.
:arg mode: specifies whether the matches should be added, removed
or merged into the specified executable.
"""
... | python | def _process_dependencies(self, anexec, contents, mode="insert"):
"""Extracts a list of subroutines and functions that are called from
within this executable.
:arg mode: specifies whether the matches should be added, removed
or merged into the specified executable.
"""
... | [
"def",
"_process_dependencies",
"(",
"self",
",",
"anexec",
",",
"contents",
",",
"mode",
"=",
"\"insert\"",
")",
":",
"#At this point we don't necessarily know which module the executables are",
"#in, so we just extract the names. Once all the modules in the library",
"#have been pa... | Extracts a list of subroutines and functions that are called from
within this executable.
:arg mode: specifies whether the matches should be added, removed
or merged into the specified executable. | [
"Extracts",
"a",
"list",
"of",
"subroutines",
"and",
"functions",
"that",
"are",
"called",
"from",
"within",
"this",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L264-L291 |
50,341 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._depend_exec_clean | def _depend_exec_clean(self, text):
"""Cleans any string constants in the specified dependency text to remove
embedded ! etc. that break the parsing.
"""
#First remove the escaped quotes, we will add them back at the end.
unquoted = text.replace('""', "_FORTPYDQ_").replace("''", ... | python | def _depend_exec_clean(self, text):
"""Cleans any string constants in the specified dependency text to remove
embedded ! etc. that break the parsing.
"""
#First remove the escaped quotes, we will add them back at the end.
unquoted = text.replace('""', "_FORTPYDQ_").replace("''", ... | [
"def",
"_depend_exec_clean",
"(",
"self",
",",
"text",
")",
":",
"#First remove the escaped quotes, we will add them back at the end.",
"unquoted",
"=",
"text",
".",
"replace",
"(",
"'\"\"'",
",",
"\"_FORTPYDQ_\"",
")",
".",
"replace",
"(",
"\"''\"",
",",
"\"_FORTPYSQ... | Cleans any string constants in the specified dependency text to remove
embedded ! etc. that break the parsing. | [
"Cleans",
"any",
"string",
"constants",
"in",
"the",
"specified",
"dependency",
"text",
"to",
"remove",
"embedded",
"!",
"etc",
".",
"that",
"break",
"the",
"parsing",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L293-L306 |
50,342 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._process_dependlist | def _process_dependlist(self, dependlist, anexec, isSubroutine, mode="insert"):
"""Processes a list of nested dependencies recursively."""
for i in range(len(dependlist)):
#Since we are looping over all the elements and some will
#be lists of parameters, we need to skip any items... | python | def _process_dependlist(self, dependlist, anexec, isSubroutine, mode="insert"):
"""Processes a list of nested dependencies recursively."""
for i in range(len(dependlist)):
#Since we are looping over all the elements and some will
#be lists of parameters, we need to skip any items... | [
"def",
"_process_dependlist",
"(",
"self",
",",
"dependlist",
",",
"anexec",
",",
"isSubroutine",
",",
"mode",
"=",
"\"insert\"",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"dependlist",
")",
")",
":",
"#Since we are looping over all the elements and ... | Processes a list of nested dependencies recursively. | [
"Processes",
"a",
"list",
"of",
"nested",
"dependencies",
"recursively",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L308-L346 |
50,343 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._remove_dependency | def _remove_dependency(self, dependlist, i, isSubroutine, anexec):
"""Removes the specified dependency from the executable if it exists
and matches the call signature."""
if dependlist[i] in anexec.dependencies:
all_depends = anexec.dependencies[dependlist[i]]
if len(all_... | python | def _remove_dependency(self, dependlist, i, isSubroutine, anexec):
"""Removes the specified dependency from the executable if it exists
and matches the call signature."""
if dependlist[i] in anexec.dependencies:
all_depends = anexec.dependencies[dependlist[i]]
if len(all_... | [
"def",
"_remove_dependency",
"(",
"self",
",",
"dependlist",
",",
"i",
",",
"isSubroutine",
",",
"anexec",
")",
":",
"if",
"dependlist",
"[",
"i",
"]",
"in",
"anexec",
".",
"dependencies",
":",
"all_depends",
"=",
"anexec",
".",
"dependencies",
"[",
"depen... | Removes the specified dependency from the executable if it exists
and matches the call signature. | [
"Removes",
"the",
"specified",
"dependency",
"from",
"the",
"executable",
"if",
"it",
"exists",
"and",
"matches",
"the",
"call",
"signature",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L348-L362 |
50,344 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._add_dependency | def _add_dependency(self, key, dependlist, i, isSubroutine, anexec):
"""Determines whether the item in the dependency list is a valid function
call by excluding local variables and members."""
#First determine if the reference is to a derived type variable
lkey = key.lower()
if "... | python | def _add_dependency(self, key, dependlist, i, isSubroutine, anexec):
"""Determines whether the item in the dependency list is a valid function
call by excluding local variables and members."""
#First determine if the reference is to a derived type variable
lkey = key.lower()
if "... | [
"def",
"_add_dependency",
"(",
"self",
",",
"key",
",",
"dependlist",
",",
"i",
",",
"isSubroutine",
",",
"anexec",
")",
":",
"#First determine if the reference is to a derived type variable",
"lkey",
"=",
"key",
".",
"lower",
"(",
")",
"if",
"\"%\"",
"in",
"key... | Determines whether the item in the dependency list is a valid function
call by excluding local variables and members. | [
"Determines",
"whether",
"the",
"item",
"in",
"the",
"dependency",
"list",
"is",
"a",
"valid",
"function",
"call",
"by",
"excluding",
"local",
"variables",
"and",
"members",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L364-L400 |
50,345 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._process_docs | def _process_docs(self, anexec, docblocks, parent, module, docsearch):
"""Associates the docstrings from the docblocks with their parameters."""
#The documentation for the parameters is stored outside of the executable
#We need to get hold of them from docblocks from the parent text
key ... | python | def _process_docs(self, anexec, docblocks, parent, module, docsearch):
"""Associates the docstrings from the docblocks with their parameters."""
#The documentation for the parameters is stored outside of the executable
#We need to get hold of them from docblocks from the parent text
key ... | [
"def",
"_process_docs",
"(",
"self",
",",
"anexec",
",",
"docblocks",
",",
"parent",
",",
"module",
",",
"docsearch",
")",
":",
"#The documentation for the parameters is stored outside of the executable",
"#We need to get hold of them from docblocks from the parent text",
"key",
... | Associates the docstrings from the docblocks with their parameters. | [
"Associates",
"the",
"docstrings",
"from",
"the",
"docblocks",
"with",
"their",
"parameters",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L402-L410 |
50,346 | rosenbrockc/fortpy | fortpy/parsers/executable.py | ExecutableParser._parse_members | def _parse_members(self, contents, anexec, params, mode="insert"):
"""Parses the local variables for the contents of the specified executable."""
#First get the variables declared in the body of the executable, these can
#be either locals or parameter declarations.
members = self.vparser... | python | def _parse_members(self, contents, anexec, params, mode="insert"):
"""Parses the local variables for the contents of the specified executable."""
#First get the variables declared in the body of the executable, these can
#be either locals or parameter declarations.
members = self.vparser... | [
"def",
"_parse_members",
"(",
"self",
",",
"contents",
",",
"anexec",
",",
"params",
",",
"mode",
"=",
"\"insert\"",
")",
":",
"#First get the variables declared in the body of the executable, these can",
"#be either locals or parameter declarations.",
"members",
"=",
"self",... | Parses the local variables for the contents of the specified executable. | [
"Parses",
"the",
"local",
"variables",
"for",
"the",
"contents",
"of",
"the",
"specified",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L413-L445 |
50,347 | shaldengeki/python-mal | myanimelist/character.py | Character.parse_sidebar | def parse_sidebar(self, character_page):
"""Parses the DOM and returns character attributes in the sidebar.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: Character attributes
:raises: :class:`.InvalidCharacterError`, :cl... | python | def parse_sidebar(self, character_page):
"""Parses the DOM and returns character attributes in the sidebar.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: Character attributes
:raises: :class:`.InvalidCharacterError`, :cl... | [
"def",
"parse_sidebar",
"(",
"self",
",",
"character_page",
")",
":",
"character_info",
"=",
"{",
"}",
"error_tag",
"=",
"character_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"'class'",
":",
"'badresult'",
"}",
")",
"if",
"error_tag",
":",
"# MAL says the ... | Parses the DOM and returns character attributes in the sidebar.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: Character attributes
:raises: :class:`.InvalidCharacterError`, :class:`.MalformedCharacterPageError` | [
"Parses",
"the",
"DOM",
"and",
"returns",
"character",
"attributes",
"in",
"the",
"sidebar",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L51-L133 |
50,348 | shaldengeki/python-mal | myanimelist/character.py | Character.parse | def parse(self, character_page):
"""Parses the DOM and returns character attributes in the main-content area.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: Character attributes.
"""
character_info = self.parse_sideba... | python | def parse(self, character_page):
"""Parses the DOM and returns character attributes in the main-content area.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: Character attributes.
"""
character_info = self.parse_sideba... | [
"def",
"parse",
"(",
"self",
",",
"character_page",
")",
":",
"character_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"character_page",
")",
"second_col",
"=",
"character_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"'id'",
":",
"'content'",
"}",
")",
".... | Parses the DOM and returns character attributes in the main-content area.
:type character_page: :class:`bs4.BeautifulSoup`
:param character_page: MAL character page's DOM
:rtype: dict
:return: Character attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"character",
"attributes",
"in",
"the",
"main",
"-",
"content",
"area",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L135-L199 |
50,349 | shaldengeki/python-mal | myanimelist/character.py | Character.parse_favorites | def parse_favorites(self, favorites_page):
"""Parses the DOM and returns character favorites attributes.
:type favorites_page: :class:`bs4.BeautifulSoup`
:param favorites_page: MAL character favorites page's DOM
:rtype: dict
:return: Character favorites attributes.
"""
character_info = se... | python | def parse_favorites(self, favorites_page):
"""Parses the DOM and returns character favorites attributes.
:type favorites_page: :class:`bs4.BeautifulSoup`
:param favorites_page: MAL character favorites page's DOM
:rtype: dict
:return: Character favorites attributes.
"""
character_info = se... | [
"def",
"parse_favorites",
"(",
"self",
",",
"favorites_page",
")",
":",
"character_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"favorites_page",
")",
"second_col",
"=",
"favorites_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"'id'",
":",
"'content'",
"}",
... | Parses the DOM and returns character favorites attributes.
:type favorites_page: :class:`bs4.BeautifulSoup`
:param favorites_page: MAL character favorites page's DOM
:rtype: dict
:return: Character favorites attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"character",
"favorites",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L201-L224 |
50,350 | shaldengeki/python-mal | myanimelist/character.py | Character.parse_pictures | def parse_pictures(self, picture_page):
"""Parses the DOM and returns character pictures attributes.
:type picture_page: :class:`bs4.BeautifulSoup`
:param picture_page: MAL character pictures page's DOM
:rtype: dict
:return: character pictures attributes.
"""
character_info = self.parse_s... | python | def parse_pictures(self, picture_page):
"""Parses the DOM and returns character pictures attributes.
:type picture_page: :class:`bs4.BeautifulSoup`
:param picture_page: MAL character pictures page's DOM
:rtype: dict
:return: character pictures attributes.
"""
character_info = self.parse_s... | [
"def",
"parse_pictures",
"(",
"self",
",",
"picture_page",
")",
":",
"character_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"picture_page",
")",
"second_col",
"=",
"picture_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"'id'",
":",
"'content'",
"}",
")",
... | Parses the DOM and returns character pictures attributes.
:type picture_page: :class:`bs4.BeautifulSoup`
:param picture_page: MAL character pictures page's DOM
:rtype: dict
:return: character pictures attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"character",
"pictures",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L226-L248 |
50,351 | shaldengeki/python-mal | myanimelist/character.py | Character.parse_clubs | def parse_clubs(self, clubs_page):
"""Parses the DOM and returns character clubs attributes.
:type clubs_page: :class:`bs4.BeautifulSoup`
:param clubs_page: MAL character clubs page's DOM
:rtype: dict
:return: character clubs attributes.
"""
character_info = self.parse_sidebar(clubs_page)... | python | def parse_clubs(self, clubs_page):
"""Parses the DOM and returns character clubs attributes.
:type clubs_page: :class:`bs4.BeautifulSoup`
:param clubs_page: MAL character clubs page's DOM
:rtype: dict
:return: character clubs attributes.
"""
character_info = self.parse_sidebar(clubs_page)... | [
"def",
"parse_clubs",
"(",
"self",
",",
"clubs_page",
")",
":",
"character_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"clubs_page",
")",
"second_col",
"=",
"clubs_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"'id'",
":",
"'content'",
"}",
")",
".",
"... | Parses the DOM and returns character clubs attributes.
:type clubs_page: :class:`bs4.BeautifulSoup`
:param clubs_page: MAL character clubs page's DOM
:rtype: dict
:return: character clubs attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"character",
"clubs",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L250-L279 |
50,352 | shaldengeki/python-mal | myanimelist/character.py | Character.load | def load(self):
"""Fetches the MAL character page and sets the current character's attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id)).text
self.set(self.parse(utilities.get_cle... | python | def load(self):
"""Fetches the MAL character page and sets the current character's attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id)).text
self.set(self.parse(utilities.get_cle... | [
"def",
"load",
"(",
"self",
")",
":",
"character",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/character/'",
"+",
"str",
"(",
"self",
".",
"id",
")",
")",
".",
"text",
"self",
".",
"set",
"(",
"self",
".",
... | Fetches the MAL character page and sets the current character's attributes.
:rtype: :class:`.Character`
:return: Current character object. | [
"Fetches",
"the",
"MAL",
"character",
"page",
"and",
"sets",
"the",
"current",
"character",
"s",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L281-L290 |
50,353 | shaldengeki/python-mal | myanimelist/character.py | Character.load_favorites | def load_favorites(self):
"""Fetches the MAL character favorites page and sets the current character's favorites attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id) + u'/' + utilitie... | python | def load_favorites(self):
"""Fetches the MAL character favorites page and sets the current character's favorites attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id) + u'/' + utilitie... | [
"def",
"load_favorites",
"(",
"self",
")",
":",
"character",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/character/'",
"+",
"str",
"(",
"self",
".",
"id",
")",
"+",
"u'/'",
"+",
"utilities",
".",
"urlencode",
"("... | Fetches the MAL character favorites page and sets the current character's favorites attributes.
:rtype: :class:`.Character`
:return: Current character object. | [
"Fetches",
"the",
"MAL",
"character",
"favorites",
"page",
"and",
"sets",
"the",
"current",
"character",
"s",
"favorites",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L292-L301 |
50,354 | shaldengeki/python-mal | myanimelist/character.py | Character.load_pictures | def load_pictures(self):
"""Fetches the MAL character pictures page and sets the current character's pictures attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id) + u'/' + utilities.u... | python | def load_pictures(self):
"""Fetches the MAL character pictures page and sets the current character's pictures attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id) + u'/' + utilities.u... | [
"def",
"load_pictures",
"(",
"self",
")",
":",
"character",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/character/'",
"+",
"str",
"(",
"self",
".",
"id",
")",
"+",
"u'/'",
"+",
"utilities",
".",
"urlencode",
"(",... | Fetches the MAL character pictures page and sets the current character's pictures attributes.
:rtype: :class:`.Character`
:return: Current character object. | [
"Fetches",
"the",
"MAL",
"character",
"pictures",
"page",
"and",
"sets",
"the",
"current",
"character",
"s",
"pictures",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L303-L312 |
50,355 | shaldengeki/python-mal | myanimelist/character.py | Character.load_clubs | def load_clubs(self):
"""Fetches the MAL character clubs page and sets the current character's clubs attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id) + u'/' + utilities.urlencode(... | python | def load_clubs(self):
"""Fetches the MAL character clubs page and sets the current character's clubs attributes.
:rtype: :class:`.Character`
:return: Current character object.
"""
character = self.session.session.get(u'http://myanimelist.net/character/' + str(self.id) + u'/' + utilities.urlencode(... | [
"def",
"load_clubs",
"(",
"self",
")",
":",
"character",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/character/'",
"+",
"str",
"(",
"self",
".",
"id",
")",
"+",
"u'/'",
"+",
"utilities",
".",
"urlencode",
"(",
... | Fetches the MAL character clubs page and sets the current character's clubs attributes.
:rtype: :class:`.Character`
:return: Current character object. | [
"Fetches",
"the",
"MAL",
"character",
"clubs",
"page",
"and",
"sets",
"the",
"current",
"character",
"s",
"clubs",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/character.py#L314-L323 |
50,356 | rexos/wordlist | wordlist/wordlist.py | Generator.generate | def generate(self, minlen, maxlen):
"""
Generates words of different length without storing
them into memory, enforced by itertools.product
"""
if minlen < 1 or maxlen < minlen:
raise ValueError()
for cur in range(minlen, maxlen + 1):
# string pro... | python | def generate(self, minlen, maxlen):
"""
Generates words of different length without storing
them into memory, enforced by itertools.product
"""
if minlen < 1 or maxlen < minlen:
raise ValueError()
for cur in range(minlen, maxlen + 1):
# string pro... | [
"def",
"generate",
"(",
"self",
",",
"minlen",
",",
"maxlen",
")",
":",
"if",
"minlen",
"<",
"1",
"or",
"maxlen",
"<",
"minlen",
":",
"raise",
"ValueError",
"(",
")",
"for",
"cur",
"in",
"range",
"(",
"minlen",
",",
"maxlen",
"+",
"1",
")",
":",
... | Generates words of different length without storing
them into memory, enforced by itertools.product | [
"Generates",
"words",
"of",
"different",
"length",
"without",
"storing",
"them",
"into",
"memory",
"enforced",
"by",
"itertools",
".",
"product"
] | 263504e31acebb5765517cf866ea7aa5bb66517a | https://github.com/rexos/wordlist/blob/263504e31acebb5765517cf866ea7aa5bb66517a/wordlist/wordlist.py#L30-L43 |
50,357 | shaldengeki/python-mal | myanimelist/user.py | User.find_username_from_user_id | def find_username_from_user_id(session, user_id):
"""Look up a MAL username's user ID.
:type session: :class:`myanimelist.session.Session`
:param session: A valid MAL session.
:type user_id: int
:param user_id: The user ID for which we want to look up a username.
:raises: :class:`.InvalidUser... | python | def find_username_from_user_id(session, user_id):
"""Look up a MAL username's user ID.
:type session: :class:`myanimelist.session.Session`
:param session: A valid MAL session.
:type user_id: int
:param user_id: The user ID for which we want to look up a username.
:raises: :class:`.InvalidUser... | [
"def",
"find_username_from_user_id",
"(",
"session",
",",
"user_id",
")",
":",
"comments_page",
"=",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/comments.php?'",
"+",
"urllib",
".",
"urlencode",
"(",
"{",
"'id'",
":",
"int",
"(",
"user_... | Look up a MAL username's user ID.
:type session: :class:`myanimelist.session.Session`
:param session: A valid MAL session.
:type user_id: int
:param user_id: The user ID for which we want to look up a username.
:raises: :class:`.InvalidUserError`
:rtype: str
:return: The given user's use... | [
"Look",
"up",
"a",
"MAL",
"username",
"s",
"user",
"ID",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L27-L46 |
50,358 | shaldengeki/python-mal | myanimelist/user.py | User.parse_reviews | def parse_reviews(self, reviews_page):
"""Parses the DOM and returns user reviews attributes.
:type reviews_page: :class:`bs4.BeautifulSoup`
:param reviews_page: MAL user reviews page's DOM
:rtype: dict
:return: User reviews attributes.
"""
user_info = self.parse_sidebar(reviews_page)
... | python | def parse_reviews(self, reviews_page):
"""Parses the DOM and returns user reviews attributes.
:type reviews_page: :class:`bs4.BeautifulSoup`
:param reviews_page: MAL user reviews page's DOM
:rtype: dict
:return: User reviews attributes.
"""
user_info = self.parse_sidebar(reviews_page)
... | [
"def",
"parse_reviews",
"(",
"self",
",",
"reviews_page",
")",
":",
"user_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"reviews_page",
")",
"second_col",
"=",
"reviews_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"u'id'",
":",
"u'content'",
"}",
")",
"."... | Parses the DOM and returns user reviews attributes.
:type reviews_page: :class:`bs4.BeautifulSoup`
:param reviews_page: MAL user reviews page's DOM
:rtype: dict
:return: User reviews attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"user",
"reviews",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L409-L461 |
50,359 | shaldengeki/python-mal | myanimelist/user.py | User.parse_recommendations | def parse_recommendations(self, recommendations_page):
"""Parses the DOM and returns user recommendations attributes.
:type recommendations_page: :class:`bs4.BeautifulSoup`
:param recommendations_page: MAL user recommendations page's DOM
:rtype: dict
:return: User recommendations attributes.
... | python | def parse_recommendations(self, recommendations_page):
"""Parses the DOM and returns user recommendations attributes.
:type recommendations_page: :class:`bs4.BeautifulSoup`
:param recommendations_page: MAL user recommendations page's DOM
:rtype: dict
:return: User recommendations attributes.
... | [
"def",
"parse_recommendations",
"(",
"self",
",",
"recommendations_page",
")",
":",
"user_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"recommendations_page",
")",
"second_col",
"=",
"recommendations_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"u'id'",
":",
"... | Parses the DOM and returns user recommendations attributes.
:type recommendations_page: :class:`bs4.BeautifulSoup`
:param recommendations_page: MAL user recommendations page's DOM
:rtype: dict
:return: User recommendations attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"user",
"recommendations",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L463-L504 |
50,360 | shaldengeki/python-mal | myanimelist/user.py | User.parse_clubs | def parse_clubs(self, clubs_page):
"""Parses the DOM and returns user clubs attributes.
:type clubs_page: :class:`bs4.BeautifulSoup`
:param clubs_page: MAL user clubs page's DOM
:rtype: dict
:return: User clubs attributes.
"""
user_info = self.parse_sidebar(clubs_page)
second_col = cl... | python | def parse_clubs(self, clubs_page):
"""Parses the DOM and returns user clubs attributes.
:type clubs_page: :class:`bs4.BeautifulSoup`
:param clubs_page: MAL user clubs page's DOM
:rtype: dict
:return: User clubs attributes.
"""
user_info = self.parse_sidebar(clubs_page)
second_col = cl... | [
"def",
"parse_clubs",
"(",
"self",
",",
"clubs_page",
")",
":",
"user_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"clubs_page",
")",
"second_col",
"=",
"clubs_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"u'id'",
":",
"u'content'",
"}",
")",
".",
"fin... | Parses the DOM and returns user clubs attributes.
:type clubs_page: :class:`bs4.BeautifulSoup`
:param clubs_page: MAL user clubs page's DOM
:rtype: dict
:return: User clubs attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"user",
"clubs",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L506-L533 |
50,361 | shaldengeki/python-mal | myanimelist/user.py | User.parse_friends | def parse_friends(self, friends_page):
"""Parses the DOM and returns user friends attributes.
:type friends_page: :class:`bs4.BeautifulSoup`
:param friends_page: MAL user friends page's DOM
:rtype: dict
:return: User friends attributes.
"""
user_info = self.parse_sidebar(friends_page)
... | python | def parse_friends(self, friends_page):
"""Parses the DOM and returns user friends attributes.
:type friends_page: :class:`bs4.BeautifulSoup`
:param friends_page: MAL user friends page's DOM
:rtype: dict
:return: User friends attributes.
"""
user_info = self.parse_sidebar(friends_page)
... | [
"def",
"parse_friends",
"(",
"self",
",",
"friends_page",
")",
":",
"user_info",
"=",
"self",
".",
"parse_sidebar",
"(",
"friends_page",
")",
"second_col",
"=",
"friends_page",
".",
"find",
"(",
"u'div'",
",",
"{",
"u'id'",
":",
"u'content'",
"}",
")",
"."... | Parses the DOM and returns user friends attributes.
:type friends_page: :class:`bs4.BeautifulSoup`
:param friends_page: MAL user friends page's DOM
:rtype: dict
:return: User friends attributes. | [
"Parses",
"the",
"DOM",
"and",
"returns",
"user",
"friends",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L535-L571 |
50,362 | shaldengeki/python-mal | myanimelist/user.py | User.load | def load(self):
"""Fetches the MAL user page and sets the current user's attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_profile = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username)).text
self.set(self.parse(utilities.get_... | python | def load(self):
"""Fetches the MAL user page and sets the current user's attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_profile = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username)).text
self.set(self.parse(utilities.get_... | [
"def",
"load",
"(",
"self",
")",
":",
"user_profile",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/profile/'",
"+",
"utilities",
".",
"urlencode",
"(",
"self",
".",
"username",
")",
")",
".",
"text",
"self",
".",
... | Fetches the MAL user page and sets the current user's attributes.
:rtype: :class:`.User`
:return: Current user object. | [
"Fetches",
"the",
"MAL",
"user",
"page",
"and",
"sets",
"the",
"current",
"user",
"s",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L573-L582 |
50,363 | shaldengeki/python-mal | myanimelist/user.py | User.load_reviews | def load_reviews(self):
"""Fetches the MAL user reviews page and sets the current user's reviews attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
page = 0
# collect all reviews over all pages.
review_collection = []
while True:
user_reviews = self.session.sess... | python | def load_reviews(self):
"""Fetches the MAL user reviews page and sets the current user's reviews attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
page = 0
# collect all reviews over all pages.
review_collection = []
while True:
user_reviews = self.session.sess... | [
"def",
"load_reviews",
"(",
"self",
")",
":",
"page",
"=",
"0",
"# collect all reviews over all pages.",
"review_collection",
"=",
"[",
"]",
"while",
"True",
":",
"user_reviews",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist... | Fetches the MAL user reviews page and sets the current user's reviews attributes.
:rtype: :class:`.User`
:return: Current user object. | [
"Fetches",
"the",
"MAL",
"user",
"reviews",
"page",
"and",
"sets",
"the",
"current",
"user",
"s",
"reviews",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L584-L609 |
50,364 | shaldengeki/python-mal | myanimelist/user.py | User.load_recommendations | def load_recommendations(self):
"""Fetches the MAL user recommendations page and sets the current user's recommendations attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_recommendations = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(sel... | python | def load_recommendations(self):
"""Fetches the MAL user recommendations page and sets the current user's recommendations attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_recommendations = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(sel... | [
"def",
"load_recommendations",
"(",
"self",
")",
":",
"user_recommendations",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/profile/'",
"+",
"utilities",
".",
"urlencode",
"(",
"self",
".",
"username",
")",
"+",
"u'/reco... | Fetches the MAL user recommendations page and sets the current user's recommendations attributes.
:rtype: :class:`.User`
:return: Current user object. | [
"Fetches",
"the",
"MAL",
"user",
"recommendations",
"page",
"and",
"sets",
"the",
"current",
"user",
"s",
"recommendations",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L611-L620 |
50,365 | shaldengeki/python-mal | myanimelist/user.py | User.load_clubs | def load_clubs(self):
"""Fetches the MAL user clubs page and sets the current user's clubs attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_clubs = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/clubs').text
self.s... | python | def load_clubs(self):
"""Fetches the MAL user clubs page and sets the current user's clubs attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_clubs = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/clubs').text
self.s... | [
"def",
"load_clubs",
"(",
"self",
")",
":",
"user_clubs",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/profile/'",
"+",
"utilities",
".",
"urlencode",
"(",
"self",
".",
"username",
")",
"+",
"u'/clubs'",
")",
".",
... | Fetches the MAL user clubs page and sets the current user's clubs attributes.
:rtype: :class:`.User`
:return: Current user object. | [
"Fetches",
"the",
"MAL",
"user",
"clubs",
"page",
"and",
"sets",
"the",
"current",
"user",
"s",
"clubs",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L622-L631 |
50,366 | shaldengeki/python-mal | myanimelist/user.py | User.load_friends | def load_friends(self):
"""Fetches the MAL user friends page and sets the current user's friends attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_friends = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/friends').text
... | python | def load_friends(self):
"""Fetches the MAL user friends page and sets the current user's friends attributes.
:rtype: :class:`.User`
:return: Current user object.
"""
user_friends = self.session.session.get(u'http://myanimelist.net/profile/' + utilities.urlencode(self.username) + u'/friends').text
... | [
"def",
"load_friends",
"(",
"self",
")",
":",
"user_friends",
"=",
"self",
".",
"session",
".",
"session",
".",
"get",
"(",
"u'http://myanimelist.net/profile/'",
"+",
"utilities",
".",
"urlencode",
"(",
"self",
".",
"username",
")",
"+",
"u'/friends'",
")",
... | Fetches the MAL user friends page and sets the current user's friends attributes.
:rtype: :class:`.User`
:return: Current user object. | [
"Fetches",
"the",
"MAL",
"user",
"friends",
"page",
"and",
"sets",
"the",
"current",
"user",
"s",
"friends",
"attributes",
"."
] | 2c3356411a74d88ba13f6b970388040d696f8392 | https://github.com/shaldengeki/python-mal/blob/2c3356411a74d88ba13f6b970388040d696f8392/myanimelist/user.py#L633-L642 |
50,367 | rosenbrockc/fortpy | fortpy/msg.py | arb | def arb(text, cols, split):
"""Prints a line of text in arbitrary colors specified by the numeric
values contained in msg.cenum dictionary.
"""
stext = text if text[-1] != split else text[0:-1]
words = stext.split(split)
for i, word in enumerate(words):
col = icols[cols[i]]
print... | python | def arb(text, cols, split):
"""Prints a line of text in arbitrary colors specified by the numeric
values contained in msg.cenum dictionary.
"""
stext = text if text[-1] != split else text[0:-1]
words = stext.split(split)
for i, word in enumerate(words):
col = icols[cols[i]]
print... | [
"def",
"arb",
"(",
"text",
",",
"cols",
",",
"split",
")",
":",
"stext",
"=",
"text",
"if",
"text",
"[",
"-",
"1",
"]",
"!=",
"split",
"else",
"text",
"[",
"0",
":",
"-",
"1",
"]",
"words",
"=",
"stext",
".",
"split",
"(",
"split",
")",
"for"... | Prints a line of text in arbitrary colors specified by the numeric
values contained in msg.cenum dictionary. | [
"Prints",
"a",
"line",
"of",
"text",
"in",
"arbitrary",
"colors",
"specified",
"by",
"the",
"numeric",
"values",
"contained",
"in",
"msg",
".",
"cenum",
"dictionary",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/msg.py#L42-L54 |
50,368 | rosenbrockc/fortpy | fortpy/msg.py | will_print | def will_print(level=1):
"""Returns True if the current global status of messaging would print a
message using any of the printing functions in this module.
"""
if level == 1:
#We only affect printability using the quiet setting.
return quiet is None or quiet == False
else:
r... | python | def will_print(level=1):
"""Returns True if the current global status of messaging would print a
message using any of the printing functions in this module.
"""
if level == 1:
#We only affect printability using the quiet setting.
return quiet is None or quiet == False
else:
r... | [
"def",
"will_print",
"(",
"level",
"=",
"1",
")",
":",
"if",
"level",
"==",
"1",
":",
"#We only affect printability using the quiet setting.",
"return",
"quiet",
"is",
"None",
"or",
"quiet",
"==",
"False",
"else",
":",
"return",
"(",
"(",
"isinstance",
"(",
... | Returns True if the current global status of messaging would print a
message using any of the printing functions in this module. | [
"Returns",
"True",
"if",
"the",
"current",
"global",
"status",
"of",
"messaging",
"would",
"print",
"a",
"message",
"using",
"any",
"of",
"the",
"printing",
"functions",
"in",
"this",
"module",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/msg.py#L72-L81 |
50,369 | rosenbrockc/fortpy | fortpy/msg.py | warn | def warn(msg, level=0, prefix=True):
"""Prints the specified message as a warning; prepends "WARNING" to
the message, so that can be left off.
"""
if will_print(level):
printer(("WARNING: " if prefix else "") + msg, "yellow") | python | def warn(msg, level=0, prefix=True):
"""Prints the specified message as a warning; prepends "WARNING" to
the message, so that can be left off.
"""
if will_print(level):
printer(("WARNING: " if prefix else "") + msg, "yellow") | [
"def",
"warn",
"(",
"msg",
",",
"level",
"=",
"0",
",",
"prefix",
"=",
"True",
")",
":",
"if",
"will_print",
"(",
"level",
")",
":",
"printer",
"(",
"(",
"\"WARNING: \"",
"if",
"prefix",
"else",
"\"\"",
")",
"+",
"msg",
",",
"\"yellow\"",
")"
] | Prints the specified message as a warning; prepends "WARNING" to
the message, so that can be left off. | [
"Prints",
"the",
"specified",
"message",
"as",
"a",
"warning",
";",
"prepends",
"WARNING",
"to",
"the",
"message",
"so",
"that",
"can",
"be",
"left",
"off",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/msg.py#L83-L88 |
50,370 | rosenbrockc/fortpy | fortpy/msg.py | err | def err(msg, level=-1, prefix=True):
"""Prints the specified message as an error; prepends "ERROR" to
the message, so that can be left off.
"""
if will_print(level) or verbosity is None:
printer(("ERROR: " if prefix else "") + msg, "red") | python | def err(msg, level=-1, prefix=True):
"""Prints the specified message as an error; prepends "ERROR" to
the message, so that can be left off.
"""
if will_print(level) or verbosity is None:
printer(("ERROR: " if prefix else "") + msg, "red") | [
"def",
"err",
"(",
"msg",
",",
"level",
"=",
"-",
"1",
",",
"prefix",
"=",
"True",
")",
":",
"if",
"will_print",
"(",
"level",
")",
"or",
"verbosity",
"is",
"None",
":",
"printer",
"(",
"(",
"\"ERROR: \"",
"if",
"prefix",
"else",
"\"\"",
")",
"+",
... | Prints the specified message as an error; prepends "ERROR" to
the message, so that can be left off. | [
"Prints",
"the",
"specified",
"message",
"as",
"an",
"error",
";",
"prepends",
"ERROR",
"to",
"the",
"message",
"so",
"that",
"can",
"be",
"left",
"off",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/msg.py#L90-L95 |
50,371 | rosenbrockc/fortpy | fortpy/config.py | _config.getenvar | def getenvar(self, envar):
from os import getenv
"""Retrieves the value of an environment variable if it exists."""
if getenv(envar) is not None:
self._vardict[envar] = getenv(envar) | python | def getenvar(self, envar):
from os import getenv
"""Retrieves the value of an environment variable if it exists."""
if getenv(envar) is not None:
self._vardict[envar] = getenv(envar) | [
"def",
"getenvar",
"(",
"self",
",",
"envar",
")",
":",
"from",
"os",
"import",
"getenv",
"if",
"getenv",
"(",
"envar",
")",
"is",
"not",
"None",
":",
"self",
".",
"_vardict",
"[",
"envar",
"]",
"=",
"getenv",
"(",
"envar",
")"
] | Retrieves the value of an environment variable if it exists. | [
"Retrieves",
"the",
"value",
"of",
"an",
"environment",
"variable",
"if",
"it",
"exists",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L85-L89 |
50,372 | rosenbrockc/fortpy | fortpy/config.py | _config._load_isense | def _load_isense(self, tag):
"""Loads isense configuration as a dict of dicts into vardict."""
isense = {}
for child in tag:
if child.tag in isense:
isense[child.tag].update(child.attrib)
else:
isense[child.tag] = child.attrib
self... | python | def _load_isense(self, tag):
"""Loads isense configuration as a dict of dicts into vardict."""
isense = {}
for child in tag:
if child.tag in isense:
isense[child.tag].update(child.attrib)
else:
isense[child.tag] = child.attrib
self... | [
"def",
"_load_isense",
"(",
"self",
",",
"tag",
")",
":",
"isense",
"=",
"{",
"}",
"for",
"child",
"in",
"tag",
":",
"if",
"child",
".",
"tag",
"in",
"isense",
":",
"isense",
"[",
"child",
".",
"tag",
"]",
".",
"update",
"(",
"child",
".",
"attri... | Loads isense configuration as a dict of dicts into vardict. | [
"Loads",
"isense",
"configuration",
"as",
"a",
"dict",
"of",
"dicts",
"into",
"vardict",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L117-L126 |
50,373 | rosenbrockc/fortpy | fortpy/config.py | _config._load_ssh | def _load_ssh(self, tag):
"""Loads the SSH configuration into the vardict."""
for child in tag:
if child.tag == "server":
self._vardict["server"] = child.attrib
elif child.tag == "codes":
self._load_codes(child, True)
elif child.tag == ... | python | def _load_ssh(self, tag):
"""Loads the SSH configuration into the vardict."""
for child in tag:
if child.tag == "server":
self._vardict["server"] = child.attrib
elif child.tag == "codes":
self._load_codes(child, True)
elif child.tag == ... | [
"def",
"_load_ssh",
"(",
"self",
",",
"tag",
")",
":",
"for",
"child",
"in",
"tag",
":",
"if",
"child",
".",
"tag",
"==",
"\"server\"",
":",
"self",
".",
"_vardict",
"[",
"\"server\"",
"]",
"=",
"child",
".",
"attrib",
"elif",
"child",
".",
"tag",
... | Loads the SSH configuration into the vardict. | [
"Loads",
"the",
"SSH",
"configuration",
"into",
"the",
"vardict",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L128-L138 |
50,374 | rosenbrockc/fortpy | fortpy/config.py | _config._load_includes | def _load_includes(self, tag, ssh=False):
"""Extracts all additional libraries that should be included when linking
the unit testing executables.
"""
import re
includes = []
for child in tag:
if child.tag == "include" and "path" in child.attrib:
... | python | def _load_includes(self, tag, ssh=False):
"""Extracts all additional libraries that should be included when linking
the unit testing executables.
"""
import re
includes = []
for child in tag:
if child.tag == "include" and "path" in child.attrib:
... | [
"def",
"_load_includes",
"(",
"self",
",",
"tag",
",",
"ssh",
"=",
"False",
")",
":",
"import",
"re",
"includes",
"=",
"[",
"]",
"for",
"child",
"in",
"tag",
":",
"if",
"child",
".",
"tag",
"==",
"\"include\"",
"and",
"\"path\"",
"in",
"child",
".",
... | Extracts all additional libraries that should be included when linking
the unit testing executables. | [
"Extracts",
"all",
"additional",
"libraries",
"that",
"should",
"be",
"included",
"when",
"linking",
"the",
"unit",
"testing",
"executables",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L140-L156 |
50,375 | rosenbrockc/fortpy | fortpy/config.py | _config._load_codes | def _load_codes(self, tag, ssh=False):
"""Extracts all the paths to additional code directories to
be considered.
:arg tag: the ET tag for the <codes> element."""
codes = []
for code in tag:
if code.tag == "trunk":
codes.append(code.attrib["value"])
... | python | def _load_codes(self, tag, ssh=False):
"""Extracts all the paths to additional code directories to
be considered.
:arg tag: the ET tag for the <codes> element."""
codes = []
for code in tag:
if code.tag == "trunk":
codes.append(code.attrib["value"])
... | [
"def",
"_load_codes",
"(",
"self",
",",
"tag",
",",
"ssh",
"=",
"False",
")",
":",
"codes",
"=",
"[",
"]",
"for",
"code",
"in",
"tag",
":",
"if",
"code",
".",
"tag",
"==",
"\"trunk\"",
":",
"codes",
".",
"append",
"(",
"code",
".",
"attrib",
"[",... | Extracts all the paths to additional code directories to
be considered.
:arg tag: the ET tag for the <codes> element. | [
"Extracts",
"all",
"the",
"paths",
"to",
"additional",
"code",
"directories",
"to",
"be",
"considered",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L158-L171 |
50,376 | rosenbrockc/fortpy | fortpy/config.py | _config._load_mapping | def _load_mapping(self, tag, ssh=False):
"""Extracts all the alternate module name mappings to
be considered.
:arg tag: the ET tag for the <mappings> element."""
mappings = {}
for mapping in tag:
if mapping.tag == "map":
mappings[mapping.attrib["modu... | python | def _load_mapping(self, tag, ssh=False):
"""Extracts all the alternate module name mappings to
be considered.
:arg tag: the ET tag for the <mappings> element."""
mappings = {}
for mapping in tag:
if mapping.tag == "map":
mappings[mapping.attrib["modu... | [
"def",
"_load_mapping",
"(",
"self",
",",
"tag",
",",
"ssh",
"=",
"False",
")",
":",
"mappings",
"=",
"{",
"}",
"for",
"mapping",
"in",
"tag",
":",
"if",
"mapping",
".",
"tag",
"==",
"\"map\"",
":",
"mappings",
"[",
"mapping",
".",
"attrib",
"[",
"... | Extracts all the alternate module name mappings to
be considered.
:arg tag: the ET tag for the <mappings> element. | [
"Extracts",
"all",
"the",
"alternate",
"module",
"name",
"mappings",
"to",
"be",
"considered",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/config.py#L173-L186 |
50,377 | rosenbrockc/fortpy | fortpy/utility.py | copytree | def copytree(src, dst):
"""Recursively copies the source directory to the destination
only if the files are newer or modified by using rsync.
"""
from os import path, waitpid
from subprocess import Popen, PIPE
#Append any trailing / that we need to get rsync to work correctly.
source = path... | python | def copytree(src, dst):
"""Recursively copies the source directory to the destination
only if the files are newer or modified by using rsync.
"""
from os import path, waitpid
from subprocess import Popen, PIPE
#Append any trailing / that we need to get rsync to work correctly.
source = path... | [
"def",
"copytree",
"(",
"src",
",",
"dst",
")",
":",
"from",
"os",
"import",
"path",
",",
"waitpid",
"from",
"subprocess",
"import",
"Popen",
",",
"PIPE",
"#Append any trailing / that we need to get rsync to work correctly.",
"source",
"=",
"path",
".",
"join",
"(... | Recursively copies the source directory to the destination
only if the files are newer or modified by using rsync. | [
"Recursively",
"copies",
"the",
"source",
"directory",
"to",
"the",
"destination",
"only",
"if",
"the",
"files",
"are",
"newer",
"or",
"modified",
"by",
"using",
"rsync",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L84-L109 |
50,378 | rosenbrockc/fortpy | fortpy/utility.py | get_fortpy_templates_dir | def get_fortpy_templates_dir():
"""Gets the templates directory from the fortpy package."""
import fortpy
from os import path
fortdir = path.dirname(fortpy.__file__)
return path.join(fortdir, "templates") | python | def get_fortpy_templates_dir():
"""Gets the templates directory from the fortpy package."""
import fortpy
from os import path
fortdir = path.dirname(fortpy.__file__)
return path.join(fortdir, "templates") | [
"def",
"get_fortpy_templates_dir",
"(",
")",
":",
"import",
"fortpy",
"from",
"os",
"import",
"path",
"fortdir",
"=",
"path",
".",
"dirname",
"(",
"fortpy",
".",
"__file__",
")",
"return",
"path",
".",
"join",
"(",
"fortdir",
",",
"\"templates\"",
")"
] | Gets the templates directory from the fortpy package. | [
"Gets",
"the",
"templates",
"directory",
"from",
"the",
"fortpy",
"package",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L111-L116 |
50,379 | rosenbrockc/fortpy | fortpy/utility.py | set_fortpy_templates | def set_fortpy_templates(obj, fortpy_templates=None):
"""Sets the directory path for the fortpy templates. If no directory
is specified, use the default one that shipped with the package.
"""
#If they didn't specify a custom templates directory, use the default
#one that shipped with the package.
... | python | def set_fortpy_templates(obj, fortpy_templates=None):
"""Sets the directory path for the fortpy templates. If no directory
is specified, use the default one that shipped with the package.
"""
#If they didn't specify a custom templates directory, use the default
#one that shipped with the package.
... | [
"def",
"set_fortpy_templates",
"(",
"obj",
",",
"fortpy_templates",
"=",
"None",
")",
":",
"#If they didn't specify a custom templates directory, use the default",
"#one that shipped with the package.",
"from",
"os",
"import",
"path",
"if",
"fortpy_templates",
"is",
"not",
"N... | Sets the directory path for the fortpy templates. If no directory
is specified, use the default one that shipped with the package. | [
"Sets",
"the",
"directory",
"path",
"for",
"the",
"fortpy",
"templates",
".",
"If",
"no",
"directory",
"is",
"specified",
"use",
"the",
"default",
"one",
"that",
"shipped",
"with",
"the",
"package",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L118-L129 |
50,380 | rosenbrockc/fortpy | fortpy/utility.py | get_dir_relpath | def get_dir_relpath(base, relpath):
"""Returns the absolute path to the 'relpath' taken relative to the base
directory.
:arg base: the base directory to take the path relative to.
:arg relpath: the path relative to 'base' in terms of '.' and '..'.
"""
from os import path
xbase = path.abspat... | python | def get_dir_relpath(base, relpath):
"""Returns the absolute path to the 'relpath' taken relative to the base
directory.
:arg base: the base directory to take the path relative to.
:arg relpath: the path relative to 'base' in terms of '.' and '..'.
"""
from os import path
xbase = path.abspat... | [
"def",
"get_dir_relpath",
"(",
"base",
",",
"relpath",
")",
":",
"from",
"os",
"import",
"path",
"xbase",
"=",
"path",
".",
"abspath",
"(",
"path",
".",
"expanduser",
"(",
"base",
")",
")",
"if",
"not",
"path",
".",
"isdir",
"(",
"xbase",
")",
":",
... | Returns the absolute path to the 'relpath' taken relative to the base
directory.
:arg base: the base directory to take the path relative to.
:arg relpath: the path relative to 'base' in terms of '.' and '..'. | [
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"relpath",
"taken",
"relative",
"to",
"the",
"base",
"directory",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L131-L151 |
50,381 | rosenbrockc/fortpy | fortpy/utility.py | wrap_line | def wrap_line(line, limit=None, chars=80):
"""Wraps the specified line of text on whitespace to make sure that none of the
lines' lengths exceeds 'chars' characters.
"""
result = []
builder = []
length = 0
if limit is not None:
sline = line[0:limit]
else:
sline = line
... | python | def wrap_line(line, limit=None, chars=80):
"""Wraps the specified line of text on whitespace to make sure that none of the
lines' lengths exceeds 'chars' characters.
"""
result = []
builder = []
length = 0
if limit is not None:
sline = line[0:limit]
else:
sline = line
... | [
"def",
"wrap_line",
"(",
"line",
",",
"limit",
"=",
"None",
",",
"chars",
"=",
"80",
")",
":",
"result",
"=",
"[",
"]",
"builder",
"=",
"[",
"]",
"length",
"=",
"0",
"if",
"limit",
"is",
"not",
"None",
":",
"sline",
"=",
"line",
"[",
"0",
":",
... | Wraps the specified line of text on whitespace to make sure that none of the
lines' lengths exceeds 'chars' characters. | [
"Wraps",
"the",
"specified",
"line",
"of",
"text",
"on",
"whitespace",
"to",
"make",
"sure",
"that",
"none",
"of",
"the",
"lines",
"lengths",
"exceeds",
"chars",
"characters",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L157-L179 |
50,382 | rosenbrockc/fortpy | fortpy/utility.py | x_parse_error | def x_parse_error(err, content, source):
"""Explains the specified ParseError instance to show the user where the error
happened in their XML.
"""
lineno, column = err.position
if "<doc>" in content:
#Adjust the position since we are taking the <doc> part out of the tags
#since we ma... | python | def x_parse_error(err, content, source):
"""Explains the specified ParseError instance to show the user where the error
happened in their XML.
"""
lineno, column = err.position
if "<doc>" in content:
#Adjust the position since we are taking the <doc> part out of the tags
#since we ma... | [
"def",
"x_parse_error",
"(",
"err",
",",
"content",
",",
"source",
")",
":",
"lineno",
",",
"column",
"=",
"err",
".",
"position",
"if",
"\"<doc>\"",
"in",
"content",
":",
"#Adjust the position since we are taking the <doc> part out of the tags",
"#since we may have put... | Explains the specified ParseError instance to show the user where the error
happened in their XML. | [
"Explains",
"the",
"specified",
"ParseError",
"instance",
"to",
"show",
"the",
"user",
"where",
"the",
"error",
"happened",
"in",
"their",
"XML",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L181-L204 |
50,383 | rosenbrockc/fortpy | fortpy/utility.py | XML | def XML(content, source=None):
"""Parses the XML text using the ET.XML function, but handling the ParseError in
a user-friendly way.
"""
try:
tree = ET.XML(content)
except ET.ParseError as err:
x_parse_error(err, content, source)
return tree | python | def XML(content, source=None):
"""Parses the XML text using the ET.XML function, but handling the ParseError in
a user-friendly way.
"""
try:
tree = ET.XML(content)
except ET.ParseError as err:
x_parse_error(err, content, source)
return tree | [
"def",
"XML",
"(",
"content",
",",
"source",
"=",
"None",
")",
":",
"try",
":",
"tree",
"=",
"ET",
".",
"XML",
"(",
"content",
")",
"except",
"ET",
".",
"ParseError",
"as",
"err",
":",
"x_parse_error",
"(",
"err",
",",
"content",
",",
"source",
")"... | Parses the XML text using the ET.XML function, but handling the ParseError in
a user-friendly way. | [
"Parses",
"the",
"XML",
"text",
"using",
"the",
"ET",
".",
"XML",
"function",
"but",
"handling",
"the",
"ParseError",
"in",
"a",
"user",
"-",
"friendly",
"way",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L206-L214 |
50,384 | rosenbrockc/fortpy | fortpy/utility.py | XML_fromstring | def XML_fromstring(content, source=None):
"""Parses the XML string into a node tree. If an ParseError exception is raised,
the error message is formatted nicely to show the badly formed XML to the user.
"""
try:
tree = ET.fromstring(content)
except ET.ParseError as err:
x_parse_error... | python | def XML_fromstring(content, source=None):
"""Parses the XML string into a node tree. If an ParseError exception is raised,
the error message is formatted nicely to show the badly formed XML to the user.
"""
try:
tree = ET.fromstring(content)
except ET.ParseError as err:
x_parse_error... | [
"def",
"XML_fromstring",
"(",
"content",
",",
"source",
"=",
"None",
")",
":",
"try",
":",
"tree",
"=",
"ET",
".",
"fromstring",
"(",
"content",
")",
"except",
"ET",
".",
"ParseError",
"as",
"err",
":",
"x_parse_error",
"(",
"err",
",",
"content",
",",... | Parses the XML string into a node tree. If an ParseError exception is raised,
the error message is formatted nicely to show the badly formed XML to the user. | [
"Parses",
"the",
"XML",
"string",
"into",
"a",
"node",
"tree",
".",
"If",
"an",
"ParseError",
"exception",
"is",
"raised",
"the",
"error",
"message",
"is",
"formatted",
"nicely",
"to",
"show",
"the",
"badly",
"formed",
"XML",
"to",
"the",
"user",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/utility.py#L216-L224 |
50,385 | rosenbrockc/fortpy | fortpy/printing/docs.py | format | def format(element):
"""Formats all of the docstrings in the specified element and its
children into a user-friendly paragraph format for printing.
:arg element: an instance of fortpy.element.CodeElement.
"""
result = []
if type(element).__name__ in ["Subroutine", "Function"]:
_format_e... | python | def format(element):
"""Formats all of the docstrings in the specified element and its
children into a user-friendly paragraph format for printing.
:arg element: an instance of fortpy.element.CodeElement.
"""
result = []
if type(element).__name__ in ["Subroutine", "Function"]:
_format_e... | [
"def",
"format",
"(",
"element",
")",
":",
"result",
"=",
"[",
"]",
"if",
"type",
"(",
"element",
")",
".",
"__name__",
"in",
"[",
"\"Subroutine\"",
",",
"\"Function\"",
"]",
":",
"_format_executable",
"(",
"result",
",",
"element",
")",
"elif",
"type",
... | Formats all of the docstrings in the specified element and its
children into a user-friendly paragraph format for printing.
:arg element: an instance of fortpy.element.CodeElement. | [
"Formats",
"all",
"of",
"the",
"docstrings",
"in",
"the",
"specified",
"element",
"and",
"its",
"children",
"into",
"a",
"user",
"-",
"friendly",
"paragraph",
"format",
"for",
"printing",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/printing/docs.py#L6-L20 |
50,386 | rosenbrockc/fortpy | fortpy/printing/docs.py | _format_executable | def _format_executable(lines, element, spacer=""):
"""Performs formatting specific to a Subroutine or Function code
element for relevant docstrings.
"""
rlines = []
rlines.append(element.signature)
_format_summary(rlines, element)
rlines.append("")
rlines.append("PARAMETERS")
for p ... | python | def _format_executable(lines, element, spacer=""):
"""Performs formatting specific to a Subroutine or Function code
element for relevant docstrings.
"""
rlines = []
rlines.append(element.signature)
_format_summary(rlines, element)
rlines.append("")
rlines.append("PARAMETERS")
for p ... | [
"def",
"_format_executable",
"(",
"lines",
",",
"element",
",",
"spacer",
"=",
"\"\"",
")",
":",
"rlines",
"=",
"[",
"]",
"rlines",
".",
"append",
"(",
"element",
".",
"signature",
")",
"_format_summary",
"(",
"rlines",
",",
"element",
")",
"rlines",
"."... | Performs formatting specific to a Subroutine or Function code
element for relevant docstrings. | [
"Performs",
"formatting",
"specific",
"to",
"a",
"Subroutine",
"or",
"Function",
"code",
"element",
"for",
"relevant",
"docstrings",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/printing/docs.py#L22-L49 |
50,387 | rosenbrockc/fortpy | fortpy/printing/docs.py | _format_type | def _format_type(lines, element, spacer=""):
"""Formats a derived type for full documentation output."""
rlines = []
rlines.append(element.signature)
_format_summary(rlines, element)
rlines.append("")
_format_generic(rlines, element, ["summary"])
if len(element.executables) > 0:
rl... | python | def _format_type(lines, element, spacer=""):
"""Formats a derived type for full documentation output."""
rlines = []
rlines.append(element.signature)
_format_summary(rlines, element)
rlines.append("")
_format_generic(rlines, element, ["summary"])
if len(element.executables) > 0:
rl... | [
"def",
"_format_type",
"(",
"lines",
",",
"element",
",",
"spacer",
"=",
"\"\"",
")",
":",
"rlines",
"=",
"[",
"]",
"rlines",
".",
"append",
"(",
"element",
".",
"signature",
")",
"_format_summary",
"(",
"rlines",
",",
"element",
")",
"rlines",
".",
"a... | Formats a derived type for full documentation output. | [
"Formats",
"a",
"derived",
"type",
"for",
"full",
"documentation",
"output",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/printing/docs.py#L51-L73 |
50,388 | rosenbrockc/fortpy | fortpy/printing/docs.py | _format_value_element | def _format_value_element(lines, element, spacer=""):
"""Formats a member or parameter for full documentation output."""
lines.append(spacer + element.definition())
_format_summary(lines, element)
_format_generic(lines, element, ["summary"]) | python | def _format_value_element(lines, element, spacer=""):
"""Formats a member or parameter for full documentation output."""
lines.append(spacer + element.definition())
_format_summary(lines, element)
_format_generic(lines, element, ["summary"]) | [
"def",
"_format_value_element",
"(",
"lines",
",",
"element",
",",
"spacer",
"=",
"\"\"",
")",
":",
"lines",
".",
"append",
"(",
"spacer",
"+",
"element",
".",
"definition",
"(",
")",
")",
"_format_summary",
"(",
"lines",
",",
"element",
")",
"_format_gene... | Formats a member or parameter for full documentation output. | [
"Formats",
"a",
"member",
"or",
"parameter",
"for",
"full",
"documentation",
"output",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/printing/docs.py#L75-L79 |
50,389 | rosenbrockc/fortpy | fortpy/printing/docs.py | _format_summary | def _format_summary(lines, element, spacer=" "):
"""Adds the element's summary tag to the lines if it exists."""
summary = spacer + element.summary
if element.summary == "":
summary = spacer + "No description given in XML documentation for this element."
lines.append(summary) | python | def _format_summary(lines, element, spacer=" "):
"""Adds the element's summary tag to the lines if it exists."""
summary = spacer + element.summary
if element.summary == "":
summary = spacer + "No description given in XML documentation for this element."
lines.append(summary) | [
"def",
"_format_summary",
"(",
"lines",
",",
"element",
",",
"spacer",
"=",
"\" \"",
")",
":",
"summary",
"=",
"spacer",
"+",
"element",
".",
"summary",
"if",
"element",
".",
"summary",
"==",
"\"\"",
":",
"summary",
"=",
"spacer",
"+",
"\"No description g... | Adds the element's summary tag to the lines if it exists. | [
"Adds",
"the",
"element",
"s",
"summary",
"tag",
"to",
"the",
"lines",
"if",
"it",
"exists",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/printing/docs.py#L81-L86 |
50,390 | rosenbrockc/fortpy | fortpy/printing/docs.py | _format_generic | def _format_generic(lines, element, printed, spacer=""):
"""Generically formats all remaining docstrings and custom XML
tags that don't appear in the list of already printed documentation.
:arg printed: a list of XML tags for the element that have already
been handled by a higher method.
"""
... | python | def _format_generic(lines, element, printed, spacer=""):
"""Generically formats all remaining docstrings and custom XML
tags that don't appear in the list of already printed documentation.
:arg printed: a list of XML tags for the element that have already
been handled by a higher method.
"""
... | [
"def",
"_format_generic",
"(",
"lines",
",",
"element",
",",
"printed",
",",
"spacer",
"=",
"\"\"",
")",
":",
"for",
"doc",
"in",
"element",
".",
"docstring",
":",
"if",
"doc",
".",
"doctype",
".",
"lower",
"(",
")",
"not",
"in",
"printed",
":",
"lin... | Generically formats all remaining docstrings and custom XML
tags that don't appear in the list of already printed documentation.
:arg printed: a list of XML tags for the element that have already
been handled by a higher method. | [
"Generically",
"formats",
"all",
"remaining",
"docstrings",
"and",
"custom",
"XML",
"tags",
"that",
"don",
"t",
"appear",
"in",
"the",
"list",
"of",
"already",
"printed",
"documentation",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/printing/docs.py#L88-L97 |
50,391 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_ex_argtype | def _py_ex_argtype(executable):
"""Returns the code to create the argtype to assign to the methods argtypes
attribute.
"""
result = []
for p in executable.ordered_parameters:
atypes = p.argtypes
if atypes is not None:
result.extend(p.argtypes)
else:
pr... | python | def _py_ex_argtype(executable):
"""Returns the code to create the argtype to assign to the methods argtypes
attribute.
"""
result = []
for p in executable.ordered_parameters:
atypes = p.argtypes
if atypes is not None:
result.extend(p.argtypes)
else:
pr... | [
"def",
"_py_ex_argtype",
"(",
"executable",
")",
":",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"executable",
".",
"ordered_parameters",
":",
"atypes",
"=",
"p",
".",
"argtypes",
"if",
"atypes",
"is",
"not",
"None",
":",
"result",
".",
"extend",
"(",
... | Returns the code to create the argtype to assign to the methods argtypes
attribute. | [
"Returns",
"the",
"code",
"to",
"create",
"the",
"argtype",
"to",
"assign",
"to",
"the",
"methods",
"argtypes",
"attribute",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L515-L530 |
50,392 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_ctype | def _py_ctype(parameter):
"""Returns the ctypes type name for the specified fortran parameter.
"""
ctype = parameter.ctype
if ctype is None:
raise ValueError("Can't bind ctypes py_parameter for parameter"
" {}".format(parameter.definition()))
return ctype.lower() | python | def _py_ctype(parameter):
"""Returns the ctypes type name for the specified fortran parameter.
"""
ctype = parameter.ctype
if ctype is None:
raise ValueError("Can't bind ctypes py_parameter for parameter"
" {}".format(parameter.definition()))
return ctype.lower() | [
"def",
"_py_ctype",
"(",
"parameter",
")",
":",
"ctype",
"=",
"parameter",
".",
"ctype",
"if",
"ctype",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Can't bind ctypes py_parameter for parameter\"",
"\" {}\"",
".",
"format",
"(",
"parameter",
".",
"definition"... | Returns the ctypes type name for the specified fortran parameter. | [
"Returns",
"the",
"ctypes",
"type",
"name",
"for",
"the",
"specified",
"fortran",
"parameter",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L532-L539 |
50,393 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_code_clean | def _py_code_clean(lines, tab, executable):
"""Appends all the code lines needed to create the result class instance and populate
its keys with all output variables.
"""
count = 0
allparams = executable.ordered_parameters
if type(executable).__name__ == "Function":
allparams = allparams ... | python | def _py_code_clean(lines, tab, executable):
"""Appends all the code lines needed to create the result class instance and populate
its keys with all output variables.
"""
count = 0
allparams = executable.ordered_parameters
if type(executable).__name__ == "Function":
allparams = allparams ... | [
"def",
"_py_code_clean",
"(",
"lines",
",",
"tab",
",",
"executable",
")",
":",
"count",
"=",
"0",
"allparams",
"=",
"executable",
".",
"ordered_parameters",
"if",
"type",
"(",
"executable",
")",
".",
"__name__",
"==",
"\"Function\"",
":",
"allparams",
"=",
... | Appends all the code lines needed to create the result class instance and populate
its keys with all output variables. | [
"Appends",
"all",
"the",
"code",
"lines",
"needed",
"to",
"create",
"the",
"result",
"class",
"instance",
"and",
"populate",
"its",
"keys",
"with",
"all",
"output",
"variables",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L549-L564 |
50,394 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_ftype | def _py_ftype(parameter, tab):
"""Returns the code to declare an Ftype object that handles memory
deallocation for Fortran return arrays that were allocated by the
method called in ctypes.
"""
splice = ', '.join(["{0}_{1:d}".format(parameter.lname, i)
for i in range(parameter... | python | def _py_ftype(parameter, tab):
"""Returns the code to declare an Ftype object that handles memory
deallocation for Fortran return arrays that were allocated by the
method called in ctypes.
"""
splice = ', '.join(["{0}_{1:d}".format(parameter.lname, i)
for i in range(parameter... | [
"def",
"_py_ftype",
"(",
"parameter",
",",
"tab",
")",
":",
"splice",
"=",
"', '",
".",
"join",
"(",
"[",
"\"{0}_{1:d}\"",
".",
"format",
"(",
"parameter",
".",
"lname",
",",
"i",
")",
"for",
"i",
"in",
"range",
"(",
"parameter",
".",
"D",
")",
"]"... | Returns the code to declare an Ftype object that handles memory
deallocation for Fortran return arrays that were allocated by the
method called in ctypes. | [
"Returns",
"the",
"code",
"to",
"declare",
"an",
"Ftype",
"object",
"that",
"handles",
"memory",
"deallocation",
"for",
"Fortran",
"return",
"arrays",
"that",
"were",
"allocated",
"by",
"the",
"method",
"called",
"in",
"ctypes",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L566-L573 |
50,395 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_clean | def _py_clean(parameter, tab):
"""Returns the code line to clean the output value of the specified parameter.
"""
if "out" in parameter.direction:
if parameter.D > 0:
if ":" in parameter.dimension and ("allocatable" in parameter.modifiers or
... | python | def _py_clean(parameter, tab):
"""Returns the code line to clean the output value of the specified parameter.
"""
if "out" in parameter.direction:
if parameter.D > 0:
if ":" in parameter.dimension and ("allocatable" in parameter.modifiers or
... | [
"def",
"_py_clean",
"(",
"parameter",
",",
"tab",
")",
":",
"if",
"\"out\"",
"in",
"parameter",
".",
"direction",
":",
"if",
"parameter",
".",
"D",
">",
"0",
":",
"if",
"\":\"",
"in",
"parameter",
".",
"dimension",
"and",
"(",
"\"allocatable\"",
"in",
... | Returns the code line to clean the output value of the specified parameter. | [
"Returns",
"the",
"code",
"line",
"to",
"clean",
"the",
"output",
"value",
"of",
"the",
"specified",
"parameter",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L575-L600 |
50,396 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_code_variables | def _py_code_variables(lines, executable, lparams, tab):
"""Adds the variable code lines for all the parameters in the executable.
:arg lparams: a list of the local variable declarations made so far that need to be passed
to the executable when it is called.
"""
allparams = executable.ordered_par... | python | def _py_code_variables(lines, executable, lparams, tab):
"""Adds the variable code lines for all the parameters in the executable.
:arg lparams: a list of the local variable declarations made so far that need to be passed
to the executable when it is called.
"""
allparams = executable.ordered_par... | [
"def",
"_py_code_variables",
"(",
"lines",
",",
"executable",
",",
"lparams",
",",
"tab",
")",
":",
"allparams",
"=",
"executable",
".",
"ordered_parameters",
"if",
"type",
"(",
"executable",
")",
".",
"__name__",
"==",
"\"Function\"",
":",
"allparams",
"=",
... | Adds the variable code lines for all the parameters in the executable.
:arg lparams: a list of the local variable declarations made so far that need to be passed
to the executable when it is called. | [
"Adds",
"the",
"variable",
"code",
"lines",
"for",
"all",
"the",
"parameters",
"in",
"the",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L622-L641 |
50,397 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_code_parameter | def _py_code_parameter(lines, parameter, position, lparams, tab):
"""Appends the code to produce the parameter at the specified position in the executable.
:arg position: one of ['invar', 'outvar', 'indices'].
:arg lparams: a list of the local variable declarations made so far that need to be passed
... | python | def _py_code_parameter(lines, parameter, position, lparams, tab):
"""Appends the code to produce the parameter at the specified position in the executable.
:arg position: one of ['invar', 'outvar', 'indices'].
:arg lparams: a list of the local variable declarations made so far that need to be passed
... | [
"def",
"_py_code_parameter",
"(",
"lines",
",",
"parameter",
",",
"position",
",",
"lparams",
",",
"tab",
")",
":",
"mdict",
"=",
"{",
"\"invar\"",
":",
"_py_invar",
",",
"\"outvar\"",
":",
"_py_outvar",
",",
"\"indices\"",
":",
"_py_indices",
"}",
"line",
... | Appends the code to produce the parameter at the specified position in the executable.
:arg position: one of ['invar', 'outvar', 'indices'].
:arg lparams: a list of the local variable declarations made so far that need to be passed
to the executable when it is called. | [
"Appends",
"the",
"code",
"to",
"produce",
"the",
"parameter",
"at",
"the",
"specified",
"position",
"in",
"the",
"executable",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L643-L660 |
50,398 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_invar | def _py_invar(parameter, lparams, tab):
"""Returns the code to create the local input parameter that is coerced to have the
correct type for ctypes interaction.
"""
if ("in" in parameter.direction and parameter.D > 0):
if parameter.direction == "(inout)" and ":" not in parameter.dimension:
... | python | def _py_invar(parameter, lparams, tab):
"""Returns the code to create the local input parameter that is coerced to have the
correct type for ctypes interaction.
"""
if ("in" in parameter.direction and parameter.D > 0):
if parameter.direction == "(inout)" and ":" not in parameter.dimension:
... | [
"def",
"_py_invar",
"(",
"parameter",
",",
"lparams",
",",
"tab",
")",
":",
"if",
"(",
"\"in\"",
"in",
"parameter",
".",
"direction",
"and",
"parameter",
".",
"D",
">",
"0",
")",
":",
"if",
"parameter",
".",
"direction",
"==",
"\"(inout)\"",
"and",
"\"... | Returns the code to create the local input parameter that is coerced to have the
correct type for ctypes interaction. | [
"Returns",
"the",
"code",
"to",
"create",
"the",
"local",
"input",
"parameter",
"that",
"is",
"coerced",
"to",
"have",
"the",
"correct",
"type",
"for",
"ctypes",
"interaction",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L662-L681 |
50,399 | rosenbrockc/fortpy | fortpy/interop/ftypes.py | _py_outvar | def _py_outvar(parameter, lparams, tab):
"""Returns the code to produce a ctypes output variable for interacting with fortran.
"""
if ("out" in parameter.direction and parameter.D > 0 and ":" in parameter.dimension and
("allocatable" in parameter.modifiers or "pointer" in parameter.modifiers)):
... | python | def _py_outvar(parameter, lparams, tab):
"""Returns the code to produce a ctypes output variable for interacting with fortran.
"""
if ("out" in parameter.direction and parameter.D > 0 and ":" in parameter.dimension and
("allocatable" in parameter.modifiers or "pointer" in parameter.modifiers)):
... | [
"def",
"_py_outvar",
"(",
"parameter",
",",
"lparams",
",",
"tab",
")",
":",
"if",
"(",
"\"out\"",
"in",
"parameter",
".",
"direction",
"and",
"parameter",
".",
"D",
">",
"0",
"and",
"\":\"",
"in",
"parameter",
".",
"dimension",
"and",
"(",
"\"allocatabl... | Returns the code to produce a ctypes output variable for interacting with fortran. | [
"Returns",
"the",
"code",
"to",
"produce",
"a",
"ctypes",
"output",
"variable",
"for",
"interacting",
"with",
"fortran",
"."
] | 1ed0757c52d549e41d9d44bdea68cb89529293a5 | https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/interop/ftypes.py#L683-L690 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.