Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
Polygon._get_ext_ring | (self) | Gets the exterior ring of the Polygon. | Gets the exterior ring of the Polygon. | def _get_ext_ring(self):
"Gets the exterior ring of the Polygon."
return self[0] | [
"def",
"_get_ext_ring",
"(",
"self",
")",
":",
"return",
"self",
"[",
"0",
"]"
] | [
157,
4
] | [
159,
22
] | python | en | ['en', 'en', 'en'] | True |
Polygon._set_ext_ring | (self, ring) | Sets the exterior ring of the Polygon. | Sets the exterior ring of the Polygon. | def _set_ext_ring(self, ring):
"Sets the exterior ring of the Polygon."
self[0] = ring | [
"def",
"_set_ext_ring",
"(",
"self",
",",
"ring",
")",
":",
"self",
"[",
"0",
"]",
"=",
"ring"
] | [
161,
4
] | [
163,
22
] | python | en | ['en', 'en', 'en'] | True |
Polygon.tuple | (self) | Gets the tuple for each ring in this Polygon. | Gets the tuple for each ring in this Polygon. | def tuple(self):
"Gets the tuple for each ring in this Polygon."
return tuple(self[i].tuple for i in range(len(self))) | [
"def",
"tuple",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"self",
"[",
"i",
"]",
".",
"tuple",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
")",
")",
")"
] | [
170,
4
] | [
172,
61
] | python | en | ['en', 'en', 'en'] | True |
Polygon.kml | (self) | Returns the KML representation of this Polygon. | Returns the KML representation of this Polygon. | def kml(self):
"Returns the KML representation of this Polygon."
inner_kml = ''.join(
"<innerBoundaryIs>%s</innerBoundaryIs>" % self[i + 1].kml
for i in range(self.num_interior_rings)
)
return "<Polygon><outerBoundaryIs>%s</outerBoundaryIs>%s</Polygon>" % (self[0]... | [
"def",
"kml",
"(",
"self",
")",
":",
"inner_kml",
"=",
"''",
".",
"join",
"(",
"\"<innerBoundaryIs>%s</innerBoundaryIs>\"",
"%",
"self",
"[",
"i",
"+",
"1",
"]",
".",
"kml",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_interior_rings",
")",
")",
"... | [
176,
4
] | [
182,
102
] | python | en | ['en', 'en', 'en'] | True |
migrate_fix_invalid_bot_owner_values | (
apps: StateApps, schema_editor: DatabaseSchemaEditor
) | Fixes UserProfile objects that incorrectly had a bot_owner set | Fixes UserProfile objects that incorrectly had a bot_owner set | def migrate_fix_invalid_bot_owner_values(
apps: StateApps, schema_editor: DatabaseSchemaEditor
) -> None:
"""Fixes UserProfile objects that incorrectly had a bot_owner set"""
UserProfile = apps.get_model("zerver", "UserProfile")
UserProfile.objects.filter(is_bot=False).exclude(bot_owner=None).update(bot... | [
"def",
"migrate_fix_invalid_bot_owner_values",
"(",
"apps",
":",
"StateApps",
",",
"schema_editor",
":",
"DatabaseSchemaEditor",
")",
"->",
"None",
":",
"UserProfile",
"=",
"apps",
".",
"get_model",
"(",
"\"zerver\"",
",",
"\"UserProfile\"",
")",
"UserProfile",
".",... | [
7,
0
] | [
12,
91
] | python | en | ['en', 'en', 'en'] | True |
BaseSpatialOperations.geo_db_type | (self, f) |
Returns the database column type for the geometry field on
the spatial backend.
|
Returns the database column type for the geometry field on
the spatial backend.
| def geo_db_type(self, f):
"""
Returns the database column type for the geometry field on
the spatial backend.
"""
raise NotImplementedError('subclasses of BaseSpatialOperations must provide a geo_db_type() method') | [
"def",
"geo_db_type",
"(",
"self",
",",
"f",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of BaseSpatialOperations must provide a geo_db_type() method'",
")"
] | [
90,
4
] | [
95,
108
] | python | en | ['en', 'error', 'th'] | False |
BaseSpatialOperations.get_distance | (self, f, value, lookup_type) |
Returns the distance parameters for the given geometry field,
lookup value, and lookup type.
|
Returns the distance parameters for the given geometry field,
lookup value, and lookup type.
| def get_distance(self, f, value, lookup_type):
"""
Returns the distance parameters for the given geometry field,
lookup value, and lookup type.
"""
raise NotImplementedError('Distance operations not available on this spatial backend.') | [
"def",
"get_distance",
"(",
"self",
",",
"f",
",",
"value",
",",
"lookup_type",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Distance operations not available on this spatial backend.'",
")"
] | [
97,
4
] | [
102,
95
] | python | en | ['en', 'error', 'th'] | False |
BaseSpatialOperations.get_geom_placeholder | (self, f, value, compiler) |
Returns the placeholder for the given geometry field with the given
value. Depending on the spatial backend, the placeholder may contain a
stored procedure call to the transformation function of the spatial
backend.
|
Returns the placeholder for the given geometry field with the given
value. Depending on the spatial backend, the placeholder may contain a
stored procedure call to the transformation function of the spatial
backend.
| def get_geom_placeholder(self, f, value, compiler):
"""
Returns the placeholder for the given geometry field with the given
value. Depending on the spatial backend, the placeholder may contain a
stored procedure call to the transformation function of the spatial
backend.
... | [
"def",
"get_geom_placeholder",
"(",
"self",
",",
"f",
",",
"value",
",",
"compiler",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses of BaseSpatialOperations must provide a geo_db_placeholder() method'",
")"
] | [
104,
4
] | [
111,
115
] | python | en | ['en', 'error', 'th'] | False |
tokenize | (sql, encoding=None) | Tokenize sql.
Tokenize *sql* using the :class:`Lexer` and return a 2-tuple stream
of ``(token type, value)`` items.
| Tokenize sql. | def tokenize(sql, encoding=None):
"""Tokenize sql.
Tokenize *sql* using the :class:`Lexer` and return a 2-tuple stream
of ``(token type, value)`` items.
"""
return Lexer().get_tokens(sql, encoding) | [
"def",
"tokenize",
"(",
"sql",
",",
"encoding",
"=",
"None",
")",
":",
"return",
"Lexer",
"(",
")",
".",
"get_tokens",
"(",
"sql",
",",
"encoding",
")"
] | [
75,
0
] | [
81,
44
] | python | nl | ['nl', 'sl', 'tr'] | False |
Lexer.get_tokens | (text, encoding=None) |
Return an iterable of (tokentype, value) pairs generated from
`text`. If `unfiltered` is set to `True`, the filtering mechanism
is bypassed even if filters are defined.
Also preprocess the text, i.e. expand tabs and strip it if
wanted and applies registered filters.
Sp... |
Return an iterable of (tokentype, value) pairs generated from
`text`. If `unfiltered` is set to `True`, the filtering mechanism
is bypassed even if filters are defined. | def get_tokens(text, encoding=None):
"""
Return an iterable of (tokentype, value) pairs generated from
`text`. If `unfiltered` is set to `True`, the filtering mechanism
is bypassed even if filters are defined.
Also preprocess the text, i.e. expand tabs and strip it if
wa... | [
"def",
"get_tokens",
"(",
"text",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"text",
",",
"TextIOBase",
")",
":",
"text",
"=",
"text",
".",
"read",
"(",
")",
"if",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"pass",
"elif... | [
27,
4
] | [
72,
40
] | python | en | ['en', 'error', 'th'] | False |
DatabaseOperations.force_no_ordering | (self) |
"ORDER BY NULL" prevents MySQL from implicitly ordering by grouped
columns. If no ordering would otherwise be applied, we don't want any
implicit sorting going on.
|
"ORDER BY NULL" prevents MySQL from implicitly ordering by grouped
columns. If no ordering would otherwise be applied, we don't want any
implicit sorting going on.
| def force_no_ordering(self):
"""
"ORDER BY NULL" prevents MySQL from implicitly ordering by grouped
columns. If no ordering would otherwise be applied, we don't want any
implicit sorting going on.
"""
return [(None, ("NULL", [], False))] | [
"def",
"force_no_ordering",
"(",
"self",
")",
":",
"return",
"[",
"(",
"None",
",",
"(",
"\"NULL\"",
",",
"[",
"]",
",",
"False",
")",
")",
"]"
] | [
104,
4
] | [
110,
44
] | python | en | ['en', 'error', 'th'] | False |
GeoIP2.__init__ | (self, path=None, cache=0, country=None, city=None) |
Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets.
* path: Base directory to where GeoIP data is located or the full path
to where the city or country data fil... |
Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets. | def __init__(self, path=None, cache=0, country=None, city=None):
"""
Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets.
* path: Base directory to where GeoIP data i... | [
"def",
"__init__",
"(",
"self",
",",
"path",
"=",
"None",
",",
"cache",
"=",
"0",
",",
"country",
"=",
"None",
",",
"city",
"=",
"None",
")",
":",
"# Checking the given cache option.",
"if",
"cache",
"in",
"self",
".",
"cache_options",
":",
"self",
".",
... | [
46,
4
] | [
114,
82
] | python | en | ['en', 'error', 'th'] | False |
GeoIP2._check_query | (self, query, country=False, city=False, city_or_country=False) | Helper routine for checking the query and database availability. | Helper routine for checking the query and database availability. | def _check_query(self, query, country=False, city=False, city_or_country=False):
"Helper routine for checking the query and database availability."
# Making sure a string was passed in for the query.
if not isinstance(query, six.string_types):
raise TypeError('GeoIP query must be a s... | [
"def",
"_check_query",
"(",
"self",
",",
"query",
",",
"country",
"=",
"False",
",",
"city",
"=",
"False",
",",
"city_or_country",
"=",
"False",
")",
":",
"# Making sure a string was passed in for the query.",
"if",
"not",
"isinstance",
"(",
"query",
",",
"six",... | [
145,
4
] | [
163,
20
] | python | en | ['en', 'en', 'en'] | True |
GeoIP2.city | (self, query) |
Return a dictionary of city information for the given IP address or
Fully Qualified Domain Name (FQDN). Some information in the dictionary
may be undefined (None).
|
Return a dictionary of city information for the given IP address or
Fully Qualified Domain Name (FQDN). Some information in the dictionary
may be undefined (None).
| def city(self, query):
"""
Return a dictionary of city information for the given IP address or
Fully Qualified Domain Name (FQDN). Some information in the dictionary
may be undefined (None).
"""
enc_query = self._check_query(query, city=True)
return City(self._cit... | [
"def",
"city",
"(",
"self",
",",
"query",
")",
":",
"enc_query",
"=",
"self",
".",
"_check_query",
"(",
"query",
",",
"city",
"=",
"True",
")",
"return",
"City",
"(",
"self",
".",
"_city",
".",
"city",
"(",
"enc_query",
")",
")"
] | [
165,
4
] | [
172,
47
] | python | en | ['en', 'error', 'th'] | False |
GeoIP2.country_code | (self, query) | Return the country code for the given IP Address or FQDN. | Return the country code for the given IP Address or FQDN. | def country_code(self, query):
"Return the country code for the given IP Address or FQDN."
enc_query = self._check_query(query, city_or_country=True)
return self.country(enc_query)['country_code'] | [
"def",
"country_code",
"(",
"self",
",",
"query",
")",
":",
"enc_query",
"=",
"self",
".",
"_check_query",
"(",
"query",
",",
"city_or_country",
"=",
"True",
")",
"return",
"self",
".",
"country",
"(",
"enc_query",
")",
"[",
"'country_code'",
"]"
] | [
174,
4
] | [
177,
54
] | python | en | ['en', 'en', 'en'] | True |
GeoIP2.country_name | (self, query) | Return the country name for the given IP Address or FQDN. | Return the country name for the given IP Address or FQDN. | def country_name(self, query):
"Return the country name for the given IP Address or FQDN."
enc_query = self._check_query(query, city_or_country=True)
return self.country(enc_query)['country_name'] | [
"def",
"country_name",
"(",
"self",
",",
"query",
")",
":",
"enc_query",
"=",
"self",
".",
"_check_query",
"(",
"query",
",",
"city_or_country",
"=",
"True",
")",
"return",
"self",
".",
"country",
"(",
"enc_query",
")",
"[",
"'country_name'",
"]"
] | [
179,
4
] | [
182,
54
] | python | en | ['en', 'en', 'en'] | True |
GeoIP2.country | (self, query) |
Return a dictionary with the country code and name when given an
IP address or a Fully Qualified Domain Name (FQDN). For example, both
'24.124.1.80' and 'djangoproject.com' are valid parameters.
|
Return a dictionary with the country code and name when given an
IP address or a Fully Qualified Domain Name (FQDN). For example, both
'24.124.1.80' and 'djangoproject.com' are valid parameters.
| def country(self, query):
"""
Return a dictionary with the country code and name when given an
IP address or a Fully Qualified Domain Name (FQDN). For example, both
'24.124.1.80' and 'djangoproject.com' are valid parameters.
"""
# Returning the country code and name
... | [
"def",
"country",
"(",
"self",
",",
"query",
")",
":",
"# Returning the country code and name",
"enc_query",
"=",
"self",
".",
"_check_query",
"(",
"query",
",",
"city_or_country",
"=",
"True",
")",
"return",
"Country",
"(",
"self",
".",
"_country_or_city",
"(",... | [
184,
4
] | [
192,
56
] | python | en | ['en', 'error', 'th'] | False |
GeoIP2.lon_lat | (self, query) | Return a tuple of the (longitude, latitude) for the given query. | Return a tuple of the (longitude, latitude) for the given query. | def lon_lat(self, query):
"Return a tuple of the (longitude, latitude) for the given query."
return self.coords(query) | [
"def",
"lon_lat",
"(",
"self",
",",
"query",
")",
":",
"return",
"self",
".",
"coords",
"(",
"query",
")"
] | [
202,
4
] | [
204,
33
] | python | en | ['en', 'en', 'en'] | True |
GeoIP2.lat_lon | (self, query) | Return a tuple of the (latitude, longitude) for the given query. | Return a tuple of the (latitude, longitude) for the given query. | def lat_lon(self, query):
"Return a tuple of the (latitude, longitude) for the given query."
return self.coords(query, ('latitude', 'longitude')) | [
"def",
"lat_lon",
"(",
"self",
",",
"query",
")",
":",
"return",
"self",
".",
"coords",
"(",
"query",
",",
"(",
"'latitude'",
",",
"'longitude'",
")",
")"
] | [
206,
4
] | [
208,
60
] | python | en | ['en', 'en', 'en'] | True |
GeoIP2.geos | (self, query) | Return a GEOS Point object for the given query. | Return a GEOS Point object for the given query. | def geos(self, query):
"Return a GEOS Point object for the given query."
ll = self.lon_lat(query)
if ll:
from django.contrib.gis.geos import Point
return Point(ll, srid=4326)
else:
return None | [
"def",
"geos",
"(",
"self",
",",
"query",
")",
":",
"ll",
"=",
"self",
".",
"lon_lat",
"(",
"query",
")",
"if",
"ll",
":",
"from",
"django",
".",
"contrib",
".",
"gis",
".",
"geos",
"import",
"Point",
"return",
"Point",
"(",
"ll",
",",
"srid",
"=... | [
210,
4
] | [
217,
23
] | python | en | ['en', 'en', 'en'] | True |
GeoIP2.info | (self) | Return information about the GeoIP library and databases in use. | Return information about the GeoIP library and databases in use. | def info(self):
"Return information about the GeoIP library and databases in use."
meta = self._reader.metadata()
return 'GeoIP Library:\n\t%s.%s\n' % (meta.binary_format_major_version, meta.binary_format_minor_version) | [
"def",
"info",
"(",
"self",
")",
":",
"meta",
"=",
"self",
".",
"_reader",
".",
"metadata",
"(",
")",
"return",
"'GeoIP Library:\\n\\t%s.%s\\n'",
"%",
"(",
"meta",
".",
"binary_format_major_version",
",",
"meta",
".",
"binary_format_minor_version",
")"
] | [
221,
4
] | [
224,
113
] | python | en | ['en', 'en', 'en'] | True |
TestImagesJinja.get_image_filename | (self, image, filterspec) |
Get the generated filename for a resized image
|
Get the generated filename for a resized image
| def get_image_filename(self, image, filterspec):
"""
Get the generated filename for a resized image
"""
name, ext = os.path.splitext(os.path.basename(image.file.name))
return '{}images/{}.{}{}'.format(
settings.MEDIA_URL, name, filterspec, ext) | [
"def",
"get_image_filename",
"(",
"self",
",",
"image",
",",
"filterspec",
")",
":",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"image",
".",
"file",
".",
"name",
")",
")",
"return",
"... | [
49,
4
] | [
55,
54
] | python | en | ['en', 'error', 'th'] | False |
render_tex | (tex: str, is_inline: bool = True) | r"""Render a TeX string into HTML using KaTeX
Returns the HTML string, or None if there was some error in the TeX syntax
Keyword arguments:
tex -- Text string with the TeX to render
Don't include delimiters ('$$', '\[ \]', etc.)
is_inline -- Boolean setting that indicates whether the render... | r"""Render a TeX string into HTML using KaTeX | def render_tex(tex: str, is_inline: bool = True) -> Optional[str]:
r"""Render a TeX string into HTML using KaTeX
Returns the HTML string, or None if there was some error in the TeX syntax
Keyword arguments:
tex -- Text string with the TeX to render
Don't include delimiters ('$$', '\[ \]', e... | [
"def",
"render_tex",
"(",
"tex",
":",
"str",
",",
"is_inline",
":",
"bool",
"=",
"True",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"katex_path",
"=",
"(",
"static_path",
"(",
"\"webpack-bundles/katex-cli.js\"",
")",
"if",
"settings",
".",
"PRODUCTION",
... | [
10,
0
] | [
42,
19
] | python | en | ['it', 'en', 'en'] | True |
TestJUnitTester.test_install_tools | (self) |
check installation of selenium-server, junit
:return:
|
check installation of selenium-server, junit
:return:
| def test_install_tools(self):
"""
check installation of selenium-server, junit
:return:
"""
installation_path = BUILD_DIR + "selenium-taurus"
source_url = "file:///" + RESOURCES_DIR + "selenium/selenium-server.jar"
shutil.rmtree(dirname(installation_path), ignore... | [
"def",
"test_install_tools",
"(",
"self",
")",
":",
"installation_path",
"=",
"BUILD_DIR",
"+",
"\"selenium-taurus\"",
"source_url",
"=",
"\"file:///\"",
"+",
"RESOURCES_DIR",
"+",
"\"selenium/selenium-server.jar\"",
"shutil",
".",
"rmtree",
"(",
"dirname",
"(",
"inst... | [
150,
4
] | [
195,
64
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_prepare_java_single | (self) |
Check if script exists in working dir
:return:
|
Check if script exists in working dir
:return:
| def test_prepare_java_single(self):
"""
Check if script exists in working dir
:return:
"""
self.obj.execution.merge({
"scenario": {"script": RESOURCES_DIR + "selenium/junit/java/TestBlazemeterFail.java"}
})
self.obj_prepare()
self.assertIsInsta... | [
"def",
"test_prepare_java_single",
"(",
"self",
")",
":",
"self",
".",
"obj",
".",
"execution",
".",
"merge",
"(",
"{",
"\"scenario\"",
":",
"{",
"\"script\"",
":",
"RESOURCES_DIR",
"+",
"\"selenium/junit/java/TestBlazemeterFail.java\"",
"}",
"}",
")",
"self",
"... | [
275,
4
] | [
285,
94
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_prepare_java_folder | (self) |
Check if scripts exist in working dir
:return:
|
Check if scripts exist in working dir
:return:
| def test_prepare_java_folder(self):
"""
Check if scripts exist in working dir
:return:
"""
self.obj.execution.merge({"scenario": {"script": RESOURCES_DIR + "selenium/junit/java/"}})
self.obj_prepare()
self.assertIsInstance(self.obj.runner, JavaTestRunner)
... | [
"def",
"test_prepare_java_folder",
"(",
"self",
")",
":",
"self",
".",
"obj",
".",
"execution",
".",
"merge",
"(",
"{",
"\"scenario\"",
":",
"{",
"\"script\"",
":",
"RESOURCES_DIR",
"+",
"\"selenium/junit/java/\"",
"}",
"}",
")",
"self",
".",
"obj_prepare",
... | [
287,
4
] | [
299,
44
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_prepare_java_package | (self) |
Check if scripts exist in working dir
:return:
|
Check if scripts exist in working dir
:return:
| def test_prepare_java_package(self):
"""
Check if scripts exist in working dir
:return:
"""
self.obj.execution.merge({"scenario": {"script": RESOURCES_DIR + "selenium/junit/java_package/"}})
self.obj_prepare()
self.assertIsInstance(self.obj.runner, JavaTestRunner) | [
"def",
"test_prepare_java_package",
"(",
"self",
")",
":",
"self",
".",
"obj",
".",
"execution",
".",
"merge",
"(",
"{",
"\"scenario\"",
":",
"{",
"\"script\"",
":",
"RESOURCES_DIR",
"+",
"\"selenium/junit/java_package/\"",
"}",
"}",
")",
"self",
".",
"obj_pre... | [
301,
4
] | [
308,
62
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_selenium_startup_shutdown_java_package | (self) |
Run tests from package
:return:
|
Run tests from package
:return:
| def test_selenium_startup_shutdown_java_package(self):
"""
Run tests from package
:return:
"""
self.configure({
'execution': {
'scenario': {'script': RESOURCES_DIR + 'selenium/junit/java_package/src'},
'executor': 'selenium'
... | [
"def",
"test_selenium_startup_shutdown_java_package",
"(",
"self",
")",
":",
"self",
".",
"configure",
"(",
"{",
"'execution'",
":",
"{",
"'scenario'",
":",
"{",
"'script'",
":",
"RESOURCES_DIR",
"+",
"'selenium/junit/java_package/src'",
"}",
",",
"'executor'",
":",... | [
310,
4
] | [
323,
62
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_selenium_startup_shutdown_jar_single | (self) |
runt tests from single jar
:return:
|
runt tests from single jar
:return:
| def test_selenium_startup_shutdown_jar_single(self):
"""
runt tests from single jar
:return:
"""
self.configure({
'execution': {
'scenario': {'script': RESOURCES_DIR + 'selenium/junit/jar/'},
'runner': 'junit',
'executor... | [
"def",
"test_selenium_startup_shutdown_jar_single",
"(",
"self",
")",
":",
"self",
".",
"configure",
"(",
"{",
"'execution'",
":",
"{",
"'scenario'",
":",
"{",
"'script'",
":",
"RESOURCES_DIR",
"+",
"'selenium/junit/jar/'",
"}",
",",
"'runner'",
":",
"'junit'",
... | [
333,
4
] | [
357,
38
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_selenium_startup_shutdown_jar_folder | (self) |
run tests from jars
:return:
|
run tests from jars
:return:
| def test_selenium_startup_shutdown_jar_folder(self):
"""
run tests from jars
:return:
"""
self.configure({
'execution': {
'scenario': {'script': RESOURCES_DIR + 'selenium/junit/jar/'},
'executor': 'selenium'
},
'... | [
"def",
"test_selenium_startup_shutdown_jar_folder",
"(",
"self",
")",
":",
"self",
".",
"configure",
"(",
"{",
"'execution'",
":",
"{",
"'scenario'",
":",
"{",
"'script'",
":",
"RESOURCES_DIR",
"+",
"'selenium/junit/jar/'",
"}",
",",
"'executor'",
":",
"'selenium'... | [
359,
4
] | [
380,
38
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_selenium_startup_shutdown_java_single | (self) |
run tests from single .java file
:return:
|
run tests from single .java file
:return:
| def test_selenium_startup_shutdown_java_single(self):
"""
run tests from single .java file
:return:
"""
self.obj.engine.config.merge({
'execution': {
'scenario': {'script': RESOURCES_DIR + 'selenium/junit/java/'},
'executor': 'selenium'... | [
"def",
"test_selenium_startup_shutdown_java_single",
"(",
"self",
")",
":",
"self",
".",
"obj",
".",
"engine",
".",
"config",
".",
"merge",
"(",
"{",
"'execution'",
":",
"{",
"'scenario'",
":",
"{",
"'script'",
":",
"RESOURCES_DIR",
"+",
"'selenium/junit/java/'"... | [
382,
4
] | [
405,
44
] | python | en | ['en', 'error', 'th'] | False |
TestSeleniumJUnitTester.test_selenium_startup_shutdown_java_folder | (self) |
run tests from .java files
:return:
|
run tests from .java files
:return:
| def test_selenium_startup_shutdown_java_folder(self):
"""
run tests from .java files
:return:
"""
self.configure({
'execution': {
'scenario': {'script': RESOURCES_DIR + 'selenium/junit/java/'},
'executor': 'selenium'
},
... | [
"def",
"test_selenium_startup_shutdown_java_folder",
"(",
"self",
")",
":",
"self",
".",
"configure",
"(",
"{",
"'execution'",
":",
"{",
"'scenario'",
":",
"{",
"'script'",
":",
"RESOURCES_DIR",
"+",
"'selenium/junit/java/'",
"}",
",",
"'executor'",
":",
"'seleniu... | [
407,
4
] | [
426,
44
] | python | en | ['en', 'error', 'th'] | False |
get_path_info | (environ) |
Returns the HTTP request's PATH_INFO as a unicode string.
|
Returns the HTTP request's PATH_INFO as a unicode string.
| def get_path_info(environ):
"""
Returns the HTTP request's PATH_INFO as a unicode string.
"""
path_info = get_bytes_from_wsgi(environ, 'PATH_INFO', '/')
return repercent_broken_unicode(path_info).decode(UTF_8) | [
"def",
"get_path_info",
"(",
"environ",
")",
":",
"path_info",
"=",
"get_bytes_from_wsgi",
"(",
"environ",
",",
"'PATH_INFO'",
",",
"'/'",
")",
"return",
"repercent_broken_unicode",
"(",
"path_info",
")",
".",
"decode",
"(",
"UTF_8",
")"
] | [
170,
0
] | [
176,
60
] | python | en | ['en', 'error', 'th'] | False |
get_script_name | (environ) |
Returns the equivalent of the HTTP request's SCRIPT_NAME environment
variable. If Apache mod_rewrite has been used, returns what would have been
the script name prior to any rewriting (so it's the script name as seen
from the client's perspective), unless the FORCE_SCRIPT_NAME setting is
set (to an... |
Returns the equivalent of the HTTP request's SCRIPT_NAME environment
variable. If Apache mod_rewrite has been used, returns what would have been
the script name prior to any rewriting (so it's the script name as seen
from the client's perspective), unless the FORCE_SCRIPT_NAME setting is
set (to an... | def get_script_name(environ):
"""
Returns the equivalent of the HTTP request's SCRIPT_NAME environment
variable. If Apache mod_rewrite has been used, returns what would have been
the script name prior to any rewriting (so it's the script name as seen
from the client's perspective), unless the FORCE_... | [
"def",
"get_script_name",
"(",
"environ",
")",
":",
"if",
"settings",
".",
"FORCE_SCRIPT_NAME",
"is",
"not",
"None",
":",
"return",
"force_text",
"(",
"settings",
".",
"FORCE_SCRIPT_NAME",
")",
"# If Apache's mod_rewrite had a whack at the URL, Apache set either",
"# SCRI... | [
179,
0
] | [
209,
36
] | python | en | ['en', 'error', 'th'] | False |
get_bytes_from_wsgi | (environ, key, default) |
Get a value from the WSGI environ dictionary as bytes.
key and default should be str objects. Under Python 2 they may also be
unicode objects provided they only contain ASCII characters.
|
Get a value from the WSGI environ dictionary as bytes. | def get_bytes_from_wsgi(environ, key, default):
"""
Get a value from the WSGI environ dictionary as bytes.
key and default should be str objects. Under Python 2 they may also be
unicode objects provided they only contain ASCII characters.
"""
value = environ.get(str(key), str(default))
# Un... | [
"def",
"get_bytes_from_wsgi",
"(",
"environ",
",",
"key",
",",
"default",
")",
":",
"value",
"=",
"environ",
".",
"get",
"(",
"str",
"(",
"key",
")",
",",
"str",
"(",
"default",
")",
")",
"# Under Python 3, non-ASCII values in the WSGI environ are arbitrarily",
... | [
212,
0
] | [
223,
57
] | python | en | ['en', 'error', 'th'] | False |
get_str_from_wsgi | (environ, key, default) |
Get a value from the WSGI environ dictionary as str.
key and default should be str objects. Under Python 2 they may also be
unicode objects provided they only contain ASCII characters.
|
Get a value from the WSGI environ dictionary as str. | def get_str_from_wsgi(environ, key, default):
"""
Get a value from the WSGI environ dictionary as str.
key and default should be str objects. Under Python 2 they may also be
unicode objects provided they only contain ASCII characters.
"""
value = get_bytes_from_wsgi(environ, key, default)
r... | [
"def",
"get_str_from_wsgi",
"(",
"environ",
",",
"key",
",",
"default",
")",
":",
"value",
"=",
"get_bytes_from_wsgi",
"(",
"environ",
",",
"key",
",",
"default",
")",
"return",
"value",
".",
"decode",
"(",
"UTF_8",
",",
"errors",
"=",
"'replace'",
")",
... | [
226,
0
] | [
234,
70
] | python | en | ['en', 'error', 'th'] | False |
fixed_geometry_mass_balance | (gdir, ys=None, ye=None, years=None,
monthly_step=False,
use_inversion_flowlines=True,
climate_filename='climate_historical',
climate_input_filesuffix='') | Computes the mass-balance with climate input from e.g. CRU or a GCM.
Parameters
----------
gdir : :py:class:`oggm.GlacierDirectory`
the glacier directory to process
ys : int
start year of the model run (default: from the climate file)
date)
ye : int
end year of the m... | Computes the mass-balance with climate input from e.g. CRU or a GCM. | def fixed_geometry_mass_balance(gdir, ys=None, ye=None, years=None,
monthly_step=False,
use_inversion_flowlines=True,
climate_filename='climate_historical',
climate_input_filesuffix=''):
"... | [
"def",
"fixed_geometry_mass_balance",
"(",
"gdir",
",",
"ys",
"=",
"None",
",",
"ye",
"=",
"None",
",",
"years",
"=",
"None",
",",
"monthly_step",
"=",
"False",
",",
"use_inversion_flowlines",
"=",
"True",
",",
"climate_filename",
"=",
"'climate_historical'",
... | [
1386,
0
] | [
1433,
14
] | python | en | ['en', 'en', 'en'] | True |
compute_ela | (gdir, ys=None, ye=None, years=None, climate_filename='climate_historical',
temperature_bias=None, precipitation_factor=None, climate_input_filesuffix='') | Computes the ELA of a glacier for a for given years and climate.
Parameters
----------
gdir : :py:class:`oggm.GlacierDirectory`
the glacier directory to process
ys : int
start year
ye : int
end year
years : array of ints
override ys and ye with the years of y... | Computes the ELA of a glacier for a for given years and climate. | def compute_ela(gdir, ys=None, ye=None, years=None, climate_filename='climate_historical',
temperature_bias=None, precipitation_factor=None, climate_input_filesuffix=''):
"""Computes the ELA of a glacier for a for given years and climate.
Parameters
----------
gdir : :py:class:`ogg... | [
"def",
"compute_ela",
"(",
"gdir",
",",
"ys",
"=",
"None",
",",
"ye",
"=",
"None",
",",
"years",
"=",
"None",
",",
"climate_filename",
"=",
"'climate_historical'",
",",
"temperature_bias",
"=",
"None",
",",
"precipitation_factor",
"=",
"None",
",",
"climate_... | [
1437,
0
] | [
1484,
14
] | python | en | ['en', 'en', 'en'] | True |
MassBalanceModel.__init__ | (self) | Initialize. | Initialize. | def __init__(self):
""" Initialize."""
self.valid_bounds = None
self.hemisphere = None
self.rho = cfg.PARAMS['ice_density'] | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"valid_bounds",
"=",
"None",
"self",
".",
"hemisphere",
"=",
"None",
"self",
".",
"rho",
"=",
"cfg",
".",
"PARAMS",
"[",
"'ice_density'",
"]"
] | [
35,
4
] | [
39,
44
] | python | en | ['en', 'en', 'it'] | False |
MassBalanceModel.__repr__ | (self) | String Representation of the mass-balance model | String Representation of the mass-balance model | def __repr__(self):
"""String Representation of the mass-balance model"""
summary = ['<oggm.MassBalanceModel>']
summary += [' Class: ' + self.__class__.__name__]
summary += [' Attributes:']
# Add all scalar attributes
for k, v in self.__dict__.items():
if np... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"summary",
"=",
"[",
"'<oggm.MassBalanceModel>'",
"]",
"summary",
"+=",
"[",
"' Class: '",
"+",
"self",
".",
"__class__",
".",
"__name__",
"]",
"summary",
"+=",
"[",
"' Attributes:'",
"]",
"# Add all scalar attributes"... | [
41,
4
] | [
53,
40
] | python | en | ['en', 'en', 'en'] | True |
MassBalanceModel.get_monthly_mb | (self, heights, year=None, fl_id=None, fls=None) | Monthly mass-balance at given altitude(s) for a moment in time.
Units: [m s-1], or meters of ice per second
Note: `year` is optional because some simpler models have no time
component.
Parameters
----------
heights: ndarray
the atitudes at which the mass-ba... | Monthly mass-balance at given altitude(s) for a moment in time. | def get_monthly_mb(self, heights, year=None, fl_id=None, fls=None):
"""Monthly mass-balance at given altitude(s) for a moment in time.
Units: [m s-1], or meters of ice per second
Note: `year` is optional because some simpler models have no time
component.
Parameters
--... | [
"def",
"get_monthly_mb",
"(",
"self",
",",
"heights",
",",
"year",
"=",
"None",
",",
"fl_id",
"=",
"None",
",",
"fls",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
69,
4
] | [
95,
35
] | python | en | ['en', 'en', 'en'] | True |
MassBalanceModel.get_annual_mb | (self, heights, year=None, fl_id=None, fls=None) | Like `self.get_monthly_mb()`, but for annual MB.
For some simpler mass-balance models ``get_monthly_mb()` and
`get_annual_mb()`` can be equivalent.
Units: [m s-1], or meters of ice per second
Note: `year` is optional because some simpler models have no time
component.
... | Like `self.get_monthly_mb()`, but for annual MB. | def get_annual_mb(self, heights, year=None, fl_id=None, fls=None):
"""Like `self.get_monthly_mb()`, but for annual MB.
For some simpler mass-balance models ``get_monthly_mb()` and
`get_annual_mb()`` can be equivalent.
Units: [m s-1], or meters of ice per second
Note: `year` is... | [
"def",
"get_annual_mb",
"(",
"self",
",",
"heights",
",",
"year",
"=",
"None",
",",
"fl_id",
"=",
"None",
",",
"fls",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
97,
4
] | [
126,
35
] | python | en | ['en', 'en', 'en'] | True |
MassBalanceModel.get_specific_mb | (self, heights=None, widths=None, fls=None,
year=None) | Specific mb for this year and a specific glacier geometry.
Units: [mm w.e. yr-1], or millimeter water equivalent per year
Parameters
----------
heights: ndarray
the altitudes at which the mass-balance will be computed.
Overridden by ``fls`` if provided
... | Specific mb for this year and a specific glacier geometry. | def get_specific_mb(self, heights=None, widths=None, fls=None,
year=None):
"""Specific mb for this year and a specific glacier geometry.
Units: [mm w.e. yr-1], or millimeter water equivalent per year
Parameters
----------
heights: ndarray
th... | [
"def",
"get_specific_mb",
"(",
"self",
",",
"heights",
"=",
"None",
",",
"widths",
"=",
"None",
",",
"fls",
"=",
"None",
",",
"year",
"=",
"None",
")",
":",
"if",
"len",
"(",
"np",
".",
"atleast_1d",
"(",
"year",
")",
")",
">",
"1",
":",
"out",
... | [
128,
4
] | [
176,
71
] | python | en | ['en', 'en', 'en'] | True |
MassBalanceModel.get_ela | (self, year=None, **kwargs) | Compute the equilibrium line altitude for this year
Parameters
----------
year: float, optional
the time (in the "hydrological floating year" convention)
**kwargs: any other keyword argument accepted by self.get_annual_mb
Returns
-------
the equilibri... | Compute the equilibrium line altitude for this year | def get_ela(self, year=None, **kwargs):
"""Compute the equilibrium line altitude for this year
Parameters
----------
year: float, optional
the time (in the "hydrological floating year" convention)
**kwargs: any other keyword argument accepted by self.get_annual_mb
... | [
"def",
"get_ela",
"(",
"self",
",",
"year",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"np",
".",
"atleast_1d",
"(",
"year",
")",
")",
">",
"1",
":",
"return",
"np",
".",
"asarray",
"(",
"[",
"self",
".",
"get_ela",
"(",
... | [
178,
4
] | [
209,
77
] | python | en | ['en', 'en', 'en'] | True |
ScalarMassBalance.__init__ | (self, mb=0.) | Initialize.
Parameters
----------
mb: float
Fix the mass balance to a certain value (unit: [mm w.e. yr-1])
| Initialize.
Parameters
----------
mb: float
Fix the mass balance to a certain value (unit: [mm w.e. yr-1])
| def __init__(self, mb=0.):
""" Initialize.
Parameters
----------
mb: float
Fix the mass balance to a certain value (unit: [mm w.e. yr-1])
"""
super(ScalarMassBalance, self).__init__()
self.hemisphere = 'nh'
self.valid_bounds = [-2e4, 2e4] # in... | [
"def",
"__init__",
"(",
"self",
",",
"mb",
"=",
"0.",
")",
":",
"super",
"(",
"ScalarMassBalance",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"hemisphere",
"=",
"'nh'",
"self",
".",
"valid_bounds",
"=",
"[",
"-",
"2e4",
",",
"2e4",
"... | [
215,
4
] | [
225,
21
] | python | en | ['en', 'en', 'it'] | False |
LinearMassBalance.__init__ | (self, ela_h, grad=3., max_mb=None) | Initialize.
Parameters
----------
ela_h: float
Equilibrium line altitude (units: [m])
grad: float
Mass-balance gradient (unit: [mm w.e. yr-1 m-1])
max_mb: float
Cap the mass balance to a certain value (unit: [mm w.e. yr-1])
Attribute... | Initialize. | def __init__(self, ela_h, grad=3., max_mb=None):
""" Initialize.
Parameters
----------
ela_h: float
Equilibrium line altitude (units: [m])
grad: float
Mass-balance gradient (unit: [mm w.e. yr-1 m-1])
max_mb: float
Cap the mass balance ... | [
"def",
"__init__",
"(",
"self",
",",
"ela_h",
",",
"grad",
"=",
"3.",
",",
"max_mb",
"=",
"None",
")",
":",
"super",
"(",
"LinearMassBalance",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"hemisphere",
"=",
"'nh'",
"self",
".",
"valid_bo... | [
240,
4
] | [
266,
27
] | python | en | ['en', 'en', 'it'] | False |
LinearMassBalance.temp_bias | (self) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self):
"""Temperature bias to add to the original series."""
return self._temp_bias | [
"def",
"temp_bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"_temp_bias"
] | [
269,
4
] | [
271,
30
] | python | en | ['en', 'en', 'en'] | True |
LinearMassBalance.temp_bias | (self, value) | Temperature bias to change the ELA. | Temperature bias to change the ELA. | def temp_bias(self, value):
"""Temperature bias to change the ELA."""
self.ela_h = self.orig_ela_h + value * 150
self._temp_bias = value | [
"def",
"temp_bias",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"ela_h",
"=",
"self",
".",
"orig_ela_h",
"+",
"value",
"*",
"150",
"self",
".",
"_temp_bias",
"=",
"value"
] | [
274,
4
] | [
277,
31
] | python | en | ['en', 'la', 'en'] | True |
PastMassBalance.__init__ | (self, gdir, mu_star=None, bias=None,
filename='climate_historical', input_filesuffix='',
repeat=False, ys=None, ye=None, check_calib_params=True) | Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float, optional
set to the alternative value of mu* you want to use
(the default is to use the calibrated value).
bias : float, optional
set ... | Initialize. | def __init__(self, gdir, mu_star=None, bias=None,
filename='climate_historical', input_filesuffix='',
repeat=False, ys=None, ye=None, check_calib_params=True):
"""Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier director... | [
"def",
"__init__",
"(",
"self",
",",
"gdir",
",",
"mu_star",
"=",
"None",
",",
"bias",
"=",
"None",
",",
"filename",
"=",
"'climate_historical'",
",",
"input_filesuffix",
"=",
"''",
",",
"repeat",
"=",
"False",
",",
"ys",
"=",
"None",
",",
"ye",
"=",
... | [
292,
4
] | [
440,
36
] | python | en | ['en', 'en', 'it'] | False |
PastMassBalance.get_monthly_climate | (self, heights, year=None) | Monthly climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other model biases (temp and prcp) are applied.
Returns
-------
(temp, tempformelt, prcp, prcpsol)
| Monthly climate information at given heights. | def get_monthly_climate(self, heights, year=None):
"""Monthly climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other model biases (temp and prcp) are applied.
Returns
-------
(temp, tempformelt, prcp, prcpsol)
... | [
"def",
"get_monthly_climate",
"(",
"self",
",",
"heights",
",",
"year",
"=",
"None",
")",
":",
"y",
",",
"m",
"=",
"floatyear_to_date",
"(",
"year",
")",
"if",
"self",
".",
"repeat",
":",
"y",
"=",
"self",
".",
"ys",
"+",
"(",
"y",
"-",
"self",
"... | [
486,
4
] | [
522,
47
] | python | en | ['en', 'en', 'en'] | True |
PastMassBalance.get_annual_climate | (self, heights, year=None) | Annual climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other model biases (temp and prcp) are applied.
Returns
-------
(temp, tempformelt, prcp, prcpsol)
| Annual climate information at given heights. | def get_annual_climate(self, heights, year=None):
"""Annual climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other model biases (temp and prcp) are applied.
Returns
-------
(temp, tempformelt, prcp, prcpsol)
... | [
"def",
"get_annual_climate",
"(",
"self",
",",
"heights",
",",
"year",
"=",
"None",
")",
":",
"t",
",",
"tmelt",
",",
"prcp",
",",
"prcpsol",
"=",
"self",
".",
"_get_2d_annual_climate",
"(",
"heights",
",",
"year",
")",
"return",
"(",
"t",
".",
"mean",... | [
559,
4
] | [
571,
54
] | python | en | ['da', 'en', 'en'] | True |
ConstantMassBalance.__init__ | (self, gdir, mu_star=None, bias=None,
y0=None, halfsize=15, filename='climate_historical',
input_filesuffix='', **kwargs) | Initialize
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float, optional
set to the alternative value of mu* you want to use
(the default is to use the calibrated value)
bias : float, optional
set to... | Initialize | def __init__(self, gdir, mu_star=None, bias=None,
y0=None, halfsize=15, filename='climate_historical',
input_filesuffix='', **kwargs):
"""Initialize
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float,... | [
"def",
"__init__",
"(",
"self",
",",
"gdir",
",",
"mu_star",
"=",
"None",
",",
"bias",
"=",
"None",
",",
"y0",
"=",
"None",
",",
"halfsize",
"=",
"15",
",",
"filename",
"=",
"'climate_historical'",
",",
"input_filesuffix",
"=",
"''",
",",
"*",
"*",
"... | [
600,
4
] | [
659,
41
] | python | en | ['en', 'en', 'it'] | False |
ConstantMassBalance.temp_bias | (self) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self):
"""Temperature bias to add to the original series."""
return self.mbmod.temp_bias | [
"def",
"temp_bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"temp_bias"
] | [
662,
4
] | [
664,
35
] | python | en | ['en', 'en', 'en'] | True |
ConstantMassBalance.temp_bias | (self, value) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self, value):
"""Temperature bias to add to the original series."""
for attr_name in ['_lazy_interp_yr', '_lazy_interp_m']:
if hasattr(self, attr_name):
delattr(self, attr_name)
self.mbmod.temp_bias = value | [
"def",
"temp_bias",
"(",
"self",
",",
"value",
")",
":",
"for",
"attr_name",
"in",
"[",
"'_lazy_interp_yr'",
",",
"'_lazy_interp_m'",
"]",
":",
"if",
"hasattr",
"(",
"self",
",",
"attr_name",
")",
":",
"delattr",
"(",
"self",
",",
"attr_name",
")",
"self... | [
667,
4
] | [
672,
36
] | python | en | ['en', 'en', 'en'] | True |
ConstantMassBalance.prcp_fac | (self) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self):
"""Precipitation factor to apply to the original series."""
return self.mbmod.prcp_fac | [
"def",
"prcp_fac",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"prcp_fac"
] | [
675,
4
] | [
677,
34
] | python | en | ['en', 'pt', 'en'] | True |
ConstantMassBalance.prcp_fac | (self, value) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self, value):
"""Precipitation factor to apply to the original series."""
for attr_name in ['_lazy_interp_yr', '_lazy_interp_m']:
if hasattr(self, attr_name):
delattr(self, attr_name)
self.mbmod.prcp_fac = value | [
"def",
"prcp_fac",
"(",
"self",
",",
"value",
")",
":",
"for",
"attr_name",
"in",
"[",
"'_lazy_interp_yr'",
",",
"'_lazy_interp_m'",
"]",
":",
"if",
"hasattr",
"(",
"self",
",",
"attr_name",
")",
":",
"delattr",
"(",
"self",
",",
"attr_name",
")",
"self"... | [
680,
4
] | [
685,
35
] | python | en | ['en', 'pt', 'en'] | True |
ConstantMassBalance.bias | (self) | Residual bias to apply to the original series. | Residual bias to apply to the original series. | def bias(self):
"""Residual bias to apply to the original series."""
return self.mbmod.bias | [
"def",
"bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"bias"
] | [
688,
4
] | [
690,
30
] | python | en | ['en', 'lt', 'en'] | True |
ConstantMassBalance.bias | (self, value) | Residual bias to apply to the original series. | Residual bias to apply to the original series. | def bias(self, value):
"""Residual bias to apply to the original series."""
self.mbmod.bias = value | [
"def",
"bias",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"mbmod",
".",
"bias",
"=",
"value"
] | [
693,
4
] | [
695,
31
] | python | en | ['en', 'lt', 'en'] | True |
ConstantMassBalance.get_monthly_climate | (self, heights, year=None) | Average climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other biases (precipitation, temp) are applied
Returns
-------
(temp, tempformelt, prcp, prcpsol)
| Average climate information at given heights. | def get_monthly_climate(self, heights, year=None):
"""Average climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other biases (precipitation, temp) are applied
Returns
-------
(temp, tempformelt, prcp, prcpsol)
... | [
"def",
"get_monthly_climate",
"(",
"self",
",",
"heights",
",",
"year",
"=",
"None",
")",
":",
"_",
",",
"m",
"=",
"floatyear_to_date",
"(",
"year",
")",
"yrs",
"=",
"[",
"date_to_floatyear",
"(",
"y",
",",
"m",
")",
"for",
"y",
"in",
"self",
".",
... | [
718,
4
] | [
746,
41
] | python | en | ['da', 'en', 'en'] | True |
ConstantMassBalance.get_annual_climate | (self, heights, year=None) | Average climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other biases (precipitation, temp) are applied
Returns
-------
(temp, tempformelt, prcp, prcpsol)
| Average climate information at given heights. | def get_annual_climate(self, heights, year=None):
"""Average climate information at given heights.
Note that prcp is corrected with the precipitation factor and that
all other biases (precipitation, temp) are applied
Returns
-------
(temp, tempformelt, prcp, prcpsol)
... | [
"def",
"get_annual_climate",
"(",
"self",
",",
"heights",
",",
"year",
"=",
"None",
")",
":",
"yrs",
"=",
"monthly_timeseries",
"(",
"self",
".",
"years",
"[",
"0",
"]",
",",
"self",
".",
"years",
"[",
"-",
"1",
"]",
",",
"include_last_year",
"=",
"T... | [
748,
4
] | [
778,
46
] | python | en | ['da', 'en', 'en'] | True |
AvgClimateMassBalance.__init__ | (self, gdir, mu_star=None, bias=None,
filename='climate_historical', input_filesuffix='',
y0=None, halfsize=15, **kwargs) | Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float, optional
set to the alternative value of mu* you want to use
(the default is to use the calibrated value).
bias : float, optional
set ... | Initialize. | def __init__(self, gdir, mu_star=None, bias=None,
filename='climate_historical', input_filesuffix='',
y0=None, halfsize=15, **kwargs):
"""Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float... | [
"def",
"__init__",
"(",
"self",
",",
"gdir",
",",
"mu_star",
"=",
"None",
",",
"bias",
"=",
"None",
",",
"filename",
"=",
"'climate_historical'",
",",
"input_filesuffix",
"=",
"''",
",",
"y0",
"=",
"None",
",",
"halfsize",
"=",
"15",
",",
"*",
"*",
"... | [
804,
4
] | [
868,
40
] | python | en | ['en', 'en', 'it'] | False |
RandomMassBalance.__init__ | (self, gdir, mu_star=None, bias=None,
y0=None, halfsize=15, seed=None,
filename='climate_historical', input_filesuffix='',
all_years=False, unique_samples=False, prescribe_years=None,
**kwargs) | Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float, optional
set to the alternative value of mu* you want to use
(the default is to use the calibrated value)
bias : float, optional
set t... | Initialize. | def __init__(self, gdir, mu_star=None, bias=None,
y0=None, halfsize=15, seed=None,
filename='climate_historical', input_filesuffix='',
all_years=False, unique_samples=False, prescribe_years=None,
**kwargs):
"""Initialize.
Parameters
... | [
"def",
"__init__",
"(",
"self",
",",
"gdir",
",",
"mu_star",
"=",
"None",
",",
"bias",
"=",
"None",
",",
"y0",
"=",
"None",
",",
"halfsize",
"=",
"15",
",",
"seed",
"=",
"None",
",",
"filename",
"=",
"'climate_historical'",
",",
"input_filesuffix",
"="... | [
882,
4
] | [
963,
44
] | python | en | ['en', 'en', 'it'] | False |
RandomMassBalance.temp_bias | (self) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self):
"""Temperature bias to add to the original series."""
return self.mbmod.temp_bias | [
"def",
"temp_bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"temp_bias"
] | [
966,
4
] | [
968,
35
] | python | en | ['en', 'en', 'en'] | True |
RandomMassBalance.temp_bias | (self, value) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self, value):
"""Temperature bias to add to the original series."""
for attr_name in ['_lazy_interp_yr', '_lazy_interp_m']:
if hasattr(self, attr_name):
delattr(self, attr_name)
self.mbmod.temp_bias = value | [
"def",
"temp_bias",
"(",
"self",
",",
"value",
")",
":",
"for",
"attr_name",
"in",
"[",
"'_lazy_interp_yr'",
",",
"'_lazy_interp_m'",
"]",
":",
"if",
"hasattr",
"(",
"self",
",",
"attr_name",
")",
":",
"delattr",
"(",
"self",
",",
"attr_name",
")",
"self... | [
971,
4
] | [
976,
36
] | python | en | ['en', 'en', 'en'] | True |
RandomMassBalance.prcp_fac | (self) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self):
"""Precipitation factor to apply to the original series."""
return self.mbmod.prcp_fac | [
"def",
"prcp_fac",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"prcp_fac"
] | [
979,
4
] | [
981,
34
] | python | en | ['en', 'pt', 'en'] | True |
RandomMassBalance.prcp_fac | (self, value) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self, value):
"""Precipitation factor to apply to the original series."""
for attr_name in ['_lazy_interp_yr', '_lazy_interp_m']:
if hasattr(self, attr_name):
delattr(self, attr_name)
self.mbmod.prcp_fac = value | [
"def",
"prcp_fac",
"(",
"self",
",",
"value",
")",
":",
"for",
"attr_name",
"in",
"[",
"'_lazy_interp_yr'",
",",
"'_lazy_interp_m'",
"]",
":",
"if",
"hasattr",
"(",
"self",
",",
"attr_name",
")",
":",
"delattr",
"(",
"self",
",",
"attr_name",
")",
"self"... | [
984,
4
] | [
989,
35
] | python | en | ['en', 'pt', 'en'] | True |
RandomMassBalance.bias | (self) | Residual bias to apply to the original series. | Residual bias to apply to the original series. | def bias(self):
"""Residual bias to apply to the original series."""
return self.mbmod.bias | [
"def",
"bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"bias"
] | [
992,
4
] | [
994,
30
] | python | en | ['en', 'lt', 'en'] | True |
RandomMassBalance.bias | (self, value) | Residual bias to apply to the original series. | Residual bias to apply to the original series. | def bias(self, value):
"""Residual bias to apply to the original series."""
self.mbmod.bias = value | [
"def",
"bias",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"mbmod",
".",
"bias",
"=",
"value"
] | [
997,
4
] | [
999,
31
] | python | en | ['en', 'lt', 'en'] | True |
RandomMassBalance.get_state_yr | (self, year=None) | For a given year, get the random year associated to it. | For a given year, get the random year associated to it. | def get_state_yr(self, year=None):
"""For a given year, get the random year associated to it."""
year = int(year)
if year not in self._state_yr:
if self.prescribe_years is not None:
self._state_yr[year] = self.prescribe_years.loc[year]
else:
... | [
"def",
"get_state_yr",
"(",
"self",
",",
"year",
"=",
"None",
")",
":",
"year",
"=",
"int",
"(",
"year",
")",
"if",
"year",
"not",
"in",
"self",
".",
"_state_yr",
":",
"if",
"self",
".",
"prescribe_years",
"is",
"not",
"None",
":",
"self",
".",
"_s... | [
1001,
4
] | [
1024,
35
] | python | en | ['en', 'en', 'en'] | True |
UncertainMassBalance.__init__ | (self, basis_model,
rdn_temp_bias_seed=None, rdn_temp_bias_sigma=0.1,
rdn_prcp_bias_seed=None, rdn_prcp_bias_sigma=0.1,
rdn_bias_seed=None, rdn_bias_sigma=100) | Initialize.
Parameters
----------
basis_model : MassBalanceModel
the model to which you want to add the uncertainty to
rdn_temp_bias_seed : int
the seed of the random number generator
rdn_temp_bias_sigma : float
the standard deviation of the r... | Initialize. | def __init__(self, basis_model,
rdn_temp_bias_seed=None, rdn_temp_bias_sigma=0.1,
rdn_prcp_bias_seed=None, rdn_prcp_bias_sigma=0.1,
rdn_bias_seed=None, rdn_bias_sigma=100):
"""Initialize.
Parameters
----------
basis_model : MassBalanceM... | [
"def",
"__init__",
"(",
"self",
",",
"basis_model",
",",
"rdn_temp_bias_seed",
"=",
"None",
",",
"rdn_temp_bias_sigma",
"=",
"0.1",
",",
"rdn_prcp_bias_seed",
"=",
"None",
",",
"rdn_prcp_bias_sigma",
"=",
"0.1",
",",
"rdn_bias_seed",
"=",
"None",
",",
"rdn_bias_... | [
1045,
4
] | [
1083,
33
] | python | en | ['en', 'en', 'it'] | False |
UncertainMassBalance.temp_bias | (self) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self):
"""Temperature bias to add to the original series."""
return self.mbmod.temp_bias | [
"def",
"temp_bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"temp_bias"
] | [
1086,
4
] | [
1088,
35
] | python | en | ['en', 'en', 'en'] | True |
UncertainMassBalance.temp_bias | (self, value) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self, value):
"""Temperature bias to add to the original series."""
for attr_name in ['_lazy_interp_yr', '_lazy_interp_m']:
if hasattr(self, attr_name):
delattr(self, attr_name)
self.mbmod.temp_bias = value | [
"def",
"temp_bias",
"(",
"self",
",",
"value",
")",
":",
"for",
"attr_name",
"in",
"[",
"'_lazy_interp_yr'",
",",
"'_lazy_interp_m'",
"]",
":",
"if",
"hasattr",
"(",
"self",
",",
"attr_name",
")",
":",
"delattr",
"(",
"self",
",",
"attr_name",
")",
"self... | [
1091,
4
] | [
1096,
36
] | python | en | ['en', 'en', 'en'] | True |
UncertainMassBalance.prcp_fac | (self) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self):
"""Precipitation factor to apply to the original series."""
return self.mbmod.prcp_fac | [
"def",
"prcp_fac",
"(",
"self",
")",
":",
"return",
"self",
".",
"mbmod",
".",
"prcp_fac"
] | [
1099,
4
] | [
1101,
34
] | python | en | ['en', 'pt', 'en'] | True |
UncertainMassBalance.prcp_fac | (self, value) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self, value):
"""Precipitation factor to apply to the original series."""
self.mbmod.prcp_fac = value | [
"def",
"prcp_fac",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"mbmod",
".",
"prcp_fac",
"=",
"value"
] | [
1104,
4
] | [
1106,
35
] | python | en | ['en', 'pt', 'en'] | True |
MultipleFlowlineMassBalance.__init__ | (self, gdir, fls=None, mu_star=None,
mb_model_class=PastMassBalance, use_inversion_flowlines=False,
input_filesuffix='', bias=None, **kwargs) | Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier directory
mu_star : float or list of floats, optional
set to the alternative value of mu* you want to use
(the default is to use the calibrated value). Give a list of values
... | Initialize. | def __init__(self, gdir, fls=None, mu_star=None,
mb_model_class=PastMassBalance, use_inversion_flowlines=False,
input_filesuffix='', bias=None, **kwargs):
"""Initialize.
Parameters
----------
gdir : GlacierDirectory
the glacier directory
... | [
"def",
"__init__",
"(",
"self",
",",
"gdir",
",",
"fls",
"=",
"None",
",",
"mu_star",
"=",
"None",
",",
"mb_model_class",
"=",
"PastMassBalance",
",",
"use_inversion_flowlines",
"=",
"False",
",",
"input_filesuffix",
"=",
"''",
",",
"bias",
"=",
"None",
",... | [
1169,
4
] | [
1253,
41
] | python | en | ['en', 'en', 'it'] | False |
MultipleFlowlineMassBalance.temp_bias | (self) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self):
"""Temperature bias to add to the original series."""
return self.flowline_mb_models[0].temp_bias | [
"def",
"temp_bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"flowline_mb_models",
"[",
"0",
"]",
".",
"temp_bias"
] | [
1256,
4
] | [
1258,
51
] | python | en | ['en', 'en', 'en'] | True |
MultipleFlowlineMassBalance.temp_bias | (self, value) | Temperature bias to add to the original series. | Temperature bias to add to the original series. | def temp_bias(self, value):
"""Temperature bias to add to the original series."""
for mbmod in self.flowline_mb_models:
mbmod.temp_bias = value | [
"def",
"temp_bias",
"(",
"self",
",",
"value",
")",
":",
"for",
"mbmod",
"in",
"self",
".",
"flowline_mb_models",
":",
"mbmod",
".",
"temp_bias",
"=",
"value"
] | [
1261,
4
] | [
1264,
35
] | python | en | ['en', 'en', 'en'] | True |
MultipleFlowlineMassBalance.prcp_fac | (self) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self):
"""Precipitation factor to apply to the original series."""
return self.flowline_mb_models[0].prcp_fac | [
"def",
"prcp_fac",
"(",
"self",
")",
":",
"return",
"self",
".",
"flowline_mb_models",
"[",
"0",
"]",
".",
"prcp_fac"
] | [
1267,
4
] | [
1269,
50
] | python | en | ['en', 'pt', 'en'] | True |
MultipleFlowlineMassBalance.prcp_fac | (self, value) | Precipitation factor to apply to the original series. | Precipitation factor to apply to the original series. | def prcp_fac(self, value):
"""Precipitation factor to apply to the original series."""
for mbmod in self.flowline_mb_models:
mbmod.prcp_fac = value | [
"def",
"prcp_fac",
"(",
"self",
",",
"value",
")",
":",
"for",
"mbmod",
"in",
"self",
".",
"flowline_mb_models",
":",
"mbmod",
".",
"prcp_fac",
"=",
"value"
] | [
1272,
4
] | [
1275,
34
] | python | en | ['en', 'pt', 'en'] | True |
MultipleFlowlineMassBalance.bias | (self) | Residual bias to apply to the original series. | Residual bias to apply to the original series. | def bias(self):
"""Residual bias to apply to the original series."""
return self.flowline_mb_models[0].bias | [
"def",
"bias",
"(",
"self",
")",
":",
"return",
"self",
".",
"flowline_mb_models",
"[",
"0",
"]",
".",
"bias"
] | [
1278,
4
] | [
1280,
46
] | python | en | ['en', 'lt', 'en'] | True |
MultipleFlowlineMassBalance.bias | (self, value) | Residual bias to apply to the original series. | Residual bias to apply to the original series. | def bias(self, value):
"""Residual bias to apply to the original series."""
for mbmod in self.flowline_mb_models:
mbmod.bias = value | [
"def",
"bias",
"(",
"self",
",",
"value",
")",
":",
"for",
"mbmod",
"in",
"self",
".",
"flowline_mb_models",
":",
"mbmod",
".",
"bias",
"=",
"value"
] | [
1283,
4
] | [
1286,
30
] | python | en | ['en', 'lt', 'en'] | True |
MultipleFlowlineMassBalance.get_annual_mb_on_flowlines | (self, fls=None, year=None) | Get the MB on all points of the glacier at once.
Parameters
----------
fls: list, optional
the list of flowlines to get the mass-balance from. Defaults
to self.fls
year: float, optional
the time (in the "floating year" convention)
Returns
... | Get the MB on all points of the glacier at once. | def get_annual_mb_on_flowlines(self, fls=None, year=None):
"""Get the MB on all points of the glacier at once.
Parameters
----------
fls: list, optional
the list of flowlines to get the mass-balance from. Defaults
to self.fls
year: float, optional
... | [
"def",
"get_annual_mb_on_flowlines",
"(",
"self",
",",
"fls",
"=",
"None",
",",
"year",
"=",
"None",
")",
":",
"if",
"fls",
"is",
"None",
":",
"fls",
"=",
"self",
".",
"fls",
"heights",
"=",
"[",
"]",
"widths",
"=",
"[",
"]",
"mbs",
"=",
"[",
"]"... | [
1308,
4
] | [
1335,
35
] | python | en | ['en', 'en', 'en'] | True |
Installer._get_all_ns_packages | (self) | Return sorted list of all package namespaces | Return sorted list of all package namespaces | def _get_all_ns_packages(self):
"""Return sorted list of all package namespaces"""
pkgs = self.distribution.namespace_packages or []
return sorted(flatten(map(self._pkg_names, pkgs))) | [
"def",
"_get_all_ns_packages",
"(",
"self",
")",
":",
"pkgs",
"=",
"self",
".",
"distribution",
".",
"namespace_packages",
"or",
"[",
"]",
"return",
"sorted",
"(",
"flatten",
"(",
"map",
"(",
"self",
".",
"_pkg_names",
",",
"pkgs",
")",
")",
")"
] | [
80,
4
] | [
83,
58
] | python | en | ['en', 'en', 'en'] | True |
Installer._pkg_names | (pkg) |
Given a namespace package, yield the components of that
package.
>>> names = Installer._pkg_names('a.b.c')
>>> set(names) == set(['a', 'a.b', 'a.b.c'])
True
|
Given a namespace package, yield the components of that
package. | def _pkg_names(pkg):
"""
Given a namespace package, yield the components of that
package.
>>> names = Installer._pkg_names('a.b.c')
>>> set(names) == set(['a', 'a.b', 'a.b.c'])
True
"""
parts = pkg.split('.')
while parts:
yield '.'.joi... | [
"def",
"_pkg_names",
"(",
"pkg",
")",
":",
"parts",
"=",
"pkg",
".",
"split",
"(",
"'.'",
")",
"while",
"parts",
":",
"yield",
"'.'",
".",
"join",
"(",
"parts",
")",
"parts",
".",
"pop",
"(",
")"
] | [
86,
4
] | [
98,
23
] | python | en | ['en', 'error', 'th'] | False |
get_template | (template_name, using=None) |
Loads and returns a template for the given name.
Raises TemplateDoesNotExist if no such template exists.
|
Loads and returns a template for the given name. | def get_template(template_name, using=None):
"""
Loads and returns a template for the given name.
Raises TemplateDoesNotExist if no such template exists.
"""
chain = []
engines = _engine_list(using)
for engine in engines:
try:
return engine.get_template(template_name)
... | [
"def",
"get_template",
"(",
"template_name",
",",
"using",
"=",
"None",
")",
":",
"chain",
"=",
"[",
"]",
"engines",
"=",
"_engine_list",
"(",
"using",
")",
"for",
"engine",
"in",
"engines",
":",
"try",
":",
"return",
"engine",
".",
"get_template",
"(",
... | [
10,
0
] | [
24,
58
] | python | en | ['en', 'error', 'th'] | False |
select_template | (template_name_list, using=None) |
Loads and returns a template for one of the given names.
Tries names in order and returns the first template found.
Raises TemplateDoesNotExist if no such template exists.
|
Loads and returns a template for one of the given names. | def select_template(template_name_list, using=None):
"""
Loads and returns a template for one of the given names.
Tries names in order and returns the first template found.
Raises TemplateDoesNotExist if no such template exists.
"""
if isinstance(template_name_list, six.string_types):
... | [
"def",
"select_template",
"(",
"template_name_list",
",",
"using",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"template_name_list",
",",
"six",
".",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"'select_template() takes an iterable of template names but got... | [
27,
0
] | [
54,
64
] | python | en | ['en', 'error', 'th'] | False |
render_to_string | (template_name, context=None, request=None, using=None) |
Loads a template and renders it with a context. Returns a string.
template_name may be a string or a list of strings.
|
Loads a template and renders it with a context. Returns a string. | def render_to_string(template_name, context=None, request=None, using=None):
"""
Loads a template and renders it with a context. Returns a string.
template_name may be a string or a list of strings.
"""
if isinstance(template_name, (list, tuple)):
template = select_template(template_name, u... | [
"def",
"render_to_string",
"(",
"template_name",
",",
"context",
"=",
"None",
",",
"request",
"=",
"None",
",",
"using",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"template_name",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"template",
"=",
"s... | [
57,
0
] | [
67,
44
] | python | en | ['en', 'error', 'th'] | False |
find_module | (module, paths=None) | Just like 'imp.find_module()', but with package support | Just like 'imp.find_module()', but with package support | def find_module(module, paths=None):
"""Just like 'imp.find_module()', but with package support"""
spec = find_spec(module, paths)
if spec is None:
raise ImportError("Can't find %s" % module)
if not spec.has_location and hasattr(spec, 'submodule_search_locations'):
spec = importlib.util.... | [
"def",
"find_module",
"(",
"module",
",",
"paths",
"=",
"None",
")",
":",
"spec",
"=",
"find_spec",
"(",
"module",
",",
"paths",
")",
"if",
"spec",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"\"Can't find %s\"",
"%",
"module",
")",
"if",
"not",
"s... | [
28,
0
] | [
67,
43
] | python | en | ['en', 'en', 'en'] | True |
shquote | (arg) | Quote an argument for later parsing by shlex.split() | Quote an argument for later parsing by shlex.split() | def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in '"', "'", "\\", "#":
if c in arg:
return repr(arg)
if arg.split() != [arg]:
return repr(arg)
return arg | [
"def",
"shquote",
"(",
"arg",
")",
":",
"for",
"c",
"in",
"'\"'",
",",
"\"'\"",
",",
"\"\\\\\"",
",",
"\"#\"",
":",
"if",
"c",
"in",
"arg",
":",
"return",
"repr",
"(",
"arg",
")",
"if",
"arg",
".",
"split",
"(",
")",
"!=",
"[",
"arg",
"]",
":... | [
5,
0
] | [
12,
14
] | python | en | ['en', 'en', 'en'] | True |
Apps.populate | (self, installed_apps=None) |
Loads application configurations and models.
This method imports each application module and then each model module.
It is thread safe and idempotent, but not reentrant.
|
Loads application configurations and models. | def populate(self, installed_apps=None):
"""
Loads application configurations and models.
This method imports each application module and then each model module.
It is thread safe and idempotent, but not reentrant.
"""
if self.ready:
return
# popula... | [
"def",
"populate",
"(",
"self",
",",
"installed_apps",
"=",
"None",
")",
":",
"if",
"self",
".",
"ready",
":",
"return",
"# populate() might be called by two threads in parallel on servers",
"# that create threads before initializing the WSGI callable.",
"with",
"self",
".",
... | [
57,
4
] | [
117,
29
] | python | en | ['en', 'error', 'th'] | False |
Apps.check_apps_ready | (self) |
Raises an exception if all apps haven't been imported yet.
|
Raises an exception if all apps haven't been imported yet.
| def check_apps_ready(self):
"""
Raises an exception if all apps haven't been imported yet.
"""
if not self.apps_ready:
raise AppRegistryNotReady("Apps aren't loaded yet.") | [
"def",
"check_apps_ready",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"apps_ready",
":",
"raise",
"AppRegistryNotReady",
"(",
"\"Apps aren't loaded yet.\"",
")"
] | [
119,
4
] | [
124,
64
] | python | en | ['en', 'error', 'th'] | False |
Apps.check_models_ready | (self) |
Raises an exception if all models haven't been imported yet.
|
Raises an exception if all models haven't been imported yet.
| def check_models_ready(self):
"""
Raises an exception if all models haven't been imported yet.
"""
if not self.models_ready:
raise AppRegistryNotReady("Models aren't loaded yet.") | [
"def",
"check_models_ready",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"models_ready",
":",
"raise",
"AppRegistryNotReady",
"(",
"\"Models aren't loaded yet.\"",
")"
] | [
126,
4
] | [
131,
66
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_app_configs | (self) |
Imports applications and returns an iterable of app configs.
|
Imports applications and returns an iterable of app configs.
| def get_app_configs(self):
"""
Imports applications and returns an iterable of app configs.
"""
self.check_apps_ready()
return self.app_configs.values() | [
"def",
"get_app_configs",
"(",
"self",
")",
":",
"self",
".",
"check_apps_ready",
"(",
")",
"return",
"self",
".",
"app_configs",
".",
"values",
"(",
")"
] | [
133,
4
] | [
138,
40
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_app_config | (self, app_label) |
Imports applications and returns an app config for the given label.
Raises LookupError if no application exists with this label.
|
Imports applications and returns an app config for the given label. | def get_app_config(self, app_label):
"""
Imports applications and returns an app config for the given label.
Raises LookupError if no application exists with this label.
"""
self.check_apps_ready()
try:
return self.app_configs[app_label]
except KeyErr... | [
"def",
"get_app_config",
"(",
"self",
",",
"app_label",
")",
":",
"self",
".",
"check_apps_ready",
"(",
")",
"try",
":",
"return",
"self",
".",
"app_configs",
"[",
"app_label",
"]",
"except",
"KeyError",
":",
"message",
"=",
"\"No installed app with label '%s'.\... | [
140,
4
] | [
155,
38
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_models | (self, include_auto_created=False, include_swapped=False) |
Returns a list of all installed models.
By default, the following models aren't included:
- auto-created models for many-to-many relations without
an explicit intermediate table,
- models that have been swapped out.
Set the corresponding keyword argument to True to ... |
Returns a list of all installed models. | def get_models(self, include_auto_created=False, include_swapped=False):
"""
Returns a list of all installed models.
By default, the following models aren't included:
- auto-created models for many-to-many relations without
an explicit intermediate table,
- models tha... | [
"def",
"get_models",
"(",
"self",
",",
"include_auto_created",
"=",
"False",
",",
"include_swapped",
"=",
"False",
")",
":",
"self",
".",
"check_models_ready",
"(",
")",
"result",
"=",
"[",
"]",
"for",
"app_config",
"in",
"self",
".",
"app_configs",
".",
"... | [
159,
4
] | [
176,
21
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_model | (self, app_label, model_name=None, require_ready=True) |
Returns the model matching the given app_label and model_name.
As a shortcut, this function also accepts a single argument in the
form <app_label>.<model_name>.
model_name is case-insensitive.
Raises LookupError if no application exists with this label, or no
model ex... |
Returns the model matching the given app_label and model_name. | def get_model(self, app_label, model_name=None, require_ready=True):
"""
Returns the model matching the given app_label and model_name.
As a shortcut, this function also accepts a single argument in the
form <app_label>.<model_name>.
model_name is case-insensitive.
Rai... | [
"def",
"get_model",
"(",
"self",
",",
"app_label",
",",
"model_name",
"=",
"None",
",",
"require_ready",
"=",
"True",
")",
":",
"if",
"require_ready",
":",
"self",
".",
"check_models_ready",
"(",
")",
"else",
":",
"self",
".",
"check_apps_ready",
"(",
")",... | [
178,
4
] | [
204,
76
] | python | en | ['en', 'error', 'th'] | False |
Apps.is_installed | (self, app_name) |
Checks whether an application with this name exists in the registry.
app_name is the full name of the app eg. 'django.contrib.admin'.
|
Checks whether an application with this name exists in the registry. | def is_installed(self, app_name):
"""
Checks whether an application with this name exists in the registry.
app_name is the full name of the app eg. 'django.contrib.admin'.
"""
self.check_apps_ready()
return any(ac.name == app_name for ac in self.app_configs.values()) | [
"def",
"is_installed",
"(",
"self",
",",
"app_name",
")",
":",
"self",
".",
"check_apps_ready",
"(",
")",
"return",
"any",
"(",
"ac",
".",
"name",
"==",
"app_name",
"for",
"ac",
"in",
"self",
".",
"app_configs",
".",
"values",
"(",
")",
")"
] | [
228,
4
] | [
235,
75
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_containing_app_config | (self, object_name) |
Look for an app config containing a given object.
object_name is the dotted Python path to the object.
Returns the app config for the inner application in case of nesting.
Returns None if the object isn't in any registered app config.
|
Look for an app config containing a given object. | def get_containing_app_config(self, object_name):
"""
Look for an app config containing a given object.
object_name is the dotted Python path to the object.
Returns the app config for the inner application in case of nesting.
Returns None if the object isn't in any registered a... | [
"def",
"get_containing_app_config",
"(",
"self",
",",
"object_name",
")",
":",
"self",
".",
"check_apps_ready",
"(",
")",
"candidates",
"=",
"[",
"]",
"for",
"app_config",
"in",
"self",
".",
"app_configs",
".",
"values",
"(",
")",
":",
"if",
"object_name",
... | [
237,
4
] | [
254,
70
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_registered_model | (self, app_label, model_name) |
Similar to get_model(), but doesn't require that an app exists with
the given app_label.
It's safe to call this method at import time, even while the registry
is being populated.
|
Similar to get_model(), but doesn't require that an app exists with
the given app_label. | def get_registered_model(self, app_label, model_name):
"""
Similar to get_model(), but doesn't require that an app exists with
the given app_label.
It's safe to call this method at import time, even while the registry
is being populated.
"""
model = self.all_mode... | [
"def",
"get_registered_model",
"(",
"self",
",",
"app_label",
",",
"model_name",
")",
":",
"model",
"=",
"self",
".",
"all_models",
"[",
"app_label",
"]",
".",
"get",
"(",
"model_name",
".",
"lower",
"(",
")",
")",
"if",
"model",
"is",
"None",
":",
"ra... | [
256,
4
] | [
268,
20
] | python | en | ['en', 'error', 'th'] | False |
Apps.get_swappable_settings_name | (self, to_string) |
For a given model string (e.g. "auth.User"), return the name of the
corresponding settings name if it refers to a swappable model. If the
referred model is not swappable, return None.
This method is decorated with lru_cache because it's performance
critical when it comes to mig... |
For a given model string (e.g. "auth.User"), return the name of the
corresponding settings name if it refers to a swappable model. If the
referred model is not swappable, return None. | def get_swappable_settings_name(self, to_string):
"""
For a given model string (e.g. "auth.User"), return the name of the
corresponding settings name if it refers to a swappable model. If the
referred model is not swappable, return None.
This method is decorated with lru_cache b... | [
"def",
"get_swappable_settings_name",
"(",
"self",
",",
"to_string",
")",
":",
"for",
"model",
"in",
"self",
".",
"get_models",
"(",
"include_swapped",
"=",
"True",
")",
":",
"swapped",
"=",
"model",
".",
"_meta",
".",
"swapped",
"# Is this model swapped out for... | [
271,
4
] | [
290,
19
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.