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
flavor_get_extras
(request, flavor_id, raw=False, flavor=None)
Get flavor extra specs.
Get flavor extra specs.
def flavor_get_extras(request, flavor_id, raw=False, flavor=None): """Get flavor extra specs.""" if flavor is None: flavor = _nova.novaclient(request).flavors.get(flavor_id) extras = flavor.get_keys() if raw: return extras return [FlavorExtraSpec(flavor_id, key, value) for ...
[ "def", "flavor_get_extras", "(", "request", ",", "flavor_id", ",", "raw", "=", "False", ",", "flavor", "=", "None", ")", ":", "if", "flavor", "is", "None", ":", "flavor", "=", "_nova", ".", "novaclient", "(", "request", ")", ".", "flavors", ".", "get",...
[ 349, 0 ]
[ 357, 41 ]
python
da
['da', 'nl', 'en']
False
flavor_extra_delete
(request, flavor_id, keys)
Unset the flavor extra spec keys.
Unset the flavor extra spec keys.
def flavor_extra_delete(request, flavor_id, keys): """Unset the flavor extra spec keys.""" flavor = _nova.novaclient(request).flavors.get(flavor_id) return flavor.unset_keys(keys)
[ "def", "flavor_extra_delete", "(", "request", ",", "flavor_id", ",", "keys", ")", ":", "flavor", "=", "_nova", ".", "novaclient", "(", "request", ")", ".", "flavors", ".", "get", "(", "flavor_id", ")", "return", "flavor", ".", "unset_keys", "(", "keys", ...
[ 361, 0 ]
[ 364, 34 ]
python
en
['en', 'en', 'en']
True
flavor_extra_set
(request, flavor_id, metadata)
Set the flavor extra spec keys.
Set the flavor extra spec keys.
def flavor_extra_set(request, flavor_id, metadata): """Set the flavor extra spec keys.""" flavor = _nova.novaclient(request).flavors.get(flavor_id) if (not metadata): # not a way to delete keys return None return flavor.set_keys(metadata)
[ "def", "flavor_extra_set", "(", "request", ",", "flavor_id", ",", "metadata", ")", ":", "flavor", "=", "_nova", ".", "novaclient", "(", "request", ")", ".", "flavors", ".", "get", "(", "flavor_id", ")", "if", "(", "not", "metadata", ")", ":", "# not a wa...
[ 368, 0 ]
[ 373, 36 ]
python
en
['en', 'hu', 'en']
True
server_console_output
(request, instance_id, tail_length=None)
Gets console output of an instance.
Gets console output of an instance.
def server_console_output(request, instance_id, tail_length=None): """Gets console output of an instance.""" nc = _nova.novaclient(request) return nc.servers.get_console_output(instance_id, length=tail_length)
[ "def", "server_console_output", "(", "request", ",", "instance_id", ",", "tail_length", "=", "None", ")", ":", "nc", "=", "_nova", ".", "novaclient", "(", "request", ")", "return", "nc", ".", "servers", ".", "get_console_output", "(", "instance_id", ",", "le...
[ 544, 0 ]
[ 547, 73 ]
python
en
['en', 'en', 'en']
True
list_extensions
(request)
List all nova extensions, except the ones in the blacklist.
List all nova extensions, except the ones in the blacklist.
def list_extensions(request): """List all nova extensions, except the ones in the blacklist.""" blacklist = set(settings.OPENSTACK_NOVA_EXTENSIONS_BLACKLIST) nova_api = _nova.novaclient(request) return tuple( extension for extension in nova_list_extensions.ListExtManager(nova_api).show_a...
[ "def", "list_extensions", "(", "request", ")", ":", "blacklist", "=", "set", "(", "settings", ".", "OPENSTACK_NOVA_EXTENSIONS_BLACKLIST", ")", "nova_api", "=", "_nova", ".", "novaclient", "(", "request", ")", "return", "tuple", "(", "extension", "for", "extensio...
[ 1023, 0 ]
[ 1031, 5 ]
python
en
['en', 'en', 'en']
True
extension_supported
(extension_name, request)
Determine if nova supports a given extension name. Example values for the extension_name include AdminActions, ConsoleOutput, etc.
Determine if nova supports a given extension name.
def extension_supported(extension_name, request): """Determine if nova supports a given extension name. Example values for the extension_name include AdminActions, ConsoleOutput, etc. """ for ext in list_extensions(request): if ext.name == extension_name: return True return ...
[ "def", "extension_supported", "(", "extension_name", ",", "request", ")", ":", "for", "ext", "in", "list_extensions", "(", "request", ")", ":", "if", "ext", ".", "name", "==", "extension_name", ":", "return", "True", "return", "False" ]
[ 1036, 0 ]
[ 1045, 16 ]
python
en
['en', 'en', 'en']
True
can_set_mount_point
()
Return the Hypervisor's capability of setting mount points.
Return the Hypervisor's capability of setting mount points.
def can_set_mount_point(): """Return the Hypervisor's capability of setting mount points.""" return utils.get_dict_config('OPENSTACK_HYPERVISOR_FEATURES', 'can_set_mount_point')
[ "def", "can_set_mount_point", "(", ")", ":", "return", "utils", ".", "get_dict_config", "(", "'OPENSTACK_HYPERVISOR_FEATURES'", ",", "'can_set_mount_point'", ")" ]
[ 1061, 0 ]
[ 1064, 55 ]
python
en
['en', 'no', 'en']
True
BaseSpecifier.__str__
(self)
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
def __str__(self): # type: () -> str """ Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. """
[ "def", "__str__", "(", "self", ")", ":", "# type: () -> str" ]
[ 41, 4 ]
[ 46, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__hash__
(self)
Returns a hash value for this Specifier like object.
Returns a hash value for this Specifier like object.
def __hash__(self): # type: () -> int """ Returns a hash value for this Specifier like object. """
[ "def", "__hash__", "(", "self", ")", ":", "# type: () -> int" ]
[ 49, 4 ]
[ 53, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__eq__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are equal.
Returns a boolean representing whether or not the two Specifier like objects are equal.
def __eq__(self, other): # type: (object) -> bool """ Returns a boolean representing whether or not the two Specifier like objects are equal. """
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "# type: (object) -> bool" ]
[ 56, 4 ]
[ 61, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__ne__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are not equal.
Returns a boolean representing whether or not the two Specifier like objects are not equal.
def __ne__(self, other): # type: (object) -> bool """ Returns a boolean representing whether or not the two Specifier like objects are not equal. """
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "# type: (object) -> bool" ]
[ 64, 4 ]
[ 69, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.prereleases
(self)
Returns whether or not pre-releases as a whole are allowed by this specifier.
Returns whether or not pre-releases as a whole are allowed by this specifier.
def prereleases(self): # type: () -> Optional[bool] """ Returns whether or not pre-releases as a whole are allowed by this specifier. """
[ "def", "prereleases", "(", "self", ")", ":", "# type: () -> Optional[bool]" ]
[ 72, 4 ]
[ 77, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.prereleases
(self, value)
Sets whether or not pre-releases as a whole are allowed by this specifier.
Sets whether or not pre-releases as a whole are allowed by this specifier.
def prereleases(self, value): # type: (bool) -> None """ Sets whether or not pre-releases as a whole are allowed by this specifier. """
[ "def", "prereleases", "(", "self", ",", "value", ")", ":", "# type: (bool) -> None" ]
[ 80, 4 ]
[ 85, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.contains
(self, item, prereleases=None)
Determines if the given item is contained within this specifier.
Determines if the given item is contained within this specifier.
def contains(self, item, prereleases=None): # type: (str, Optional[bool]) -> bool """ Determines if the given item is contained within this specifier. """
[ "def", "contains", "(", "self", ",", "item", ",", "prereleases", "=", "None", ")", ":", "# type: (str, Optional[bool]) -> bool" ]
[ 88, 4 ]
[ 92, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.filter
(self, iterable, prereleases=None)
Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it.
Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it.
def filter(self, iterable, prereleases=None): # type: (Iterable[UnparsedVersion], Optional[bool]) -> Iterable[UnparsedVersion] """ Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. """
[ "def", "filter", "(", "self", ",", "iterable", ",", "prereleases", "=", "None", ")", ":", "# type: (Iterable[UnparsedVersion], Optional[bool]) -> Iterable[UnparsedVersion]" ]
[ 95, 4 ]
[ 100, 11 ]
python
en
['en', 'error', 'th']
False
generate_time_series_data
( days: int = 100, business_hours_base: float = 10, non_business_hours_base: float = 10, growth: float = 1, autocorrelation: float = 0, spikiness: float = 1, holiday_rate: float = 0, frequency: str = CountStat.DAY, partial_sum: bool = False, random_seed: int = 26, )
Generate semi-realistic looking time series data for testing analytics graphs. days -- Number of days of data. Is the number of data points generated if frequency is CountStat.DAY. business_hours_base -- Average value during a business hour (or day) at beginning of time series, if frequenc...
Generate semi-realistic looking time series data for testing analytics graphs.
def generate_time_series_data( days: int = 100, business_hours_base: float = 10, non_business_hours_base: float = 10, growth: float = 1, autocorrelation: float = 0, spikiness: float = 1, holiday_rate: float = 0, frequency: str = CountStat.DAY, partial_sum: bool = False, random_se...
[ "def", "generate_time_series_data", "(", "days", ":", "int", "=", "100", ",", "business_hours_base", ":", "float", "=", "10", ",", "non_business_hours_base", ":", "float", "=", "10", ",", "growth", ":", "float", "=", "1", ",", "autocorrelation", ":", "float"...
[ 7, 0 ]
[ 78, 38 ]
python
en
['en', 'error', 'th']
False
OpenAPIArgumentsTest.convert_regex_to_url_pattern
(self, regex_pattern: str)
Convert regular expressions style URL patterns to their corresponding OpenAPI style formats. All patterns are expected to start with ^ and end with $. Examples: 1. /messages/{message_id} <-> r'^messages/(?P<message_id>[0-9]+)$' 2. /events <-> r'^events$' 3. '/...
Convert regular expressions style URL patterns to their corresponding OpenAPI style formats. All patterns are expected to start with ^ and end with $. Examples: 1. /messages/{message_id} <-> r'^messages/(?P<message_id>[0-9]+)$' 2. /events <-> r'^events$' 3. '/...
def convert_regex_to_url_pattern(self, regex_pattern: str) -> str: """Convert regular expressions style URL patterns to their corresponding OpenAPI style formats. All patterns are expected to start with ^ and end with $. Examples: 1. /messages/{message_id} <-> r'^messages/(?P...
[ "def", "convert_regex_to_url_pattern", "(", "self", ",", "regex_pattern", ":", "str", ")", "->", "str", ":", "# Handle the presence-email code which has a non-slashes syntax.", "regex_pattern", "=", "regex_pattern", ".", "replace", "(", "\"[^/]*\"", ",", "\".*\"", ")", ...
[ 293, 4 ]
[ 311, 26 ]
python
en
['en', 'en', 'en']
True
OpenAPIArgumentsTest.check_for_non_existant_openapi_endpoints
(self)
Here, we check to see if every endpoint documented in the OpenAPI documentation actually exists in urls.py and thus in actual code. Note: We define this as a helper called at the end of test_openapi_arguments instead of as a separate test to ensure that this test is only executed after t...
Here, we check to see if every endpoint documented in the OpenAPI documentation actually exists in urls.py and thus in actual code. Note: We define this as a helper called at the end of test_openapi_arguments instead of as a separate test to ensure that this test is only executed after t...
def check_for_non_existant_openapi_endpoints(self) -> None: """Here, we check to see if every endpoint documented in the OpenAPI documentation actually exists in urls.py and thus in actual code. Note: We define this as a helper called at the end of test_openapi_arguments instead of as a ...
[ "def", "check_for_non_existant_openapi_endpoints", "(", "self", ")", "->", "None", ":", "openapi_paths", "=", "set", "(", "get_openapi_paths", "(", ")", ")", "undocumented_paths", "=", "openapi_paths", "-", "self", ".", "checked_endpoints", "undocumented_paths", "-=",...
[ 327, 4 ]
[ 344, 37 ]
python
en
['en', 'en', 'en']
True
OpenAPIArgumentsTest.get_standardized_argument_type
(self, t: Any)
Given a type from the typing module such as List[str] or Union[str, int], convert it into a corresponding Python type. Unions are mapped to a canonical choice among the options. E.g. typing.Union[typing.List[typing.Dict[str, typing.Any]], NoneType] needs to be mapped to list.
Given a type from the typing module such as List[str] or Union[str, int], convert it into a corresponding Python type. Unions are mapped to a canonical choice among the options. E.g. typing.Union[typing.List[typing.Dict[str, typing.Any]], NoneType] needs to be mapped to list.
def get_standardized_argument_type(self, t: Any) -> Union[type, Tuple[type, object]]: """Given a type from the typing module such as List[str] or Union[str, int], convert it into a corresponding Python type. Unions are mapped to a canonical choice among the options. E.g. typing.Union[typ...
[ "def", "get_standardized_argument_type", "(", "self", ",", "t", ":", "Any", ")", "->", "Union", "[", "type", ",", "Tuple", "[", "type", ",", "object", "]", "]", ":", "origin", "=", "getattr", "(", "t", ",", "\"__origin__\"", ",", "None", ")", "if", "...
[ 360, 4 ]
[ 390, 56 ]
python
en
['en', 'en', 'en']
True
OpenAPIArgumentsTest.render_openapi_type_exception
( self, function: Callable[..., HttpResponse], openapi_params: Set[Tuple[str, Union[type, Tuple[type, object]]]], function_params: Set[Tuple[str, Union[type, Tuple[type, object]]]], diff: Set[Tuple[str, Union[type, Tuple[type, object]]]], )
Print a *VERY* clear and verbose error message for when the types (between the OpenAPI documentation and the function declaration) don't match.
Print a *VERY* clear and verbose error message for when the types (between the OpenAPI documentation and the function declaration) don't match.
def render_openapi_type_exception( self, function: Callable[..., HttpResponse], openapi_params: Set[Tuple[str, Union[type, Tuple[type, object]]]], function_params: Set[Tuple[str, Union[type, Tuple[type, object]]]], diff: Set[Tuple[str, Union[type, Tuple[type, object]]]], ) ->...
[ "def", "render_openapi_type_exception", "(", "self", ",", "function", ":", "Callable", "[", "...", ",", "HttpResponse", "]", ",", "openapi_params", ":", "Set", "[", "Tuple", "[", "str", ",", "Union", "[", "type", ",", "Tuple", "[", "type", ",", "object", ...
[ 392, 4 ]
[ 423, 33 ]
python
en
['en', 'en', 'en']
True
OpenAPIArgumentsTest.check_argument_types
( self, function: Callable[..., HttpResponse], openapi_parameters: List[Dict[str, Any]] )
We construct for both the OpenAPI data and the function's definition a set of tuples of the form (var_name, type) and then compare those sets to see if the OpenAPI data defines a different type than that actually accepted by the function. Otherwise, we print out the exact differences for conveni...
We construct for both the OpenAPI data and the function's definition a set of tuples of the form (var_name, type) and then compare those sets to see if the OpenAPI data defines a different type than that actually accepted by the function. Otherwise, we print out the exact differences for conveni...
def check_argument_types( self, function: Callable[..., HttpResponse], openapi_parameters: List[Dict[str, Any]] ) -> None: """We construct for both the OpenAPI data and the function's definition a set of tuples of the form (var_name, type) and then compare those sets to see if the Op...
[ "def", "check_argument_types", "(", "self", ",", "function", ":", "Callable", "[", "...", ",", "HttpResponse", "]", ",", "openapi_parameters", ":", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ")", "->", "None", ":", "openapi_params", ":", "Set...
[ 425, 4 ]
[ 515, 95 ]
python
en
['en', 'en', 'en']
True
OpenAPIArgumentsTest.test_openapi_arguments
(self)
This end-to-end API documentation test compares the arguments defined in the actual code using @has_request_variables and REQ(), with the arguments declared in our API documentation for every API endpoint in Zulip. First, we import the fancy-Django version of zproject/urls.py by...
This end-to-end API documentation test compares the arguments defined in the actual code using @has_request_variables and REQ(), with the arguments declared in our API documentation for every API endpoint in Zulip.
def test_openapi_arguments(self) -> None: """This end-to-end API documentation test compares the arguments defined in the actual code using @has_request_variables and REQ(), with the arguments declared in our API documentation for every API endpoint in Zulip. First, we import th...
[ "def", "test_openapi_arguments", "(", "self", ")", "->", "None", ":", "from", "zproject", "import", "urls", "as", "urlconf", "# We loop through all the API patterns, looking in particular", "# for those using the rest_dispatch decorator; we then parse", "# its mapping of (HTTP_METHOD...
[ 517, 4 ]
[ 643, 55 ]
python
en
['en', 'en', 'en']
True
OpenAPIAttributesTest.test_attributes
(self)
Checks: * All endpoints have `operationId` and `tag` attributes. * All example responses match their schema. * That no opaque object exists.
Checks: * All endpoints have `operationId` and `tag` attributes. * All example responses match their schema. * That no opaque object exists.
def test_attributes(self) -> None: """ Checks: * All endpoints have `operationId` and `tag` attributes. * All example responses match their schema. * That no opaque object exists. """ EXCLUDE = ["/real-time"] VALID_TAGS = [ "users", ...
[ "def", "test_attributes", "(", "self", ")", "->", "None", ":", "EXCLUDE", "=", "[", "\"/real-time\"", "]", "VALID_TAGS", "=", "[", "\"users\"", ",", "\"server_and_organizations\"", ",", "\"authentication\"", ",", "\"real_time_events\"", ",", "\"streams\"", ",", "\...
[ 991, 4 ]
[ 1034, 21 ]
python
en
['en', 'error', 'th']
False
OpenAPIRegexTest.test_regex
(self)
Calls a few documented and undocumented endpoints and checks whether they find a match or not.
Calls a few documented and undocumented endpoints and checks whether they find a match or not.
def test_regex(self) -> None: """ Calls a few documented and undocumented endpoints and checks whether they find a match or not. """ # Some of the undocumentd endpoints which are very similar to # some of the documented endpoints. assert find_openapi_endpoint("/u...
[ "def", "test_regex", "(", "self", ")", "->", "None", ":", "# Some of the undocumentd endpoints which are very similar to", "# some of the documented endpoints.", "assert", "find_openapi_endpoint", "(", "\"/users/me/presence\"", ")", "is", "None", "assert", "find_openapi_endpoint"...
[ 1038, 4 ]
[ 1060, 97 ]
python
en
['en', 'error', 'th']
False
OpenAPIRequestValidatorTest.test_validator
(self)
Test to make sure the request validator works properly The tests cover both cases such as catching valid requests marked as invalid and making sure invalid requests are markded properly
Test to make sure the request validator works properly The tests cover both cases such as catching valid requests marked as invalid and making sure invalid requests are markded properly
def test_validator(self) -> None: """ Test to make sure the request validator works properly The tests cover both cases such as catching valid requests marked as invalid and making sure invalid requests are markded properly """ # `/users/me/subscriptions` doesn't require ...
[ "def", "test_validator", "(", "self", ")", "->", "None", ":", "# `/users/me/subscriptions` doesn't require any parameters", "validate_request", "(", "\"/users/me/subscriptions\"", ",", "\"get\"", ",", "{", "}", ",", "{", "}", ",", "False", ",", "\"200\"", ")", "with...
[ 1064, 4 ]
[ 1081, 9 ]
python
en
['en', 'error', 'th']
False
transform_hits
(hits)
The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use.
The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use.
def transform_hits(hits): # type: (List[Dict[str, str]]) -> List[TransformedHit] """ The list from pypi is really a list of versions. We want a list of packages with the list of versions stored inline. This converts the list from pypi into one we can use. """ packages = OrderedDict() # type...
[ "def", "transform_hits", "(", "hits", ")", ":", "# type: (List[Dict[str, str]]) -> List[TransformedHit]", "packages", "=", "OrderedDict", "(", ")", "# type: OrderedDict[str, TransformedHit]", "for", "hit", "in", "hits", ":", "name", "=", "hit", "[", "'name'", "]", "su...
[ 83, 0 ]
[ 109, 34 ]
python
en
['en', 'error', 'th']
False
show_actual_vendor_versions
(vendor_txt_versions)
Log the actual version and print extra info if there is a conflict or if the actual version could not be imported.
Log the actual version and print extra info if there is a conflict or if the actual version could not be imported.
def show_actual_vendor_versions(vendor_txt_versions): # type: (Dict[str, str]) -> None """Log the actual version and print extra info if there is a conflict or if the actual version could not be imported. """ for module_name, expected_version in vendor_txt_versions.items(): extra_message = '...
[ "def", "show_actual_vendor_versions", "(", "vendor_txt_versions", ")", ":", "# type: (Dict[str, str]) -> None", "for", "module_name", ",", "expected_version", "in", "vendor_txt_versions", ".", "items", "(", ")", ":", "extra_message", "=", "''", "actual_version", "=", "g...
[ 102, 0 ]
[ 117, 75 ]
python
en
['en', 'en', 'en']
True
test_color_yes_collection_on_non_atty
(testdir, verbose)
skip collect progress report when working on non-terminals. #1397
skip collect progress report when working on non-terminals. #1397
def test_color_yes_collection_on_non_atty(testdir, verbose): """skip collect progress report when working on non-terminals. #1397 """ testdir.makepyfile(""" import pytest @pytest.mark.parametrize('i', range(10)) def test_this(i): assert 1 """) args = ['--color...
[ "def", "test_color_yes_collection_on_non_atty", "(", "testdir", ",", "verbose", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n import pytest\n @pytest.mark.parametrize('i', range(10))\n def test_this(i):\n assert 1\n \"\"\"", ")", "args", "=",...
[ 636, 0 ]
[ 655, 54 ]
python
en
['en', 'en', 'en']
True
test_terminal_summary_warnings_are_displayed
(testdir)
Test that warnings emitted during pytest_terminal_summary are displayed. (#1305).
Test that warnings emitted during pytest_terminal_summary are displayed. (#1305).
def test_terminal_summary_warnings_are_displayed(testdir): """Test that warnings emitted during pytest_terminal_summary are displayed. (#1305). """ testdir.makeconftest(""" def pytest_terminal_summary(terminalreporter): config = terminalreporter.config config.warn('C1', '...
[ "def", "test_terminal_summary_warnings_are_displayed", "(", "testdir", ")", ":", "testdir", ".", "makeconftest", "(", "\"\"\"\n def pytest_terminal_summary(terminalreporter):\n config = terminalreporter.config\n config.warn('C1', 'internal warning')\n \"\"\"", "...
[ 877, 0 ]
[ 890, 6 ]
python
en
['en', 'en', 'en']
True
TestTerminal.test_collect_single_item
(self, testdir)
Use singular 'item' when reporting a single test item
Use singular 'item' when reporting a single test item
def test_collect_single_item(self, testdir): """Use singular 'item' when reporting a single test item""" testdir.makepyfile(""" def test_foobar(): pass """) result = testdir.runpytest() result.stdout.fnmatch_lines(['collected 1 item'])
[ "def", "test_collect_single_item", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n def test_foobar():\n pass\n \"\"\"", ")", "result", "=", "testdir", ".", "runpytest", "(", ")", "result", ".", "stdout...
[ 207, 4 ]
[ 214, 57 ]
python
en
['en', 'en', 'en']
True
TestCollectonly.test_collectonly_missing_path
(self, testdir)
this checks issue 115, failure in parseargs will cause session not to have the items attribute
this checks issue 115, failure in parseargs will cause session not to have the items attribute
def test_collectonly_missing_path(self, testdir): """this checks issue 115, failure in parseargs will cause session not to have the items attribute """ result = testdir.runpytest("--collect-only", "uhm_missing_path") assert result.ret == 4 result.stderr.fn...
[ "def", "test_collectonly_missing_path", "(", "self", ",", "testdir", ")", ":", "result", "=", "testdir", ".", "runpytest", "(", "\"--collect-only\"", ",", "\"uhm_missing_path\"", ")", "assert", "result", ".", "ret", "==", "4", "result", ".", "stderr", ".", "fn...
[ 298, 4 ]
[ 307, 10 ]
python
en
['en', 'hmn', 'en']
True
TestFixtureReporting.test_setup_teardown_output_and_test_failure
(self, testdir)
Test for issue #442
Test for issue #442
def test_setup_teardown_output_and_test_failure(self, testdir): """ Test for issue #442 """ testdir.makepyfile(""" def setup_function(function): print ("setup func") def test_fail(): assert 0, "failingfunc" def teardown_function(funct...
[ "def", "test_setup_teardown_output_and_test_failure", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n def setup_function(function):\n print (\"setup func\")\n\n def test_fail():\n assert 0, \"failingfunc\...
[ 394, 4 ]
[ 417, 10 ]
python
en
['en', 'en', 'en']
True
TestProgress.test_zero_tests_collected
(self, testdir)
Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being actually collected (#2971).
Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being actually collected (#2971).
def test_zero_tests_collected(self, testdir): """Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being actually collected (#2971).""" testdir.makeconftest(""" def pytest_collection_modifyitems(items, config): from _pytest.runner impor...
[ "def", "test_zero_tests_collected", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makeconftest", "(", "\"\"\"\n def pytest_collection_modifyitems(items, config):\n from _pytest.runner import CollectReport\n for node_id in ('nodeid1', 'nodeid2'):\n ...
[ 990, 4 ]
[ 1006, 10 ]
python
en
['en', 'en', 'en']
True
bdist_wininst.reinitialize_command
(self, command, reinit_subcommands=0)
Supplement reinitialize_command to work around http://bugs.python.org/issue20819
Supplement reinitialize_command to work around http://bugs.python.org/issue20819
def reinitialize_command(self, command, reinit_subcommands=0): """ Supplement reinitialize_command to work around http://bugs.python.org/issue20819 """ cmd = self.distribution.reinitialize_command( command, reinit_subcommands) if command in ('install', 'instal...
[ "def", "reinitialize_command", "(", "self", ",", "command", ",", "reinit_subcommands", "=", "0", ")", ":", "cmd", "=", "self", ".", "distribution", ".", "reinitialize_command", "(", "command", ",", "reinit_subcommands", ")", "if", "command", "in", "(", "'insta...
[ 7, 4 ]
[ 16, 18 ]
python
en
['en', 'error', 'th']
False
FormsetDataTableMixin.get_required_columns
(self)
Lists names of columns that have required fields.
Lists names of columns that have required fields.
def get_required_columns(self): """Lists names of columns that have required fields.""" required_columns = [] if self.formset_class: empty_form = self.get_formset().empty_form for column in self.columns.values(): field = empty_form.fields.get(column.name) ...
[ "def", "get_required_columns", "(", "self", ")", ":", "required_columns", "=", "[", "]", "if", "self", ".", "formset_class", ":", "empty_form", "=", "self", ".", "get_formset", "(", ")", ".", "empty_form", "for", "column", "in", "self", ".", "columns", "."...
[ 86, 4 ]
[ 95, 31 ]
python
en
['en', 'en', 'en']
True
FormsetDataTableMixin._get_formset_data
(self)
Formats the self.filtered_data in a way suitable for a formset.
Formats the self.filtered_data in a way suitable for a formset.
def _get_formset_data(self): """Formats the self.filtered_data in a way suitable for a formset.""" data = [] for datum in self.filtered_data: form_data = {} for column in self.columns.values(): value = column.get_data(datum) form_data[colum...
[ "def", "_get_formset_data", "(", "self", ")", ":", "data", "=", "[", "]", "for", "datum", "in", "self", ".", "filtered_data", ":", "form_data", "=", "{", "}", "for", "column", "in", "self", ".", "columns", ".", "values", "(", ")", ":", "value", "=", ...
[ 97, 4 ]
[ 107, 19 ]
python
en
['en', 'en', 'en']
True
FormsetDataTableMixin.get_formset
(self)
Provide the formset corresponding to this DataTable. Use this to validate the formset and to get the submitted data back.
Provide the formset corresponding to this DataTable.
def get_formset(self): """Provide the formset corresponding to this DataTable. Use this to validate the formset and to get the submitted data back. """ if self._formset is None: self._formset = self.formset_class( self.request.POST or None, in...
[ "def", "get_formset", "(", "self", ")", ":", "if", "self", ".", "_formset", "is", "None", ":", "self", ".", "_formset", "=", "self", ".", "formset_class", "(", "self", ".", "request", ".", "POST", "or", "None", ",", "initial", "=", "self", ".", "_get...
[ 109, 4 ]
[ 119, 28 ]
python
en
['en', 'en', 'en']
True
FormsetDataTableMixin.get_empty_row
(self)
Return a row with no data, for adding at the end of the table.
Return a row with no data, for adding at the end of the table.
def get_empty_row(self): """Return a row with no data, for adding at the end of the table.""" return self._meta.row_class(self, None, self.get_formset().empty_form)
[ "def", "get_empty_row", "(", "self", ")", ":", "return", "self", ".", "_meta", ".", "row_class", "(", "self", ",", "None", ",", "self", ".", "get_formset", "(", ")", ".", "empty_form", ")" ]
[ 121, 4 ]
[ 123, 78 ]
python
en
['en', 'en', 'en']
True
FormsetDataTableMixin.get_rows
(self)
Return the row data for this table broken out by columns. The row objects get an additional ``form`` parameter, with the formset form corresponding to that row.
Return the row data for this table broken out by columns.
def get_rows(self): """Return the row data for this table broken out by columns. The row objects get an additional ``form`` parameter, with the formset form corresponding to that row. """ try: rows = [] if self.formset_class is None: forms...
[ "def", "get_rows", "(", "self", ")", ":", "try", ":", "rows", "=", "[", "]", "if", "self", ".", "formset_class", "is", "None", ":", "formset", "=", "[", "]", "else", ":", "formset", "=", "self", ".", "get_formset", "(", ")", "formset", ".", "is_val...
[ 125, 4 ]
[ 152, 19 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__init__
(self, geom_input, srs=None)
Initializes Geometry on either WKT or an OGR pointer as input.
Initializes Geometry on either WKT or an OGR pointer as input.
def __init__(self, geom_input, srs=None): "Initializes Geometry on either WKT or an OGR pointer as input." str_instance = isinstance(geom_input, six.string_types) # If HEX, unpack input to a binary buffer. if str_instance and hex_regex.match(geom_input): geom_input = six.me...
[ "def", "__init__", "(", "self", ",", "geom_input", ",", "srs", "=", "None", ")", ":", "str_instance", "=", "isinstance", "(", "geom_input", ",", "six", ".", "string_types", ")", "# If HEX, unpack input to a binary buffer.", "if", "str_instance", "and", "hex_regex"...
[ 70, 4 ]
[ 125, 56 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__del__
(self)
Deletes this Geometry.
Deletes this Geometry.
def __del__(self): "Deletes this Geometry." if self._ptr and capi: capi.destroy_geom(self._ptr)
[ "def", "__del__", "(", "self", ")", ":", "if", "self", ".", "_ptr", "and", "capi", ":", "capi", ".", "destroy_geom", "(", "self", ".", "_ptr", ")" ]
[ 127, 4 ]
[ 130, 40 ]
python
en
['en', 'sr', 'en']
True
OGRGeometry.from_bbox
(cls, bbox)
Constructs a Polygon from a bounding box (4-tuple).
Constructs a Polygon from a bounding box (4-tuple).
def from_bbox(cls, bbox): "Constructs a Polygon from a bounding box (4-tuple)." x0, y0, x1, y1 = bbox return OGRGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % ( x0, y0, x0, y1, x1, y1, x1, y0, x0, y0))
[ "def", "from_bbox", "(", "cls", ",", "bbox", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "bbox", "return", "OGRGeometry", "(", "'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))'", "%", "(", "x0", ",", "y0", ",", "x0", ",", "y1", ",", "x1", ",", ...
[ 150, 4 ]
[ 154, 52 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__or__
(self, other)
Returns the union of the two geometries.
Returns the union of the two geometries.
def __or__(self, other): "Returns the union of the two geometries." return self.union(other)
[ "def", "__or__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "union", "(", "other", ")" ]
[ 158, 4 ]
[ 160, 32 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__and__
(self, other)
Returns the intersection of this Geometry and the other.
Returns the intersection of this Geometry and the other.
def __and__(self, other): "Returns the intersection of this Geometry and the other." return self.intersection(other)
[ "def", "__and__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "intersection", "(", "other", ")" ]
[ 163, 4 ]
[ 165, 39 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__sub__
(self, other)
Return the difference this Geometry and the other.
Return the difference this Geometry and the other.
def __sub__(self, other): "Return the difference this Geometry and the other." return self.difference(other)
[ "def", "__sub__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "difference", "(", "other", ")" ]
[ 168, 4 ]
[ 170, 37 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__xor__
(self, other)
Return the symmetric difference of this Geometry and the other.
Return the symmetric difference of this Geometry and the other.
def __xor__(self, other): "Return the symmetric difference of this Geometry and the other." return self.sym_difference(other)
[ "def", "__xor__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "sym_difference", "(", "other", ")" ]
[ 173, 4 ]
[ 175, 41 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__eq__
(self, other)
Is this Geometry equal to the other?
Is this Geometry equal to the other?
def __eq__(self, other): "Is this Geometry equal to the other?" if isinstance(other, OGRGeometry): return self.equals(other) else: return False
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "OGRGeometry", ")", ":", "return", "self", ".", "equals", "(", "other", ")", "else", ":", "return", "False" ]
[ 177, 4 ]
[ 182, 24 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__ne__
(self, other)
Tests for inequality.
Tests for inequality.
def __ne__(self, other): "Tests for inequality." return not (self == other)
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "return", "not", "(", "self", "==", "other", ")" ]
[ 184, 4 ]
[ 186, 34 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.__str__
(self)
WKT is used for the string representation.
WKT is used for the string representation.
def __str__(self): "WKT is used for the string representation." return self.wkt
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "wkt" ]
[ 188, 4 ]
[ 190, 23 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.dimension
(self)
Returns 0 for points, 1 for lines, and 2 for surfaces.
Returns 0 for points, 1 for lines, and 2 for surfaces.
def dimension(self): "Returns 0 for points, 1 for lines, and 2 for surfaces." return capi.get_dims(self.ptr)
[ "def", "dimension", "(", "self", ")", ":", "return", "capi", ".", "get_dims", "(", "self", ".", "ptr", ")" ]
[ 194, 4 ]
[ 196, 38 ]
python
en
['en', 'en', 'en']
True
OGRGeometry._get_coord_dim
(self)
Returns the coordinate dimension of the Geometry.
Returns the coordinate dimension of the Geometry.
def _get_coord_dim(self): "Returns the coordinate dimension of the Geometry." return capi.get_coord_dim(self.ptr)
[ "def", "_get_coord_dim", "(", "self", ")", ":", "return", "capi", ".", "get_coord_dim", "(", "self", ".", "ptr", ")" ]
[ 198, 4 ]
[ 200, 43 ]
python
en
['en', 'en', 'en']
True
OGRGeometry._set_coord_dim
(self, dim)
Sets the coordinate dimension of this Geometry.
Sets the coordinate dimension of this Geometry.
def _set_coord_dim(self, dim): "Sets the coordinate dimension of this Geometry." if dim not in (2, 3): raise ValueError('Geometry dimension must be either 2 or 3') capi.set_coord_dim(self.ptr, dim)
[ "def", "_set_coord_dim", "(", "self", ",", "dim", ")", ":", "if", "dim", "not", "in", "(", "2", ",", "3", ")", ":", "raise", "ValueError", "(", "'Geometry dimension must be either 2 or 3'", ")", "capi", ".", "set_coord_dim", "(", "self", ".", "ptr", ",", ...
[ 202, 4 ]
[ 206, 41 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.geom_count
(self)
The number of elements in this Geometry.
The number of elements in this Geometry.
def geom_count(self): "The number of elements in this Geometry." return capi.get_geom_count(self.ptr)
[ "def", "geom_count", "(", "self", ")", ":", "return", "capi", ".", "get_geom_count", "(", "self", ".", "ptr", ")" ]
[ 211, 4 ]
[ 213, 44 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.point_count
(self)
Returns the number of Points in this Geometry.
Returns the number of Points in this Geometry.
def point_count(self): "Returns the number of Points in this Geometry." return capi.get_point_count(self.ptr)
[ "def", "point_count", "(", "self", ")", ":", "return", "capi", ".", "get_point_count", "(", "self", ".", "ptr", ")" ]
[ 216, 4 ]
[ 218, 45 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.num_points
(self)
Alias for `point_count` (same name method in GEOS API.)
Alias for `point_count` (same name method in GEOS API.)
def num_points(self): "Alias for `point_count` (same name method in GEOS API.)" return self.point_count
[ "def", "num_points", "(", "self", ")", ":", "return", "self", ".", "point_count" ]
[ 221, 4 ]
[ 223, 31 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.num_coords
(self)
Alais for `point_count`.
Alais for `point_count`.
def num_coords(self): "Alais for `point_count`." return self.point_count
[ "def", "num_coords", "(", "self", ")", ":", "return", "self", ".", "point_count" ]
[ 226, 4 ]
[ 228, 31 ]
python
en
['fr', 'en', 'en']
True
OGRGeometry.geom_type
(self)
Returns the Type for this Geometry.
Returns the Type for this Geometry.
def geom_type(self): "Returns the Type for this Geometry." return OGRGeomType(capi.get_geom_type(self.ptr))
[ "def", "geom_type", "(", "self", ")", ":", "return", "OGRGeomType", "(", "capi", ".", "get_geom_type", "(", "self", ".", "ptr", ")", ")" ]
[ 231, 4 ]
[ 233, 56 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.geom_name
(self)
Returns the Name of this Geometry.
Returns the Name of this Geometry.
def geom_name(self): "Returns the Name of this Geometry." return capi.get_geom_name(self.ptr)
[ "def", "geom_name", "(", "self", ")", ":", "return", "capi", ".", "get_geom_name", "(", "self", ".", "ptr", ")" ]
[ 236, 4 ]
[ 238, 43 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.area
(self)
Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise.
Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise.
def area(self): "Returns the area for a LinearRing, Polygon, or MultiPolygon; 0 otherwise." return capi.get_area(self.ptr)
[ "def", "area", "(", "self", ")", ":", "return", "capi", ".", "get_area", "(", "self", ".", "ptr", ")" ]
[ 241, 4 ]
[ 243, 38 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.envelope
(self)
Returns the envelope for this Geometry.
Returns the envelope for this Geometry.
def envelope(self): "Returns the envelope for this Geometry." # TODO: Fix Envelope() for Point geometries. return Envelope(capi.get_envelope(self.ptr, byref(OGREnvelope())))
[ "def", "envelope", "(", "self", ")", ":", "# TODO: Fix Envelope() for Point geometries.", "return", "Envelope", "(", "capi", ".", "get_envelope", "(", "self", ".", "ptr", ",", "byref", "(", "OGREnvelope", "(", ")", ")", ")", ")" ]
[ 246, 4 ]
[ 249, 74 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.extent
(self)
Returns the envelope as a 4-tuple, instead of as an Envelope object.
Returns the envelope as a 4-tuple, instead of as an Envelope object.
def extent(self): "Returns the envelope as a 4-tuple, instead of as an Envelope object." return self.envelope.tuple
[ "def", "extent", "(", "self", ")", ":", "return", "self", ".", "envelope", ".", "tuple" ]
[ 252, 4 ]
[ 254, 34 ]
python
en
['en', 'en', 'en']
True
OGRGeometry._get_srs
(self)
Returns the Spatial Reference for this Geometry.
Returns the Spatial Reference for this Geometry.
def _get_srs(self): "Returns the Spatial Reference for this Geometry." try: srs_ptr = capi.get_geom_srs(self.ptr) return SpatialReference(srs_api.clone_srs(srs_ptr)) except SRSException: return None
[ "def", "_get_srs", "(", "self", ")", ":", "try", ":", "srs_ptr", "=", "capi", ".", "get_geom_srs", "(", "self", ".", "ptr", ")", "return", "SpatialReference", "(", "srs_api", ".", "clone_srs", "(", "srs_ptr", ")", ")", "except", "SRSException", ":", "ret...
[ 259, 4 ]
[ 265, 23 ]
python
en
['en', 'en', 'en']
True
OGRGeometry._set_srs
(self, srs)
Sets the SpatialReference for this geometry.
Sets the SpatialReference for this geometry.
def _set_srs(self, srs): "Sets the SpatialReference for this geometry." # Do not have to clone the `SpatialReference` object pointer because # when it is assigned to this `OGRGeometry` it's internal OGR # reference count is incremented, and will likewise be released # (decremente...
[ "def", "_set_srs", "(", "self", ",", "srs", ")", ":", "# Do not have to clone the `SpatialReference` object pointer because", "# when it is assigned to this `OGRGeometry` it's internal OGR", "# reference count is incremented, and will likewise be released", "# (decremented) when this geometry'...
[ 267, 4 ]
[ 280, 42 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.geos
(self)
Returns a GEOSGeometry object from this OGRGeometry.
Returns a GEOSGeometry object from this OGRGeometry.
def geos(self): "Returns a GEOSGeometry object from this OGRGeometry." from django.contrib.gis.geos import GEOSGeometry return GEOSGeometry(self.wkb, self.srid)
[ "def", "geos", "(", "self", ")", ":", "from", "django", ".", "contrib", ".", "gis", ".", "geos", "import", "GEOSGeometry", "return", "GEOSGeometry", "(", "self", ".", "wkb", ",", "self", ".", "srid", ")" ]
[ 301, 4 ]
[ 304, 48 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.gml
(self)
Returns the GML representation of the Geometry.
Returns the GML representation of the Geometry.
def gml(self): "Returns the GML representation of the Geometry." return capi.to_gml(self.ptr)
[ "def", "gml", "(", "self", ")", ":", "return", "capi", ".", "to_gml", "(", "self", ".", "ptr", ")" ]
[ 307, 4 ]
[ 309, 36 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.hex
(self)
Returns the hexadecimal representation of the WKB (a string).
Returns the hexadecimal representation of the WKB (a string).
def hex(self): "Returns the hexadecimal representation of the WKB (a string)." return b2a_hex(self.wkb).upper()
[ "def", "hex", "(", "self", ")", ":", "return", "b2a_hex", "(", "self", ".", "wkb", ")", ".", "upper", "(", ")" ]
[ 312, 4 ]
[ 314, 40 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.json
(self)
Returns the GeoJSON representation of this Geometry.
Returns the GeoJSON representation of this Geometry.
def json(self): """ Returns the GeoJSON representation of this Geometry. """ return capi.to_json(self.ptr)
[ "def", "json", "(", "self", ")", ":", "return", "capi", ".", "to_json", "(", "self", ".", "ptr", ")" ]
[ 317, 4 ]
[ 321, 37 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.kml
(self)
Returns the KML representation of the Geometry.
Returns the KML representation of the Geometry.
def kml(self): "Returns the KML representation of the Geometry." return capi.to_kml(self.ptr, None)
[ "def", "kml", "(", "self", ")", ":", "return", "capi", ".", "to_kml", "(", "self", ".", "ptr", ",", "None", ")" ]
[ 325, 4 ]
[ 327, 42 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.wkb_size
(self)
Returns the size of the WKB buffer.
Returns the size of the WKB buffer.
def wkb_size(self): "Returns the size of the WKB buffer." return capi.get_wkbsize(self.ptr)
[ "def", "wkb_size", "(", "self", ")", ":", "return", "capi", ".", "get_wkbsize", "(", "self", ".", "ptr", ")" ]
[ 330, 4 ]
[ 332, 41 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.wkb
(self)
Returns the WKB representation of the Geometry.
Returns the WKB representation of the Geometry.
def wkb(self): "Returns the WKB representation of the Geometry." if sys.byteorder == 'little': byteorder = 1 # wkbNDR (from ogr_core.h) else: byteorder = 0 # wkbXDR sz = self.wkb_size # Creating the unsigned character buffer, and passing it in by referen...
[ "def", "wkb", "(", "self", ")", ":", "if", "sys", ".", "byteorder", "==", "'little'", ":", "byteorder", "=", "1", "# wkbNDR (from ogr_core.h)", "else", ":", "byteorder", "=", "0", "# wkbXDR", "sz", "=", "self", ".", "wkb_size", "# Creating the unsigned charact...
[ 335, 4 ]
[ 346, 49 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.wkt
(self)
Returns the WKT representation of the Geometry.
Returns the WKT representation of the Geometry.
def wkt(self): "Returns the WKT representation of the Geometry." return capi.to_wkt(self.ptr, byref(c_char_p()))
[ "def", "wkt", "(", "self", ")", ":", "return", "capi", ".", "to_wkt", "(", "self", ".", "ptr", ",", "byref", "(", "c_char_p", "(", ")", ")", ")" ]
[ 349, 4 ]
[ 351, 55 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.ewkt
(self)
Returns the EWKT representation of the Geometry.
Returns the EWKT representation of the Geometry.
def ewkt(self): "Returns the EWKT representation of the Geometry." srs = self.srs if srs and srs.srid: return 'SRID=%s;%s' % (srs.srid, self.wkt) else: return self.wkt
[ "def", "ewkt", "(", "self", ")", ":", "srs", "=", "self", ".", "srs", "if", "srs", "and", "srs", ".", "srid", ":", "return", "'SRID=%s;%s'", "%", "(", "srs", ".", "srid", ",", "self", ".", "wkt", ")", "else", ":", "return", "self", ".", "wkt" ]
[ 354, 4 ]
[ 360, 27 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.clone
(self)
Clones this OGR Geometry.
Clones this OGR Geometry.
def clone(self): "Clones this OGR Geometry." return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
[ "def", "clone", "(", "self", ")", ":", "return", "OGRGeometry", "(", "capi", ".", "clone_geom", "(", "self", ".", "ptr", ")", ",", "self", ".", "srs", ")" ]
[ 363, 4 ]
[ 365, 63 ]
python
en
['en', 'id', 'en']
True
OGRGeometry.close_rings
(self)
If there are any rings within this geometry that have not been closed, this routine will do so by adding the starting point at the end.
If there are any rings within this geometry that have not been closed, this routine will do so by adding the starting point at the end.
def close_rings(self): """ If there are any rings within this geometry that have not been closed, this routine will do so by adding the starting point at the end. """ # Closing the open rings. capi.geom_close_rings(self.ptr)
[ "def", "close_rings", "(", "self", ")", ":", "# Closing the open rings.", "capi", ".", "geom_close_rings", "(", "self", ".", "ptr", ")" ]
[ 367, 4 ]
[ 374, 39 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.transform
(self, coord_trans, clone=False)
Transforms this geometry to a different spatial reference system. May take a CoordTransform object, a SpatialReference object, string WKT or PROJ.4, and/or an integer SRID. By default nothing is returned and the geometry is transformed in-place. However, if the `clone` keyword...
Transforms this geometry to a different spatial reference system. May take a CoordTransform object, a SpatialReference object, string WKT or PROJ.4, and/or an integer SRID. By default nothing is returned and the geometry is transformed in-place. However, if the `clone` keyword...
def transform(self, coord_trans, clone=False): """ Transforms this geometry to a different spatial reference system. May take a CoordTransform object, a SpatialReference object, string WKT or PROJ.4, and/or an integer SRID. By default nothing is returned and the geometry is tran...
[ "def", "transform", "(", "self", ",", "coord_trans", ",", "clone", "=", "False", ")", ":", "if", "clone", ":", "klone", "=", "self", ".", "clone", "(", ")", "klone", ".", "transform", "(", "coord_trans", ")", "return", "klone", "# Depending on the input ty...
[ 376, 4 ]
[ 401, 77 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.transform_to
(self, srs)
For backwards-compatibility.
For backwards-compatibility.
def transform_to(self, srs): "For backwards-compatibility." self.transform(srs)
[ "def", "transform_to", "(", "self", ",", "srs", ")", ":", "self", ".", "transform", "(", "srs", ")" ]
[ 403, 4 ]
[ 405, 27 ]
python
en
['en', 'en', 'en']
False
OGRGeometry._topology
(self, func, other)
A generalized function for topology operations, takes a GDAL function and the other geometry to perform the operation on.
A generalized function for topology operations, takes a GDAL function and the other geometry to perform the operation on.
def _topology(self, func, other): """A generalized function for topology operations, takes a GDAL function and the other geometry to perform the operation on.""" if not isinstance(other, OGRGeometry): raise TypeError('Must use another OGRGeometry object for topology operations!') ...
[ "def", "_topology", "(", "self", ",", "func", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "OGRGeometry", ")", ":", "raise", "TypeError", "(", "'Must use another OGRGeometry object for topology operations!'", ")", "# Returning the output of th...
[ 408, 4 ]
[ 416, 40 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.intersects
(self, other)
Returns True if this geometry intersects with the other.
Returns True if this geometry intersects with the other.
def intersects(self, other): "Returns True if this geometry intersects with the other." return self._topology(capi.ogr_intersects, other)
[ "def", "intersects", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_intersects", ",", "other", ")" ]
[ 418, 4 ]
[ 420, 57 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.equals
(self, other)
Returns True if this geometry is equivalent to the other.
Returns True if this geometry is equivalent to the other.
def equals(self, other): "Returns True if this geometry is equivalent to the other." return self._topology(capi.ogr_equals, other)
[ "def", "equals", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_equals", ",", "other", ")" ]
[ 422, 4 ]
[ 424, 53 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.disjoint
(self, other)
Returns True if this geometry and the other are spatially disjoint.
Returns True if this geometry and the other are spatially disjoint.
def disjoint(self, other): "Returns True if this geometry and the other are spatially disjoint." return self._topology(capi.ogr_disjoint, other)
[ "def", "disjoint", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_disjoint", ",", "other", ")" ]
[ 426, 4 ]
[ 428, 55 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.touches
(self, other)
Returns True if this geometry touches the other.
Returns True if this geometry touches the other.
def touches(self, other): "Returns True if this geometry touches the other." return self._topology(capi.ogr_touches, other)
[ "def", "touches", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_touches", ",", "other", ")" ]
[ 430, 4 ]
[ 432, 54 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.crosses
(self, other)
Returns True if this geometry crosses the other.
Returns True if this geometry crosses the other.
def crosses(self, other): "Returns True if this geometry crosses the other." return self._topology(capi.ogr_crosses, other)
[ "def", "crosses", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_crosses", ",", "other", ")" ]
[ 434, 4 ]
[ 436, 54 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.within
(self, other)
Returns True if this geometry is within the other.
Returns True if this geometry is within the other.
def within(self, other): "Returns True if this geometry is within the other." return self._topology(capi.ogr_within, other)
[ "def", "within", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_within", ",", "other", ")" ]
[ 438, 4 ]
[ 440, 53 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.contains
(self, other)
Returns True if this geometry contains the other.
Returns True if this geometry contains the other.
def contains(self, other): "Returns True if this geometry contains the other." return self._topology(capi.ogr_contains, other)
[ "def", "contains", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_contains", ",", "other", ")" ]
[ 442, 4 ]
[ 444, 55 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.overlaps
(self, other)
Returns True if this geometry overlaps the other.
Returns True if this geometry overlaps the other.
def overlaps(self, other): "Returns True if this geometry overlaps the other." return self._topology(capi.ogr_overlaps, other)
[ "def", "overlaps", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_topology", "(", "capi", ".", "ogr_overlaps", ",", "other", ")" ]
[ 446, 4 ]
[ 448, 55 ]
python
en
['en', 'en', 'en']
True
OGRGeometry._geomgen
(self, gen_func, other=None)
A helper routine for the OGR routines that generate geometries.
A helper routine for the OGR routines that generate geometries.
def _geomgen(self, gen_func, other=None): "A helper routine for the OGR routines that generate geometries." if isinstance(other, OGRGeometry): return OGRGeometry(gen_func(self.ptr, other.ptr), self.srs) else: return OGRGeometry(gen_func(self.ptr), self.srs)
[ "def", "_geomgen", "(", "self", ",", "gen_func", ",", "other", "=", "None", ")", ":", "if", "isinstance", "(", "other", ",", "OGRGeometry", ")", ":", "return", "OGRGeometry", "(", "gen_func", "(", "self", ".", "ptr", ",", "other", ".", "ptr", ")", ",...
[ 451, 4 ]
[ 456, 60 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.boundary
(self)
Returns the boundary of this geometry.
Returns the boundary of this geometry.
def boundary(self): "Returns the boundary of this geometry." return self._geomgen(capi.get_boundary)
[ "def", "boundary", "(", "self", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "get_boundary", ")" ]
[ 459, 4 ]
[ 461, 47 ]
python
en
['en', 'en', 'en']
True
OGRGeometry.convex_hull
(self)
Returns the smallest convex Polygon that contains all the points in this Geometry.
Returns the smallest convex Polygon that contains all the points in this Geometry.
def convex_hull(self): """ Returns the smallest convex Polygon that contains all the points in this Geometry. """ return self._geomgen(capi.geom_convex_hull)
[ "def", "convex_hull", "(", "self", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_convex_hull", ")" ]
[ 464, 4 ]
[ 469, 51 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.difference
(self, other)
Returns a new geometry consisting of the region which is the difference of this geometry and the other.
Returns a new geometry consisting of the region which is the difference of this geometry and the other.
def difference(self, other): """ Returns a new geometry consisting of the region which is the difference of this geometry and the other. """ return self._geomgen(capi.geom_diff, other)
[ "def", "difference", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_diff", ",", "other", ")" ]
[ 471, 4 ]
[ 476, 51 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.intersection
(self, other)
Returns a new geometry consisting of the region of intersection of this geometry and the other.
Returns a new geometry consisting of the region of intersection of this geometry and the other.
def intersection(self, other): """ Returns a new geometry consisting of the region of intersection of this geometry and the other. """ return self._geomgen(capi.geom_intersection, other)
[ "def", "intersection", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_intersection", ",", "other", ")" ]
[ 478, 4 ]
[ 483, 59 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.sym_difference
(self, other)
Returns a new geometry which is the symmetric difference of this geometry and the other.
Returns a new geometry which is the symmetric difference of this geometry and the other.
def sym_difference(self, other): """ Returns a new geometry which is the symmetric difference of this geometry and the other. """ return self._geomgen(capi.geom_sym_diff, other)
[ "def", "sym_difference", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_sym_diff", ",", "other", ")" ]
[ 485, 4 ]
[ 490, 55 ]
python
en
['en', 'error', 'th']
False
OGRGeometry.union
(self, other)
Returns a new geometry consisting of the region which is the union of this geometry and the other.
Returns a new geometry consisting of the region which is the union of this geometry and the other.
def union(self, other): """ Returns a new geometry consisting of the region which is the union of this geometry and the other. """ return self._geomgen(capi.geom_union, other)
[ "def", "union", "(", "self", ",", "other", ")", ":", "return", "self", ".", "_geomgen", "(", "capi", ".", "geom_union", ",", "other", ")" ]
[ 492, 4 ]
[ 497, 52 ]
python
en
['en', 'error', 'th']
False
Point.x
(self)
Returns the X coordinate for this Point.
Returns the X coordinate for this Point.
def x(self): "Returns the X coordinate for this Point." return capi.getx(self.ptr, 0)
[ "def", "x", "(", "self", ")", ":", "return", "capi", ".", "getx", "(", "self", ".", "ptr", ",", "0", ")" ]
[ 504, 4 ]
[ 506, 37 ]
python
en
['en', 'en', 'en']
True
Point.y
(self)
Returns the Y coordinate for this Point.
Returns the Y coordinate for this Point.
def y(self): "Returns the Y coordinate for this Point." return capi.gety(self.ptr, 0)
[ "def", "y", "(", "self", ")", ":", "return", "capi", ".", "gety", "(", "self", ".", "ptr", ",", "0", ")" ]
[ 509, 4 ]
[ 511, 37 ]
python
en
['en', 'en', 'en']
True
Point.z
(self)
Returns the Z coordinate for this Point.
Returns the Z coordinate for this Point.
def z(self): "Returns the Z coordinate for this Point." if self.coord_dim == 3: return capi.getz(self.ptr, 0)
[ "def", "z", "(", "self", ")", ":", "if", "self", ".", "coord_dim", "==", "3", ":", "return", "capi", ".", "getz", "(", "self", ".", "ptr", ",", "0", ")" ]
[ 514, 4 ]
[ 517, 41 ]
python
en
['en', 'en', 'en']
True
Point.tuple
(self)
Returns the tuple of this point.
Returns the tuple of this point.
def tuple(self): "Returns the tuple of this point." if self.coord_dim == 2: return (self.x, self.y) elif self.coord_dim == 3: return (self.x, self.y, self.z)
[ "def", "tuple", "(", "self", ")", ":", "if", "self", ".", "coord_dim", "==", "2", ":", "return", "(", "self", ".", "x", ",", "self", ".", "y", ")", "elif", "self", ".", "coord_dim", "==", "3", ":", "return", "(", "self", ".", "x", ",", "self", ...
[ 520, 4 ]
[ 525, 43 ]
python
en
['en', 'en', 'en']
True
LineString.__getitem__
(self, index)
Returns the Point at the given index.
Returns the Point at the given index.
def __getitem__(self, index): "Returns the Point at the given index." if index >= 0 and index < self.point_count: x, y, z = c_double(), c_double(), c_double() capi.get_point(self.ptr, index, byref(x), byref(y), byref(z)) dim = self.coord_dim if dim == 1: ...
[ "def", "__getitem__", "(", "self", ",", "index", ")", ":", "if", "index", ">=", "0", "and", "index", "<", "self", ".", "point_count", ":", "x", ",", "y", ",", "z", "=", "c_double", "(", ")", ",", "c_double", "(", ")", ",", "c_double", "(", ")", ...
[ 531, 4 ]
[ 544, 70 ]
python
en
['en', 'en', 'en']
True
LineString.__iter__
(self)
Iterates over each point in the LineString.
Iterates over each point in the LineString.
def __iter__(self): "Iterates over each point in the LineString." for i in xrange(self.point_count): yield self[i]
[ "def", "__iter__", "(", "self", ")", ":", "for", "i", "in", "xrange", "(", "self", ".", "point_count", ")", ":", "yield", "self", "[", "i", "]" ]
[ 546, 4 ]
[ 549, 25 ]
python
en
['en', 'en', 'en']
True
LineString.__len__
(self)
The length returns the number of points in the LineString.
The length returns the number of points in the LineString.
def __len__(self): "The length returns the number of points in the LineString." return self.point_count
[ "def", "__len__", "(", "self", ")", ":", "return", "self", ".", "point_count" ]
[ 551, 4 ]
[ 553, 31 ]
python
en
['en', 'en', 'en']
True
LineString.tuple
(self)
Returns the tuple representation of this LineString.
Returns the tuple representation of this LineString.
def tuple(self): "Returns the tuple representation of this LineString." return tuple(self[i] for i in xrange(len(self)))
[ "def", "tuple", "(", "self", ")", ":", "return", "tuple", "(", "self", "[", "i", "]", "for", "i", "in", "xrange", "(", "len", "(", "self", ")", ")", ")" ]
[ 556, 4 ]
[ 558, 56 ]
python
en
['en', 'en', 'en']
True