repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
pipermerriam/flex
flex/exceptions.py
ErrorList.add_error
def add_error(self, error): """ In the case where a list/tuple is passed in this just extends the list rather than having nested lists. Otherwise, the value is appended. """ if is_non_string_iterable(error) and not isinstance(error, collections.Mapping): for ...
python
def add_error(self, error): """ In the case where a list/tuple is passed in this just extends the list rather than having nested lists. Otherwise, the value is appended. """ if is_non_string_iterable(error) and not isinstance(error, collections.Mapping): for ...
In the case where a list/tuple is passed in this just extends the list rather than having nested lists. Otherwise, the value is appended.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/exceptions.py#L33-L44
pipermerriam/flex
flex/utils.py
deep_equal
def deep_equal(a, b): """ Because of things in python like: >>> 1 == 1.0 True >>> 1 == True True >>> b'test' == 'test' # python3 False """ if is_any_string_type(a) and is_any_string_type(b): if isinstance(a, six.binary_type): a = six.t...
python
def deep_equal(a, b): """ Because of things in python like: >>> 1 == 1.0 True >>> 1 == True True >>> b'test' == 'test' # python3 False """ if is_any_string_type(a) and is_any_string_type(b): if isinstance(a, six.binary_type): a = six.t...
Because of things in python like: >>> 1 == 1.0 True >>> 1 == True True >>> b'test' == 'test' # python3 False
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/utils.py#L68-L84
pipermerriam/flex
flex/utils.py
format_errors
def format_errors(errors, indent=0, prefix='', suffix=''): """ string: "example" "example" dict: "example": - """ if is_single_item_iterable(errors): errors = errors[0] if isinstance(errors, SINGULAR_TYPES): yield indent_message(repr(errors), indent...
python
def format_errors(errors, indent=0, prefix='', suffix=''): """ string: "example" "example" dict: "example": - """ if is_single_item_iterable(errors): errors = errors[0] if isinstance(errors, SINGULAR_TYPES): yield indent_message(repr(errors), indent...
string: "example" "example" dict: "example": -
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/utils.py#L148-L188
pipermerriam/flex
flex/validation/operation.py
generate_header_validator
def generate_header_validator(headers, context, **kwargs): """ Generates a validation function that will validate a dictionary of headers. """ validators = ValidationDict() for header_definition in headers: header_processor = generate_value_processor( context=context, ...
python
def generate_header_validator(headers, context, **kwargs): """ Generates a validation function that will validate a dictionary of headers. """ validators = ValidationDict() for header_definition in headers: header_processor = generate_value_processor( context=context, ...
Generates a validation function that will validate a dictionary of headers.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/operation.py#L62-L82
pipermerriam/flex
flex/validation/operation.py
generate_parameters_validator
def generate_parameters_validator(api_path, path_definition, parameters, context, **kwargs): """ Generates a validator function to validate. - request.path against the path parameters. - request.query against the query parameters. - request.headers against the head...
python
def generate_parameters_validator(api_path, path_definition, parameters, context, **kwargs): """ Generates a validator function to validate. - request.path against the path parameters. - request.query against the query parameters. - request.headers against the head...
Generates a validator function to validate. - request.path against the path parameters. - request.query against the query parameters. - request.headers against the header parameters. - TODO: request.body against the body parameters. - TODO: request.formData against any form data.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/operation.py#L100-L182
pipermerriam/flex
flex/validation/operation.py
construct_operation_validators
def construct_operation_validators(api_path, path_definition, operation_definition, context): """ - consumes (did the request conform to the content types this api consumes) - produces (did the response conform to the content types this endpoint produces) - parameters (did the parameters of this request...
python
def construct_operation_validators(api_path, path_definition, operation_definition, context): """ - consumes (did the request conform to the content types this api consumes) - produces (did the response conform to the content types this endpoint produces) - parameters (did the parameters of this request...
- consumes (did the request conform to the content types this api consumes) - produces (did the response conform to the content types this endpoint produces) - parameters (did the parameters of this request validate) TODO: move path parameter validation to here, because each operation can over...
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/operation.py#L192-L232
pipermerriam/flex
flex/decorators.py
partial_safe_wraps
def partial_safe_wraps(wrapped_func, *args, **kwargs): """ A version of `functools.wraps` that is safe to wrap a partial in. """ if isinstance(wrapped_func, functools.partial): return partial_safe_wraps(wrapped_func.func) else: return functools.wraps(wrapped_func)
python
def partial_safe_wraps(wrapped_func, *args, **kwargs): """ A version of `functools.wraps` that is safe to wrap a partial in. """ if isinstance(wrapped_func, functools.partial): return partial_safe_wraps(wrapped_func.func) else: return functools.wraps(wrapped_func)
A version of `functools.wraps` that is safe to wrap a partial in.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/decorators.py#L10-L17
pipermerriam/flex
flex/decorators.py
skip_if_empty
def skip_if_empty(func): """ Decorator for validation functions which makes them pass if the value passed in is the EMPTY sentinal value. """ @partial_safe_wraps(func) def inner(value, *args, **kwargs): if value is EMPTY: return else: return func(value, *a...
python
def skip_if_empty(func): """ Decorator for validation functions which makes them pass if the value passed in is the EMPTY sentinal value. """ @partial_safe_wraps(func) def inner(value, *args, **kwargs): if value is EMPTY: return else: return func(value, *a...
Decorator for validation functions which makes them pass if the value passed in is the EMPTY sentinal value.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/decorators.py#L42-L53
pipermerriam/flex
flex/decorators.py
rewrite_reserved_words
def rewrite_reserved_words(func): """ Given a function whos kwargs need to contain a reserved word such as `in`, allow calling that function with the keyword as `in_`, such that function kwargs are rewritten to use the reserved word. """ @partial_safe_wraps(func) def inner(*args, **kwargs): ...
python
def rewrite_reserved_words(func): """ Given a function whos kwargs need to contain a reserved word such as `in`, allow calling that function with the keyword as `in_`, such that function kwargs are rewritten to use the reserved word. """ @partial_safe_wraps(func) def inner(*args, **kwargs): ...
Given a function whos kwargs need to contain a reserved word such as `in`, allow calling that function with the keyword as `in_`, such that function kwargs are rewritten to use the reserved word.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/decorators.py#L74-L87
pipermerriam/flex
flex/validation/utils.py
any_validator
def any_validator(obj, validators, **kwargs): """ Attempt multiple validators on an object. - If any pass, then all validation passes. - Otherwise, raise all of the errors. """ if not len(validators) > 1: raise ValueError( "any_validator requires at least 2 validator. Only ...
python
def any_validator(obj, validators, **kwargs): """ Attempt multiple validators on an object. - If any pass, then all validation passes. - Otherwise, raise all of the errors. """ if not len(validators) > 1: raise ValueError( "any_validator requires at least 2 validator. Only ...
Attempt multiple validators on an object. - If any pass, then all validation passes. - Otherwise, raise all of the errors.
https://github.com/pipermerriam/flex/blob/233f8149fb851a6255753bcec948cb6fefb2723b/flex/validation/utils.py#L9-L37
toabctl/metaextract
metaextract/utils.py
_extract_to_tempdir
def _extract_to_tempdir(archive_filename): """extract the given tarball or zipfile to a tempdir and change the cwd to the new tempdir. Delete the tempdir at the end""" if not os.path.exists(archive_filename): raise Exception("Archive '%s' does not exist" % (archive_filename)) tempdir = tempfile...
python
def _extract_to_tempdir(archive_filename): """extract the given tarball or zipfile to a tempdir and change the cwd to the new tempdir. Delete the tempdir at the end""" if not os.path.exists(archive_filename): raise Exception("Archive '%s' does not exist" % (archive_filename)) tempdir = tempfile...
extract the given tarball or zipfile to a tempdir and change the cwd to the new tempdir. Delete the tempdir at the end
https://github.com/toabctl/metaextract/blob/0515490b5983d888bbbaec5fdb5a0a4214743335/metaextract/utils.py#L37-L59
toabctl/metaextract
metaextract/utils.py
_enter_single_subdir
def _enter_single_subdir(root_dir): """if the given directory has just a single subdir, enter that""" current_cwd = os.getcwd() try: dest_dir = root_dir dir_list = os.listdir(root_dir) if len(dir_list) == 1: first = os.path.join(root_dir, dir_list[0]) if os.pa...
python
def _enter_single_subdir(root_dir): """if the given directory has just a single subdir, enter that""" current_cwd = os.getcwd() try: dest_dir = root_dir dir_list = os.listdir(root_dir) if len(dir_list) == 1: first = os.path.join(root_dir, dir_list[0]) if os.pa...
if the given directory has just a single subdir, enter that
https://github.com/toabctl/metaextract/blob/0515490b5983d888bbbaec5fdb5a0a4214743335/metaextract/utils.py#L63-L78
toabctl/metaextract
metaextract/utils.py
_set_file_encoding_utf8
def _set_file_encoding_utf8(filename): """set a encoding header as suggested in PEP-0263. This is not entirely correct because we don't know the encoding of the given file but it's at least a chance to get metadata from the setup.py""" with open(filename, 'r+') as f: content = f.read() f...
python
def _set_file_encoding_utf8(filename): """set a encoding header as suggested in PEP-0263. This is not entirely correct because we don't know the encoding of the given file but it's at least a chance to get metadata from the setup.py""" with open(filename, 'r+') as f: content = f.read() f...
set a encoding header as suggested in PEP-0263. This is not entirely correct because we don't know the encoding of the given file but it's at least a chance to get metadata from the setup.py
https://github.com/toabctl/metaextract/blob/0515490b5983d888bbbaec5fdb5a0a4214743335/metaextract/utils.py#L81-L88
toabctl/metaextract
metaextract/utils.py
_setup_py_run_from_dir
def _setup_py_run_from_dir(root_dir, py_interpreter): """run the extractmeta command via the setup.py in the given root_dir. the output of extractmeta is json and is stored in a tempfile which is then read in and returned as data""" data = {} with _enter_single_subdir(root_dir) as single_subdir: ...
python
def _setup_py_run_from_dir(root_dir, py_interpreter): """run the extractmeta command via the setup.py in the given root_dir. the output of extractmeta is json and is stored in a tempfile which is then read in and returned as data""" data = {} with _enter_single_subdir(root_dir) as single_subdir: ...
run the extractmeta command via the setup.py in the given root_dir. the output of extractmeta is json and is stored in a tempfile which is then read in and returned as data
https://github.com/toabctl/metaextract/blob/0515490b5983d888bbbaec5fdb5a0a4214743335/metaextract/utils.py#L91-L121
toabctl/metaextract
metaextract/utils.py
from_archive
def from_archive(archive_filename, py_interpreter=sys.executable): """extract metadata from a given sdist archive file :param archive_filename: a sdist archive file :param py_interpreter: The full path to the used python interpreter :returns: a json blob with metadata """ with _extract_to_tempdir(...
python
def from_archive(archive_filename, py_interpreter=sys.executable): """extract metadata from a given sdist archive file :param archive_filename: a sdist archive file :param py_interpreter: The full path to the used python interpreter :returns: a json blob with metadata """ with _extract_to_tempdir(...
extract metadata from a given sdist archive file :param archive_filename: a sdist archive file :param py_interpreter: The full path to the used python interpreter :returns: a json blob with metadata
https://github.com/toabctl/metaextract/blob/0515490b5983d888bbbaec5fdb5a0a4214743335/metaextract/utils.py#L125-L135
rwl/PyCIM
PyCIM/RDFXMLReader.py
cimread
def cimread(source, packageMap=None, nsURI=None, start_dict=None): """ CIM RDF/XML parser. @type source: File-like object or a path to a file. @param source: CIM RDF/XML file. @type profile: dict @param packageMap: Map of class name to PyCIM package name. All CIM classes are under the one names...
python
def cimread(source, packageMap=None, nsURI=None, start_dict=None): """ CIM RDF/XML parser. @type source: File-like object or a path to a file. @param source: CIM RDF/XML file. @type profile: dict @param packageMap: Map of class name to PyCIM package name. All CIM classes are under the one names...
CIM RDF/XML parser. @type source: File-like object or a path to a file. @param source: CIM RDF/XML file. @type profile: dict @param packageMap: Map of class name to PyCIM package name. All CIM classes are under the one namespace, but are arranged into sub-packages so a map from class name to pa...
https://github.com/rwl/PyCIM/blob/4a12ebb5a7fb03c7790d396910daef9b97c4ef99/PyCIM/RDFXMLReader.py#L31-L223
rwl/PyCIM
PyCIM/RDFXMLReader.py
xmlns
def xmlns(source): """ Returns a map of prefix to namespace for the given XML file. """ namespaces = {} events=("end", "start-ns", "end-ns") for (event, elem) in iterparse(source, events): if event == "start-ns": prefix, ns = elem namespaces[prefix] = ns ...
python
def xmlns(source): """ Returns a map of prefix to namespace for the given XML file. """ namespaces = {} events=("end", "start-ns", "end-ns") for (event, elem) in iterparse(source, events): if event == "start-ns": prefix, ns = elem namespaces[prefix] = ns ...
Returns a map of prefix to namespace for the given XML file.
https://github.com/rwl/PyCIM/blob/4a12ebb5a7fb03c7790d396910daef9b97c4ef99/PyCIM/RDFXMLReader.py#L226-L244
rwl/PyCIM
PyCIM/RDFXMLReader.py
get_cim_ns
def get_cim_ns(namespaces): """ Tries to obtain the CIM version from the given map of namespaces and returns the appropriate *nsURI* and *packageMap*. """ try: ns = namespaces['cim'] if ns.endswith('#'): ns = ns[:-1] except KeyError: ns = '' logger.er...
python
def get_cim_ns(namespaces): """ Tries to obtain the CIM version from the given map of namespaces and returns the appropriate *nsURI* and *packageMap*. """ try: ns = namespaces['cim'] if ns.endswith('#'): ns = ns[:-1] except KeyError: ns = '' logger.er...
Tries to obtain the CIM version from the given map of namespaces and returns the appropriate *nsURI* and *packageMap*.
https://github.com/rwl/PyCIM/blob/4a12ebb5a7fb03c7790d396910daef9b97c4ef99/PyCIM/RDFXMLReader.py#L257-L288
rwl/PyCIM
PyCIM/RDFXMLWriter.py
cimwrite
def cimwrite(d, source, encoding="utf-8"): """CIM RDF/XML serializer. @type d: dict @param d: Map of URIs to CIM objects. @type source: File or file-like object. @param source: This object must implement a C{write} method that takes an 8-bit string. @type encoding: string @param encodin...
python
def cimwrite(d, source, encoding="utf-8"): """CIM RDF/XML serializer. @type d: dict @param d: Map of URIs to CIM objects. @type source: File or file-like object. @param source: This object must implement a C{write} method that takes an 8-bit string. @type encoding: string @param encodin...
CIM RDF/XML serializer. @type d: dict @param d: Map of URIs to CIM objects. @type source: File or file-like object. @param source: This object must implement a C{write} method that takes an 8-bit string. @type encoding: string @param encoding: Character encoding defaults to "utf-8", but can...
https://github.com/rwl/PyCIM/blob/4a12ebb5a7fb03c7790d396910daef9b97c4ef99/PyCIM/RDFXMLWriter.py#L34-L109
adafruit/Adafruit_Python_PN532
examples/mcpi_listen.py
create_block
def create_block(mc, block_id, subtype=None): """Build a block with the specified id and subtype under the player in the Minecraft world. Subtype is optional and can be specified as None to use the default subtype for the block. """ # Get player tile position and real position. ptx, pty, ptz = ...
python
def create_block(mc, block_id, subtype=None): """Build a block with the specified id and subtype under the player in the Minecraft world. Subtype is optional and can be specified as None to use the default subtype for the block. """ # Get player tile position and real position. ptx, pty, ptz = ...
Build a block with the specified id and subtype under the player in the Minecraft world. Subtype is optional and can be specified as None to use the default subtype for the block.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/examples/mcpi_listen.py#L48-L62
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532._busy_wait_ms
def _busy_wait_ms(self, ms): """Busy wait for the specified number of milliseconds.""" start = time.time() delta = ms/1000.0 while (time.time() - start) <= delta: pass
python
def _busy_wait_ms(self, ms): """Busy wait for the specified number of milliseconds.""" start = time.time() delta = ms/1000.0 while (time.time() - start) <= delta: pass
Busy wait for the specified number of milliseconds.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L191-L196
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532._write_frame
def _write_frame(self, data): """Write a frame to the PN532 with the specified data bytearray.""" assert data is not None and 0 < len(data) < 255, 'Data must be array of 1 to 255 bytes.' # Build frame to send as: # - SPI data write (0x01) # - Preamble (0x00) # - Start cod...
python
def _write_frame(self, data): """Write a frame to the PN532 with the specified data bytearray.""" assert data is not None and 0 < len(data) < 255, 'Data must be array of 1 to 255 bytes.' # Build frame to send as: # - SPI data write (0x01) # - Preamble (0x00) # - Start cod...
Write a frame to the PN532 with the specified data bytearray.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L198-L227
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532._read_data
def _read_data(self, count): """Read a specified count of bytes from the PN532.""" # Build a read request frame. frame = bytearray(count) frame[0] = PN532_SPI_DATAREAD # Send the frame and return the response, ignoring the SPI header byte. self._gpio.set_low(self._cs) ...
python
def _read_data(self, count): """Read a specified count of bytes from the PN532.""" # Build a read request frame. frame = bytearray(count) frame[0] = PN532_SPI_DATAREAD # Send the frame and return the response, ignoring the SPI header byte. self._gpio.set_low(self._cs) ...
Read a specified count of bytes from the PN532.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L229-L239
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532._read_frame
def _read_frame(self, length): """Read a response frame from the PN532 of at most length bytes in size. Returns the data inside the frame if found, otherwise raises an exception if there is an error parsing the frame. Note that less than length bytes might be returned! """ ...
python
def _read_frame(self, length): """Read a response frame from the PN532 of at most length bytes in size. Returns the data inside the frame if found, otherwise raises an exception if there is an error parsing the frame. Note that less than length bytes might be returned! """ ...
Read a response frame from the PN532 of at most length bytes in size. Returns the data inside the frame if found, otherwise raises an exception if there is an error parsing the frame. Note that less than length bytes might be returned!
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L241-L274
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532._wait_ready
def _wait_ready(self, timeout_sec=1): """Wait until the PN532 is ready to receive commands. At most wait timeout_sec seconds for the PN532 to be ready. If the PN532 is ready before the timeout is exceeded then True will be returned, otherwise False is returned when the timeout is excee...
python
def _wait_ready(self, timeout_sec=1): """Wait until the PN532 is ready to receive commands. At most wait timeout_sec seconds for the PN532 to be ready. If the PN532 is ready before the timeout is exceeded then True will be returned, otherwise False is returned when the timeout is excee...
Wait until the PN532 is ready to receive commands. At most wait timeout_sec seconds for the PN532 to be ready. If the PN532 is ready before the timeout is exceeded then True will be returned, otherwise False is returned when the timeout is exceeded.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L276-L299
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.call_function
def call_function(self, command, response_length=0, params=[], timeout_sec=1): """Send specified command to the PN532 and expect up to response_length bytes back in a response. Note that less than the expected bytes might be returned! Params can optionally specify an array of bytes to send as ...
python
def call_function(self, command, response_length=0, params=[], timeout_sec=1): """Send specified command to the PN532 and expect up to response_length bytes back in a response. Note that less than the expected bytes might be returned! Params can optionally specify an array of bytes to send as ...
Send specified command to the PN532 and expect up to response_length bytes back in a response. Note that less than the expected bytes might be returned! Params can optionally specify an array of bytes to send as parameters to the function call. Will wait up to timeout_secs seconds for...
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L301-L330
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.begin
def begin(self): """Initialize communication with the PN532. Must be called before any other calls are made against the PN532. """ # Assert CS pin low for a second for PN532 to be ready. self._gpio.set_low(self._cs) time.sleep(1.0) # Call GetFirmwareVersion to sy...
python
def begin(self): """Initialize communication with the PN532. Must be called before any other calls are made against the PN532. """ # Assert CS pin low for a second for PN532 to be ready. self._gpio.set_low(self._cs) time.sleep(1.0) # Call GetFirmwareVersion to sy...
Initialize communication with the PN532. Must be called before any other calls are made against the PN532.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L332-L342
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.get_firmware_version
def get_firmware_version(self): """Call PN532 GetFirmwareVersion function and return a tuple with the IC, Ver, Rev, and Support values. """ response = self.call_function(PN532_COMMAND_GETFIRMWAREVERSION, 4) if response is None: raise RuntimeError('Failed to detect the...
python
def get_firmware_version(self): """Call PN532 GetFirmwareVersion function and return a tuple with the IC, Ver, Rev, and Support values. """ response = self.call_function(PN532_COMMAND_GETFIRMWAREVERSION, 4) if response is None: raise RuntimeError('Failed to detect the...
Call PN532 GetFirmwareVersion function and return a tuple with the IC, Ver, Rev, and Support values.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L344-L351
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.read_passive_target
def read_passive_target(self, card_baud=PN532_MIFARE_ISO14443A, timeout_sec=1): """Wait for a MiFare card to be available and return its UID when found. Will wait up to timeout_sec seconds and return None if no card is found, otherwise a bytearray with the UID of the found card is returned. ...
python
def read_passive_target(self, card_baud=PN532_MIFARE_ISO14443A, timeout_sec=1): """Wait for a MiFare card to be available and return its UID when found. Will wait up to timeout_sec seconds and return None if no card is found, otherwise a bytearray with the UID of the found card is returned. ...
Wait for a MiFare card to be available and return its UID when found. Will wait up to timeout_sec seconds and return None if no card is found, otherwise a bytearray with the UID of the found card is returned.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L363-L381
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.mifare_classic_authenticate_block
def mifare_classic_authenticate_block(self, uid, block_number, key_number, key): """Authenticate specified block number for a MiFare classic card. Uid should be a byte array with the UID of the card, block number should be the block to authenticate, key number should be the key type (like ...
python
def mifare_classic_authenticate_block(self, uid, block_number, key_number, key): """Authenticate specified block number for a MiFare classic card. Uid should be a byte array with the UID of the card, block number should be the block to authenticate, key number should be the key type (like ...
Authenticate specified block number for a MiFare classic card. Uid should be a byte array with the UID of the card, block number should be the block to authenticate, key number should be the key type (like MIFARE_CMD_AUTH_A or MIFARE_CMD_AUTH_B), and key should be a byte array with the ...
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L383-L404
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.mifare_classic_read_block
def mifare_classic_read_block(self, block_number): """Read a block of data from the card. Block number should be the block to read. If the block is successfully read a bytearray of length 16 with data starting at the specified block will be returned. If the block is not read then None...
python
def mifare_classic_read_block(self, block_number): """Read a block of data from the card. Block number should be the block to read. If the block is successfully read a bytearray of length 16 with data starting at the specified block will be returned. If the block is not read then None...
Read a block of data from the card. Block number should be the block to read. If the block is successfully read a bytearray of length 16 with data starting at the specified block will be returned. If the block is not read then None will be returned.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L406-L420
adafruit/Adafruit_Python_PN532
Adafruit_PN532/PN532.py
PN532.mifare_classic_write_block
def mifare_classic_write_block(self, block_number, data): """Write a block of data to the card. Block number should be the block to write and data should be a byte array of length 16 with the data to write. If the data is successfully written then True is returned, otherwise False is r...
python
def mifare_classic_write_block(self, block_number, data): """Write a block of data to the card. Block number should be the block to write and data should be a byte array of length 16 with the data to write. If the data is successfully written then True is returned, otherwise False is r...
Write a block of data to the card. Block number should be the block to write and data should be a byte array of length 16 with the data to write. If the data is successfully written then True is returned, otherwise False is returned.
https://github.com/adafruit/Adafruit_Python_PN532/blob/343521a8ec842ea82f680a5ed868fee16e9609bd/Adafruit_PN532/PN532.py#L422-L439
edwardgeorge/virtualenv-clone
clonevirtualenv.py
_dirmatch
def _dirmatch(path, matchwith): """Check if path is within matchwith's tree. >>> _dirmatch('/home/foo/bar', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar/', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar/etc', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar2', '/home/foo/bar...
python
def _dirmatch(path, matchwith): """Check if path is within matchwith's tree. >>> _dirmatch('/home/foo/bar', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar/', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar/etc', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar2', '/home/foo/bar...
Check if path is within matchwith's tree. >>> _dirmatch('/home/foo/bar', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar/', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar/etc', '/home/foo/bar') True >>> _dirmatch('/home/foo/bar2', '/home/foo/bar') False >>> _dirmatch('/home/f...
https://github.com/edwardgeorge/virtualenv-clone/blob/434b12eb725ac1850b60f2bad8e848540e5596de/clonevirtualenv.py#L29-L47
edwardgeorge/virtualenv-clone
clonevirtualenv.py
_virtualenv_sys
def _virtualenv_sys(venv_path): "obtain version and path info from a virtualenv." executable = os.path.join(venv_path, env_bin_dir, 'python') # Must use "executable" as the first argument rather than as the # keyword argument "executable" to get correct value from sys.path p = subprocess.Popen([exec...
python
def _virtualenv_sys(venv_path): "obtain version and path info from a virtualenv." executable = os.path.join(venv_path, env_bin_dir, 'python') # Must use "executable" as the first argument rather than as the # keyword argument "executable" to get correct value from sys.path p = subprocess.Popen([exec...
obtain version and path info from a virtualenv.
https://github.com/edwardgeorge/virtualenv-clone/blob/434b12eb725ac1850b60f2bad8e848540e5596de/clonevirtualenv.py#L50-L64
dsoprea/PyEasyArchive
libarchive/types/archive_entry.py
int_to_ef
def int_to_ef(n): """This is here for testing support but, in practice, this isn't very useful as many of the flags are just combinations of other flags. The relationships are defined by the OS in ways that aren't semantically intuitive to this project. """ flags = {} for name, value in lib...
python
def int_to_ef(n): """This is here for testing support but, in practice, this isn't very useful as many of the flags are just combinations of other flags. The relationships are defined by the OS in ways that aren't semantically intuitive to this project. """ flags = {} for name, value in lib...
This is here for testing support but, in practice, this isn't very useful as many of the flags are just combinations of other flags. The relationships are defined by the OS in ways that aren't semantically intuitive to this project.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/types/archive_entry.py#L24-L35
dsoprea/PyEasyArchive
libarchive/adapters/archive_read.py
_enumerator
def _enumerator(opener, entry_cls, format_code=None, filter_code=None): """Return an archive enumerator from a user-defined source, using a user- defined entry type. """ archive_res = _archive_read_new() try: r = _set_read_context(archive_res, format_code, filter_code) opener(archi...
python
def _enumerator(opener, entry_cls, format_code=None, filter_code=None): """Return an archive enumerator from a user-defined source, using a user- defined entry type. """ archive_res = _archive_read_new() try: r = _set_read_context(archive_res, format_code, filter_code) opener(archi...
Return an archive enumerator from a user-defined source, using a user- defined entry type.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_read.py#L270-L293
dsoprea/PyEasyArchive
libarchive/adapters/archive_read.py
file_enumerator
def file_enumerator(filepath, block_size=10240, *args, **kwargs): """Return an enumerator that knows how to read a physical file.""" _LOGGER.debug("Enumerating through archive file: %s", filepath) def opener(archive_res): _LOGGER.debug("Opening from file (file_enumerator): %s", filepath) _...
python
def file_enumerator(filepath, block_size=10240, *args, **kwargs): """Return an enumerator that knows how to read a physical file.""" _LOGGER.debug("Enumerating through archive file: %s", filepath) def opener(archive_res): _LOGGER.debug("Opening from file (file_enumerator): %s", filepath) _...
Return an enumerator that knows how to read a physical file.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_read.py#L295-L309
dsoprea/PyEasyArchive
libarchive/adapters/archive_read.py
memory_enumerator
def memory_enumerator(buffer_, *args, **kwargs): """Return an enumerator that knows how to read raw memory.""" _LOGGER.debug("Enumerating through (%d) bytes of archive data.", len(buffer_)) def opener(archive_res): _LOGGER.debug("Opening from (%d) bytes (memory_enumerator).", ...
python
def memory_enumerator(buffer_, *args, **kwargs): """Return an enumerator that knows how to read raw memory.""" _LOGGER.debug("Enumerating through (%d) bytes of archive data.", len(buffer_)) def opener(archive_res): _LOGGER.debug("Opening from (%d) bytes (memory_enumerator).", ...
Return an enumerator that knows how to read raw memory.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_read.py#L311-L328
dsoprea/PyEasyArchive
libarchive/adapters/archive_read.py
_pour
def _pour(opener, flags=0, *args, **kwargs): """A flexible pouring facility that knows how to enumerate entry data.""" with _enumerator(opener, *args, entry_cls=_ArchiveEntryItState, **kwargs) as r: ext = libarchive.calls.archive_write.c_ar...
python
def _pour(opener, flags=0, *args, **kwargs): """A flexible pouring facility that knows how to enumerate entry data.""" with _enumerator(opener, *args, entry_cls=_ArchiveEntryItState, **kwargs) as r: ext = libarchive.calls.archive_write.c_ar...
A flexible pouring facility that knows how to enumerate entry data.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_read.py#L348-L397
dsoprea/PyEasyArchive
libarchive/adapters/archive_read.py
file_pour
def file_pour(filepath, block_size=10240, *args, **kwargs): """Write physical files from entries.""" def opener(archive_res): _LOGGER.debug("Opening from file (file_pour): %s", filepath) _archive_read_open_filename(archive_res, filepath, block_size) return _pour(opener, *args, flags=0, **k...
python
def file_pour(filepath, block_size=10240, *args, **kwargs): """Write physical files from entries.""" def opener(archive_res): _LOGGER.debug("Opening from file (file_pour): %s", filepath) _archive_read_open_filename(archive_res, filepath, block_size) return _pour(opener, *args, flags=0, **k...
Write physical files from entries.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_read.py#L399-L406
dsoprea/PyEasyArchive
libarchive/adapters/archive_read.py
memory_pour
def memory_pour(buffer_, *args, **kwargs): """Yield data from entries.""" def opener(archive_res): _LOGGER.debug("Opening from (%d) bytes (memory_pour).", len(buffer_)) _archive_read_open_memory(archive_res, buffer_) return _pour(opener, *args, flags=0, **kwargs)
python
def memory_pour(buffer_, *args, **kwargs): """Yield data from entries.""" def opener(archive_res): _LOGGER.debug("Opening from (%d) bytes (memory_pour).", len(buffer_)) _archive_read_open_memory(archive_res, buffer_) return _pour(opener, *args, flags=0, **kwargs)
Yield data from entries.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_read.py#L408-L415
dsoprea/PyEasyArchive
libarchive/adapters/archive_write.py
_archive_write_data
def _archive_write_data(archive, data): """Write data to archive. This will only be called with a non-empty string. """ n = libarchive.calls.archive_write.c_archive_write_data( archive, ctypes.cast(ctypes.c_char_p(data), ctypes.c_void_p), len(data)) if n == 0: ...
python
def _archive_write_data(archive, data): """Write data to archive. This will only be called with a non-empty string. """ n = libarchive.calls.archive_write.c_archive_write_data( archive, ctypes.cast(ctypes.c_char_p(data), ctypes.c_void_p), len(data)) if n == 0: ...
Write data to archive. This will only be called with a non-empty string.
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_write.py#L71-L82
dsoprea/PyEasyArchive
libarchive/adapters/archive_write.py
_create
def _create(opener, format_code, files, filter_code=None, block_size=16384): """Create an archive from a collection of files (not recursive).""" a = _archive_write_new() _set_write_context(a, format_code, filter_code) _LOGGER.debug("Opening archive (crea...
python
def _create(opener, format_code, files, filter_code=None, block_size=16384): """Create an archive from a collection of files (not recursive).""" a = _archive_write_new() _set_write_context(a, format_code, filter_code) _LOGGER.debug("Opening archive (crea...
Create an archive from a collection of files (not recursive).
https://github.com/dsoprea/PyEasyArchive/blob/50414b9fa9a1055435499b5b2e4b2a336a40dff6/libarchive/adapters/archive_write.py#L197-L285
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280._write_ctrl_meas
def _write_ctrl_meas(self): """ Write the values to the ctrl_meas and ctrl_hum registers in the device ctrl_meas sets the pressure and temperature data acquistion options ctrl_hum sets the humidty oversampling and must be written to first """ self._write_register_byte(_BM...
python
def _write_ctrl_meas(self): """ Write the values to the ctrl_meas and ctrl_hum registers in the device ctrl_meas sets the pressure and temperature data acquistion options ctrl_hum sets the humidty oversampling and must be written to first """ self._write_register_byte(_BM...
Write the values to the ctrl_meas and ctrl_hum registers in the device ctrl_meas sets the pressure and temperature data acquistion options ctrl_hum sets the humidty oversampling and must be written to first
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L161-L168
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280._write_config
def _write_config(self): """Write the value to the config register in the device """ normal_flag = False if self._mode == MODE_NORMAL: #Writes to the config register may be ignored while in Normal mode normal_flag = True self.mode = MODE_SLEEP #So we switch to...
python
def _write_config(self): """Write the value to the config register in the device """ normal_flag = False if self._mode == MODE_NORMAL: #Writes to the config register may be ignored while in Normal mode normal_flag = True self.mode = MODE_SLEEP #So we switch to...
Write the value to the config register in the device
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L178-L187
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280._config
def _config(self): """Value to be written to the device's config register """ config = 0 if self.mode == MODE_NORMAL: config += (self._t_standby << 5) if self._iir_filter: config += (self._iir_filter << 2) return config
python
def _config(self): """Value to be written to the device's config register """ config = 0 if self.mode == MODE_NORMAL: config += (self._t_standby << 5) if self._iir_filter: config += (self._iir_filter << 2) return config
Value to be written to the device's config register
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L282-L289
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280._ctrl_meas
def _ctrl_meas(self): """Value to be written to the device's ctrl_meas register """ ctrl_meas = (self.overscan_temperature << 5) ctrl_meas += (self.overscan_pressure << 2) ctrl_meas += self.mode return ctrl_meas
python
def _ctrl_meas(self): """Value to be written to the device's ctrl_meas register """ ctrl_meas = (self.overscan_temperature << 5) ctrl_meas += (self.overscan_pressure << 2) ctrl_meas += self.mode return ctrl_meas
Value to be written to the device's ctrl_meas register
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L292-L297
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280.measurement_time_typical
def measurement_time_typical(self): """Typical time in milliseconds required to complete a measurement in normal mode""" meas_time_ms = 1.0 if self.overscan_temperature != OVERSCAN_DISABLE: meas_time_ms += (2 * _BME280_OVERSCANS.get(self.overscan_temperature)) if self.oversca...
python
def measurement_time_typical(self): """Typical time in milliseconds required to complete a measurement in normal mode""" meas_time_ms = 1.0 if self.overscan_temperature != OVERSCAN_DISABLE: meas_time_ms += (2 * _BME280_OVERSCANS.get(self.overscan_temperature)) if self.oversca...
Typical time in milliseconds required to complete a measurement in normal mode
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L300-L309
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280.pressure
def pressure(self): """ The compensated pressure in hectoPascals. returns None if pressure measurement is disabled """ self._read_temperature() # Algorithm from the BME280 driver # https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c adc =...
python
def pressure(self): """ The compensated pressure in hectoPascals. returns None if pressure measurement is disabled """ self._read_temperature() # Algorithm from the BME280 driver # https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c adc =...
The compensated pressure in hectoPascals. returns None if pressure measurement is disabled
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L330-L363
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280.humidity
def humidity(self): """ The relative humidity in RH % returns None if humidity measurement is disabled """ self._read_temperature() hum = self._read_register(_BME280_REGISTER_HUMIDDATA, 2) #print("Humidity data: ", hum) adc = float(hum[0] << 8 | hum[1]) ...
python
def humidity(self): """ The relative humidity in RH % returns None if humidity measurement is disabled """ self._read_temperature() hum = self._read_register(_BME280_REGISTER_HUMIDDATA, 2) #print("Humidity data: ", hum) adc = float(hum[0] << 8 | hum[1]) ...
The relative humidity in RH % returns None if humidity measurement is disabled
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L366-L399
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280.altitude
def altitude(self): """The altitude based on current ``pressure`` versus the sea level pressure (``sea_level_pressure``) - which you must enter ahead of time)""" pressure = self.pressure # in Si units for hPascal return 44330 * (1.0 - math.pow(pressure / self.sea_level_pressure, 0.190...
python
def altitude(self): """The altitude based on current ``pressure`` versus the sea level pressure (``sea_level_pressure``) - which you must enter ahead of time)""" pressure = self.pressure # in Si units for hPascal return 44330 * (1.0 - math.pow(pressure / self.sea_level_pressure, 0.190...
The altitude based on current ``pressure`` versus the sea level pressure (``sea_level_pressure``) - which you must enter ahead of time)
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L402-L406
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280._read_coefficients
def _read_coefficients(self): """Read & save the calibration coefficients""" coeff = self._read_register(_BME280_REGISTER_DIG_T1, 24) coeff = list(struct.unpack('<HhhHhhhhhhhh', bytes(coeff))) coeff = [float(i) for i in coeff] self._temp_calib = coeff[:3] self._pressure_c...
python
def _read_coefficients(self): """Read & save the calibration coefficients""" coeff = self._read_register(_BME280_REGISTER_DIG_T1, 24) coeff = list(struct.unpack('<HhhHhhhhhhhh', bytes(coeff))) coeff = [float(i) for i in coeff] self._temp_calib = coeff[:3] self._pressure_c...
Read & save the calibration coefficients
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L408-L424
adafruit/Adafruit_CircuitPython_BME280
adafruit_bme280.py
Adafruit_BME280._read24
def _read24(self, register): """Read an unsigned 24-bit value as a floating point and return it.""" ret = 0.0 for b in self._read_register(register, 3): ret *= 256.0 ret += float(b & 0xFF) return ret
python
def _read24(self, register): """Read an unsigned 24-bit value as a floating point and return it.""" ret = 0.0 for b in self._read_register(register, 3): ret *= 256.0 ret += float(b & 0xFF) return ret
Read an unsigned 24-bit value as a floating point and return it.
https://github.com/adafruit/Adafruit_CircuitPython_BME280/blob/febcd51983dc2bc3cd006bacaada505251c39af1/adafruit_bme280.py#L430-L436
ArangoDB-Community/pyArango
pyArango/index.py
Index._create
def _create(self, postData) : """Creates an index of any type according to postData""" if self.infos is None : r = self.connection.session.post(self.indexesURL, params = {"collection" : self.collection.name}, data = json.dumps(postData, default=str)) data = r.json() i...
python
def _create(self, postData) : """Creates an index of any type according to postData""" if self.infos is None : r = self.connection.session.post(self.indexesURL, params = {"collection" : self.collection.name}, data = json.dumps(postData, default=str)) data = r.json() i...
Creates an index of any type according to postData
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/index.py#L22-L29
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.createVertex
def createVertex(self, collectionName, docAttributes, waitForSync = False) : """adds a vertex to the graph and returns it""" url = "%s/vertex/%s" % (self.URL, collectionName) store = DOC.DocumentStore(self.database[collectionName], validators=self.database[collectionName]._fields, initDct=docAt...
python
def createVertex(self, collectionName, docAttributes, waitForSync = False) : """adds a vertex to the graph and returns it""" url = "%s/vertex/%s" % (self.URL, collectionName) store = DOC.DocumentStore(self.database[collectionName], validators=self.database[collectionName]._fields, initDct=docAt...
adds a vertex to the graph and returns it
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L115-L129
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.deleteVertex
def deleteVertex(self, document, waitForSync = False) : """deletes a vertex from the graph as well as al linked edges""" url = "%s/vertex/%s" % (self.URL, document._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) data = r.json() if r.status_co...
python
def deleteVertex(self, document, waitForSync = False) : """deletes a vertex from the graph as well as al linked edges""" url = "%s/vertex/%s" % (self.URL, document._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) data = r.json() if r.status_co...
deletes a vertex from the graph as well as al linked edges
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L131-L140
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.createEdge
def createEdge(self, collectionName, _fromId, _toId, edgeAttributes, waitForSync = False) : """creates an edge between two documents""" if not _fromId : raise ValueError("Invalid _fromId: %s" % _fromId) if not _toId : raise ValueError("Invalid _toId: %s" % _toId) ...
python
def createEdge(self, collectionName, _fromId, _toId, edgeAttributes, waitForSync = False) : """creates an edge between two documents""" if not _fromId : raise ValueError("Invalid _fromId: %s" % _fromId) if not _toId : raise ValueError("Invalid _toId: %s" % _toId) ...
creates an edge between two documents
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L142-L170
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.link
def link(self, definition, doc1, doc2, edgeAttributes, waitForSync = False) : "A shorthand for createEdge that takes two documents as input" if type(doc1) is DOC.Document : if not doc1._id : doc1.save() doc1_id = doc1._id else : doc1_id = doc1 ...
python
def link(self, definition, doc1, doc2, edgeAttributes, waitForSync = False) : "A shorthand for createEdge that takes two documents as input" if type(doc1) is DOC.Document : if not doc1._id : doc1.save() doc1_id = doc1._id else : doc1_id = doc1 ...
A shorthand for createEdge that takes two documents as input
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L172-L188
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.unlink
def unlink(self, definition, doc1, doc2) : "deletes all links between doc1 and doc2" links = self.database[definition].fetchByExample( {"_from": doc1._id,"_to" : doc2._id}, batchSize = 100) for l in links : self.deleteEdge(l)
python
def unlink(self, definition, doc1, doc2) : "deletes all links between doc1 and doc2" links = self.database[definition].fetchByExample( {"_from": doc1._id,"_to" : doc2._id}, batchSize = 100) for l in links : self.deleteEdge(l)
deletes all links between doc1 and doc2
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L190-L194
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.deleteEdge
def deleteEdge(self, edge, waitForSync = False) : """removes an edge from the graph""" url = "%s/edge/%s" % (self.URL, edge._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) if r.status_code == 200 or r.status_code == 202 : return True ...
python
def deleteEdge(self, edge, waitForSync = False) : """removes an edge from the graph""" url = "%s/edge/%s" % (self.URL, edge._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) if r.status_code == 200 or r.status_code == 202 : return True ...
removes an edge from the graph
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L196-L202
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.traverse
def traverse(self, startVertex, **kwargs) : """Traversal! see: https://docs.arangodb.com/HttpTraversal/README.html for a full list of the possible kwargs. The function must have as argument either: direction = "outbout"/"any"/"inbound" or expander = "custom JS (see arangodb's doc)". The function...
python
def traverse(self, startVertex, **kwargs) : """Traversal! see: https://docs.arangodb.com/HttpTraversal/README.html for a full list of the possible kwargs. The function must have as argument either: direction = "outbout"/"any"/"inbound" or expander = "custom JS (see arangodb's doc)". The function...
Traversal! see: https://docs.arangodb.com/HttpTraversal/README.html for a full list of the possible kwargs. The function must have as argument either: direction = "outbout"/"any"/"inbound" or expander = "custom JS (see arangodb's doc)". The function can't have both 'direction' and 'expander' as argument...
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L211-L237
ArangoDB-Community/pyArango
pyArango/collection.py
DocumentCache.delete
def delete(self, _key) : "removes a document from the cache" try : doc = self.cacheStore[_key] doc.prev.nextDoc = doc.nextDoc doc.nextDoc.prev = doc.prev del(self.cacheStore[_key]) except KeyError : raise KeyError("Document with _key %s...
python
def delete(self, _key) : "removes a document from the cache" try : doc = self.cacheStore[_key] doc.prev.nextDoc = doc.nextDoc doc.nextDoc.prev = doc.prev del(self.cacheStore[_key]) except KeyError : raise KeyError("Document with _key %s...
removes a document from the cache
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L73-L81
ArangoDB-Community/pyArango
pyArango/collection.py
DocumentCache.getChain
def getChain(self) : "returns a list of keys representing the chain of documents" l = [] h = self.head while h : l.append(h._key) h = h.nextDoc return l
python
def getChain(self) : "returns a list of keys representing the chain of documents" l = [] h = self.head while h : l.append(h._key) h = h.nextDoc return l
returns a list of keys representing the chain of documents
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L83-L90
ArangoDB-Community/pyArango
pyArango/collection.py
DocumentCache.stringify
def stringify(self) : "a pretty str version of getChain()" l = [] h = self.head while h : l.append(str(h._key)) h = h.nextDoc return "<->".join(l)
python
def stringify(self) : "a pretty str version of getChain()" l = [] h = self.head while h : l.append(str(h._key)) h = h.nextDoc return "<->".join(l)
a pretty str version of getChain()
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L92-L99
ArangoDB-Community/pyArango
pyArango/collection.py
Field.validate
def validate(self, value) : """checks the validity of 'value' given the lits of validators""" for v in self.validators : v.validate(value) return True
python
def validate(self, value) : """checks the validity of 'value' given the lits of validators""" for v in self.validators : v.validate(value) return True
checks the validity of 'value' given the lits of validators
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L121-L125
ArangoDB-Community/pyArango
pyArango/collection.py
Collection_metaclass.getCollectionClass
def getCollectionClass(cls, name) : """Return the class object of a collection given its 'name'""" try : return cls.collectionClasses[name] except KeyError : raise KeyError( "There is no Collection Class of type: '%s'; currently supported values: [%s]" % (name, ', '.join(...
python
def getCollectionClass(cls, name) : """Return the class object of a collection given its 'name'""" try : return cls.collectionClasses[name] except KeyError : raise KeyError( "There is no Collection Class of type: '%s'; currently supported values: [%s]" % (name, ', '.join(...
Return the class object of a collection given its 'name
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L168-L173
ArangoDB-Community/pyArango
pyArango/collection.py
Collection_metaclass.isDocumentCollection
def isDocumentCollection(cls, name) : """return true or false wether 'name' is the name of a document collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Collection) except KeyError : return False
python
def isDocumentCollection(cls, name) : """return true or false wether 'name' is the name of a document collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Collection) except KeyError : return False
return true or false wether 'name' is the name of a document collection.
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L181-L187
ArangoDB-Community/pyArango
pyArango/collection.py
Collection_metaclass.isEdgeCollection
def isEdgeCollection(cls, name) : """return true or false wether 'name' is the name of an edge collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Edges) except KeyError : return False
python
def isEdgeCollection(cls, name) : """return true or false wether 'name' is the name of an edge collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Edges) except KeyError : return False
return true or false wether 'name' is the name of an edge collection.
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L190-L196
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.getIndexes
def getIndexes(self) : """Fills self.indexes with all the indexes associates with the collection and returns it""" url = "%s/index" % self.database.URL r = self.connection.session.get(url, params = {"collection": self.name}) data = r.json() for ind in data["indexes"] : ...
python
def getIndexes(self) : """Fills self.indexes with all the indexes associates with the collection and returns it""" url = "%s/index" % self.database.URL r = self.connection.session.get(url, params = {"collection": self.name}) data = r.json() for ind in data["indexes"] : ...
Fills self.indexes with all the indexes associates with the collection and returns it
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L265-L273
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.delete
def delete(self) : """deletes the collection from the database""" r = self.connection.session.delete(self.URL) data = r.json() if not r.status_code == 200 or data["error"] : raise DeletionError(data["errorMessage"], data)
python
def delete(self) : """deletes the collection from the database""" r = self.connection.session.delete(self.URL) data = r.json() if not r.status_code == 200 or data["error"] : raise DeletionError(data["errorMessage"], data)
deletes the collection from the database
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L283-L288
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.createDocument
def createDocument(self, initDict = None) : """create and returns a document populated with the defaults or with the values in initDict""" if initDict is not None : return self.createDocument_(initDict) else : if self._validation["on_load"] : self._validat...
python
def createDocument(self, initDict = None) : """create and returns a document populated with the defaults or with the values in initDict""" if initDict is not None : return self.createDocument_(initDict) else : if self._validation["on_load"] : self._validat...
create and returns a document populated with the defaults or with the values in initDict
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L290-L300
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.createDocument_
def createDocument_(self, initDict = None) : "create and returns a completely empty document or one populated with initDict" if initDict is None : initV = {} else : initV = initDict return self.documentClass(self, initV)
python
def createDocument_(self, initDict = None) : "create and returns a completely empty document or one populated with initDict" if initDict is None : initV = {} else : initV = initDict return self.documentClass(self, initV)
create and returns a completely empty document or one populated with initDict
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L302-L309
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.ensureHashIndex
def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) : """Creates a hash index if it does not already exist, and returns it""" data = { "type" : "hash", "fields" : fields, "unique" : unique, "sparse" : sparse, "...
python
def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) : """Creates a hash index if it does not already exist, and returns it""" data = { "type" : "hash", "fields" : fields, "unique" : unique, "sparse" : sparse, "...
Creates a hash index if it does not already exist, and returns it
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L333-L344
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.ensureGeoIndex
def ensureGeoIndex(self, fields) : """Creates a geo index if it does not already exist, and returns it""" data = { "type" : "geo", "fields" : fields, } ind = Index(self, creationData = data) self.indexes["geo"][ind.infos["id"]] = ind return ind
python
def ensureGeoIndex(self, fields) : """Creates a geo index if it does not already exist, and returns it""" data = { "type" : "geo", "fields" : fields, } ind = Index(self, creationData = data) self.indexes["geo"][ind.infos["id"]] = ind return ind
Creates a geo index if it does not already exist, and returns it
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L359-L367
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.ensureFulltextIndex
def ensureFulltextIndex(self, fields, minLength = None) : """Creates a fulltext index if it does not already exist, and returns it""" data = { "type" : "fulltext", "fields" : fields, } if minLength is not None : data["minLength"] = minLength i...
python
def ensureFulltextIndex(self, fields, minLength = None) : """Creates a fulltext index if it does not already exist, and returns it""" data = { "type" : "fulltext", "fields" : fields, } if minLength is not None : data["minLength"] = minLength i...
Creates a fulltext index if it does not already exist, and returns it
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L369-L380
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.validatePrivate
def validatePrivate(self, field, value) : """validate a private field value""" if field not in self.arangoPrivates : raise ValueError("%s is not a private field of collection %s" % (field, self)) if field in self._fields : self._fields[field].validate(value) retu...
python
def validatePrivate(self, field, value) : """validate a private field value""" if field not in self.arangoPrivates : raise ValueError("%s is not a private field of collection %s" % (field, self)) if field in self._fields : self._fields[field].validate(value) retu...
validate a private field value
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L383-L390
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.hasField
def hasField(cls, fieldName) : """returns True/False wether the collection has field K in it's schema. Use the dot notation for the nested fields: address.street""" path = fieldName.split(".") v = cls._fields for k in path : try : v = v[k] except K...
python
def hasField(cls, fieldName) : """returns True/False wether the collection has field K in it's schema. Use the dot notation for the nested fields: address.street""" path = fieldName.split(".") v = cls._fields for k in path : try : v = v[k] except K...
returns True/False wether the collection has field K in it's schema. Use the dot notation for the nested fields: address.street
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L442-L451
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.fetchDocument
def fetchDocument(self, key, rawResults = False, rev = None) : """Fetches a document from the collection given it's key. This function always goes straight to the db and bypasses the cache. If you want to take advantage of the cache use the __getitem__ interface: collection[key]""" url = "%s/%s/...
python
def fetchDocument(self, key, rawResults = False, rev = None) : """Fetches a document from the collection given it's key. This function always goes straight to the db and bypasses the cache. If you want to take advantage of the cache use the __getitem__ interface: collection[key]""" url = "%s/%s/...
Fetches a document from the collection given it's key. This function always goes straight to the db and bypasses the cache. If you want to take advantage of the cache use the __getitem__ interface: collection[key]
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L453-L469
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.fetchByExample
def fetchByExample(self, exampleDict, batchSize, rawResults = False, **queryArgs) : """exampleDict should be something like {'age' : 28}""" return self.simpleQuery('by-example', rawResults, example = exampleDict, batchSize = batchSize, **queryArgs)
python
def fetchByExample(self, exampleDict, batchSize, rawResults = False, **queryArgs) : """exampleDict should be something like {'age' : 28}""" return self.simpleQuery('by-example', rawResults, example = exampleDict, batchSize = batchSize, **queryArgs)
exampleDict should be something like {'age' : 28}
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L471-L473
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.fetchFirstExample
def fetchFirstExample(self, exampleDict, rawResults = False) : """exampleDict should be something like {'age' : 28}. returns only a single element but still in a SimpleQuery object. returns the first example found that matches the example""" return self.simpleQuery('first-example', rawResults = ...
python
def fetchFirstExample(self, exampleDict, rawResults = False) : """exampleDict should be something like {'age' : 28}. returns only a single element but still in a SimpleQuery object. returns the first example found that matches the example""" return self.simpleQuery('first-example', rawResults = ...
exampleDict should be something like {'age' : 28}. returns only a single element but still in a SimpleQuery object. returns the first example found that matches the example
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L475-L478
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.fetchAll
def fetchAll(self, rawResults = False, **queryArgs) : """Returns all the documents in the collection. You can use the optinal arguments 'skip' and 'limit':: fetchAlll(limit = 3, shik = 10)""" return self.simpleQuery('all', rawResults = rawResults, **queryArgs)
python
def fetchAll(self, rawResults = False, **queryArgs) : """Returns all the documents in the collection. You can use the optinal arguments 'skip' and 'limit':: fetchAlll(limit = 3, shik = 10)""" return self.simpleQuery('all', rawResults = rawResults, **queryArgs)
Returns all the documents in the collection. You can use the optinal arguments 'skip' and 'limit':: fetchAlll(limit = 3, shik = 10)
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L480-L484
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.simpleQuery
def simpleQuery(self, queryType, rawResults = False, **queryArgs) : """General interface for simple queries. queryType can be something like 'all', 'by-example' etc... everything is in the arango doc. If rawResults, the query will return dictionaries instead of Document objetcs. """ retu...
python
def simpleQuery(self, queryType, rawResults = False, **queryArgs) : """General interface for simple queries. queryType can be something like 'all', 'by-example' etc... everything is in the arango doc. If rawResults, the query will return dictionaries instead of Document objetcs. """ retu...
General interface for simple queries. queryType can be something like 'all', 'by-example' etc... everything is in the arango doc. If rawResults, the query will return dictionaries instead of Document objetcs.
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L486-L490
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.action
def action(self, method, action, **params) : """a generic fct for interacting everything that doesn't have an assigned fct""" fct = getattr(self.connection.session, method.lower()) r = fct(self.URL + "/" + action, params = params) return r.json()
python
def action(self, method, action, **params) : """a generic fct for interacting everything that doesn't have an assigned fct""" fct = getattr(self.connection.session, method.lower()) r = fct(self.URL + "/" + action, params = params) return r.json()
a generic fct for interacting everything that doesn't have an assigned fct
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L492-L496
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.bulkSave
def bulkSave(self, docs, onDuplicate="error", **params) : """Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any par...
python
def bulkSave(self, docs, onDuplicate="error", **params) : """Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any par...
Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any parameters from arango's documentation
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L498-L528
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.bulkImport_json
def bulkImport_json(self, filename, onDuplicate="error", formatType="auto", **params) : """bulk import from a file repecting arango's key/value format""" url = "%s/import" % self.database.URL params["onDuplicate"] = onDuplicate params["collection"] = self.name params["type"] = f...
python
def bulkImport_json(self, filename, onDuplicate="error", formatType="auto", **params) : """bulk import from a file repecting arango's key/value format""" url = "%s/import" % self.database.URL params["onDuplicate"] = onDuplicate params["collection"] = self.name params["type"] = f...
bulk import from a file repecting arango's key/value format
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L530-L544
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.getType
def getType(self) : """returns a word describing the type of the collection (edges or ducments) instead of a number, if you prefer the number it's in self.type""" if self.type == CONST.COLLECTION_DOCUMENT_TYPE : return "document" elif self.type == CONST.COLLECTION_EDGE_TYPE : ...
python
def getType(self) : """returns a word describing the type of the collection (edges or ducments) instead of a number, if you prefer the number it's in self.type""" if self.type == CONST.COLLECTION_DOCUMENT_TYPE : return "document" elif self.type == CONST.COLLECTION_EDGE_TYPE : ...
returns a word describing the type of the collection (edges or ducments) instead of a number, if you prefer the number it's in self.type
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L597-L604
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.getStatus
def getStatus(self) : """returns a word describing the status of the collection (loaded, loading, deleted, unloaded, newborn) instead of a number, if you prefer the number it's in self.status""" if self.status == CONST.COLLECTION_LOADING_STATUS : return "loading" elif self.status == ...
python
def getStatus(self) : """returns a word describing the status of the collection (loaded, loading, deleted, unloaded, newborn) instead of a number, if you prefer the number it's in self.status""" if self.status == CONST.COLLECTION_LOADING_STATUS : return "loading" elif self.status == ...
returns a word describing the status of the collection (loaded, loading, deleted, unloaded, newborn) instead of a number, if you prefer the number it's in self.status
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L606-L619
ArangoDB-Community/pyArango
pyArango/collection.py
Edges.validateField
def validateField(cls, fieldName, value) : """checks if 'value' is valid for field 'fieldName'. If the validation is unsuccessful, raises a SchemaViolation or a ValidationError. for nested dicts ex: {address : { street: xxx} }, fieldName can take the form address.street """ try : ...
python
def validateField(cls, fieldName, value) : """checks if 'value' is valid for field 'fieldName'. If the validation is unsuccessful, raises a SchemaViolation or a ValidationError. for nested dicts ex: {address : { street: xxx} }, fieldName can take the form address.street """ try : ...
checks if 'value' is valid for field 'fieldName'. If the validation is unsuccessful, raises a SchemaViolation or a ValidationError. for nested dicts ex: {address : { street: xxx} }, fieldName can take the form address.street
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L664-L675
ArangoDB-Community/pyArango
pyArango/collection.py
Edges.getOutEdges
def getOutEdges(self, vertex, rawResults = False) : """An alias for getEdges() that returns only the out Edges""" return self.getEdges(vertex, inEdges = False, outEdges = True, rawResults = rawResults)
python
def getOutEdges(self, vertex, rawResults = False) : """An alias for getEdges() that returns only the out Edges""" return self.getEdges(vertex, inEdges = False, outEdges = True, rawResults = rawResults)
An alias for getEdges() that returns only the out Edges
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L691-L693
ArangoDB-Community/pyArango
pyArango/collection.py
Edges.getEdges
def getEdges(self, vertex, inEdges = True, outEdges = True, rawResults = False) : """returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge ob...
python
def getEdges(self, vertex, inEdges = True, outEdges = True, rawResults = False) : """returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge ob...
returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L695-L726
ArangoDB-Community/pyArango
pyArango/database.py
Database.reloadCollections
def reloadCollections(self) : "reloads the collection list." r = self.connection.session.get(self.collectionsURL) data = r.json() if r.status_code == 200 : self.collections = {} for colData in data["result"] : colName = colData['name'] ...
python
def reloadCollections(self) : "reloads the collection list." r = self.connection.session.get(self.collectionsURL) data = r.json() if r.status_code == 200 : self.collections = {} for colData in data["result"] : colName = colData['name'] ...
reloads the collection list.
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L36-L62
ArangoDB-Community/pyArango
pyArango/database.py
Database.reloadGraphs
def reloadGraphs(self) : "reloads the graph list" r = self.connection.session.get(self.graphsURL) data = r.json() if r.status_code == 200 : self.graphs = {} for graphData in data["graphs"] : try : self.graphs[graphData["_key"]] ...
python
def reloadGraphs(self) : "reloads the graph list" r = self.connection.session.get(self.graphsURL) data = r.json() if r.status_code == 200 : self.graphs = {} for graphData in data["graphs"] : try : self.graphs[graphData["_key"]] ...
reloads the graph list
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L64-L76
ArangoDB-Community/pyArango
pyArango/database.py
Database.createCollection
def createCollection(self, className = 'Collection', **colProperties) : """Creates a collection and returns it. ClassName the name of a class inheriting from Collection or Egdes, it can also be set to 'Collection' or 'Edges' in order to create untyped collections of documents or edges. Use colPr...
python
def createCollection(self, className = 'Collection', **colProperties) : """Creates a collection and returns it. ClassName the name of a class inheriting from Collection or Egdes, it can also be set to 'Collection' or 'Edges' in order to create untyped collections of documents or edges. Use colPr...
Creates a collection and returns it. ClassName the name of a class inheriting from Collection or Egdes, it can also be set to 'Collection' or 'Edges' in order to create untyped collections of documents or edges. Use colProperties to put things such as 'waitForSync = True' (see ArangoDB's doc for...
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L83-L122
ArangoDB-Community/pyArango
pyArango/database.py
Database.createGraph
def createGraph(self, name, createCollections = True, isSmart = False, numberOfShards = None, smartGraphAttribute = None) : """Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges def...
python
def createGraph(self, name, createCollections = True, isSmart = False, numberOfShards = None, smartGraphAttribute = None) : """Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges def...
Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges definition exist. Raises a ValueError in case of a non-existing collection.
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L129-L179
ArangoDB-Community/pyArango
pyArango/database.py
Database.dropAllCollections
def dropAllCollections(self): """drops all public collections (graphs included) from the database""" for graph_name in self.graphs: self.graphs[graph_name].delete() for collection_name in self.collections: # Collections whose name starts with '_' are system collections ...
python
def dropAllCollections(self): """drops all public collections (graphs included) from the database""" for graph_name in self.graphs: self.graphs[graph_name].delete() for collection_name in self.collections: # Collections whose name starts with '_' are system collections ...
drops all public collections (graphs included) from the database
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L189-L197
ArangoDB-Community/pyArango
pyArango/database.py
Database.AQLQuery
def AQLQuery(self, query, batchSize = 100, rawResults = False, bindVars = {}, options = {}, count = False, fullCount = False, json_encoder = None, **moreArgs) : """Set rawResults = True if you want the query to return dictionnaries instead of Document objects. You can use **moreArgs to ...
python
def AQLQuery(self, query, batchSize = 100, rawResults = False, bindVars = {}, options = {}, count = False, fullCount = False, json_encoder = None, **moreArgs) : """Set rawResults = True if you want the query to return dictionnaries instead of Document objects. You can use **moreArgs to ...
Set rawResults = True if you want the query to return dictionnaries instead of Document objects. You can use **moreArgs to pass more arguments supported by the api, such as ttl=60 (time to live)
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L199-L204
ArangoDB-Community/pyArango
pyArango/database.py
Database.explainAQLQuery
def explainAQLQuery(self, query, bindVars={}, allPlans = False) : """Returns an explanation of the query. Setting allPlans to True will result in ArangoDB returning all possible plans. False returns only the optimal plan""" payload = {'query' : query, 'bindVars' : bindVars, 'allPlans' : allPlans} ...
python
def explainAQLQuery(self, query, bindVars={}, allPlans = False) : """Returns an explanation of the query. Setting allPlans to True will result in ArangoDB returning all possible plans. False returns only the optimal plan""" payload = {'query' : query, 'bindVars' : bindVars, 'allPlans' : allPlans} ...
Returns an explanation of the query. Setting allPlans to True will result in ArangoDB returning all possible plans. False returns only the optimal plan
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L206-L210
ArangoDB-Community/pyArango
pyArango/database.py
Database.validateAQLQuery
def validateAQLQuery(self, query, bindVars = None, options = None) : "returns the server answer is the query is valid. Raises an AQLQueryError if not" if bindVars is None : bindVars = {} if options is None : options = {} payload = {'query' : query, 'bindVars' : bi...
python
def validateAQLQuery(self, query, bindVars = None, options = None) : "returns the server answer is the query is valid. Raises an AQLQueryError if not" if bindVars is None : bindVars = {} if options is None : options = {} payload = {'query' : query, 'bindVars' : bi...
returns the server answer is the query is valid. Raises an AQLQueryError if not
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L212-L224
ArangoDB-Community/pyArango
pyArango/database.py
Database.transaction
def transaction(self, collections, action, waitForSync = False, lockTimeout = None, params = None) : """Execute a server-side transaction""" payload = { "collections": collections, "action": action, "waitForSync": waitForSync} if lockTimeout is not...
python
def transaction(self, collections, action, waitForSync = False, lockTimeout = None, params = None) : """Execute a server-side transaction""" payload = { "collections": collections, "action": action, "waitForSync": waitForSync} if lockTimeout is not...
Execute a server-side transaction
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L226-L248
ArangoDB-Community/pyArango
pyArango/document.py
DocumentStore.getPatches
def getPatches(self) : """get patches as a dictionary""" if not self.mustValidate : return self.getStore() res = {} res.update(self.patchStore) for k, v in self.subStores.items() : res[k] = v.getPatches() return res
python
def getPatches(self) : """get patches as a dictionary""" if not self.mustValidate : return self.getStore() res = {} res.update(self.patchStore) for k, v in self.subStores.items() : res[k] = v.getPatches() return res
get patches as a dictionary
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L38-L48