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
harmsm/PyCmdMessenger
PyCmdMessenger/PyCmdMessenger.py
CmdMessenger._recv_guess
def _recv_guess(self,value): """ Take the binary spew and try to make it into a float or integer. If that can't be done, return a string. Note: this is generally a bad idea, as values can be seriously mangled by going from float -> string -> float. You'll generally be bette...
python
def _recv_guess(self,value): """ Take the binary spew and try to make it into a float or integer. If that can't be done, return a string. Note: this is generally a bad idea, as values can be seriously mangled by going from float -> string -> float. You'll generally be bette...
Take the binary spew and try to make it into a float or integer. If that can't be done, return a string. Note: this is generally a bad idea, as values can be seriously mangled by going from float -> string -> float. You'll generally be better off using a format specifier and binary...
https://github.com/harmsm/PyCmdMessenger/blob/215d6f9402262662a14a2996f532934339639a5b/PyCmdMessenger/PyCmdMessenger.py#L610-L640
severb/graypy
graypy/handler.py
BaseGELFHandler.makePickle
def makePickle(self, record): """Convert a :class:`logging.LogRecord` into a bytes object representing a GELF log :param record: :class:`logging.LogRecord` to convert into a Graylog GELF log. :type record: logging.LogRecord :return: A bytes object representing a GEL...
python
def makePickle(self, record): """Convert a :class:`logging.LogRecord` into a bytes object representing a GELF log :param record: :class:`logging.LogRecord` to convert into a Graylog GELF log. :type record: logging.LogRecord :return: A bytes object representing a GEL...
Convert a :class:`logging.LogRecord` into a bytes object representing a GELF log :param record: :class:`logging.LogRecord` to convert into a Graylog GELF log. :type record: logging.LogRecord :return: A bytes object representing a GELF log. :rtype: bytes
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L110-L124
severb/graypy
graypy/handler.py
BaseGELFHandler._make_gelf_dict
def _make_gelf_dict(self, record): """Create a dictionary representing a Graylog GELF log from a python :class:`logging.LogRecord` :param record: :class:`logging.LogRecord` to create a Graylog GELF log from. :type record: logging.LogRecord :return: dictionary repres...
python
def _make_gelf_dict(self, record): """Create a dictionary representing a Graylog GELF log from a python :class:`logging.LogRecord` :param record: :class:`logging.LogRecord` to create a Graylog GELF log from. :type record: logging.LogRecord :return: dictionary repres...
Create a dictionary representing a Graylog GELF log from a python :class:`logging.LogRecord` :param record: :class:`logging.LogRecord` to create a Graylog GELF log from. :type record: logging.LogRecord :return: dictionary representing a Graylog GELF log. :rtype: dic...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L126-L157
severb/graypy
graypy/handler.py
BaseGELFHandler._add_full_message
def _add_full_message(gelf_dict, record): """Add the ``full_message`` field to the ``gelf_dict`` if any traceback information exists within the logging record :param gelf_dict: dictionary representation of a GELF log. :type gelf_dict: dict :param record: :class:`logging.LogReco...
python
def _add_full_message(gelf_dict, record): """Add the ``full_message`` field to the ``gelf_dict`` if any traceback information exists within the logging record :param gelf_dict: dictionary representation of a GELF log. :type gelf_dict: dict :param record: :class:`logging.LogReco...
Add the ``full_message`` field to the ``gelf_dict`` if any traceback information exists within the logging record :param gelf_dict: dictionary representation of a GELF log. :type gelf_dict: dict :param record: :class:`logging.LogRecord` to extract a full logging message fro...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L194-L216
severb/graypy
graypy/handler.py
BaseGELFHandler._resolve_host
def _resolve_host(fqdn, localname): """Resolve the ``host`` GELF field :param fqdn: Boolean indicating whether to use :meth:`socket.getfqdn` to obtain the ``host`` GELF field. :type fqdn: bool :param localname: Use specified hostname as the ``host`` GELF field. :typ...
python
def _resolve_host(fqdn, localname): """Resolve the ``host`` GELF field :param fqdn: Boolean indicating whether to use :meth:`socket.getfqdn` to obtain the ``host`` GELF field. :type fqdn: bool :param localname: Use specified hostname as the ``host`` GELF field. :typ...
Resolve the ``host`` GELF field :param fqdn: Boolean indicating whether to use :meth:`socket.getfqdn` to obtain the ``host`` GELF field. :type fqdn: bool :param localname: Use specified hostname as the ``host`` GELF field. :type localname: str or None :return: Stri...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L219-L236
severb/graypy
graypy/handler.py
BaseGELFHandler._add_debugging_fields
def _add_debugging_fields(gelf_dict, record): """Add debugging fields to the given ``gelf_dict`` :param gelf_dict: dictionary representation of a GELF log. :type gelf_dict: dict :param record: :class:`logging.LogRecord` to extract debugging fields from to insert into the gi...
python
def _add_debugging_fields(gelf_dict, record): """Add debugging fields to the given ``gelf_dict`` :param gelf_dict: dictionary representation of a GELF log. :type gelf_dict: dict :param record: :class:`logging.LogRecord` to extract debugging fields from to insert into the gi...
Add debugging fields to the given ``gelf_dict`` :param gelf_dict: dictionary representation of a GELF log. :type gelf_dict: dict :param record: :class:`logging.LogRecord` to extract debugging fields from to insert into the given ``gelf_dict``. :type record: logging.LogRecor...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L239-L259
severb/graypy
graypy/handler.py
BaseGELFHandler._add_extra_fields
def _add_extra_fields(gelf_dict, record): """Add extra fields to the given ``gelf_dict`` However, this does not add additional fields in to ``message_dict`` that are either duplicated from standard :class:`logging.LogRecord` attributes, duplicated from the python logging module source ...
python
def _add_extra_fields(gelf_dict, record): """Add extra fields to the given ``gelf_dict`` However, this does not add additional fields in to ``message_dict`` that are either duplicated from standard :class:`logging.LogRecord` attributes, duplicated from the python logging module source ...
Add extra fields to the given ``gelf_dict`` However, this does not add additional fields in to ``message_dict`` that are either duplicated from standard :class:`logging.LogRecord` attributes, duplicated from the python logging module source (e.g. ``exc_text``), or violate GLEF format (i...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L262-L294
severb/graypy
graypy/handler.py
BaseGELFHandler._pack_gelf_dict
def _pack_gelf_dict(gelf_dict): """Convert a given ``gelf_dict`` to a JSON-encoded string, thus, creating an uncompressed GELF log ready for consumption by Graylog. Since we cannot be 100% sure of what is contained in the ``gelf_dict`` we have to do some sanitation. :param gelf...
python
def _pack_gelf_dict(gelf_dict): """Convert a given ``gelf_dict`` to a JSON-encoded string, thus, creating an uncompressed GELF log ready for consumption by Graylog. Since we cannot be 100% sure of what is contained in the ``gelf_dict`` we have to do some sanitation. :param gelf...
Convert a given ``gelf_dict`` to a JSON-encoded string, thus, creating an uncompressed GELF log ready for consumption by Graylog. Since we cannot be 100% sure of what is contained in the ``gelf_dict`` we have to do some sanitation. :param gelf_dict: dictionary representation of a GELF ...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L297-L317
severb/graypy
graypy/handler.py
BaseGELFHandler._sanitize_to_unicode
def _sanitize_to_unicode(obj): """Convert all strings records of the object to unicode :param obj: object to sanitize to unicode. :type obj: object :return: Unicode string representation of the given object. :rtype: str """ if isinstance(obj, dict): ...
python
def _sanitize_to_unicode(obj): """Convert all strings records of the object to unicode :param obj: object to sanitize to unicode. :type obj: object :return: Unicode string representation of the given object. :rtype: str """ if isinstance(obj, dict): ...
Convert all strings records of the object to unicode :param obj: object to sanitize to unicode. :type obj: object :return: Unicode string representation of the given object. :rtype: str
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L320-L335
severb/graypy
graypy/handler.py
BaseGELFHandler._object_to_json
def _object_to_json(obj): """Convert objects that cannot be natively serialized into JSON into their string representation For datetime based objects convert them into their ISO formatted string as specified by :meth:`datetime.datetime.isoformat`. :param obj: object to convert ...
python
def _object_to_json(obj): """Convert objects that cannot be natively serialized into JSON into their string representation For datetime based objects convert them into their ISO formatted string as specified by :meth:`datetime.datetime.isoformat`. :param obj: object to convert ...
Convert objects that cannot be natively serialized into JSON into their string representation For datetime based objects convert them into their ISO formatted string as specified by :meth:`datetime.datetime.isoformat`. :param obj: object to convert into a JSON via getting its string ...
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L338-L355
severb/graypy
graypy/handler.py
GELFTLSHandler.makeSocket
def makeSocket(self, timeout=1): """Override SocketHandler.makeSocket, to allow creating wrapped TLS sockets""" plain_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if hasattr(plain_socket, 'settimeout'): plain_socket.settimeout(timeout) wrapped_socket =...
python
def makeSocket(self, timeout=1): """Override SocketHandler.makeSocket, to allow creating wrapped TLS sockets""" plain_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if hasattr(plain_socket, 'settimeout'): plain_socket.settimeout(timeout) wrapped_socket =...
Override SocketHandler.makeSocket, to allow creating wrapped TLS sockets
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L451-L468
severb/graypy
graypy/handler.py
GELFHTTPHandler.emit
def emit(self, record): """Convert a :class:`logging.LogRecord` to GELF and emit it to Graylog via an HTTP POST request :param record: :class:`logging.LogRecord` to convert into a Graylog GELF log and emit to Graylog via HTTP POST. :type record: logging.LogRecord """...
python
def emit(self, record): """Convert a :class:`logging.LogRecord` to GELF and emit it to Graylog via an HTTP POST request :param record: :class:`logging.LogRecord` to convert into a Graylog GELF log and emit to Graylog via HTTP POST. :type record: logging.LogRecord """...
Convert a :class:`logging.LogRecord` to GELF and emit it to Graylog via an HTTP POST request :param record: :class:`logging.LogRecord` to convert into a Graylog GELF log and emit to Graylog via HTTP POST. :type record: logging.LogRecord
https://github.com/severb/graypy/blob/32018c41a792e71a8de9f9e14f770d1bc60c2313/graypy/handler.py#L509-L523
codeinthehole/purl
purl/url.py
to_unicode
def to_unicode(string): """ Ensure a passed string is unicode """ if isinstance(string, six.binary_type): return string.decode('utf8') if isinstance(string, six.text_type): return string if six.PY2: return unicode(string) return str(string)
python
def to_unicode(string): """ Ensure a passed string is unicode """ if isinstance(string, six.binary_type): return string.decode('utf8') if isinstance(string, six.text_type): return string if six.PY2: return unicode(string) return str(string)
Ensure a passed string is unicode
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L22-L32
codeinthehole/purl
purl/url.py
to_utf8
def to_utf8(string): """ Encode a string as a UTF8 bytestring. This function could be passed a bytestring or unicode string so must distinguish between the two. """ if isinstance(string, six.text_type): return string.encode('utf8') if isinstance(string, six.binary_type): return ...
python
def to_utf8(string): """ Encode a string as a UTF8 bytestring. This function could be passed a bytestring or unicode string so must distinguish between the two. """ if isinstance(string, six.text_type): return string.encode('utf8') if isinstance(string, six.binary_type): return ...
Encode a string as a UTF8 bytestring. This function could be passed a bytestring or unicode string so must distinguish between the two.
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L35-L44
codeinthehole/purl
purl/url.py
dict_to_unicode
def dict_to_unicode(raw_dict): """ Ensure all keys and values in a dict are unicode. The passed dict is assumed to have lists for all values. """ decoded = {} for key, value in raw_dict.items(): decoded[to_unicode(key)] = map( to_unicode, value) return decoded
python
def dict_to_unicode(raw_dict): """ Ensure all keys and values in a dict are unicode. The passed dict is assumed to have lists for all values. """ decoded = {} for key, value in raw_dict.items(): decoded[to_unicode(key)] = map( to_unicode, value) return decoded
Ensure all keys and values in a dict are unicode. The passed dict is assumed to have lists for all values.
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L47-L57
codeinthehole/purl
purl/url.py
unicode_urlencode
def unicode_urlencode(query, doseq=True): """ Custom wrapper around urlencode to support unicode Python urlencode doesn't handle unicode well so we need to convert to bytestrings before using it: http://stackoverflow.com/questions/6480723/urllib-urlencode-doesnt-like-unicode-values-how-about-this-w...
python
def unicode_urlencode(query, doseq=True): """ Custom wrapper around urlencode to support unicode Python urlencode doesn't handle unicode well so we need to convert to bytestrings before using it: http://stackoverflow.com/questions/6480723/urllib-urlencode-doesnt-like-unicode-values-how-about-this-w...
Custom wrapper around urlencode to support unicode Python urlencode doesn't handle unicode well so we need to convert to bytestrings before using it: http://stackoverflow.com/questions/6480723/urllib-urlencode-doesnt-like-unicode-values-how-about-this-workaround
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L80-L97
codeinthehole/purl
purl/url.py
parse
def parse(url_str): """ Extract all parts from a URL string and return them as a dictionary """ url_str = to_unicode(url_str) result = urlparse(url_str) netloc_parts = result.netloc.rsplit('@', 1) if len(netloc_parts) == 1: username = password = None host = netloc_parts[0] ...
python
def parse(url_str): """ Extract all parts from a URL string and return them as a dictionary """ url_str = to_unicode(url_str) result = urlparse(url_str) netloc_parts = result.netloc.rsplit('@', 1) if len(netloc_parts) == 1: username = password = None host = netloc_parts[0] ...
Extract all parts from a URL string and return them as a dictionary
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L100-L129
codeinthehole/purl
purl/url.py
URL.netloc
def netloc(self): """ Return the netloc """ url = self._tuple if url.username and url.password: netloc = '%s:%s@%s' % (url.username, url.password, url.host) elif url.username and not url.password: netloc = '%s@%s' % (url.username, url.host) ...
python
def netloc(self): """ Return the netloc """ url = self._tuple if url.username and url.password: netloc = '%s:%s@%s' % (url.username, url.password, url.host) elif url.username and not url.password: netloc = '%s@%s' % (url.username, url.host) ...
Return the netloc
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L221-L234
codeinthehole/purl
purl/url.py
URL.host
def host(self, value=None): """ Return the host :param string value: new host string """ if value is not None: return URL._mutate(self, host=value) return self._tuple.host
python
def host(self, value=None): """ Return the host :param string value: new host string """ if value is not None: return URL._mutate(self, host=value) return self._tuple.host
Return the host :param string value: new host string
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L236-L244
codeinthehole/purl
purl/url.py
URL.username
def username(self, value=None): """ Return or set the username :param string value: the new username to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, username=value) return unicode_unquote(self._t...
python
def username(self, value=None): """ Return or set the username :param string value: the new username to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, username=value) return unicode_unquote(self._t...
Return or set the username :param string value: the new username to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L248-L257
codeinthehole/purl
purl/url.py
URL.password
def password(self, value=None): """ Return or set the password :param string value: the new password to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, password=value) return unicode_unquote(self._t...
python
def password(self, value=None): """ Return or set the password :param string value: the new password to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, password=value) return unicode_unquote(self._t...
Return or set the password :param string value: the new password to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L259-L268
codeinthehole/purl
purl/url.py
URL.subdomains
def subdomains(self, value=None): """ Returns a list of subdomains or set the subdomains and returns a new :class:`URL` instance. :param list value: a list of subdomains """ if value is not None: return URL._mutate(self, host='.'.join(value)) return s...
python
def subdomains(self, value=None): """ Returns a list of subdomains or set the subdomains and returns a new :class:`URL` instance. :param list value: a list of subdomains """ if value is not None: return URL._mutate(self, host='.'.join(value)) return s...
Returns a list of subdomains or set the subdomains and returns a new :class:`URL` instance. :param list value: a list of subdomains
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L270-L279
codeinthehole/purl
purl/url.py
URL.subdomain
def subdomain(self, index, value=None): """ Return a subdomain or set a new value and return a new :class:`URL` instance. :param integer index: 0-indexed subdomain :param string value: New subdomain """ if value is not None: subdomains = self.subdomai...
python
def subdomain(self, index, value=None): """ Return a subdomain or set a new value and return a new :class:`URL` instance. :param integer index: 0-indexed subdomain :param string value: New subdomain """ if value is not None: subdomains = self.subdomai...
Return a subdomain or set a new value and return a new :class:`URL` instance. :param integer index: 0-indexed subdomain :param string value: New subdomain
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L281-L293
codeinthehole/purl
purl/url.py
URL.scheme
def scheme(self, value=None): """ Return or set the scheme. :param string value: the new scheme to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, scheme=value) return self._tuple.scheme
python
def scheme(self, value=None): """ Return or set the scheme. :param string value: the new scheme to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, scheme=value) return self._tuple.scheme
Return or set the scheme. :param string value: the new scheme to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L295-L304
codeinthehole/purl
purl/url.py
URL.path
def path(self, value=None): """ Return or set the path :param string value: the new path to use :returns: string or new :class:`URL` instance """ if value is not None: if not value.startswith('/'): value = '/' + value encoded_value...
python
def path(self, value=None): """ Return or set the path :param string value: the new path to use :returns: string or new :class:`URL` instance """ if value is not None: if not value.startswith('/'): value = '/' + value encoded_value...
Return or set the path :param string value: the new path to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L306-L318
codeinthehole/purl
purl/url.py
URL.query
def query(self, value=None): """ Return or set the query string :param string value: the new query string to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, query=value) return self._tuple.query
python
def query(self, value=None): """ Return or set the query string :param string value: the new query string to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, query=value) return self._tuple.query
Return or set the query string :param string value: the new query string to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L320-L329
codeinthehole/purl
purl/url.py
URL.port
def port(self, value=None): """ Return or set the port :param string value: the new port to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, port=value) return self._tuple.port
python
def port(self, value=None): """ Return or set the port :param string value: the new port to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, port=value) return self._tuple.port
Return or set the port :param string value: the new port to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L331-L340
codeinthehole/purl
purl/url.py
URL.fragment
def fragment(self, value=None): """ Return or set the fragment (hash) :param string value: the new fragment to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, fragment=value) return unicode_unquote(...
python
def fragment(self, value=None): """ Return or set the fragment (hash) :param string value: the new fragment to use :returns: string or new :class:`URL` instance """ if value is not None: return URL._mutate(self, fragment=value) return unicode_unquote(...
Return or set the fragment (hash) :param string value: the new fragment to use :returns: string or new :class:`URL` instance
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L342-L351
codeinthehole/purl
purl/url.py
URL.path_segment
def path_segment(self, index, value=None, default=None): """ Return the path segment at the given index :param integer index: :param string value: the new segment value :param string default: the default value to return if no path segment exists with the given index """ ...
python
def path_segment(self, index, value=None, default=None): """ Return the path segment at the given index :param integer index: :param string value: the new segment value :param string default: the default value to return if no path segment exists with the given index """ ...
Return the path segment at the given index :param integer index: :param string value: the new segment value :param string default: the default value to return if no path segment exists with the given index
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L365-L383
codeinthehole/purl
purl/url.py
URL.path_segments
def path_segments(self, value=None): """ Return the path segments :param list value: the new path segments to use """ if value is not None: encoded_values = map(unicode_quote_path_segment, value) new_path = '/' + '/'.join(encoded_values) retur...
python
def path_segments(self, value=None): """ Return the path segments :param list value: the new path segments to use """ if value is not None: encoded_values = map(unicode_quote_path_segment, value) new_path = '/' + '/'.join(encoded_values) retur...
Return the path segments :param list value: the new path segments to use
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L385-L400
codeinthehole/purl
purl/url.py
URL.add_path_segment
def add_path_segment(self, value): """ Add a new path segment to the end of the current string :param string value: the new path segment to use Example:: >>> u = URL('http://example.com/foo/') >>> u.add_path_segment('bar').as_string() 'http://exampl...
python
def add_path_segment(self, value): """ Add a new path segment to the end of the current string :param string value: the new path segment to use Example:: >>> u = URL('http://example.com/foo/') >>> u.add_path_segment('bar').as_string() 'http://exampl...
Add a new path segment to the end of the current string :param string value: the new path segment to use Example:: >>> u = URL('http://example.com/foo/') >>> u.add_path_segment('bar').as_string() 'http://example.com/foo/bar'
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L402-L415
codeinthehole/purl
purl/url.py
URL.query_param
def query_param(self, key, value=None, default=None, as_list=False): """ Return or set a query parameter for the given key The value can be a list. :param string key: key to look for :param string default: value to return if ``key`` isn't found :param boolean as_list: w...
python
def query_param(self, key, value=None, default=None, as_list=False): """ Return or set a query parameter for the given key The value can be a list. :param string key: key to look for :param string default: value to return if ``key`` isn't found :param boolean as_list: w...
Return or set a query parameter for the given key The value can be a list. :param string key: key to look for :param string default: value to return if ``key`` isn't found :param boolean as_list: whether to return the values as a list :param string value: the new query paramete...
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L437-L465
codeinthehole/purl
purl/url.py
URL.append_query_param
def append_query_param(self, key, value): """ Append a query parameter :param string key: The query param key :param string value: The new value """ values = self.query_param(key, as_list=True, default=[]) values.append(value) return self.query_param(key,...
python
def append_query_param(self, key, value): """ Append a query parameter :param string key: The query param key :param string value: The new value """ values = self.query_param(key, as_list=True, default=[]) values.append(value) return self.query_param(key,...
Append a query parameter :param string key: The query param key :param string value: The new value
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L467-L476
codeinthehole/purl
purl/url.py
URL.query_params
def query_params(self, value=None): """ Return or set a dictionary of query params :param dict value: new dictionary of values """ if value is not None: return URL._mutate(self, query=unicode_urlencode(value, doseq=True)) query = '' if self._tuple.query is No...
python
def query_params(self, value=None): """ Return or set a dictionary of query params :param dict value: new dictionary of values """ if value is not None: return URL._mutate(self, query=unicode_urlencode(value, doseq=True)) query = '' if self._tuple.query is No...
Return or set a dictionary of query params :param dict value: new dictionary of values
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L478-L494
codeinthehole/purl
purl/url.py
URL.remove_query_param
def remove_query_param(self, key, value=None): """ Remove a query param from a URL Set the value parameter if removing from a list. :param string key: The key to delete :param string value: The value of the param to delete (of more than one) """ parse_result = s...
python
def remove_query_param(self, key, value=None): """ Remove a query param from a URL Set the value parameter if removing from a list. :param string key: The key to delete :param string value: The value of the param to delete (of more than one) """ parse_result = s...
Remove a query param from a URL Set the value parameter if removing from a list. :param string key: The key to delete :param string value: The value of the param to delete (of more than one)
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/url.py#L496-L511
codeinthehole/purl
purl/template.py
expand
def expand(template, variables=None): """ Expand a URL template string using the passed variables """ if variables is None: variables = {} return patterns.sub(functools.partial(_replace, variables), template)
python
def expand(template, variables=None): """ Expand a URL template string using the passed variables """ if variables is None: variables = {} return patterns.sub(functools.partial(_replace, variables), template)
Expand a URL template string using the passed variables
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/template.py#L31-L37
codeinthehole/purl
purl/template.py
_format_pair_no_equals
def _format_pair_no_equals(explode, separator, escape, key, value): """ Format a key, value pair but don't include the equals sign when there is no value """ if not value: return key return _format_pair(explode, separator, escape, key, value)
python
def _format_pair_no_equals(explode, separator, escape, key, value): """ Format a key, value pair but don't include the equals sign when there is no value """ if not value: return key return _format_pair(explode, separator, escape, key, value)
Format a key, value pair but don't include the equals sign when there is no value
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/template.py#L56-L63
codeinthehole/purl
purl/template.py
_format_pair_with_equals
def _format_pair_with_equals(explode, separator, escape, key, value): """ Format a key, value pair including the equals sign when there is no value """ if not value: return key + '=' return _format_pair(explode, separator, escape, key, value)
python
def _format_pair_with_equals(explode, separator, escape, key, value): """ Format a key, value pair including the equals sign when there is no value """ if not value: return key + '=' return _format_pair(explode, separator, escape, key, value)
Format a key, value pair including the equals sign when there is no value
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/template.py#L66-L73
codeinthehole/purl
purl/template.py
_split_basic
def _split_basic(string): """ Split a string into a list of tuples of the form (key, modifier_fn, explode) where modifier_fn is a function that applies the appropriate modification to the variable. """ tuples = [] for word in string.split(','): # Attempt to split on colon par...
python
def _split_basic(string): """ Split a string into a list of tuples of the form (key, modifier_fn, explode) where modifier_fn is a function that applies the appropriate modification to the variable. """ tuples = [] for word in string.split(','): # Attempt to split on colon par...
Split a string into a list of tuples of the form (key, modifier_fn, explode) where modifier_fn is a function that applies the appropriate modification to the variable.
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/template.py#L143-L161
codeinthehole/purl
purl/template.py
_replace
def _replace(variables, match): """ Return the appropriate replacement for `match` using the passed variables """ expression = match.group(1) # Look-up chars and functions for the specified operator (prefix_char, separator_char, split_fn, escape_fn, format_fn) = operator_map.get(expression...
python
def _replace(variables, match): """ Return the appropriate replacement for `match` using the passed variables """ expression = match.group(1) # Look-up chars and functions for the specified operator (prefix_char, separator_char, split_fn, escape_fn, format_fn) = operator_map.get(expression...
Return the appropriate replacement for `match` using the passed variables
https://github.com/codeinthehole/purl/blob/e70ed132f1fdc17d00c78199cedb1e3adcb2bc55/purl/template.py#L195-L214
LucidtechAI/las-sdk-python
las/api_client.py
ApiClient.predict
def predict(self, document_path: str, model_name: str, consent_id: str = None) -> Prediction: """Run inference and create prediction on document. This method takes care of creating and uploading a document specified by document_path. as well as running inference using model specified by model_na...
python
def predict(self, document_path: str, model_name: str, consent_id: str = None) -> Prediction: """Run inference and create prediction on document. This method takes care of creating and uploading a document specified by document_path. as well as running inference using model specified by model_na...
Run inference and create prediction on document. This method takes care of creating and uploading a document specified by document_path. as well as running inference using model specified by model_name to create prediction on the document. >>> from las import ApiClient >>> api_client = ...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/api_client.py#L30-L57
LucidtechAI/las-sdk-python
las/api_client.py
ApiClient.send_feedback
def send_feedback(self, document_id: str, feedback: List[Field]) -> dict: """Send feedback to the model. This method takes care of sending feedback related to document specified by document_id. Feedback consists of ground truth values for the document specified as a list of Field instances. ...
python
def send_feedback(self, document_id: str, feedback: List[Field]) -> dict: """Send feedback to the model. This method takes care of sending feedback related to document specified by document_id. Feedback consists of ground truth values for the document specified as a list of Field instances. ...
Send feedback to the model. This method takes care of sending feedback related to document specified by document_id. Feedback consists of ground truth values for the document specified as a list of Field instances. >>> from las import ApiClient >>> api_client = ApiClient(endpoint='<api ...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/api_client.py#L59-L81
LucidtechAI/las-sdk-python
las/_extrahdr.py
extra_what
def extra_what(file, h=None): """Code mostly copied from imghdr.what""" tests = [] def test_pdf(h, f): if b'PDF' in h[0:10]: return 'pdf' tests.append(test_pdf) f = None try: if h is None: if isinstance(file, (str, PathLike)): f = open(f...
python
def extra_what(file, h=None): """Code mostly copied from imghdr.what""" tests = [] def test_pdf(h, f): if b'PDF' in h[0:10]: return 'pdf' tests.append(test_pdf) f = None try: if h is None: if isinstance(file, (str, PathLike)): f = open(f...
Code mostly copied from imghdr.what
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/_extrahdr.py#L4-L31
LucidtechAI/las-sdk-python
las/client.py
Client.post_documents
def post_documents(self, content_type: str, consent_id: str) -> dict: """Creates a document handle, calls the POST /documents endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.post_documents('image/jpeg', consent_id='foobar') :param ...
python
def post_documents(self, content_type: str, consent_id: str) -> dict: """Creates a document handle, calls the POST /documents endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.post_documents('image/jpeg', consent_id='foobar') :param ...
Creates a document handle, calls the POST /documents endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.post_documents('image/jpeg', consent_id='foobar') :param content_type: A mime type for the document handle :type content_type: str...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/client.py#L84-L113
LucidtechAI/las-sdk-python
las/client.py
Client.put_document
def put_document(document_path: str, content_type: str, presigned_url: str) -> str: """Convenience method for putting a document to presigned url. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.put_document(document_path='document.jpeg', content_typ...
python
def put_document(document_path: str, content_type: str, presigned_url: str) -> str: """Convenience method for putting a document to presigned url. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.put_document(document_path='document.jpeg', content_typ...
Convenience method for putting a document to presigned url. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.put_document(document_path='document.jpeg', content_type='image/jpeg', >>> presigned_url='<presigned url>') :param document_path: Pat...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/client.py#L117-L140
LucidtechAI/las-sdk-python
las/client.py
Client.post_predictions
def post_predictions(self, document_id: str, model_name: str) -> dict: """Run inference and create a prediction, calls the POST /predictions endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.post_predictions(document_id='<document id>', model...
python
def post_predictions(self, document_id: str, model_name: str) -> dict: """Run inference and create a prediction, calls the POST /predictions endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.post_predictions(document_id='<document id>', model...
Run inference and create a prediction, calls the POST /predictions endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.post_predictions(document_id='<document id>', model_name='invoice') :param document_id: The document id to run inference and...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/client.py#L144-L173
LucidtechAI/las-sdk-python
las/client.py
Client.post_document_id
def post_document_id(self, document_id: str, feedback: List[Dict[str, str]]) -> dict: """Post feedback to the REST API, calls the POST /documents/{documentId} endpoint. Posting feedback means posting the ground truth data for the particular document. This enables the API to learn from past mista...
python
def post_document_id(self, document_id: str, feedback: List[Dict[str, str]]) -> dict: """Post feedback to the REST API, calls the POST /documents/{documentId} endpoint. Posting feedback means posting the ground truth data for the particular document. This enables the API to learn from past mista...
Post feedback to the REST API, calls the POST /documents/{documentId} endpoint. Posting feedback means posting the ground truth data for the particular document. This enables the API to learn from past mistakes. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') ...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/client.py#L177-L209
LucidtechAI/las-sdk-python
las/client.py
Client.delete_consent_id
def delete_consent_id(self, consent_id: str) -> dict: """Delete documents with this consent_id, calls the DELETE /consent/{consentId} endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.delete_consent_id('<consent id>') :param consent_...
python
def delete_consent_id(self, consent_id: str) -> dict: """Delete documents with this consent_id, calls the DELETE /consent/{consentId} endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.delete_consent_id('<consent id>') :param consent_...
Delete documents with this consent_id, calls the DELETE /consent/{consentId} endpoint. >>> from las import Client >>> client = Client(endpoint='<api endpoint>') >>> client.delete_consent_id('<consent id>') :param consent_id: Delete documents with this consent_id :type consent_i...
https://github.com/LucidtechAI/las-sdk-python/blob/5f39dee7983baff28a1deb93c12d36414d835d12/las/client.py#L213-L240
owncloud/pyocclient
owncloud/owncloud.py
ShareInfo.get_expiration
def get_expiration(self): """Returns the expiration date. :returns: expiration date :rtype: datetime object """ exp = self._get_int('expiration') if exp is not None: return datetime.datetime.fromtimestamp( exp ) return None
python
def get_expiration(self): """Returns the expiration date. :returns: expiration date :rtype: datetime object """ exp = self._get_int('expiration') if exp is not None: return datetime.datetime.fromtimestamp( exp ) return None
Returns the expiration date. :returns: expiration date :rtype: datetime object
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L140-L151
owncloud/pyocclient
owncloud/owncloud.py
Client.login
def login(self, user_id, password): """Authenticate to ownCloud. This will create a session on the server. :param user_id: user id :param password: password :raises: HTTPResponseError in case an HTTP error status was returned """ self._session = requests.session...
python
def login(self, user_id, password): """Authenticate to ownCloud. This will create a session on the server. :param user_id: user id :param password: password :raises: HTTPResponseError in case an HTTP error status was returned """ self._session = requests.session...
Authenticate to ownCloud. This will create a session on the server. :param user_id: user id :param password: password :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L339-L366
owncloud/pyocclient
owncloud/owncloud.py
Client.file_info
def file_info(self, path): """Returns the file info for the given remote file :param path: path to the remote file :returns: file info :rtype: :class:`FileInfo` object or `None` if file was not found :raises: HTTPResponseError in case an HTTP error status was returne...
python
def file_info(self, path): """Returns the file info for the given remote file :param path: path to the remote file :returns: file info :rtype: :class:`FileInfo` object or `None` if file was not found :raises: HTTPResponseError in case an HTTP error status was returne...
Returns the file info for the given remote file :param path: path to the remote file :returns: file info :rtype: :class:`FileInfo` object or `None` if file was not found :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L378-L390
owncloud/pyocclient
owncloud/owncloud.py
Client.list
def list(self, path, depth=1): """Returns the listing/contents of the given remote directory :param path: path to the remote directory :param depth: depth of the listing, integer or "infinity" :returns: directory listing :rtype: array of :class:`FileInfo` objects :raises...
python
def list(self, path, depth=1): """Returns the listing/contents of the given remote directory :param path: path to the remote directory :param depth: depth of the listing, integer or "infinity" :returns: directory listing :rtype: array of :class:`FileInfo` objects :raises...
Returns the listing/contents of the given remote directory :param path: path to the remote directory :param depth: depth of the listing, integer or "infinity" :returns: directory listing :rtype: array of :class:`FileInfo` objects :raises: HTTPResponseError in case an HTTP error ...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L392-L412
owncloud/pyocclient
owncloud/owncloud.py
Client.get_file_contents
def get_file_contents(self, path): """Returns the contents of a remote file :param path: path to the remote file :returns: file contents :rtype: binary data :raises: HTTPResponseError in case an HTTP error status was returned """ path = self._normalize_path(path)...
python
def get_file_contents(self, path): """Returns the contents of a remote file :param path: path to the remote file :returns: file contents :rtype: binary data :raises: HTTPResponseError in case an HTTP error status was returned """ path = self._normalize_path(path)...
Returns the contents of a remote file :param path: path to the remote file :returns: file contents :rtype: binary data :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L414-L430
owncloud/pyocclient
owncloud/owncloud.py
Client.get_directory_as_zip
def get_directory_as_zip(self, remote_path, local_file): """Downloads a remote directory as zip :param remote_path: path to the remote directory to download :param local_file: path and name of the target local file :returns: True if the operation succeeded, False otherwise :rais...
python
def get_directory_as_zip(self, remote_path, local_file): """Downloads a remote directory as zip :param remote_path: path to the remote directory to download :param local_file: path and name of the target local file :returns: True if the operation succeeded, False otherwise :rais...
Downloads a remote directory as zip :param remote_path: path to the remote directory to download :param local_file: path and name of the target local file :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L461-L486
owncloud/pyocclient
owncloud/owncloud.py
Client.put_file
def put_file(self, remote_path, local_source_file, **kwargs): """Upload a file :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/" :param local_source_file: path to the local file to upload :param chunked: (optiona...
python
def put_file(self, remote_path, local_source_file, **kwargs): """Upload a file :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/" :param local_source_file: path to the local file to upload :param chunked: (optiona...
Upload a file :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/" :param local_source_file: path to the local file to upload :param chunked: (optional) use file chunking (defaults to True) :param chunk_size: (optio...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L498-L534
owncloud/pyocclient
owncloud/owncloud.py
Client.put_directory
def put_directory(self, target_path, local_directory, **kwargs): """Upload a directory with all its contents :param target_path: path of the directory to upload into :param local_directory: path to the local directory to upload :param \*\*kwargs: optional arguments that ``put_file`` acc...
python
def put_directory(self, target_path, local_directory, **kwargs): """Upload a directory with all its contents :param target_path: path of the directory to upload into :param local_directory: path to the local directory to upload :param \*\*kwargs: optional arguments that ``put_file`` acc...
Upload a directory with all its contents :param target_path: path of the directory to upload into :param local_directory: path to the local directory to upload :param \*\*kwargs: optional arguments that ``put_file`` accepts :returns: True if the operation succeeded, False otherwise ...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L536-L566
owncloud/pyocclient
owncloud/owncloud.py
Client._put_file_chunked
def _put_file_chunked(self, remote_path, local_source_file, **kwargs): """Uploads a file using chunks. If the file is smaller than ``chunk_size`` it will be uploaded directly. :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/...
python
def _put_file_chunked(self, remote_path, local_source_file, **kwargs): """Uploads a file using chunks. If the file is smaller than ``chunk_size`` it will be uploaded directly. :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/...
Uploads a file using chunks. If the file is smaller than ``chunk_size`` it will be uploaded directly. :param remote_path: path to the target file. A target directory can also be specified instead by appending a "/" :param local_source_file: path to the local file to upload :para...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L568-L630
owncloud/pyocclient
owncloud/owncloud.py
Client.list_open_remote_share
def list_open_remote_share(self): """List all pending remote shares :returns: array of pending remote shares :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( 'GET', self.OCS_SERVICE_SHARE, ...
python
def list_open_remote_share(self): """List all pending remote shares :returns: array of pending remote shares :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( 'GET', self.OCS_SERVICE_SHARE, ...
List all pending remote shares :returns: array of pending remote shares :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L652-L676
owncloud/pyocclient
owncloud/owncloud.py
Client.accept_remote_share
def accept_remote_share(self, share_id): """Accepts a remote share :param share_id: Share ID (int) :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned """ if not isinstance(share_id, int): ...
python
def accept_remote_share(self, share_id): """Accepts a remote share :param share_id: Share ID (int) :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned """ if not isinstance(share_id, int): ...
Accepts a remote share :param share_id: Share ID (int) :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L678-L695
owncloud/pyocclient
owncloud/owncloud.py
Client.update_share
def update_share(self, share_id, **kwargs): """Updates a given share :param share_id: (int) Share ID :param perms: (int) update permissions (see share_file_with_user() below) :param password: (string) updated password for public link Share :param public_upload: (boolean) enable/...
python
def update_share(self, share_id, **kwargs): """Updates a given share :param share_id: (int) Share ID :param perms: (int) update permissions (see share_file_with_user() below) :param password: (string) updated password for public link Share :param public_upload: (boolean) enable/...
Updates a given share :param share_id: (int) Share ID :param perms: (int) update permissions (see share_file_with_user() below) :param password: (string) updated password for public link Share :param public_upload: (boolean) enable/disable public upload for public shares :return...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L735-L772
owncloud/pyocclient
owncloud/owncloud.py
Client.share_file_with_link
def share_file_with_link(self, path, **kwargs): """Shares a remote file with link :param path: path to the remote file to share :param perms (optional): permission of the shared object defaults to read only (1) :param public_upload (optional): allows users to upload files or fol...
python
def share_file_with_link(self, path, **kwargs): """Shares a remote file with link :param path: path to the remote file to share :param perms (optional): permission of the shared object defaults to read only (1) :param public_upload (optional): allows users to upload files or fol...
Shares a remote file with link :param path: path to the remote file to share :param perms (optional): permission of the shared object defaults to read only (1) :param public_upload (optional): allows users to upload files or folders :param password (optional): sets a password ...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L800-L847
owncloud/pyocclient
owncloud/owncloud.py
Client.is_shared
def is_shared(self, path): """Checks whether a path is already shared :param path: path to the share to be checked :returns: True if the path is already shared, else False :raises: HTTPResponseError in case an HTTP error status was returned """ # make sure that the path ...
python
def is_shared(self, path): """Checks whether a path is already shared :param path: path to the share to be checked :returns: True if the path is already shared, else False :raises: HTTPResponseError in case an HTTP error status was returned """ # make sure that the path ...
Checks whether a path is already shared :param path: path to the share to be checked :returns: True if the path is already shared, else False :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L849-L866
owncloud/pyocclient
owncloud/owncloud.py
Client.get_share
def get_share(self, share_id): """Returns share information about known share :param share_id: id of the share to be checked :returns: instance of ShareInfo class :raises: ResponseError in case an HTTP error status was returned """ if (share_id is None) or not (isinstanc...
python
def get_share(self, share_id): """Returns share information about known share :param share_id: id of the share to be checked :returns: instance of ShareInfo class :raises: ResponseError in case an HTTP error status was returned """ if (share_id is None) or not (isinstanc...
Returns share information about known share :param share_id: id of the share to be checked :returns: instance of ShareInfo class :raises: ResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L868-L887
owncloud/pyocclient
owncloud/owncloud.py
Client.get_shares
def get_shares(self, path='', **kwargs): """Returns array of shares :param path: path to the share to be checked :param reshares: (optional, boolean) returns not only the shares from the current user but all shares from the given file (default: False) :param subfiles: (optio...
python
def get_shares(self, path='', **kwargs): """Returns array of shares :param path: path to the share to be checked :param reshares: (optional, boolean) returns not only the shares from the current user but all shares from the given file (default: False) :param subfiles: (optio...
Returns array of shares :param path: path to the share to be checked :param reshares: (optional, boolean) returns not only the shares from the current user but all shares from the given file (default: False) :param subfiles: (optional, boolean) returns all shares within ...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L889-L943
owncloud/pyocclient
owncloud/owncloud.py
Client.create_user
def create_user(self, user_name, initial_password): """Create a new user with an initial password via provisioning API. It is not an error, if the user already existed before. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be c...
python
def create_user(self, user_name, initial_password): """Create a new user with an initial password via provisioning API. It is not an error, if the user already existed before. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be c...
Create a new user with an initial password via provisioning API. It is not an error, if the user already existed before. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be created :param initial_password: password for user bein...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L945-L969
owncloud/pyocclient
owncloud/owncloud.py
Client.delete_user
def delete_user(self, user_name): """Deletes a user via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be deleted :returns: True on success :raises: HTTPResponseError in case an HTTP error status was r...
python
def delete_user(self, user_name): """Deletes a user via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be deleted :returns: True on success :raises: HTTPResponseError in case an HTTP error status was r...
Deletes a user via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be deleted :returns: True on success :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L971-L990
owncloud/pyocclient
owncloud/owncloud.py
Client.search_users
def search_users(self, user_name): """Searches for users via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be searched for :returns: list of usernames that contain user_name as substring :raises: HTTP...
python
def search_users(self, user_name): """Searches for users via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be searched for :returns: list of usernames that contain user_name as substring :raises: HTTP...
Searches for users via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param user_name: name of user to be searched for :returns: list of usernames that contain user_name as substring :raises: HTTPResponseError in case an HTTP error status was...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1004-L1029
owncloud/pyocclient
owncloud/owncloud.py
Client.set_user_attribute
def set_user_attribute(self, user_name, key, value): """Sets a user attribute :param user_name: name of user to modify :param key: key of the attribute to set :param value: value to set :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError...
python
def set_user_attribute(self, user_name, key, value): """Sets a user attribute :param user_name: name of user to modify :param key: key of the attribute to set :param value: value to set :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError...
Sets a user attribute :param user_name: name of user to modify :param key: key of the attribute to set :param value: value to set :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1041-L1063
owncloud/pyocclient
owncloud/owncloud.py
Client.add_user_to_group
def add_user_to_group(self, user_name, group_name): """Adds a user to a group. :param user_name: name of user to be added :param group_name: name of group user is to be added to :returns: True if user added :raises: HTTPResponseError in case an HTTP error status was returned ...
python
def add_user_to_group(self, user_name, group_name): """Adds a user to a group. :param user_name: name of user to be added :param group_name: name of group user is to be added to :returns: True if user added :raises: HTTPResponseError in case an HTTP error status was returned ...
Adds a user to a group. :param user_name: name of user to be added :param group_name: name of group user is to be added to :returns: True if user added :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1065-L1087
owncloud/pyocclient
owncloud/owncloud.py
Client.get_user_groups
def get_user_groups(self, user_name): """Get a list of groups associated to a user. :param user_name: name of user to list groups :returns: list of groups :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( ...
python
def get_user_groups(self, user_name): """Get a list of groups associated to a user. :param user_name: name of user to list groups :returns: list of groups :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( ...
Get a list of groups associated to a user. :param user_name: name of user to list groups :returns: list of groups :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1089-L1109
owncloud/pyocclient
owncloud/owncloud.py
Client.get_user
def get_user(self, user_name): """Retrieves information about a user :param user_name: name of user to query :returns: Dictionary of information about user :raises: ResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( 'G...
python
def get_user(self, user_name): """Retrieves information about a user :param user_name: name of user to query :returns: Dictionary of information about user :raises: ResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( 'G...
Retrieves information about a user :param user_name: name of user to query :returns: Dictionary of information about user :raises: ResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1121-L1145
owncloud/pyocclient
owncloud/owncloud.py
Client.get_user_subadmin_groups
def get_user_subadmin_groups(self, user_name): """Get a list of subadmin groups associated to a user. :param user_name: name of user :returns: list of subadmin groups :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request...
python
def get_user_subadmin_groups(self, user_name): """Get a list of subadmin groups associated to a user. :param user_name: name of user :returns: list of subadmin groups :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request...
Get a list of subadmin groups associated to a user. :param user_name: name of user :returns: list of subadmin groups :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1194-L1217
owncloud/pyocclient
owncloud/owncloud.py
Client.share_file_with_user
def share_file_with_user(self, path, user, **kwargs): """Shares a remote file with specified user :param path: path to the remote file to share :param user: name of the user whom we want to share a file/folder :param perms (optional): permissions of the shared object default...
python
def share_file_with_user(self, path, user, **kwargs): """Shares a remote file with specified user :param path: path to the remote file to share :param user: name of the user whom we want to share a file/folder :param perms (optional): permissions of the shared object default...
Shares a remote file with specified user :param path: path to the remote file to share :param user: name of the user whom we want to share a file/folder :param perms (optional): permissions of the shared object defaults to read only (1) http://doc.owncloud.org/server/6.0...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1229-L1281
owncloud/pyocclient
owncloud/owncloud.py
Client.delete_group
def delete_group(self, group_name): """Delete a group via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to be deleted :returns: True if group deleted :raises: HTTPResponseError in case an HTTP error st...
python
def delete_group(self, group_name): """Delete a group via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to be deleted :returns: True if group deleted :raises: HTTPResponseError in case an HTTP error st...
Delete a group via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to be deleted :returns: True if group deleted :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1307-L1326
owncloud/pyocclient
owncloud/owncloud.py
Client.get_groups
def get_groups(self): """Get groups via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :returns: list of groups :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( ...
python
def get_groups(self): """Get groups via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :returns: list of groups :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_request( ...
Get groups via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :returns: list of groups :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1328-L1348
owncloud/pyocclient
owncloud/owncloud.py
Client.get_group_members
def get_group_members(self, group_name): """Get group members via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to list members :returns: list of group members :raises: HTTPResponseError in case an HTT...
python
def get_group_members(self, group_name): """Get group members via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to list members :returns: list of group members :raises: HTTPResponseError in case an HTT...
Get group members via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to list members :returns: list of group members :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1350-L1370
owncloud/pyocclient
owncloud/owncloud.py
Client.group_exists
def group_exists(self, group_name): """Checks a group via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to be checked :returns: True if group exists :raises: HTTPResponseError in case an HTTP error sta...
python
def group_exists(self, group_name): """Checks a group via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to be checked :returns: True if group exists :raises: HTTPResponseError in case an HTTP error sta...
Checks a group via provisioning API. If you get back an error 999, then the provisioning API is not enabled. :param group_name: name of group to be checked :returns: True if group exists :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1372-L1396
owncloud/pyocclient
owncloud/owncloud.py
Client.share_file_with_group
def share_file_with_group(self, path, group, **kwargs): """Shares a remote file with specified group :param path: path to the remote file to share :param group: name of the group with which we want to share a file/folder :param perms (optional): permissions of the shared object ...
python
def share_file_with_group(self, path, group, **kwargs): """Shares a remote file with specified group :param path: path to the remote file to share :param group: name of the group with which we want to share a file/folder :param perms (optional): permissions of the shared object ...
Shares a remote file with specified group :param path: path to the remote file to share :param group: name of the group with which we want to share a file/folder :param perms (optional): permissions of the shared object defaults to read only (1) http://doc.owncloud.org/s...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1398-L1438
owncloud/pyocclient
owncloud/owncloud.py
Client.get_config
def get_config(self): """Returns ownCloud config information :returns: array of tuples (key, value) for each information e.g. [('version', '1.7'), ('website', 'ownCloud'), ('host', 'cloud.example.com'), ('contact', ''), ('ssl', 'false')] :raises: HTTPResponseError in case...
python
def get_config(self): """Returns ownCloud config information :returns: array of tuples (key, value) for each information e.g. [('version', '1.7'), ('website', 'ownCloud'), ('host', 'cloud.example.com'), ('contact', ''), ('ssl', 'false')] :raises: HTTPResponseError in case...
Returns ownCloud config information :returns: array of tuples (key, value) for each information e.g. [('version', '1.7'), ('website', 'ownCloud'), ('host', 'cloud.example.com'), ('contact', ''), ('ssl', 'false')] :raises: HTTPResponseError in case an HTTP error status was returne...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1440-L1467
owncloud/pyocclient
owncloud/owncloud.py
Client.get_attribute
def get_attribute(self, app=None, key=None): """Returns an application attribute :param app: application id :param key: attribute key or None to retrieve all values for the given application :returns: attribute value if key was specified, or an array of tuples (k...
python
def get_attribute(self, app=None, key=None): """Returns an application attribute :param app: application id :param key: attribute key or None to retrieve all values for the given application :returns: attribute value if key was specified, or an array of tuples (k...
Returns an application attribute :param app: application id :param key: attribute key or None to retrieve all values for the given application :returns: attribute value if key was specified, or an array of tuples (key, value) for each attribute :raises: HTTPRespo...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1469-L1508
owncloud/pyocclient
owncloud/owncloud.py
Client.set_attribute
def set_attribute(self, app, key, value): """Sets an application attribute :param app: application id :param key: key of the attribute to set :param value: value to set :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP ...
python
def set_attribute(self, app, key, value): """Sets an application attribute :param app: application id :param key: key of the attribute to set :param value: value to set :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP ...
Sets an application attribute :param app: application id :param key: key of the attribute to set :param value: value to set :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1510-L1531
owncloud/pyocclient
owncloud/owncloud.py
Client.get_apps
def get_apps(self): """ List all enabled apps through the provisioning api. :returns: a dict of apps, with values True/False, representing the enabled state. :raises: HTTPResponseError in case an HTTP error status was returned """ ena_apps = {} res = self._make_ocs_requ...
python
def get_apps(self): """ List all enabled apps through the provisioning api. :returns: a dict of apps, with values True/False, representing the enabled state. :raises: HTTPResponseError in case an HTTP error status was returned """ ena_apps = {} res = self._make_ocs_requ...
List all enabled apps through the provisioning api. :returns: a dict of apps, with values True/False, representing the enabled state. :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1554-L1580
owncloud/pyocclient
owncloud/owncloud.py
Client.enable_app
def enable_app(self, appname): """Enable an app through provisioning_api :param appname: Name of app to be enabled :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_r...
python
def enable_app(self, appname): """Enable an app through provisioning_api :param appname: Name of app to be enabled :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned """ res = self._make_ocs_r...
Enable an app through provisioning_api :param appname: Name of app to be enabled :returns: True if the operation succeeded, False otherwise :raises: HTTPResponseError in case an HTTP error status was returned
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1601-L1614
owncloud/pyocclient
owncloud/owncloud.py
Client._normalize_path
def _normalize_path(path): """Makes sure the path starts with a "/" """ if isinstance(path, FileInfo): path = path.path if len(path) == 0: return '/' if not path.startswith('/'): path = '/' + path return path
python
def _normalize_path(path): """Makes sure the path starts with a "/" """ if isinstance(path, FileInfo): path = path.path if len(path) == 0: return '/' if not path.startswith('/'): path = '/' + path return path
Makes sure the path starts with a "/"
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1632-L1641
owncloud/pyocclient
owncloud/owncloud.py
Client._encode_string
def _encode_string(s): """Encodes a unicode instance to utf-8. If a str is passed it will simply be returned :param s: str or unicode to encode :returns: encoded output as str """ if six.PY2 and isinstance(s, unicode): return s.encode('utf-8') return ...
python
def _encode_string(s): """Encodes a unicode instance to utf-8. If a str is passed it will simply be returned :param s: str or unicode to encode :returns: encoded output as str """ if six.PY2 and isinstance(s, unicode): return s.encode('utf-8') return ...
Encodes a unicode instance to utf-8. If a str is passed it will simply be returned :param s: str or unicode to encode :returns: encoded output as str
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1644-L1653
owncloud/pyocclient
owncloud/owncloud.py
Client._check_ocs_status
def _check_ocs_status(tree, accepted_codes=[100]): """Checks the status code of an OCS request :param tree: response parsed with elementtree :param accepted_codes: list of statuscodes we consider good. E.g. [100,102] can be used to accept a POST returning an 'already exists' cond...
python
def _check_ocs_status(tree, accepted_codes=[100]): """Checks the status code of an OCS request :param tree: response parsed with elementtree :param accepted_codes: list of statuscodes we consider good. E.g. [100,102] can be used to accept a POST returning an 'already exists' cond...
Checks the status code of an OCS request :param tree: response parsed with elementtree :param accepted_codes: list of statuscodes we consider good. E.g. [100,102] can be used to accept a POST returning an 'already exists' condition :raises: HTTPResponseError if the http status is...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1656-L1672
owncloud/pyocclient
owncloud/owncloud.py
Client.make_ocs_request
def make_ocs_request(self, method, service, action, **kwargs): """Makes a OCS API request and analyses the response :param method: HTTP method :param service: service name :param action: action path :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts ...
python
def make_ocs_request(self, method, service, action, **kwargs): """Makes a OCS API request and analyses the response :param method: HTTP method :param service: service name :param action: action path :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts ...
Makes a OCS API request and analyses the response :param method: HTTP method :param service: service name :param action: action path :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns :class:`requests.Response` instance
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1674-L1692
owncloud/pyocclient
owncloud/owncloud.py
Client._make_ocs_request
def _make_ocs_request(self, method, service, action, **kwargs): """Makes a OCS API request :param method: HTTP method :param service: service name :param action: action path :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns :class:`...
python
def _make_ocs_request(self, method, service, action, **kwargs): """Makes a OCS API request :param method: HTTP method :param service: service name :param action: action path :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns :class:`...
Makes a OCS API request :param method: HTTP method :param service: service name :param action: action path :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns :class:`requests.Response` instance
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1694-L1720
owncloud/pyocclient
owncloud/owncloud.py
Client._make_dav_request
def _make_dav_request(self, method, path, **kwargs): """Makes a WebDAV request :param method: HTTP method :param path: remote path of the targetted file :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns array of :class:`FileInfo` if the res...
python
def _make_dav_request(self, method, path, **kwargs): """Makes a WebDAV request :param method: HTTP method :param path: remote path of the targetted file :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns array of :class:`FileInfo` if the res...
Makes a WebDAV request :param method: HTTP method :param path: remote path of the targetted file :param \*\*kwargs: optional arguments that ``requests.Request.request`` accepts :returns array of :class:`FileInfo` if the response contains it, or True if the operation succeded, Fa...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1722-L1749
owncloud/pyocclient
owncloud/owncloud.py
Client._parse_dav_response
def _parse_dav_response(self, res): """Parses the DAV responses from a multi-status response :param res: DAV response :returns array of :class:`FileInfo` or False if the operation did not succeed """ if res.status_code == 207: tree = ET.fromstring(res.content...
python
def _parse_dav_response(self, res): """Parses the DAV responses from a multi-status response :param res: DAV response :returns array of :class:`FileInfo` or False if the operation did not succeed """ if res.status_code == 207: tree = ET.fromstring(res.content...
Parses the DAV responses from a multi-status response :param res: DAV response :returns array of :class:`FileInfo` or False if the operation did not succeed
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1751-L1764
owncloud/pyocclient
owncloud/owncloud.py
Client._parse_dav_element
def _parse_dav_element(self, dav_response): """Parses a single DAV element :param dav_response: DAV response :returns :class:`FileInfo` """ href = parse.unquote( self._strip_dav_path(dav_response.find('{DAV:}href').text) ) if six.PY2: hre...
python
def _parse_dav_element(self, dav_response): """Parses a single DAV element :param dav_response: DAV response :returns :class:`FileInfo` """ href = parse.unquote( self._strip_dav_path(dav_response.find('{DAV:}href').text) ) if six.PY2: hre...
Parses a single DAV element :param dav_response: DAV response :returns :class:`FileInfo`
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1766-L1789
owncloud/pyocclient
owncloud/owncloud.py
Client._strip_dav_path
def _strip_dav_path(self, path): """Removes the leading "remote.php/webdav" path from the given path :param path: path containing the remote DAV path "remote.php/webdav" :returns: path stripped of the remote DAV path """ if path.startswith(self._davpath): return path...
python
def _strip_dav_path(self, path): """Removes the leading "remote.php/webdav" path from the given path :param path: path containing the remote DAV path "remote.php/webdav" :returns: path stripped of the remote DAV path """ if path.startswith(self._davpath): return path...
Removes the leading "remote.php/webdav" path from the given path :param path: path containing the remote DAV path "remote.php/webdav" :returns: path stripped of the remote DAV path
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1791-L1799
owncloud/pyocclient
owncloud/owncloud.py
Client._webdav_move_copy
def _webdav_move_copy(self, remote_path_source, remote_path_target, operation): """Copies or moves a remote file or directory :param remote_path_source: source file or folder to copy / move :param remote_path_target: target file to which to copy / move :param ...
python
def _webdav_move_copy(self, remote_path_source, remote_path_target, operation): """Copies or moves a remote file or directory :param remote_path_source: source file or folder to copy / move :param remote_path_target: target file to which to copy / move :param ...
Copies or moves a remote file or directory :param remote_path_source: source file or folder to copy / move :param remote_path_target: target file to which to copy / move :param operation: MOVE or COPY :returns: True if the operation succeeded, False otherwise :raises: HTTPRespo...
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1801-L1832
owncloud/pyocclient
owncloud/owncloud.py
Client._xml_to_dict
def _xml_to_dict(self, element): """ Take an XML element, iterate over it and build a dict :param element: An xml.etree.ElementTree.Element, or a list of the same :returns: A dictionary """ return_dict = {} for el in element: return_dict[el.tag] = Non...
python
def _xml_to_dict(self, element): """ Take an XML element, iterate over it and build a dict :param element: An xml.etree.ElementTree.Element, or a list of the same :returns: A dictionary """ return_dict = {} for el in element: return_dict[el.tag] = Non...
Take an XML element, iterate over it and build a dict :param element: An xml.etree.ElementTree.Element, or a list of the same :returns: A dictionary
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1834-L1849
owncloud/pyocclient
owncloud/owncloud.py
Client._get_shareinfo
def _get_shareinfo(self, data_el): """Simple helper which returns instance of ShareInfo class :param data_el: 'data' element extracted from _make_ocs_request :returns: instance of ShareInfo class """ if (data_el is None) or not (isinstance(data_el, ET.Element)): retu...
python
def _get_shareinfo(self, data_el): """Simple helper which returns instance of ShareInfo class :param data_el: 'data' element extracted from _make_ocs_request :returns: instance of ShareInfo class """ if (data_el is None) or not (isinstance(data_el, ET.Element)): retu...
Simple helper which returns instance of ShareInfo class :param data_el: 'data' element extracted from _make_ocs_request :returns: instance of ShareInfo class
https://github.com/owncloud/pyocclient/blob/b9e1f04cdbde74588e86f1bebb6144571d82966c/owncloud/owncloud.py#L1851-L1859
dgovil/PySignal
PySignal.py
Signal.emit
def emit(self, *args, **kwargs): """ Calls all the connected slots with the provided args and kwargs unless block is activated """ if self._block: return for slot in self._slots: if not slot: continue elif isinstance(slot, par...
python
def emit(self, *args, **kwargs): """ Calls all the connected slots with the provided args and kwargs unless block is activated """ if self._block: return for slot in self._slots: if not slot: continue elif isinstance(slot, par...
Calls all the connected slots with the provided args and kwargs unless block is activated
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L25-L49
dgovil/PySignal
PySignal.py
Signal.connect
def connect(self, slot): """ Connects the signal to any callable object """ if not callable(slot): raise ValueError("Connection to non-callable '%s' object failed" % slot.__class__.__name__) if (isinstance(slot, partial) or '<' in slot.__name__): # If it'...
python
def connect(self, slot): """ Connects the signal to any callable object """ if not callable(slot): raise ValueError("Connection to non-callable '%s' object failed" % slot.__class__.__name__) if (isinstance(slot, partial) or '<' in slot.__name__): # If it'...
Connects the signal to any callable object
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L51-L73
dgovil/PySignal
PySignal.py
Signal.disconnect
def disconnect(self, slot): """ Disconnects the slot from the signal """ if not callable(slot): return if inspect.ismethod(slot): # If it's a method, then find it by its instance slotSelf = slot.__self__ for s in self._slots: ...
python
def disconnect(self, slot): """ Disconnects the slot from the signal """ if not callable(slot): return if inspect.ismethod(slot): # If it's a method, then find it by its instance slotSelf = slot.__self__ for s in self._slots: ...
Disconnects the slot from the signal
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L75-L100
dgovil/PySignal
PySignal.py
SignalFactory.register
def register(self, name, *slots): """ Registers a given signal :param name: the signal to register """ # setdefault initializes the object even if it exists. This is more efficient if name not in self: self[name] = Signal() for slot in slots: ...
python
def register(self, name, *slots): """ Registers a given signal :param name: the signal to register """ # setdefault initializes the object even if it exists. This is more efficient if name not in self: self[name] = Signal() for slot in slots: ...
Registers a given signal :param name: the signal to register
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L131-L141
dgovil/PySignal
PySignal.py
SignalFactory.emit
def emit(self, signalName, *args, **kwargs): """ Emits a signal by name if it exists. Any additional args or kwargs are passed to the signal :param signalName: the signal name to emit """ assert signalName in self, "%s is not a registered signal" % signalName self[signalN...
python
def emit(self, signalName, *args, **kwargs): """ Emits a signal by name if it exists. Any additional args or kwargs are passed to the signal :param signalName: the signal name to emit """ assert signalName in self, "%s is not a registered signal" % signalName self[signalN...
Emits a signal by name if it exists. Any additional args or kwargs are passed to the signal :param signalName: the signal name to emit
https://github.com/dgovil/PySignal/blob/72f4ced949f81e5438bd8f15247ef7890e8cc5ff/PySignal.py#L150-L156