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
GEOSGeometryBase._topology
(self, gptr)
Return Geometry from the given pointer.
Return Geometry from the given pointer.
def _topology(self, gptr): "Return Geometry from the given pointer." return GEOSGeometry(gptr, srid=self.srid)
[ "def", "_topology", "(", "self", ",", "gptr", ")", ":", "return", "GEOSGeometry", "(", "gptr", ",", "srid", "=", "self", ".", "srid", ")" ]
[ 488, 4 ]
[ 490, 49 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.boundary
(self)
Return the boundary as a newly allocated Geometry object.
Return the boundary as a newly allocated Geometry object.
def boundary(self): "Return the boundary as a newly allocated Geometry object." return self._topology(capi.geos_boundary(self.ptr))
[ "def", "boundary", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_boundary", "(", "self", ".", "ptr", ")", ")" ]
[ 493, 4 ]
[ 495, 59 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.buffer
(self, width, quadsegs=8)
Return a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry. The optional third parameter sets the number of segment used to approximate a quarter circle (defaults to ...
Return a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry. The optional third parameter sets the number of segment used to approximate a quarter circle (defaults to ...
def buffer(self, width, quadsegs=8): """ Return a geometry that represents all points whose distance from this Geometry is less than or equal to distance. Calculations are in the Spatial Reference System of this Geometry. The optional third parameter sets the number of segment us...
[ "def", "buffer", "(", "self", ",", "width", ",", "quadsegs", "=", "8", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_buffer", "(", "self", ".", "ptr", ",", "width", ",", "quadsegs", ")", ")" ]
[ 497, 4 ]
[ 505, 74 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.buffer_with_style
(self, width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0)
Same as buffer() but allows customizing the style of the buffer. End cap style can be round (1), flat (2), or square (3). Join style can be round (1), mitre (2), or bevel (3). Mitre ratio limit only affects mitered join style.
Same as buffer() but allows customizing the style of the buffer.
def buffer_with_style(self, width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0): """ Same as buffer() but allows customizing the style of the buffer. End cap style can be round (1), flat (2), or square (3). Join style can be round (1), mitre (2), or bevel (3). Mit...
[ "def", "buffer_with_style", "(", "self", ",", "width", ",", "quadsegs", "=", "8", ",", "end_cap_style", "=", "1", ",", "join_style", "=", "1", ",", "mitre_limit", "=", "5.0", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_bufferwit...
[ 507, 4 ]
[ 517, 9 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.centroid
(self)
The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).
The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid).
def centroid(self): """ The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid). """ return self._topology(capi.geos_centroid(self.ptr))
[ "def", "centroid", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_centroid", "(", "self", ".", "ptr", ")", ")" ]
[ 520, 4 ]
[ 526, 59 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.convex_hull
(self)
Return the smallest convex Polygon that contains all the points in the Geometry.
Return the smallest convex Polygon that contains all the points in the Geometry.
def convex_hull(self): """ Return the smallest convex Polygon that contains all the points in the Geometry. """ return self._topology(capi.geos_convexhull(self.ptr))
[ "def", "convex_hull", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_convexhull", "(", "self", ".", "ptr", ")", ")" ]
[ 529, 4 ]
[ 534, 61 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.difference
(self, other)
Return a Geometry representing the points making up this Geometry that do not make up other.
Return a Geometry representing the points making up this Geometry that do not make up other.
def difference(self, other): """ Return a Geometry representing the points making up this Geometry that do not make up other. """ return self._topology(capi.geos_difference(self.ptr, other.ptr))
[ "def", "difference", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_difference", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ")" ]
[ 536, 4 ]
[ 541, 72 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.envelope
(self)
Return the envelope for this geometry (a polygon).
Return the envelope for this geometry (a polygon).
def envelope(self): "Return the envelope for this geometry (a polygon)." return self._topology(capi.geos_envelope(self.ptr))
[ "def", "envelope", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_envelope", "(", "self", ".", "ptr", ")", ")" ]
[ 544, 4 ]
[ 546, 59 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.intersection
(self, other)
Return a Geometry representing the points shared by this Geometry and other.
Return a Geometry representing the points shared by this Geometry and other.
def intersection(self, other): "Return a Geometry representing the points shared by this Geometry and other." return self._topology(capi.geos_intersection(self.ptr, other.ptr))
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_intersection", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ")" ]
[ 548, 4 ]
[ 550, 74 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.point_on_surface
(self)
Compute an interior point of this Geometry.
Compute an interior point of this Geometry.
def point_on_surface(self): "Compute an interior point of this Geometry." return self._topology(capi.geos_pointonsurface(self.ptr))
[ "def", "point_on_surface", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_pointonsurface", "(", "self", ".", "ptr", ")", ")" ]
[ 553, 4 ]
[ 555, 65 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.relate
(self, other)
Return the DE-9IM intersection matrix for this Geometry and the other.
Return the DE-9IM intersection matrix for this Geometry and the other.
def relate(self, other): "Return the DE-9IM intersection matrix for this Geometry and the other." return capi.geos_relate(self.ptr, other.ptr).decode()
[ "def", "relate", "(", "self", ",", "other", ")", ":", "return", "capi", ".", "geos_relate", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ".", "decode", "(", ")" ]
[ 557, 4 ]
[ 559, 61 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.simplify
(self, tolerance=0.0, preserve_topology=False)
Return the Geometry, simplified using the Douglas-Peucker algorithm to the specified tolerance (higher tolerance => less points). If no tolerance provided, defaults to 0. By default, don't preserve topology - e.g. polygons can be split, collapse to lines or disappear holes can...
Return the Geometry, simplified using the Douglas-Peucker algorithm to the specified tolerance (higher tolerance => less points). If no tolerance provided, defaults to 0.
def simplify(self, tolerance=0.0, preserve_topology=False): """ Return the Geometry, simplified using the Douglas-Peucker algorithm to the specified tolerance (higher tolerance => less points). If no tolerance provided, defaults to 0. By default, don't preserve topology - e.g. ...
[ "def", "simplify", "(", "self", ",", "tolerance", "=", "0.0", ",", "preserve_topology", "=", "False", ")", ":", "if", "preserve_topology", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_preservesimplify", "(", "self", ".", "ptr", ",", "to...
[ 561, 4 ]
[ 576, 74 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.sym_difference
(self, other)
Return a set combining the points in this Geometry not in other, and the points in other not in this Geometry.
Return a set combining the points in this Geometry not in other, and the points in other not in this Geometry.
def sym_difference(self, other): """ Return a set combining the points in this Geometry not in other, and the points in other not in this Geometry. """ return self._topology(capi.geos_symdifference(self.ptr, other.ptr))
[ "def", "sym_difference", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_symdifference", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ")" ]
[ 578, 4 ]
[ 583, 75 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.unary_union
(self)
Return the union of all the elements of this geometry.
Return the union of all the elements of this geometry.
def unary_union(self): "Return the union of all the elements of this geometry." return self._topology(capi.geos_unary_union(self.ptr))
[ "def", "unary_union", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_unary_union", "(", "self", ".", "ptr", ")", ")" ]
[ 586, 4 ]
[ 588, 62 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.union
(self, other)
Return a Geometry representing all the points in this Geometry and other.
Return a Geometry representing all the points in this Geometry and other.
def union(self, other): "Return a Geometry representing all the points in this Geometry and other." return self._topology(capi.geos_union(self.ptr, other.ptr))
[ "def", "union", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_union", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ")" ]
[ 590, 4 ]
[ 592, 67 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.area
(self)
Return the area of the Geometry.
Return the area of the Geometry.
def area(self): "Return the area of the Geometry." return capi.geos_area(self.ptr, byref(c_double()))
[ "def", "area", "(", "self", ")", ":", "return", "capi", ".", "geos_area", "(", "self", ".", "ptr", ",", "byref", "(", "c_double", "(", ")", ")", ")" ]
[ 596, 4 ]
[ 598, 58 ]
python
en
['en', 'en', 'en']
True
GEOSGeometryBase.distance
(self, other)
Return the distance between the closest points on this Geometry and the other. Units will be in those of the coordinate system of the Geometry.
Return the distance between the closest points on this Geometry and the other. Units will be in those of the coordinate system of the Geometry.
def distance(self, other): """ Return the distance between the closest points on this Geometry and the other. Units will be in those of the coordinate system of the Geometry. """ if not isinstance(other, GEOSGeometry): raise TypeError('distance() works only on...
[ "def", "distance", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "GEOSGeometry", ")", ":", "raise", "TypeError", "(", "'distance() works only on other GEOS Geometries.'", ")", "return", "capi", ".", "geos_distance", "(", "sel...
[ 600, 4 ]
[ 608, 73 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.extent
(self)
Return the extent of this geometry as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).
Return the extent of this geometry as a 4-tuple, consisting of (xmin, ymin, xmax, ymax).
def extent(self): """ Return the extent of this geometry as a 4-tuple, consisting of (xmin, ymin, xmax, ymax). """ from .point import Point env = self.envelope if isinstance(env, Point): xmin, ymin = env.tuple xmax, ymax = xmin, ymin ...
[ "def", "extent", "(", "self", ")", ":", "from", ".", "point", "import", "Point", "env", "=", "self", ".", "envelope", "if", "isinstance", "(", "env", ",", "Point", ")", ":", "xmin", ",", "ymin", "=", "env", ".", "tuple", "xmax", ",", "ymax", "=", ...
[ 611, 4 ]
[ 624, 39 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.length
(self)
Return the length of this Geometry (e.g., 0 for point, or the circumference of a Polygon).
Return the length of this Geometry (e.g., 0 for point, or the circumference of a Polygon).
def length(self): """ Return the length of this Geometry (e.g., 0 for point, or the circumference of a Polygon). """ return capi.geos_length(self.ptr, byref(c_double()))
[ "def", "length", "(", "self", ")", ":", "return", "capi", ".", "geos_length", "(", "self", ".", "ptr", ",", "byref", "(", "c_double", "(", ")", ")", ")" ]
[ 627, 4 ]
[ 632, 60 ]
python
en
['en', 'error', 'th']
False
GEOSGeometryBase.clone
(self)
Clone this Geometry.
Clone this Geometry.
def clone(self): "Clone this Geometry." return GEOSGeometry(capi.geom_clone(self.ptr))
[ "def", "clone", "(", "self", ")", ":", "return", "GEOSGeometry", "(", "capi", ".", "geom_clone", "(", "self", ".", "ptr", ")", ")" ]
[ 634, 4 ]
[ 636, 54 ]
python
en
['en', 'sn', 'en']
True
LinearGeometryMixin.merged
(self)
Return the line merge of this Geometry.
Return the line merge of this Geometry.
def merged(self): """ Return the line merge of this Geometry. """ return self._topology(capi.geos_linemerge(self.ptr))
[ "def", "merged", "(", "self", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "geos_linemerge", "(", "self", ".", "ptr", ")", ")" ]
[ 662, 4 ]
[ 666, 60 ]
python
en
['en', 'error', 'th']
False
LinearGeometryMixin.closed
(self)
Return whether or not this Geometry is closed.
Return whether or not this Geometry is closed.
def closed(self): """ Return whether or not this Geometry is closed. """ return capi.geos_isclosed(self.ptr)
[ "def", "closed", "(", "self", ")", ":", "return", "capi", ".", "geos_isclosed", "(", "self", ".", "ptr", ")" ]
[ 669, 4 ]
[ 673, 43 ]
python
en
['en', 'error', 'th']
False
ResolveNamesRequest.__init__
(self, names, principal=None)
Initialize the request. :param names: The list of names to resolve.
Initialize the request.
def __init__(self, names, principal=None): """ Initialize the request. :param names: The list of names to resolve. """ body = M.ResolveNames( {'ReturnFullContactData': 'true'}, *[M.UnresolvedEntry(x) for x in names] ) kwargs = {} i...
[ "def", "__init__", "(", "self", ",", "names", ",", "principal", "=", "None", ")", ":", "body", "=", "M", ".", "ResolveNames", "(", "{", "'ReturnFullContactData'", ":", "'true'", "}", ",", "*", "[", "M", ".", "UnresolvedEntry", "(", "x", ")", "for", "...
[ 9, 4 ]
[ 22, 40 ]
python
en
['en', 'error', 'th']
False
ResolveNamesRequest.send
(self, sess)
Send the resolve request, and return a list of user info objects. :type sess: respa_exchange.session.ExchangeSession
Send the resolve request, and return a list of user info objects.
def send(self, sess): """ Send the resolve request, and return a list of user info objects. :type sess: respa_exchange.session.ExchangeSession """ resp = sess.soap(self) resolutions = resp.xpath("//t:Resolution", namespaces=NAMESPACES) return resolutions
[ "def", "send", "(", "self", ",", "sess", ")", ":", "resp", "=", "sess", ".", "soap", "(", "self", ")", "resolutions", "=", "resp", ".", "xpath", "(", "\"//t:Resolution\"", ",", "namespaces", "=", "NAMESPACES", ")", "return", "resolutions" ]
[ 24, 4 ]
[ 32, 26 ]
python
en
['en', 'error', 'th']
False
GetDelegateRequest.__init__
(self, email, principal=None)
Initialize the request. :param email: Email address of the user to query.
Initialize the request.
def __init__(self, email, principal=None): """ Initialize the request. :param email: Email address of the user to query. """ body = M.GetDelegate( {'IncludePermissions': 'true'}, M.Mailbox(T.EmailAddress(email)) ) kwargs = {} if pr...
[ "def", "__init__", "(", "self", ",", "email", ",", "principal", "=", "None", ")", ":", "body", "=", "M", ".", "GetDelegate", "(", "{", "'IncludePermissions'", ":", "'true'", "}", ",", "M", ".", "Mailbox", "(", "T", ".", "EmailAddress", "(", "email", ...
[ 40, 4 ]
[ 53, 40 ]
python
en
['en', 'error', 'th']
False
GetDelegateRequest.send
(self, sess)
Send the resolve request, and return a list of user info objects. :type sess: respa_exchange.session.ExchangeSession
Send the resolve request, and return a list of user info objects.
def send(self, sess): """ Send the resolve request, and return a list of user info objects. :type sess: respa_exchange.session.ExchangeSession """ resp = sess.soap(self) resolutions = resp.xpath("//t:Resolution", namespaces=NAMESPACES) return resolutions
[ "def", "send", "(", "self", ",", "sess", ")", ":", "resp", "=", "sess", ".", "soap", "(", "self", ")", "resolutions", "=", "resp", ".", "xpath", "(", "\"//t:Resolution\"", ",", "namespaces", "=", "NAMESPACES", ")", "return", "resolutions" ]
[ 55, 4 ]
[ 63, 26 ]
python
en
['en', 'error', 'th']
False
write_pot_file
(potfile, msgs)
Write the :param potfile: POT file with the :param msgs: contents, previously making sure its format is valid.
Write the :param potfile: POT file with the :param msgs: contents, previously making sure its format is valid.
def write_pot_file(potfile, msgs): """ Write the :param potfile: POT file with the :param msgs: contents, previously making sure its format is valid. """ if os.path.exists(potfile): # Strip the header msgs = '\n'.join(dropwhile(len, msgs.split('\n'))) else: msgs = msgs.re...
[ "def", "write_pot_file", "(", "potfile", ",", "msgs", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "potfile", ")", ":", "# Strip the header", "msgs", "=", "'\\n'", ".", "join", "(", "dropwhile", "(", "len", ",", "msgs", ".", "split", "(", "...
[ 149, 0 ]
[ 160, 22 ]
python
en
['en', 'error', 'th']
False
Command.build_potfiles
(self)
Build pot files and apply msguniq to them.
Build pot files and apply msguniq to them.
def build_potfiles(self): """ Build pot files and apply msguniq to them. """ file_list = self.find_files(".") self.remove_potfiles() for f in file_list: try: f.process(self, self.domain) except UnicodeDecodeError: se...
[ "def", "build_potfiles", "(", "self", ")", ":", "file_list", "=", "self", ".", "find_files", "(", "\".\"", ")", "self", ".", "remove_potfiles", "(", ")", "for", "f", "in", "file_list", ":", "try", ":", "f", ".", "process", "(", "self", ",", "self", "...
[ 313, 4 ]
[ 343, 23 ]
python
en
['en', 'error', 'th']
False
Command.find_files
(self, root)
Helper method to get all files in the given root. Also check that there is a matching locale dir for each file.
Helper method to get all files in the given root. Also check that there is a matching locale dir for each file.
def find_files(self, root): """ Helper method to get all files in the given root. Also check that there is a matching locale dir for each file. """ def is_ignored(path, ignore_patterns): """ Check if the given path should be ignored or not. ""...
[ "def", "find_files", "(", "self", ",", "root", ")", ":", "def", "is_ignored", "(", "path", ",", "ignore_patterns", ")", ":", "\"\"\"\n Check if the given path should be ignored or not.\n \"\"\"", "filename", "=", "os", ".", "path", ".", "basename",...
[ 351, 4 ]
[ 404, 32 ]
python
en
['en', 'error', 'th']
False
Command.write_po_file
(self, potfile, locale)
Creates or updates the PO file for self.domain and :param locale:. Uses contents of the existing :param potfile:. Uses msgmerge, and msgattrib GNU gettext utilities.
Creates or updates the PO file for self.domain and :param locale:. Uses contents of the existing :param potfile:.
def write_po_file(self, potfile, locale): """ Creates or updates the PO file for self.domain and :param locale:. Uses contents of the existing :param potfile:. Uses msgmerge, and msgattrib GNU gettext utilities. """ basedir = os.path.join(os.path.dirname(potfile), locale...
[ "def", "write_po_file", "(", "self", ",", "potfile", ",", "locale", ")", ":", "basedir", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "potfile", ")", ",", "locale", ",", "'LC_MESSAGES'", ")", "if", "not", "os", ...
[ 406, 4 ]
[ 447, 45 ]
python
en
['en', 'error', 'th']
False
Command.copy_plural_forms
(self, msgs, locale)
Copies plural forms header contents from a Django catalog of locale to the msgs string, inserting it at the right place. msgs should be the contents of a newly created .po file.
Copies plural forms header contents from a Django catalog of locale to the msgs string, inserting it at the right place. msgs should be the contents of a newly created .po file.
def copy_plural_forms(self, msgs, locale): """ Copies plural forms header contents from a Django catalog of locale to the msgs string, inserting it at the right place. msgs should be the contents of a newly created .po file. """ django_dir = os.path.normpath(os.path.join(...
[ "def", "copy_plural_forms", "(", "self", ",", "msgs", ",", "locale", ")", ":", "django_dir", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "django", ".", "__file__", ")", ...
[ 449, 4 ]
[ 478, 19 ]
python
en
['en', 'error', 'th']
False
_parse_codestream
(fp)
Parse the JPEG 2000 codestream to extract the size and component count from the SIZ marker segment, returning a PIL (size, mode) tuple.
Parse the JPEG 2000 codestream to extract the size and component count from the SIZ marker segment, returning a PIL (size, mode) tuple.
def _parse_codestream(fp): """Parse the JPEG 2000 codestream to extract the size and component count from the SIZ marker segment, returning a PIL (size, mode) tuple.""" hdr = fp.read(2) lsiz = struct.unpack(">H", hdr)[0] siz = hdr + fp.read(lsiz - 2) lsiz, rsiz, xsiz, ysiz, xosiz, yosiz, _, _, ...
[ "def", "_parse_codestream", "(", "fp", ")", ":", "hdr", "=", "fp", ".", "read", "(", "2", ")", "lsiz", "=", "struct", ".", "unpack", "(", "\">H\"", ",", "hdr", ")", "[", "0", "]", "siz", "=", "hdr", "+", "fp", ".", "read", "(", "lsiz", "-", "...
[ 21, 0 ]
[ 52, 23 ]
python
en
['en', 'en', 'en']
True
_parse_jp2_header
(fp)
Parse the JP2 header box to extract size, component count and color space information, returning a (size, mode, mimetype) tuple.
Parse the JP2 header box to extract size, component count and color space information, returning a (size, mode, mimetype) tuple.
def _parse_jp2_header(fp): """Parse the JP2 header box to extract size, component count and color space information, returning a (size, mode, mimetype) tuple.""" # Find the JP2 header box header = None mimetype = None while True: lbox, tbox = struct.unpack(">I4s", fp.read(8)) if...
[ "def", "_parse_jp2_header", "(", "fp", ")", ":", "# Find the JP2 header box", "header", "=", "None", "mimetype", "=", "None", "while", "True", ":", "lbox", ",", "tbox", "=", "struct", ".", "unpack", "(", "\">I4s\"", ",", "fp", ".", "read", "(", "8", ")",...
[ 55, 0 ]
[ 149, 33 ]
python
en
['en', 'en', 'en']
True
bool_output
(func, argtypes, errcheck=None)
Generate a ctypes function that returns a boolean value.
Generate a ctypes function that returns a boolean value.
def bool_output(func, argtypes, errcheck=None): """Generate a ctypes function that returns a boolean value.""" func.argtypes = argtypes func.restype = c_bool if errcheck: func.errcheck = errcheck return func
[ "def", "bool_output", "(", "func", ",", "argtypes", ",", "errcheck", "=", "None", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "c_bool", "if", "errcheck", ":", "func", ".", "errcheck", "=", "errcheck", "return", "func"...
[ 19, 0 ]
[ 25, 15 ]
python
en
['en', 'en', 'en']
True
double_output
(func, argtypes, errcheck=False, strarg=False, cpl=False)
Generate a ctypes function that returns a double value.
Generate a ctypes function that returns a double value.
def double_output(func, argtypes, errcheck=False, strarg=False, cpl=False): "Generate a ctypes function that returns a double value." func.argtypes = argtypes func.restype = c_double if errcheck: func.errcheck = partial(check_arg_errcode, cpl=cpl) if strarg: func.errcheck = check_str...
[ "def", "double_output", "(", "func", ",", "argtypes", ",", "errcheck", "=", "False", ",", "strarg", "=", "False", ",", "cpl", "=", "False", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "c_double", "if", "errcheck", "...
[ 28, 0 ]
[ 36, 15 ]
python
en
['en', 'en', 'en']
True
geom_output
(func, argtypes, offset=None)
Generate a function that returns a Geometry either by reference or directly (if the return_geom keyword is set to True).
Generate a function that returns a Geometry either by reference or directly (if the return_geom keyword is set to True).
def geom_output(func, argtypes, offset=None): """ Generate a function that returns a Geometry either by reference or directly (if the return_geom keyword is set to True). """ # Setting the argument types func.argtypes = argtypes if not offset: # When a geometry pointer is directly r...
[ "def", "geom_output", "(", "func", ",", "argtypes", ",", "offset", "=", "None", ")", ":", "# Setting the argument types", "func", ".", "argtypes", "=", "argtypes", "if", "not", "offset", ":", "# When a geometry pointer is directly returned.", "func", ".", "restype",...
[ 39, 0 ]
[ 59, 15 ]
python
en
['en', 'error', 'th']
False
int_output
(func, argtypes, errcheck=None)
Generate a ctypes function that returns an integer value.
Generate a ctypes function that returns an integer value.
def int_output(func, argtypes, errcheck=None): "Generate a ctypes function that returns an integer value." func.argtypes = argtypes func.restype = c_int if errcheck: func.errcheck = errcheck return func
[ "def", "int_output", "(", "func", ",", "argtypes", ",", "errcheck", "=", "None", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "c_int", "if", "errcheck", ":", "func", ".", "errcheck", "=", "errcheck", "return", "func" ]
[ 62, 0 ]
[ 68, 15 ]
python
en
['en', 'en', 'en']
True
int64_output
(func, argtypes)
Generate a ctypes function that returns a 64-bit integer value.
Generate a ctypes function that returns a 64-bit integer value.
def int64_output(func, argtypes): "Generate a ctypes function that returns a 64-bit integer value." func.argtypes = argtypes func.restype = c_int64 return func
[ "def", "int64_output", "(", "func", ",", "argtypes", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "c_int64", "return", "func" ]
[ 71, 0 ]
[ 75, 15 ]
python
en
['en', 'en', 'en']
True
srs_output
(func, argtypes)
Generate a ctypes prototype for the given function with the given C arguments that returns a pointer to an OGR Spatial Reference System.
Generate a ctypes prototype for the given function with the given C arguments that returns a pointer to an OGR Spatial Reference System.
def srs_output(func, argtypes): """ Generate a ctypes prototype for the given function with the given C arguments that returns a pointer to an OGR Spatial Reference System. """ func.argtypes = argtypes func.restype = c_void_p func.errcheck = check_srs return func
[ "def", "srs_output", "(", "func", ",", "argtypes", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "c_void_p", "func", ".", "errcheck", "=", "check_srs", "return", "func" ]
[ 78, 0 ]
[ 87, 15 ]
python
en
['en', 'error', 'th']
False
string_output
(func, argtypes, offset=-1, str_result=False, decoding=None)
Generate a ctypes prototype for the given function with the given argument types that returns a string from a GDAL pointer. The `const` flag indicates whether the allocated pointer should be freed via the GDAL library routine VSIFree -- but only applies only when `str_result` is True.
Generate a ctypes prototype for the given function with the given argument types that returns a string from a GDAL pointer. The `const` flag indicates whether the allocated pointer should be freed via the GDAL library routine VSIFree -- but only applies only when `str_result` is True.
def string_output(func, argtypes, offset=-1, str_result=False, decoding=None): """ Generate a ctypes prototype for the given function with the given argument types that returns a string from a GDAL pointer. The `const` flag indicates whether the allocated pointer should be freed via the GDAL library...
[ "def", "string_output", "(", "func", ",", "argtypes", ",", "offset", "=", "-", "1", ",", "str_result", "=", "False", ",", "decoding", "=", "None", ")", ":", "func", ".", "argtypes", "=", "argtypes", "if", "str_result", ":", "# Use subclass of c_char_p so the...
[ 107, 0 ]
[ 132, 15 ]
python
en
['en', 'error', 'th']
False
void_output
(func, argtypes, errcheck=True, cpl=False)
For functions that don't only return an error code that needs to be examined.
For functions that don't only return an error code that needs to be examined.
def void_output(func, argtypes, errcheck=True, cpl=False): """ For functions that don't only return an error code that needs to be examined. """ if argtypes: func.argtypes = argtypes if errcheck: # `errcheck` keyword may be set to False for routines that # return void, ra...
[ "def", "void_output", "(", "func", ",", "argtypes", ",", "errcheck", "=", "True", ",", "cpl", "=", "False", ")", ":", "if", "argtypes", ":", "func", ".", "argtypes", "=", "argtypes", "if", "errcheck", ":", "# `errcheck` keyword may be set to False for routines t...
[ 135, 0 ]
[ 150, 15 ]
python
en
['en', 'error', 'th']
False
voidptr_output
(func, argtypes, errcheck=True)
For functions that return c_void_p.
For functions that return c_void_p.
def voidptr_output(func, argtypes, errcheck=True): "For functions that return c_void_p." func.argtypes = argtypes func.restype = c_void_p if errcheck: func.errcheck = check_pointer return func
[ "def", "voidptr_output", "(", "func", ",", "argtypes", ",", "errcheck", "=", "True", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "c_void_p", "if", "errcheck", ":", "func", ".", "errcheck", "=", "check_pointer", "return"...
[ 153, 0 ]
[ 159, 15 ]
python
en
['en', 'en', 'en']
True
chararray_output
(func, argtypes, errcheck=True)
For functions that return a c_char_p array.
For functions that return a c_char_p array.
def chararray_output(func, argtypes, errcheck=True): """For functions that return a c_char_p array.""" func.argtypes = argtypes func.restype = POINTER(c_char_p) if errcheck: func.errcheck = check_pointer return func
[ "def", "chararray_output", "(", "func", ",", "argtypes", ",", "errcheck", "=", "True", ")", ":", "func", ".", "argtypes", "=", "argtypes", "func", ".", "restype", "=", "POINTER", "(", "c_char_p", ")", "if", "errcheck", ":", "func", ".", "errcheck", "=", ...
[ 162, 0 ]
[ 168, 15 ]
python
en
['en', 'en', 'en']
True
LogEntry.get_change_message
(self)
If self.change_message is a JSON structure, interpret it as a change string, properly translated.
If self.change_message is a JSON structure, interpret it as a change string, properly translated.
def get_change_message(self): """ If self.change_message is a JSON structure, interpret it as a change string, properly translated. """ if self.change_message and self.change_message[0] == '[': try: change_message = json.loads(self.change_message) ...
[ "def", "get_change_message", "(", "self", ")", ":", "if", "self", ".", "change_message", "and", "self", ".", "change_message", "[", "0", "]", "==", "'['", ":", "try", ":", "change_message", "=", "json", ".", "loads", "(", "self", ".", "change_message", "...
[ 95, 4 ]
[ 133, 38 ]
python
en
['en', 'error', 'th']
False
LogEntry.get_edited_object
(self)
Return the edited object represented by this log entry.
Return the edited object represented by this log entry.
def get_edited_object(self): """Return the edited object represented by this log entry.""" return self.content_type.get_object_for_this_type(pk=self.object_id)
[ "def", "get_edited_object", "(", "self", ")", ":", "return", "self", ".", "content_type", ".", "get_object_for_this_type", "(", "pk", "=", "self", ".", "object_id", ")" ]
[ 135, 4 ]
[ 137, 76 ]
python
en
['en', 'en', 'en']
True
LogEntry.get_admin_url
(self)
Return the admin URL to edit the object represented by this log entry.
Return the admin URL to edit the object represented by this log entry.
def get_admin_url(self): """ Return the admin URL to edit the object represented by this log entry. """ if self.content_type and self.object_id: url_name = 'admin:%s_%s_change' % (self.content_type.app_label, self.content_type.model) try: return re...
[ "def", "get_admin_url", "(", "self", ")", ":", "if", "self", ".", "content_type", "and", "self", ".", "object_id", ":", "url_name", "=", "'admin:%s_%s_change'", "%", "(", "self", ".", "content_type", ".", "app_label", ",", "self", ".", "content_type", ".", ...
[ 139, 4 ]
[ 149, 19 ]
python
en
['en', 'error', 'th']
False
create_reverse_many_to_one_manager
(superclass, rel)
Create a manager for the reverse side of a many-to-one relation. This manager subclasses another manager, generally the default manager of the related model, and adds behaviors specific to many-to-one relations.
Create a manager for the reverse side of a many-to-one relation.
def create_reverse_many_to_one_manager(superclass, rel): """ Create a manager for the reverse side of a many-to-one relation. This manager subclasses another manager, generally the default manager of the related model, and adds behaviors specific to many-to-one relations. """ class RelatedMana...
[ "def", "create_reverse_many_to_one_manager", "(", "superclass", ",", "rel", ")", ":", "class", "RelatedManager", "(", "superclass", ")", ":", "def", "__init__", "(", "self", ",", "instance", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", "...
[ 549, 0 ]
[ 752, 25 ]
python
en
['en', 'error', 'th']
False
create_forward_many_to_many_manager
(superclass, rel, reverse)
Create a manager for the either side of a many-to-many relation. This manager subclasses another manager, generally the default manager of the related model, and adds behaviors specific to many-to-many relations.
Create a manager for the either side of a many-to-many relation.
def create_forward_many_to_many_manager(superclass, rel, reverse): """ Create a manager for the either side of a many-to-many relation. This manager subclasses another manager, generally the default manager of the related model, and adds behaviors specific to many-to-many relations. """ class ...
[ "def", "create_forward_many_to_many_manager", "(", "superclass", ",", "rel", ",", "reverse", ")", ":", "class", "ManyRelatedManager", "(", "superclass", ")", ":", "def", "__init__", "(", "self", ",", "instance", "=", "None", ")", ":", "super", "(", ")", ".",...
[ 801, 0 ]
[ 1198, 29 ]
python
en
['en', 'error', 'th']
False
ForwardManyToOneDescriptor.__get__
(self, instance, cls=None)
Get the related instance through the forward relation. With the example above, when getting ``child.parent``: - ``self`` is the descriptor managing the ``parent`` attribute - ``instance`` is the ``child`` instance - ``cls`` is the ``Child`` class (we don't need it)
Get the related instance through the forward relation.
def __get__(self, instance, cls=None): """ Get the related instance through the forward relation. With the example above, when getting ``child.parent``: - ``self`` is the descriptor managing the ``parent`` attribute - ``instance`` is the ``child`` instance - ``cls`` is ...
[ "def", "__get__", "(", "self", ",", "instance", ",", "cls", "=", "None", ")", ":", "if", "instance", "is", "None", ":", "return", "self", "# The related instance is loaded from the database and then cached", "# by the field on the model instance state. It can also be pre-cach...
[ 154, 4 ]
[ 199, 26 ]
python
en
['en', 'error', 'th']
False
ForwardManyToOneDescriptor.__set__
(self, instance, value)
Set the related instance through the forward relation. With the example above, when setting ``child.parent = parent``: - ``self`` is the descriptor managing the ``parent`` attribute - ``instance`` is the ``child`` instance - ``value`` is the ``parent`` instance on the right of...
Set the related instance through the forward relation.
def __set__(self, instance, value): """ Set the related instance through the forward relation. With the example above, when setting ``child.parent = parent``: - ``self`` is the descriptor managing the ``parent`` attribute - ``instance`` is the ``child`` instance - ``val...
[ "def", "__set__", "(", "self", ",", "instance", ",", "value", ")", ":", "# An object must be an instance of the related class.", "if", "value", "is", "not", "None", "and", "not", "isinstance", "(", "value", ",", "self", ".", "field", ".", "remote_field", ".", ...
[ 201, 4 ]
[ 265, 58 ]
python
en
['en', 'error', 'th']
False
ForwardManyToOneDescriptor.__reduce__
(self)
Pickling should return the instance attached by self.field on the model, not a new copy of that descriptor. Use getattr() to retrieve the instance directly from the model.
Pickling should return the instance attached by self.field on the model, not a new copy of that descriptor. Use getattr() to retrieve the instance directly from the model.
def __reduce__(self): """ Pickling should return the instance attached by self.field on the model, not a new copy of that descriptor. Use getattr() to retrieve the instance directly from the model. """ return getattr, (self.field.model, self.field.name)
[ "def", "__reduce__", "(", "self", ")", ":", "return", "getattr", ",", "(", "self", ".", "field", ".", "model", ",", "self", ".", "field", ".", "name", ")" ]
[ 267, 4 ]
[ 273, 59 ]
python
en
['en', 'error', 'th']
False
ReverseOneToOneDescriptor.__get__
(self, instance, cls=None)
Get the related instance through the reverse relation. With the example above, when getting ``place.restaurant``: - ``self`` is the descriptor managing the ``restaurant`` attribute - ``instance`` is the ``place`` instance - ``cls`` is the ``Place`` class (unused) Keep...
Get the related instance through the reverse relation.
def __get__(self, instance, cls=None): """ Get the related instance through the reverse relation. With the example above, when getting ``place.restaurant``: - ``self`` is the descriptor managing the ``restaurant`` attribute - ``instance`` is the ``place`` instance - ``c...
[ "def", "__get__", "(", "self", ",", "instance", ",", "cls", "=", "None", ")", ":", "if", "instance", "is", "None", ":", "return", "self", "# The related instance is loaded from the database and then cached", "# by the field on the model instance state. It can also be pre-cach...
[ 381, 4 ]
[ 426, 26 ]
python
en
['en', 'error', 'th']
False
ReverseOneToOneDescriptor.__set__
(self, instance, value)
Set the related instance through the reverse relation. With the example above, when setting ``place.restaurant = restaurant``: - ``self`` is the descriptor managing the ``restaurant`` attribute - ``instance`` is the ``place`` instance - ``value`` is the ``restaurant`` instance...
Set the related instance through the reverse relation.
def __set__(self, instance, value): """ Set the related instance through the reverse relation. With the example above, when setting ``place.restaurant = restaurant``: - ``self`` is the descriptor managing the ``restaurant`` attribute - ``instance`` is the ``place`` instance ...
[ "def", "__set__", "(", "self", ",", "instance", ",", "value", ")", ":", "# The similarity of the code below to the code in", "# ForwardManyToOneDescriptor is annoying, but there's a bunch", "# of small differences that would make a common base class convoluted.", "if", "value", "is", ...
[ 428, 4 ]
[ 485, 64 ]
python
en
['en', 'error', 'th']
False
ReverseManyToOneDescriptor.__get__
(self, instance, cls=None)
Get the related objects through the reverse relation. With the example above, when getting ``parent.children``: - ``self`` is the descriptor managing the ``children`` attribute - ``instance`` is the ``parent`` instance - ``cls`` is the ``Parent`` class (unused)
Get the related objects through the reverse relation.
def __get__(self, instance, cls=None): """ Get the related objects through the reverse relation. With the example above, when getting ``parent.children``: - ``self`` is the descriptor managing the ``children`` attribute - ``instance`` is the ``parent`` instance - ``cls`...
[ "def", "__get__", "(", "self", ",", "instance", ",", "cls", "=", "None", ")", ":", "if", "instance", "is", "None", ":", "return", "self", "return", "self", ".", "related_manager_cls", "(", "instance", ")" ]
[ 521, 4 ]
[ 534, 49 ]
python
en
['en', 'error', 'th']
False
_BinaryPlistParser._get_size
(self, tokenL)
return the size of the next object.
return the size of the next object.
def _get_size(self, tokenL): """ return the size of the next object.""" if tokenL == 0xF: m = ord(self._fp.read(1)[0]) & 0x3 s = 1 << m f = '>' + _BINARY_FORMAT[s] return struct.unpack(f, self._fp.read(s))[0] return tokenL
[ "def", "_get_size", "(", "self", ",", "tokenL", ")", ":", "if", "tokenL", "==", "0xF", ":", "m", "=", "ord", "(", "self", ".", "_fp", ".", "read", "(", "1", ")", "[", "0", "]", ")", "&", "0x3", "s", "=", "1", "<<", "m", "f", "=", "'>'", "...
[ 233, 4 ]
[ 241, 21 ]
python
en
['en', 'en', 'en']
True
_BinaryPlistParser._read_object
(self, ref)
read the object by reference. May recursively read sub-objects (content of an array/dict/set)
read the object by reference. May recursively read sub-objects (content of an array/dict/set)
def _read_object(self, ref): """ read the object by reference. May recursively read sub-objects (content of an array/dict/set) """ result = self._objects[ref] if result is not _undefined: return result offset = self._object_offsets[ref] self._...
[ "def", "_read_object", "(", "self", ",", "ref", ")", ":", "result", "=", "self", ".", "_objects", "[", "ref", "]", "if", "result", "is", "not", "_undefined", ":", "return", "result", "offset", "=", "self", ".", "_object_offsets", "[", "ref", "]", "self...
[ 256, 4 ]
[ 353, 21 ]
python
en
['en', 'error', 'th']
False
RealmTest.test_do_set_realm_name_caching
(self)
The main complicated thing about setting realm names is fighting the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that the new value is there.
The main complicated thing about setting realm names is fighting the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that the new value is there.
def test_do_set_realm_name_caching(self) -> None: """The main complicated thing about setting realm names is fighting the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that the new value is there.""" realm = get_realm("zulip") ...
[ "def", "test_do_set_realm_name_caching", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "new_name", "=", "\"Zed You Elle Eye Pea\"", "do_set_realm_property", "(", "realm", ",", "\"name\"", ",", "new_name", ",", "acting_user", ...
[ 58, 4 ]
[ 66, 91 ]
python
en
['en', 'en', 'en']
True
RealmTest.test_do_deactivate_realm_clears_user_realm_cache
(self)
The main complicated thing about deactivating realm names is updating the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that his realm appears to be deactivated. You can make this test fail by disabling cache.flush_realm().
The main complicated thing about deactivating realm names is updating the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that his realm appears to be deactivated. You can make this test fail by disabling cache.flush_realm().
def test_do_deactivate_realm_clears_user_realm_cache(self) -> None: """The main complicated thing about deactivating realm names is updating the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that his realm appears to be deactivated. Y...
[ "def", "test_do_deactivate_realm_clears_user_realm_cache", "(", "self", ")", "->", "None", ":", "hamlet_id", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", ".", "id", "get_user_profile_by_id", "(", "hamlet_id", ")", "realm", "=", "get_realm", "(", "\"zu...
[ 174, 4 ]
[ 185, 47 ]
python
en
['en', 'en', 'en']
True
RealmTest.test_do_change_realm_subdomain_clears_user_realm_cache
(self)
The main complicated thing about changing realm subdomains is updating the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that his realm appears to be deactivated. You can make this test fail by disabling cache.flush_realm().
The main complicated thing about changing realm subdomains is updating the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that his realm appears to be deactivated. You can make this test fail by disabling cache.flush_realm().
def test_do_change_realm_subdomain_clears_user_realm_cache(self) -> None: """The main complicated thing about changing realm subdomains is updating the cache, and we start by populating the cache for Hamlet, and we end by checking the cache to ensure that his realm appears to be deactiva...
[ "def", "test_do_change_realm_subdomain_clears_user_realm_cache", "(", "self", ")", "->", "None", ":", "hamlet_id", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", ".", "id", "user", "=", "get_user_profile_by_id", "(", "hamlet_id", ")", "realm", "=", "get...
[ 187, 4 ]
[ 210, 59 ]
python
en
['en', 'en', 'en']
True
RealmTest.test_do_deactivate_realm_on_deactivated_realm
(self)
Ensure early exit is working in realm deactivation
Ensure early exit is working in realm deactivation
def test_do_deactivate_realm_on_deactivated_realm(self) -> None: """Ensure early exit is working in realm deactivation""" realm = get_realm("zulip") self.assertFalse(realm.deactivated) do_deactivate_realm(realm, acting_user=None) self.assertTrue(realm.deactivated) do_de...
[ "def", "test_do_deactivate_realm_on_deactivated_realm", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "self", ".", "assertFalse", "(", "realm", ".", "deactivated", ")", "do_deactivate_realm", "(", "realm", ",", "acting_user...
[ 240, 4 ]
[ 249, 42 ]
python
en
['en', 'en', 'en']
True
RealmTest.test_do_set_deactivated_redirect_on_deactivated_realm
(self)
Ensure that the redirect url is working when deactivating realm
Ensure that the redirect url is working when deactivating realm
def test_do_set_deactivated_redirect_on_deactivated_realm(self) -> None: """Ensure that the redirect url is working when deactivating realm""" realm = get_realm("zulip") redirect_url = "new_server.zulip.com" do_deactivate_realm(realm, acting_user=None) self.assertTrue(realm.deac...
[ "def", "test_do_set_deactivated_redirect_on_deactivated_realm", "(", "self", ")", "->", "None", ":", "realm", "=", "get_realm", "(", "\"zulip\"", ")", "redirect_url", "=", "\"new_server.zulip.com\"", "do_deactivate_realm", "(", "realm", ",", "acting_user", "=", "None", ...
[ 251, 4 ]
[ 264, 69 ]
python
en
['en', 'en', 'en']
True
RealmAPITest.do_test_realm_update_api
(self, name: str)
Test updating realm properties. If new realm properties have been added to the Realm model but the test_values dict below has not been updated, this will raise an assertion error.
Test updating realm properties.
def do_test_realm_update_api(self, name: str) -> None: """Test updating realm properties. If new realm properties have been added to the Realm model but the test_values dict below has not been updated, this will raise an assertion error. """ bool_tests: List[bool] = [Fa...
[ "def", "do_test_realm_update_api", "(", "self", ",", "name", ":", "str", ")", "->", "None", ":", "bool_tests", ":", "List", "[", "bool", "]", "=", "[", "False", ",", "True", "]", "test_values", ":", "Dict", "[", "str", ",", "Any", "]", "=", "dict", ...
[ 834, 4 ]
[ 916, 59 ]
python
en
['en', 'en', 'en']
True
RealmAPITest.test_update_realm_allow_message_editing
(self)
Tests updating the realm property 'allow_message_editing'.
Tests updating the realm property 'allow_message_editing'.
def test_update_realm_allow_message_editing(self) -> None: """Tests updating the realm property 'allow_message_editing'.""" self.set_up_db("allow_message_editing", False) self.set_up_db("message_content_edit_limit_seconds", 0) self.set_up_db("allow_community_topic_editing", False) ...
[ "def", "test_update_realm_allow_message_editing", "(", "self", ")", "->", "None", ":", "self", ".", "set_up_db", "(", "\"allow_message_editing\"", ",", "False", ")", "self", ".", "set_up_db", "(", "\"message_content_edit_limit_seconds\"", ",", "0", ")", "self", ".",...
[ 923, 4 ]
[ 945, 68 ]
python
en
['en', 'en', 'en']
True
RealmAPITest.test_update_realm_allow_message_deleting
(self)
Tests updating the realm property 'allow_message_deleting'.
Tests updating the realm property 'allow_message_deleting'.
def test_update_realm_allow_message_deleting(self) -> None: """Tests updating the realm property 'allow_message_deleting'.""" self.set_up_db("allow_message_deleting", True) self.set_up_db("message_content_delete_limit_seconds", 0) realm = self.update_with_api("allow_message_deleting", Fa...
[ "def", "test_update_realm_allow_message_deleting", "(", "self", ")", "->", "None", ":", "self", ".", "set_up_db", "(", "\"allow_message_deleting\"", ",", "True", ")", "self", ".", "set_up_db", "(", "\"message_content_delete_limit_seconds\"", ",", "0", ")", "realm", ...
[ 947, 4 ]
[ 960, 73 ]
python
en
['en', 'en', 'en']
True
QueryDictTests.test_single_key_value
(self)
Test QueryDict with one key/value pair
Test QueryDict with one key/value pair
def test_single_key_value(self): """Test QueryDict with one key/value pair""" q = QueryDict(str('foo=bar')) self.assertEqual(q['foo'], 'bar') self.assertRaises(KeyError, q.__getitem__, 'bar') self.assertRaises(AttributeError, q.__setitem__, 'something', 'bar') self.asse...
[ "def", "test_single_key_value", "(", "self", ")", ":", "q", "=", "QueryDict", "(", "str", "(", "'foo=bar'", ")", ")", "self", ".", "assertEqual", "(", "q", "[", "'foo'", "]", ",", "'bar'", ")", "self", ".", "assertRaises", "(", "KeyError", ",", "q", ...
[ 62, 4 ]
[ 97, 50 ]
python
en
['en', 'en', 'en']
True
QueryDictTests.test_mutable_copy
(self)
A copy of a QueryDict is mutable.
A copy of a QueryDict is mutable.
def test_mutable_copy(self): """A copy of a QueryDict is mutable.""" q = QueryDict().copy() self.assertRaises(KeyError, q.__getitem__, "foo") q['name'] = 'john' self.assertEqual(q['name'], 'john')
[ "def", "test_mutable_copy", "(", "self", ")", ":", "q", "=", "QueryDict", "(", ")", ".", "copy", "(", ")", "self", ".", "assertRaises", "(", "KeyError", ",", "q", ".", "__getitem__", ",", "\"foo\"", ")", "q", "[", "'name'", "]", "=", "'john'", "self"...
[ 109, 4 ]
[ 114, 43 ]
python
en
['en', 'en', 'en']
True
QueryDictTests.test_multiple_keys
(self)
Test QueryDict with two key/value pairs with same keys.
Test QueryDict with two key/value pairs with same keys.
def test_multiple_keys(self): """Test QueryDict with two key/value pairs with same keys.""" q = QueryDict(str('vote=yes&vote=no')) self.assertEqual(q['vote'], 'no') self.assertRaises(AttributeError, q.__setitem__, 'something', 'bar') self.assertEqual(q.get('vote', 'default'), ...
[ "def", "test_multiple_keys", "(", "self", ")", ":", "q", "=", "QueryDict", "(", "str", "(", "'vote=yes&vote=no'", ")", ")", "self", ".", "assertEqual", "(", "q", "[", "'vote'", "]", ",", "'no'", ")", "self", ".", "assertRaises", "(", "AttributeError", ",...
[ 165, 4 ]
[ 199, 64 ]
python
en
['en', 'en', 'en']
True
QueryDictTests.test_update_from_querydict
(self)
Regression test for #8278: QueryDict.update(QueryDict)
Regression test for #8278: QueryDict.update(QueryDict)
def test_update_from_querydict(self): """Regression test for #8278: QueryDict.update(QueryDict)""" x = QueryDict(str("a=1&a=2"), mutable=True) y = QueryDict(str("a=3&a=4")) x.update(y) self.assertEqual(x.getlist('a'), ['1', '2', '3', '4'])
[ "def", "test_update_from_querydict", "(", "self", ")", ":", "x", "=", "QueryDict", "(", "str", "(", "\"a=1&a=2\"", ")", ",", "mutable", "=", "True", ")", "y", "=", "QueryDict", "(", "str", "(", "\"a=3&a=4\"", ")", ")", "x", ".", "update", "(", "y", "...
[ 225, 4 ]
[ 230, 62 ]
python
en
['en', 'la', 'en']
True
QueryDictTests.test_non_default_encoding
(self)
#13572 - QueryDict with a non-default encoding
#13572 - QueryDict with a non-default encoding
def test_non_default_encoding(self): """#13572 - QueryDict with a non-default encoding""" q = QueryDict(str('cur=%A4'), encoding='iso-8859-15') self.assertEqual(q.encoding, 'iso-8859-15') self.assertEqual(list(six.iteritems(q)), [('cur', '€')]) self.assertEqual(q.urlencode(), 'cu...
[ "def", "test_non_default_encoding", "(", "self", ")", ":", "q", "=", "QueryDict", "(", "str", "(", "'cur=%A4'", ")", ",", "encoding", "=", "'iso-8859-15'", ")", "self", ".", "assertEqual", "(", "q", ".", "encoding", ",", "'iso-8859-15'", ")", "self", ".", ...
[ 232, 4 ]
[ 243, 66 ]
python
en
['en', 'fr', 'en']
True
HttpResponseTests.test_dict_behavior
(self)
Test for bug #14020: Make HttpResponse.get work like dict.get
Test for bug #14020: Make HttpResponse.get work like dict.get
def test_dict_behavior(self): """ Test for bug #14020: Make HttpResponse.get work like dict.get """ r = HttpResponse() self.assertEqual(r.get('test'), None)
[ "def", "test_dict_behavior", "(", "self", ")", ":", "r", "=", "HttpResponse", "(", ")", "self", ".", "assertEqual", "(", "r", ".", "get", "(", "'test'", ")", ",", "None", ")" ]
[ 314, 4 ]
[ 319, 45 ]
python
en
['en', 'error', 'th']
False
HttpResponseSubclassesTests.test_redirect_lazy
(self)
Make sure HttpResponseRedirect works with lazy strings.
Make sure HttpResponseRedirect works with lazy strings.
def test_redirect_lazy(self): """Make sure HttpResponseRedirect works with lazy strings.""" r = HttpResponseRedirect(lazystr('/redirected/')) self.assertEqual(r.url, '/redirected/')
[ "def", "test_redirect_lazy", "(", "self", ")", ":", "r", "=", "HttpResponseRedirect", "(", "lazystr", "(", "'/redirected/'", ")", ")", "self", ".", "assertEqual", "(", "r", ".", "url", ",", "'/redirected/'", ")" ]
[ 434, 4 ]
[ 437, 47 ]
python
en
['en', 'en', 'en']
True
CookieTests.test_encode
(self)
Test that we don't output tricky characters in encoded value
Test that we don't output tricky characters in encoded value
def test_encode(self): """ Test that we don't output tricky characters in encoded value """ c = SimpleCookie() c['test'] = "An,awkward;value" self.assertTrue(";" not in c.output().rstrip(';')) # IE compat self.assertTrue("," not in c.output().rstrip(';'))
[ "def", "test_encode", "(", "self", ")", ":", "c", "=", "SimpleCookie", "(", ")", "c", "[", "'test'", "]", "=", "\"An,awkward;value\"", "self", ".", "assertTrue", "(", "\";\"", "not", "in", "c", ".", "output", "(", ")", ".", "rstrip", "(", "';'", ")",...
[ 605, 4 ]
[ 612, 58 ]
python
en
['en', 'error', 'th']
False
CookieTests.test_decode
(self)
Test that we can still preserve semi-colons and commas
Test that we can still preserve semi-colons and commas
def test_decode(self): """ Test that we can still preserve semi-colons and commas """ c = SimpleCookie() c['test'] = "An,awkward;value" c2 = SimpleCookie() c2.load(c.output()) self.assertEqual(c['test'].value, c2['test'].value)
[ "def", "test_decode", "(", "self", ")", ":", "c", "=", "SimpleCookie", "(", ")", "c", "[", "'test'", "]", "=", "\"An,awkward;value\"", "c2", "=", "SimpleCookie", "(", ")", "c2", ".", "load", "(", "c", ".", "output", "(", ")", ")", "self", ".", "ass...
[ 614, 4 ]
[ 622, 59 ]
python
en
['en', 'error', 'th']
False
CookieTests.test_decode_2
(self)
Test that we haven't broken normal encoding
Test that we haven't broken normal encoding
def test_decode_2(self): """ Test that we haven't broken normal encoding """ c = SimpleCookie() c['test'] = b"\xf0" c2 = SimpleCookie() c2.load(c.output()) self.assertEqual(c['test'].value, c2['test'].value)
[ "def", "test_decode_2", "(", "self", ")", ":", "c", "=", "SimpleCookie", "(", ")", "c", "[", "'test'", "]", "=", "b\"\\xf0\"", "c2", "=", "SimpleCookie", "(", ")", "c2", ".", "load", "(", "c", ".", "output", "(", ")", ")", "self", ".", "assertEqual...
[ 624, 4 ]
[ 632, 59 ]
python
en
['en', 'error', 'th']
False
CookieTests.test_nonstandard_keys
(self)
Test that a single non-standard cookie name doesn't affect all cookies. Ticket #13007.
Test that a single non-standard cookie name doesn't affect all cookies. Ticket #13007.
def test_nonstandard_keys(self): """ Test that a single non-standard cookie name doesn't affect all cookies. Ticket #13007. """ self.assertTrue('good_cookie' in parse_cookie('good_cookie=yes;bad:cookie=yes').keys())
[ "def", "test_nonstandard_keys", "(", "self", ")", ":", "self", ".", "assertTrue", "(", "'good_cookie'", "in", "parse_cookie", "(", "'good_cookie=yes;bad:cookie=yes'", ")", ".", "keys", "(", ")", ")" ]
[ 634, 4 ]
[ 638, 95 ]
python
en
['en', 'error', 'th']
False
CookieTests.test_repeated_nonstandard_keys
(self)
Test that a repeated non-standard name doesn't affect all cookies. Ticket #15852
Test that a repeated non-standard name doesn't affect all cookies. Ticket #15852
def test_repeated_nonstandard_keys(self): """ Test that a repeated non-standard name doesn't affect all cookies. Ticket #15852 """ self.assertTrue('good_cookie' in parse_cookie('a:=b; a:=c; good_cookie=yes').keys())
[ "def", "test_repeated_nonstandard_keys", "(", "self", ")", ":", "self", ".", "assertTrue", "(", "'good_cookie'", "in", "parse_cookie", "(", "'a:=b; a:=c; good_cookie=yes'", ")", ".", "keys", "(", ")", ")" ]
[ 640, 4 ]
[ 644, 92 ]
python
en
['en', 'error', 'th']
False
CookieTests.test_httponly_after_load
(self)
Test that we can use httponly attribute on cookies that we load
Test that we can use httponly attribute on cookies that we load
def test_httponly_after_load(self): """ Test that we can use httponly attribute on cookies that we load """ c = SimpleCookie() c.load("name=val") c['name']['httponly'] = True self.assertTrue(c['name']['httponly'])
[ "def", "test_httponly_after_load", "(", "self", ")", ":", "c", "=", "SimpleCookie", "(", ")", "c", ".", "load", "(", "\"name=val\"", ")", "c", "[", "'name'", "]", "[", "'httponly'", "]", "=", "True", "self", ".", "assertTrue", "(", "c", "[", "'name'", ...
[ 646, 4 ]
[ 653, 46 ]
python
en
['en', 'error', 'th']
False
CookieTests.test_bad_cookie
(self)
Regression test for #18403
Regression test for #18403
def test_bad_cookie(self): """ Regression test for #18403 """ r = HttpResponse() r.set_cookie("a:.b/", 1) self.assertEqual(len(r.cookies.bad_cookies), 1)
[ "def", "test_bad_cookie", "(", "self", ")", ":", "r", "=", "HttpResponse", "(", ")", "r", ".", "set_cookie", "(", "\"a:.b/\"", ",", "1", ")", "self", ".", "assertEqual", "(", "len", "(", "r", ".", "cookies", ".", "bad_cookies", ")", ",", "1", ")" ]
[ 661, 4 ]
[ 667, 55 ]
python
en
['en', 'error', 'th']
False
open_resource
(name)
Open a resource from the zoneinfo subdir for reading. Uses the pkg_resources module if available and no standard file found at the calculated location. It is possible to specify different location for zoneinfo subdir by using the PYTZ_TZDATADIR environment variable.
Open a resource from the zoneinfo subdir for reading.
def open_resource(name): """Open a resource from the zoneinfo subdir for reading. Uses the pkg_resources module if available and no standard file found at the calculated location. It is possible to specify different location for zoneinfo subdir by using the PYTZ_TZDATADIR environment variable. ...
[ "def", "open_resource", "(", "name", ")", ":", "name_parts", "=", "name", ".", "lstrip", "(", "'/'", ")", ".", "split", "(", "'/'", ")", "for", "part", "in", "name_parts", ":", "if", "part", "==", "os", ".", "path", ".", "pardir", "or", "os", ".", ...
[ 77, 0 ]
[ 107, 31 ]
python
en
['en', 'en', 'en']
True
resource_exists
(name)
Return true if the given resource exists
Return true if the given resource exists
def resource_exists(name): """Return true if the given resource exists""" try: open_resource(name).close() return True except IOError: return False
[ "def", "resource_exists", "(", "name", ")", ":", "try", ":", "open_resource", "(", "name", ")", ".", "close", "(", ")", "return", "True", "except", "IOError", ":", "return", "False" ]
[ 110, 0 ]
[ 116, 20 ]
python
en
['en', 'en', 'en']
True
timezone
(zone)
r''' Return a datetime.tzinfo implementation for the given timezone >>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(unicode('US/Eastern')) is eastern True >>> utc_dt = datetime(2002, 1...
r''' Return a datetime.tzinfo implementation for the given timezone
def timezone(zone): r''' Return a datetime.tzinfo implementation for the given timezone >>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(unicode('US/Eastern')) is eastern True >>> u...
[ "def", "timezone", "(", "zone", ")", ":", "if", "zone", "is", "None", ":", "raise", "UnknownTimeZoneError", "(", "None", ")", "if", "zone", ".", "upper", "(", ")", "==", "'UTC'", ":", "return", "utc", "try", ":", "zone", "=", "ascii", "(", "zone", ...
[ 122, 0 ]
[ 182, 30 ]
python
en
['en', 'en', 'en']
True
_unmunge_zone
(zone)
Undo the time zone name munging done by older versions of pytz.
Undo the time zone name munging done by older versions of pytz.
def _unmunge_zone(zone): """Undo the time zone name munging done by older versions of pytz.""" return zone.replace('_plus_', '+').replace('_minus_', '-')
[ "def", "_unmunge_zone", "(", "zone", ")", ":", "return", "zone", ".", "replace", "(", "'_plus_'", ",", "'+'", ")", ".", "replace", "(", "'_minus_'", ",", "'-'", ")" ]
[ 185, 0 ]
[ 187, 62 ]
python
en
['en', 'en', 'en']
True
_case_insensitive_zone_lookup
(zone)
case-insensitively matching timezone, else return zone unchanged
case-insensitively matching timezone, else return zone unchanged
def _case_insensitive_zone_lookup(zone): """case-insensitively matching timezone, else return zone unchanged""" global _all_timezones_lower_to_standard if _all_timezones_lower_to_standard is None: _all_timezones_lower_to_standard = dict((tz.lower(), tz) for tz in all_timezones) # noqa return _a...
[ "def", "_case_insensitive_zone_lookup", "(", "zone", ")", ":", "global", "_all_timezones_lower_to_standard", "if", "_all_timezones_lower_to_standard", "is", "None", ":", "_all_timezones_lower_to_standard", "=", "dict", "(", "(", "tz", ".", "lower", "(", ")", ",", "tz"...
[ 193, 0 ]
[ 198, 69 ]
python
en
['en', 'zu', 'en']
True
_UTC
()
Factory function for utc unpickling. Makes sure that unpickling a utc instance always returns the same module global. These examples belong in the UTC class above, but it is obscured; or in the README.rst, but we are not depending on Python 2.4 so integrating the README.rst examples with the unit ...
Factory function for utc unpickling.
def _UTC(): """Factory function for utc unpickling. Makes sure that unpickling a utc instance always returns the same module global. These examples belong in the UTC class above, but it is obscured; or in the README.rst, but we are not depending on Python 2.4 so integrating the README.rst exam...
[ "def", "_UTC", "(", ")", ":", "return", "utc" ]
[ 258, 0 ]
[ 287, 14 ]
python
en
['en', 'en', 'en']
True
_p
(*args)
Factory function for unpickling pytz tzinfo instances. Just a wrapper around tzinfo.unpickler to save a few bytes in each pickle by shortening the path.
Factory function for unpickling pytz tzinfo instances.
def _p(*args): """Factory function for unpickling pytz tzinfo instances. Just a wrapper around tzinfo.unpickler to save a few bytes in each pickle by shortening the path. """ return unpickler(*args)
[ "def", "_p", "(", "*", "args", ")", ":", "return", "unpickler", "(", "*", "args", ")" ]
[ 293, 0 ]
[ 299, 27 ]
python
en
['en', 'fr', 'en']
True
FixedOffset
(offset, _tzinfos={})
return a fixed-offset timezone based off a number of minutes. >>> one = FixedOffset(-330) >>> one pytz.FixedOffset(-330) >>> str(one.utcoffset(datetime.datetime.now())) '-1 day, 18:30:00' >>> str(one.dst(datetime.datetime.now())) '0:00:00' >>> two = Fixe...
return a fixed-offset timezone based off a number of minutes.
def FixedOffset(offset, _tzinfos={}): """return a fixed-offset timezone based off a number of minutes. >>> one = FixedOffset(-330) >>> one pytz.FixedOffset(-330) >>> str(one.utcoffset(datetime.datetime.now())) '-1 day, 18:30:00' >>> str(one.dst(datetime.datetime.now(...
[ "def", "FixedOffset", "(", "offset", ",", "_tzinfos", "=", "{", "}", ")", ":", "if", "offset", "==", "0", ":", "return", "UTC", "info", "=", "_tzinfos", ".", "get", "(", "offset", ")", "if", "info", "is", "None", ":", "# We haven't seen this one before. ...
[ 430, 0 ]
[ 494, 15 ]
python
en
['en', 'en', 'en']
True
UTC.localize
(self, dt, is_dst=False)
Convert naive time to local time
Convert naive time to local time
def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError('Not naive datetime (tzinfo is already set)') return dt.replace(tzinfo=self)
[ "def", "localize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", ":", "raise", "ValueError", "(", "'Not naive datetime (tzinfo is already set)'", ")", "return", "dt", ".", "replace", "(", "tz...
[ 234, 4 ]
[ 238, 38 ]
python
en
['en', 'en', 'en']
True
UTC.normalize
(self, dt, is_dst=False)
Correct the timezone information on the given datetime
Correct the timezone information on the given datetime
def normalize(self, dt, is_dst=False): '''Correct the timezone information on the given datetime''' if dt.tzinfo is self: return dt if dt.tzinfo is None: raise ValueError('Naive time - no tzinfo set') return dt.astimezone(self)
[ "def", "normalize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "self", ":", "return", "dt", "if", "dt", ".", "tzinfo", "is", "None", ":", "raise", "ValueError", "(", "'Naive time - no tzinfo set'", "...
[ 240, 4 ]
[ 246, 34 ]
python
en
['en', 'en', 'en']
True
_CountryTimezoneDict.__call__
(self, iso3166_code)
Backwards compatibility.
Backwards compatibility.
def __call__(self, iso3166_code): """Backwards compatibility.""" return self[iso3166_code]
[ "def", "__call__", "(", "self", ",", "iso3166_code", ")", ":", "return", "self", "[", "iso3166_code", "]" ]
[ 337, 4 ]
[ 339, 33 ]
python
en
['en', 'zu', 'en']
False
_FixedOffset.localize
(self, dt, is_dst=False)
Convert naive time to local time
Convert naive time to local time
def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError('Not naive datetime (tzinfo is already set)') return dt.replace(tzinfo=self)
[ "def", "localize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", ":", "raise", "ValueError", "(", "'Not naive datetime (tzinfo is already set)'", ")", "return", "dt", ".", "replace", "(", "tz...
[ 415, 4 ]
[ 419, 38 ]
python
en
['en', 'en', 'en']
True
_FixedOffset.normalize
(self, dt, is_dst=False)
Correct the timezone information on the given datetime
Correct the timezone information on the given datetime
def normalize(self, dt, is_dst=False): '''Correct the timezone information on the given datetime''' if dt.tzinfo is self: return dt if dt.tzinfo is None: raise ValueError('Naive time - no tzinfo set') return dt.astimezone(self)
[ "def", "normalize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "self", ":", "return", "dt", "if", "dt", ".", "tzinfo", "is", "None", ":", "raise", "ValueError", "(", "'Naive time - no tzinfo set'", "...
[ 421, 4 ]
[ 427, 34 ]
python
en
['en', 'en', 'en']
True
get_major_minor_version
()
Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10".
Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10".
def get_major_minor_version(): # type: () -> str """ Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". """ return '{}.{}'.format(*sys.version_info)
[ "def", "get_major_minor_version", "(", ")", ":", "# type: () -> str", "return", "'{}.{}'", ".", "format", "(", "*", "sys", ".", "version_info", ")" ]
[ 33, 0 ]
[ 39, 44 ]
python
en
['en', 'error', 'th']
False
distutils_scheme
( dist_name, user=False, home=None, root=None, isolated=False, prefix=None )
Return a distutils install scheme
Return a distutils install scheme
def distutils_scheme( dist_name, user=False, home=None, root=None, isolated=False, prefix=None ): # type:(str, bool, str, str, bool, str) -> Dict[str, str] """ Return a distutils install scheme """ from distutils.dist import Distribution dist_args = {'name': dist_name} # type: Dict[str, Un...
[ "def", "distutils_scheme", "(", "dist_name", ",", "user", "=", "False", ",", "home", "=", "None", ",", "root", "=", "None", ",", "isolated", "=", "False", ",", "prefix", "=", "None", ")", ":", "# type:(str, bool, str, str, bool, str) -> Dict[str, str]", "from", ...
[ 94, 0 ]
[ 155, 17 ]
python
en
['en', 'error', 'th']
False
get_scheme
( dist_name, # type: str user=False, # type: bool home=None, # type: Optional[str] root=None, # type: Optional[str] isolated=False, # type: bool prefix=None, # type: Optional[str] )
Get the "scheme" corresponding to the input parameters. The distutils documentation provides the context for the available schemes: https://docs.python.org/3/install/index.html#alternate-installation :param dist_name: the name of the package to retrieve the scheme for, used in the headers sche...
Get the "scheme" corresponding to the input parameters. The distutils documentation provides the context for the available schemes: https://docs.python.org/3/install/index.html#alternate-installation
def get_scheme( dist_name, # type: str user=False, # type: bool home=None, # type: Optional[str] root=None, # type: Optional[str] isolated=False, # type: bool prefix=None, # type: Optional[str] ): # type: (...) -> Scheme """ Get the "scheme" corresponding to the input parameter...
[ "def", "get_scheme", "(", "dist_name", ",", "# type: str", "user", "=", "False", ",", "# type: bool", "home", "=", "None", ",", "# type: Optional[str]", "root", "=", "None", ",", "# type: Optional[str]", "isolated", "=", "False", ",", "# type: bool", "prefix", "...
[ 158, 0 ]
[ 193, 5 ]
python
en
['en', 'error', 'th']
False
get_abbr_impl
()
Return abbreviated implementation name.
Return abbreviated implementation name.
def get_abbr_impl(): """Return abbreviated implementation name.""" impl = platform.python_implementation() if impl == 'PyPy': return 'pp' elif impl == 'Jython': return 'jy' elif impl == 'IronPython': return 'ip' elif impl == 'CPython': return 'cp' raise Looku...
[ "def", "get_abbr_impl", "(", ")", ":", "impl", "=", "platform", ".", "python_implementation", "(", ")", "if", "impl", "==", "'PyPy'", ":", "return", "'pp'", "elif", "impl", "==", "'Jython'", ":", "return", "'jy'", "elif", "impl", "==", "'IronPython'", ":",...
[ 29, 0 ]
[ 41, 63 ]
python
en
['en', 'en', 'en']
True
get_impl_ver
()
Return implementation version.
Return implementation version.
def get_impl_ver(): """Return implementation version.""" impl_ver = get_config_var("py_version_nodot") if not impl_ver: impl_ver = ''.join(map(str, get_impl_version_info())) return impl_ver
[ "def", "get_impl_ver", "(", ")", ":", "impl_ver", "=", "get_config_var", "(", "\"py_version_nodot\"", ")", "if", "not", "impl_ver", ":", "impl_ver", "=", "''", ".", "join", "(", "map", "(", "str", ",", "get_impl_version_info", "(", ")", ")", ")", "return",...
[ 44, 0 ]
[ 49, 19 ]
python
en
['en', 'da', 'en']
True
get_impl_version_info
()
Return sys.version_info-like tuple for use in decrementing the minor version.
Return sys.version_info-like tuple for use in decrementing the minor version.
def get_impl_version_info(): """Return sys.version_info-like tuple for use in decrementing the minor version.""" return sys.version_info[0], sys.version_info[1]
[ "def", "get_impl_version_info", "(", ")", ":", "return", "sys", ".", "version_info", "[", "0", "]", ",", "sys", ".", "version_info", "[", "1", "]" ]
[ 52, 0 ]
[ 55, 51 ]
python
en
['en', 'en', 'en']
True
get_flag
(var, fallback, expected=True, warn=True)
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
def get_flag(var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = get_config_var(var) if val is None: if warn: warnings.warn("Config variable '{0}' is unset, Python ABI tag may " ...
[ "def", "get_flag", "(", "var", ",", "fallback", ",", "expected", "=", "True", ",", "warn", "=", "True", ")", ":", "val", "=", "get_config_var", "(", "var", ")", "if", "val", "is", "None", ":", "if", "warn", ":", "warnings", ".", "warn", "(", "\"Con...
[ 58, 0 ]
[ 67, 26 ]
python
en
['en', 'en', 'en']
True
get_abi_tag
()
Return the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).
Return the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).
def get_abi_tag(): """Return the ABI tag based on SOABI (if available) or emulate SOABI (CPython 2, PyPy).""" soabi = get_config_var('SOABI') impl = get_abbr_impl() if not soabi and impl in ('cp', 'pp') and hasattr(sys, 'maxunicode'): d = '' m = '' u = '' if get_flag(...
[ "def", "get_abi_tag", "(", ")", ":", "soabi", "=", "get_config_var", "(", "'SOABI'", ")", "impl", "=", "get_abbr_impl", "(", ")", "if", "not", "soabi", "and", "impl", "in", "(", "'cp'", ",", "'pp'", ")", "and", "hasattr", "(", "sys", ",", "'maxunicode'...
[ 70, 0 ]
[ 103, 14 ]
python
en
['en', 'sm', 'en']
True
calculate_macosx_platform_tag
(archive_root, platform_tag)
Calculate proper macosx platform tag basing on files which are included to wheel Example platform tag `macosx-10.14-x86_64`
Calculate proper macosx platform tag basing on files which are included to wheel
def calculate_macosx_platform_tag(archive_root, platform_tag): """ Calculate proper macosx platform tag basing on files which are included to wheel Example platform tag `macosx-10.14-x86_64` """ prefix, base_version, suffix = platform_tag.split('-') base_version = tuple([int(x) for x in base_ve...
[ "def", "calculate_macosx_platform_tag", "(", "archive_root", ",", "platform_tag", ")", ":", "prefix", ",", "base_version", ",", "suffix", "=", "platform_tag", ".", "split", "(", "'-'", ")", "base_version", "=", "tuple", "(", "[", "int", "(", "x", ")", "for",...
[ 106, 0 ]
[ 171, 23 ]
python
en
['en', 'error', 'th']
False