INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Returns an amount of free space on remote WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PROPFIND
def free(self): """Returns an amount of free space on remote WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :return: an amount of free space in bytes. """ data = WebDavXmlUtils.create_free_space_request_content() ...
Checks an existence of remote resource on WebDAV server by remote path. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#rfc. section. 9. 4
def check(self, remote_path=root): """Checks an existence of remote resource on WebDAV server by remote path. More information you can find by link http://webdav.org/specs/rfc4918.html#rfc.section.9.4 :param remote_path: (optional) path to resource on WebDAV server. Defaults is root directory o...
Makes new directory on WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_MKCOL
def mkdir(self, remote_path): """Makes new directory on WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_MKCOL :param remote_path: path to directory :return: True if request executed with code 200 or 201 and False otherwise. """ ...
Downloads file from WebDAV and writes it in buffer.
def download_from(self, buff, remote_path): """Downloads file from WebDAV and writes it in buffer. :param buff: buffer object for writing of downloaded file content. :param remote_path: path to file on WebDAV server. """ urn = Urn(remote_path) if self.is_dir(urn.path()):...
Downloads remote resource from WebDAV and save it in local path. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#rfc. section. 9. 4
def download(self, remote_path, local_path, progress=None): """Downloads remote resource from WebDAV and save it in local path. More information you can find by link http://webdav.org/specs/rfc4918.html#rfc.section.9.4 :param remote_path: the path to remote resource for downloading can be file ...
Downloads directory and downloads all nested files and directories from remote WebDAV to local. If there is something on local path it deletes directories and files then creates new.
def download_directory(self, remote_path, local_path, progress=None): """Downloads directory and downloads all nested files and directories from remote WebDAV to local. If there is something on local path it deletes directories and files then creates new. :param remote_path: the path to directo...
Downloads file from WebDAV server and saves it temprorary then opens it for further manipulations. Has the same interface as built - in open ()
def open(self, file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): """Downloads file from WebDAV server and saves it temprorary, then opens it for further manipulations. Has the same interface as built-in open() :param file: the path to remote fil...
Downloads file from WebDAV server and save it locally. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#rfc. section. 9. 4
def download_file(self, remote_path, local_path, progress=None): """Downloads file from WebDAV server and save it locally. More information you can find by link http://webdav.org/specs/rfc4918.html#rfc.section.9.4 :param remote_path: the path to remote file for downloading. :param local...
Downloads remote resources from WebDAV server synchronously.
def download_sync(self, remote_path, local_path, callback=None): """Downloads remote resources from WebDAV server synchronously. :param remote_path: the path to remote resource on WebDAV server. Can be file and directory. :param local_path: the path to save resource locally. :param call...
Downloads remote resources from WebDAV server asynchronously
def download_async(self, remote_path, local_path, callback=None): """Downloads remote resources from WebDAV server asynchronously :param remote_path: the path to remote resource on WebDAV server. Can be file and directory. :param local_path: the path to save resource locally. :param cal...
Uploads file from buffer to remote path on WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PUT
def upload_to(self, buff, remote_path): """Uploads file from buffer to remote path on WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PUT :param buff: the buffer with content for file. :param remote_path: the path to save file remotely on...
Uploads resource to remote path on WebDAV server. In case resource is directory it will upload all nested files and directories. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PUT
def upload(self, remote_path, local_path, progress=None): """Uploads resource to remote path on WebDAV server. In case resource is directory it will upload all nested files and directories. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PUT :param remo...
Uploads directory to remote path on WebDAV server. In case directory is exist on remote server it will delete it and then upload directory with nested files and directories.
def upload_directory(self, remote_path, local_path, progress=None): """Uploads directory to remote path on WebDAV server. In case directory is exist on remote server it will delete it and then upload directory with nested files and directories. :param remote_path: the path to directory ...
Uploads file to remote path on WebDAV server. File should be 2Gb or less. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PUT
def upload_file(self, remote_path, local_path, progress=None): """Uploads file to remote path on WebDAV server. File should be 2Gb or less. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PUT :param remote_path: the path to uploading file on WebDAV server. ...
Uploads resource to remote path on WebDAV server synchronously. In case resource is directory it will upload all nested files and directories.
def upload_sync(self, remote_path, local_path, callback=None): """Uploads resource to remote path on WebDAV server synchronously. In case resource is directory it will upload all nested files and directories. :param remote_path: the path for uploading resources on WebDAV server. Can be file and...
Uploads resource to remote path on WebDAV server asynchronously. In case resource is directory it will upload all nested files and directories.
def upload_async(self, remote_path, local_path, callback=None): """Uploads resource to remote path on WebDAV server asynchronously. In case resource is directory it will upload all nested files and directories. :param remote_path: the path for uploading resources on WebDAV server. Can be file a...
Copies resource from one place to another on WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_COPY
def copy(self, remote_path_from, remote_path_to): """Copies resource from one place to another on WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_COPY :param remote_path_from: the path to resource which will be copied, :param remote_path_...
Moves resource from one place to another on WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_MOVE
def move(self, remote_path_from, remote_path_to, overwrite=False): """Moves resource from one place to another on WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_MOVE :param remote_path_from: the path to resource which will be moved, :par...
Cleans ( Deletes ) a remote resource on WebDAV server. The name of method is not changed for back compatibility with original library. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_DELETE
def clean(self, remote_path): """Cleans (Deletes) a remote resource on WebDAV server. The name of method is not changed for back compatibility with original library. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_DELETE :param remote_path: the remote r...
Gets information about resource on WebDAV. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PROPFIND
def info(self, remote_path): """Gets information about resource on WebDAV. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: a dictionary of information attributes and them values with fol...
Checks is the remote resource directory. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PROPFIND
def is_dir(self, remote_path): """Checks is the remote resource directory. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: True in case the remote resource is directory and False otherwi...
Gets metadata property of remote resource on WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PROPFIND
def get_property(self, remote_path, option): """Gets metadata property of remote resource on WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :param option: the property attribute a...
Sets metadata property of remote resource on WebDAV server. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PROPPATCH
def set_property(self, remote_path, option): """Sets metadata property of remote resource on WebDAV server. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPPATCH :param remote_path: the path to remote resource. :param option: the property attribute ...
Sets batch metadata properties of remote resource on WebDAV server in batch. More information you can find by link http:// webdav. org/ specs/ rfc4918. html#METHOD_PROPPATCH
def set_property_batch(self, remote_path, option): """Sets batch metadata properties of remote resource on WebDAV server in batch. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPPATCH :param remote_path: the path to remote resource. :param option: ...
Parses of response content XML from WebDAV server and extract file and directory names.
def parse_get_list_response(content): """Parses of response content XML from WebDAV server and extract file and directory names. :param content: the XML content of HTTP response from WebDAV server for getting list of files by remote path. :return: list of extracted file or directory names. ...
Creates an XML for requesting of free space on remote WebDAV server.
def create_free_space_request_content(): """Creates an XML for requesting of free space on remote WebDAV server. :return: the XML string of request content. """ root = etree.Element('propfind', xmlns='DAV:') prop = etree.SubElement(root, 'prop') etree.SubElement(prop, 'q...
Parses of response content XML from WebDAV server and extract an amount of free space.
def parse_free_space_response(content, hostname): """Parses of response content XML from WebDAV server and extract an amount of free space. :param content: the XML content of HTTP response from WebDAV server for getting free space. :param hostname: the server hostname. :return: an amoun...
Parses of response content XML from WebDAV server and extract an information about resource.
def parse_info_response(content, path, hostname): """Parses of response content XML from WebDAV server and extract an information about resource. :param content: the XML content of HTTP response from WebDAV server. :param path: the path to resource. :param hostname: the server hostname....
Parses of response content XML from WebDAV server and extract an information about resource.
def parse_is_dir_response(content, path, hostname): """Parses of response content XML from WebDAV server and extract an information about resource. :param content: the XML content of HTTP response from WebDAV server. :param path: the path to resource. :param hostname: the server hostnam...
Creates an XML for requesting of getting a property value of remote WebDAV resource.
def create_get_property_request_content(option): """Creates an XML for requesting of getting a property value of remote WebDAV resource. :param option: the property attributes as dictionary with following keys: `namespace`: (optional) the namespace for XML property which will be ...
Parses of response content XML from WebDAV server for getting metadata property value for some resource.
def parse_get_property_response(content, name): """Parses of response content XML from WebDAV server for getting metadata property value for some resource. :param content: the XML content of response as string. :param name: the name of property for finding a value in response :return: t...
Creates an XML for requesting of setting a property values for remote WebDAV resource in batch.
def create_set_property_batch_request_content(options): """Creates an XML for requesting of setting a property values for remote WebDAV resource in batch. :param options: the property attributes as list of dictionaries with following keys: `namespace`: (optional) the namespace fo...
Creates string from lxml. etree. ElementTree with XML declaration and UTF - 8 encoding.
def etree_to_string(tree): """Creates string from lxml.etree.ElementTree with XML declaration and UTF-8 encoding. :param tree: the instance of ElementTree :return: the string of XML. """ buff = BytesIO() tree.write(buff, xml_declaration=True, encoding='UTF-8') re...
Extracts single response for specified remote resource.
def extract_response_for_path(content, path, hostname): """Extracts single response for specified remote resource. :param content: raw content of response as string. :param path: the path to needed remote resource. :param hostname: the server hostname. :return: XML object of res...
Remove temporary stderr and stdout files as well as the daemon socket.
def cleanup(config_dir): """Remove temporary stderr and stdout files as well as the daemon socket.""" stdout_path = os.path.join(config_dir, 'pueue.stdout') stderr_path = os.path.join(config_dir, 'pueue.stderr') if os._exists(stdout_path): os.remove(stdout_path) if os._exists(stderr_path): ...
Get the descriptor output and handle incorrect UTF - 8 encoding of subprocess logs.
def get_descriptor_output(descriptor, key, handler=None): """Get the descriptor output and handle incorrect UTF-8 encoding of subprocess logs. In case an process contains valid UTF-8 lines as well as invalid lines, we want to preserve the valid and remove the invalid ones. To do this we need to get eac...
Query conversion server
def request(self, hash_, quickkey, doc_type, page=None, output=None, size_id=None, metadata=None, request_conversion_only=None): """Query conversion server hash_: 4 characters of file hash quickkey: File quickkey doc_type: "i" for image, "d" for documents...
Decorator of the Pdb user_ * methods that controls the RemoteSocket.
def user_method(user_event): """Decorator of the Pdb user_* methods that controls the RemoteSocket.""" def wrapper(self, *args): stdin = self.stdin is_sock = isinstance(stdin, RemoteSocket) try: try: if is_sock and not stdin.connect(): retu...
This function is called when we stop or break at this line.
def user_line(self, frame, breakpoint_hits=None): """This function is called when we stop or break at this line.""" if not breakpoint_hits: self.interaction(frame, None) else: commands_result = self.bp_commands(frame, breakpoint_hits) if not commands_result: ...
Call every command that was set for the current active breakpoints.
def bp_commands(self, frame, breakpoint_hits): """Call every command that was set for the current active breakpoints. Returns True if the normal interaction function must be called, False otherwise.""" # Handle multiple breakpoints on the same line (issue 14789) effective_bp_lis...
This function is called when a return trap is set here.
def user_return(self, frame, return_value): """This function is called when a return trap is set here.""" frame.f_locals['__return__'] = return_value self.message('--Return--') self.interaction(frame, None)
This function is called if an exception occurs but only if we are to stop at or just below this level.
def user_exception(self, frame, exc_info): """This function is called if an exception occurs, but only if we are to stop at or just below this level.""" exc_type, exc_value, exc_traceback = exc_info frame.f_locals['__exception__'] = exc_type, exc_value # An 'Internal StopIterati...
Handle alias expansion and ;; separator.
def precmd(self, line): """Handle alias expansion and ';;' separator.""" if not line.strip(): return line args = line.split() while args[0] in self.aliases: line = self.aliases[args[0]] ii = 1 for tmpArg in args[1:]: line = ...
Interpret the argument as though it had been typed in response to the prompt.
def onecmd(self, line): """Interpret the argument as though it had been typed in response to the prompt. Checks whether this line is typed at the normal prompt or in a breakpoint command list definition. """ if not self.commands_defining: return cmd.Cmd.onecm...
Handles one command line during command list definition.
def handle_command_def(self, line): """Handles one command line during command list definition.""" cmd, arg, line = self.parseline(line) if not cmd: return if cmd == 'silent': self.commands_silent[self.commands_bnum] = True return # continue to handle ...
commands [ bpnumber ] ( com )... ( com ) end ( Pdb )
def do_commands(self, arg): """commands [bpnumber] (com) ... (com) end (Pdb) Specify a list of commands for breakpoint number bpnumber. The commands themselves are entered on the following lines. Type a line containing just 'end' to terminate the commands. ...
b ( reak ) [ ( [ filename: ] lineno | function ) [ condition ] ] Without argument list all breaks.
def do_break(self, arg, temporary = 0): """b(reak) [ ([filename:]lineno | function) [, condition] ] Without argument, list all breaks. With a line number argument, set a break at this line in the current file. With a function name, set a break at the first executable line of th...
Produce a reasonable default.
def defaultFile(self): """Produce a reasonable default.""" filename = self.curframe.f_code.co_filename if filename == '<string>' and self.mainpyfile: filename = self.mainpyfile return filename
enable bpnumber [ bpnumber... ] Enables the breakpoints given as a space separated list of breakpoint numbers.
def do_enable(self, arg): """enable bpnumber [bpnumber ...] Enables the breakpoints given as a space separated list of breakpoint numbers. """ args = arg.split() for i in args: try: bp = self.get_bpbynumber(i) except ValueError as e...
disable bpnumber [ bpnumber... ] Disables the breakpoints given as a space separated list of breakpoint numbers. Disabling a breakpoint means it cannot cause the program to stop execution but unlike clearing a breakpoint it remains in the list of breakpoints and can be ( re - ) enabled.
def do_disable(self, arg): """disable bpnumber [bpnumber ...] Disables the breakpoints given as a space separated list of breakpoint numbers. Disabling a breakpoint means it cannot cause the program to stop execution, but unlike clearing a breakpoint, it remains in the list of b...
condition bpnumber [ condition ] Set a new condition for the breakpoint an expression which must evaluate to true before the breakpoint is honored. If condition is absent any existing condition is removed ; i. e. the breakpoint is made unconditional.
def do_condition(self, arg): """condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditiona...
ignore bpnumber [ count ] Set the ignore count for the given breakpoint number. If count is omitted the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non - zero the count is decremented each time the breakpoint is reached and the breakpoint is not disabled and any associated ...
def do_ignore(self, arg): """ignore bpnumber [count] Set the ignore count for the given breakpoint number. If count is omitted, the ignore count is set to 0. A breakpoint becomes active when the ignore count is zero. When non-zero, the count is decremented each time the breakp...
cl ( ear ) filename: lineno \ ncl ( ear ) [ bpnumber [ bpnumber... ]] With a space separated list of breakpoint numbers clear those breakpoints. Without argument clear all breaks ( but first ask confirmation ). With a filename: lineno argument clear all breaks at that line in that file.
def do_clear(self, arg): """cl(ear) filename:lineno\ncl(ear) [bpnumber [bpnumber...]] With a space separated list of breakpoint numbers, clear those breakpoints. Without argument, clear all breaks (but first ask confirmation). With a filename:lineno argument, clear all breaks a...
u ( p ) [ count ] Move the current frame count ( default one ) levels up in the stack trace ( to an older frame ).
def do_up(self, arg): """u(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame). """ if self.curindex == 0: self.error('Oldest frame') return try: count = int(arg or 1) except Va...
d ( own ) [ count ] Move the current frame count ( default one ) levels down in the stack trace ( to a newer frame ).
def do_down(self, arg): """d(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame). """ if self.curindex + 1 == len(self.stack): self.error('Newest frame') return try: count = int(arg ...
unt ( il ) [ lineno ] Without argument continue execution until the line with a number greater than the current one is reached. With a line number continue execution until a line with a number greater or equal to that is reached. In both cases also stop when the current frame returns.
def do_until(self, arg): """unt(il) [lineno] Without argument, continue execution until the line with a number greater than the current one is reached. With a line number, continue execution until a line with a number greater or equal to that is reached. In both cases, also sto...
run [ args... ] Restart the debugged python program. If a string is supplied it is splitted with shlex and the result is used as the new sys. argv. History breakpoints actions and debugger options are preserved. restart is an alias for run.
def do_run(self, arg): """run [args...] Restart the debugged python program. If a string is supplied it is splitted with "shlex", and the result is used as the new sys.argv. History, breakpoints, actions and debugger options are preserved. "restart" is an alias for "run". ...
j ( ump ) lineno Set the next line that will be executed. Only available in the bottom - most frame. This lets you jump back and execute code again or jump forward to skip code that you don t want to run.
def do_jump(self, arg): """j(ump) lineno Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don't want to run. It should be noted that not all jumps are...
debug code Enter a recursive debugger that steps through the code argument ( which is an arbitrary expression or statement to be executed in the current environment ).
def do_debug(self, arg): """debug code Enter a recursive debugger that steps through the code argument (which is an arbitrary expression or statement to be executed in the current environment). """ self.settrace(False) globals = self.curframe.f_globals loc...
q ( uit ) \ nexit Quit from the debugger. The program being executed is aborted.
def do_quit(self, arg): """q(uit)\nexit Quit from the debugger. The program being executed is aborted. """ if isinstance(self.stdin, RemoteSocket) and not self.is_debug_instance: return self.do_detach(arg) self._user_requested_quit = True self.set_quit() ...
a ( rgs ) Print the argument list of the current function.
def do_args(self, arg): """a(rgs) Print the argument list of the current function. """ co = self.curframe.f_code dict = self.get_locals(self.curframe) n = co.co_argcount if co.co_flags & 4: n = n+1 if co.co_flags & 8: n = n+1 for i in range(n): ...
retval Print the return value for the last return of a function.
def do_retval(self, arg): """retval Print the return value for the last return of a function. """ locals = self.get_locals(self.curframe) if '__return__' in locals: self.message(bdb.safe_repr(locals['__return__'])) else: self.error('Not yet returne...
p expression Print the value of the expression.
def do_p(self, arg): """p expression Print the value of the expression. """ try: self.message(bdb.safe_repr(self._getval(arg))) except Exception: pass
pp expression Pretty - print the value of the expression.
def do_pp(self, arg): """pp expression Pretty-print the value of the expression. """ obj = self._getval(arg) try: repr(obj) except Exception: self.message(bdb.safe_repr(obj)) else: self.message(pprint.pformat(obj))
l ( ist ) [ first [ last ] |. ]
def do_list(self, arg): """l(ist) [first [,last] | .] List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With . as argument, list 11 lines around the current line. With one argument, list 11 lines ...
longlist | ll List the whole source code for the current function or frame.
def do_longlist(self, arg): """longlist | ll List the whole source code for the current function or frame. """ filename = self.curframe.f_code.co_filename breaklist = self.get_file_breaks(filename) try: lines, lineno = getsourcelines(self.curframe, ...
source expression Try to get source code for the given object and display it.
def do_source(self, arg): """source expression Try to get source code for the given object and display it. """ try: obj = self._getval(arg) except Exception: return try: lines, lineno = getsourcelines(obj, self.get_locals(self.curframe)...
Print a range of lines.
def _print_lines(self, lines, start, breaks=(), frame=None): """Print a range of lines.""" if frame: current_lineno = frame.f_lineno exc_lineno = self.tb_lineno.get(frame, -1) else: current_lineno = exc_lineno = -1 for lineno, line in enumerate(lines, ...
whatis arg Print the type of the argument.
def do_whatis(self, arg): """whatis arg Print the type of the argument. """ try: value = self._getval(arg) except Exception: # _getval() already printed the error return code = None # Is it a function? try: c...
display [ expression ]
def do_display(self, arg): """display [expression] Display the value of the expression if it changed, each time execution stops in the current frame. Without expression, list all display expressions for the current frame. """ if not arg: self.message('Curren...
undisplay [ expression ]
def do_undisplay(self, arg): """undisplay [expression] Do not display the expression any more in the current frame. Without expression, clear all display expressions for the current frame. """ if arg: try: del self.displaying.get(self.curframe, {})[a...
interact
def do_interact(self, arg): """interact Start an interative interpreter whose global namespace contains all the (global and local) names found in the current scope. """ def readfunc(prompt): self.stdout.write(prompt) self.stdout.flush() line =...
alias [ name [ command [ parameter parameter... ] ]] Create an alias called name that executes command. The command must * not * be enclosed in quotes. Replaceable parameters can be indicated by %1 %2 and so on while % * is replaced by all the parameters. If no command is given the current alias for name is shown. If n...
def do_alias(self, arg): """alias [name [command [parameter parameter ...] ]] Create an alias called 'name' that executes 'command'. The command must *not* be enclosed in quotes. Replaceable parameters can be indicated by %1, %2, and so on, while %* is replaced by all the param...
unalias name Delete the specified alias.
def do_unalias(self, arg): """unalias name Delete the specified alias. """ args = arg.split() if len(args) == 0: return if args[0] in self.aliases: del self.aliases[args[0]]
th ( read ) [ threadnumber ] Without argument display a summary of all active threads. The summary prints for each thread: 1. the thread number assigned by pdb 2. the thread name 3. the python thread identifier 4. the current stack frame summary for that thread An asterisk * to the left of the pdb thread number indicat...
def do_thread(self, arg): """th(read) [threadnumber] Without argument, display a summary of all active threads. The summary prints for each thread: 1. the thread number assigned by pdb 2. the thread name 3. the python thread identifier 4. the current s...
h ( elp ) Without argument print the list of available commands. With a command name as argument print help about that command. help pdb shows the full pdb documentation. help exec gives help on the ! command.
def do_help(self, arg): """h(elp) Without argument, print the list of available commands. With a command name as argument, print help about that command. "help pdb" shows the full pdb documentation. "help exec" gives help on the ! command. """ if not arg: ...
Read content. See file. read
def read(self, limit=-1): """Read content. See file.read""" remaining = self.len - self.parent_fd.tell() + self.offset if limit > remaining or limit == -1: limit = remaining return self.parent_fd.read(limit)
Seek to position in stream see file. seek
def seek(self, offset, whence=os.SEEK_SET): """Seek to position in stream, see file.seek""" pos = None if whence == os.SEEK_SET: pos = self.offset + offset elif whence == os.SEEK_CUR: pos = self.tell() + offset elif whence == os.SEEK_END: pos ...
Close file see file. close
def close(self): """Close file, see file.close""" try: self.parent_fd.fileno() except io.UnsupportedOperation: logger.debug("Not closing parent_fd - reusing existing") else: self.parent_fd.close()
Prepare query string
def _build_query(self, uri, params=None, action_token_type=None): """Prepare query string""" if params is None: params = QueryParams() params['response_format'] = 'json' session_token = None if action_token_type in self._action_tokens: # Favor action t...
Perform request to MediaFire API
def request(self, action, params=None, action_token_type=None, upload_info=None, headers=None): """Perform request to MediaFire API action -- "category/name" of method to call params -- dict of parameters or query string action_token_type -- action token to use: None, "u...
Parse response
def _process_response(self, response): """Parse response""" forward_raw = False content_type = response.headers['Content-Type'] if content_type != 'application/json': logger.debug("headers: %s", response.headers) # API BUG: text/xml content-type with json payload...
Regenerate secret key
def _regenerate_secret_key(self): """Regenerate secret key http://www.mediafire.com/developers/core_api/1.3/getting_started/#call_signature """ # Don't regenerate the key if we have none if self._session and 'secret_key' in self._session: self._session['secret_key'] ...
Set session token
def session(self, value): """Set session token value -- dict returned by user/get_session_token""" # unset session token if value is None: self._session = None return if not isinstance(value, dict): raise ValueError("session info is required...
Set action tokens
def set_action_token(self, type_=None, action_token=None): """Set action tokens type_ -- either "upload" or "image" action_token -- string obtained from user/get_action_token, set None to remove the token """ if action_token is None: del self....
user/ get_session_token
def user_get_session_token(self, app_id=None, email=None, password=None, ekey=None, fb_access_token=None, tw_oauth_token=None, tw_oauth_token_secret=None, api_key=None): """user/get_session_token http://www.med...
user/ set_avatar
def user_set_avatar(self, action=None, quick_key=None, url=None): """user/set_avatar http://www.mediafire.com/developers/core_api/1.3/user/#set_avatar """ return self.request("user/set_avatar", QueryParams({ "action": action, "quick_key": quick_key, "...
user/ update
def user_update(self, display_name=None, first_name=None, last_name=None, email=None, password=None, current_password=None, birth_date=None, gender=None, website=None, subdomain=None, location=None, newsletter=None, primary_usage=None, time...
folder/ get_info
def folder_get_info(self, folder_key=None, device_id=None, details=None): """folder/get_info http://www.mediafire.com/developers/core_api/1.3/folder/#get_info """ return self.request('folder/get_info', QueryParams({ 'folder_key': folder_key, 'device_id': device_i...
folder/ get_content
def folder_get_content(self, folder_key=None, content_type=None, filter_=None, device_id=None, order_by=None, order_direction=None, chunk=None, details=None, chunk_size=None): """folder/get_content http://www.mediafire.com...
folder/ update
def folder_update(self, folder_key, foldername=None, description=None, privacy=None, privacy_recursive=None, mtime=None): """folder/update http://www.mediafire.com/developers/core_api/1.3/folder/#update """ return self.request('folder/update', QueryParams({ ...
folder/ create
def folder_create(self, foldername=None, parent_key=None, action_on_duplicate=None, mtime=None): """folder/create http://www.mediafire.com/developers/core_api/1.3/folder/#create """ return self.request('folder/create', QueryParams({ 'foldername': folder...
upload/ check
def upload_check(self, filename=None, folder_key=None, filedrop_key=None, size=None, hash_=None, path=None, resumable=None): """upload/check http://www.mediafire.com/developers/core_api/1.3/upload/#check """ return self.request('upload/check', QueryParams({ ...
upload/ simple
def upload_simple(self, fd, filename, folder_key=None, path=None, filedrop_key=None, action_on_duplicate=None, mtime=None, file_size=None, file_hash=None): """upload/simple http://www.mediafire.com/developers/core_api/1.3/upload/#simple """ ac...
upload/ resumable
def upload_resumable(self, fd, filesize, filehash, unit_hash, unit_id, unit_size, quick_key=None, action_on_duplicate=None, mtime=None, version_control=None, folder_key=None, filedrop_key=None, path=None, previous_hash=None): """upload/r...
upload/ instant
def upload_instant(self, filename, size, hash_, quick_key=None, folder_key=None, filedrop_key=None, path=None, action_on_duplicate=None, mtime=None, version_control=None, previous_hash=None): """upload/instant http://www.mediafire.com...
file/ update
def file_update(self, quick_key, filename=None, description=None, mtime=None, privacy=None): """file/update http://www.mediafire.com/developers/core_api/1.3/file/#update """ return self.request('file/update', QueryParams({ 'quick_key': quick_key, ...
file/ update_file
def file_update_file(self, quick_key, file_extension=None, filename=None, description=None, mtime=None, privacy=None, timezone=None): """file/update_file http://www.mediafire.com/developers/core_api/1.3/file/#update_file """ return self....
file/ zip
def file_zip(self, keys, confirm_download=None, meta_only=None): """file/zip http://www.mediafire.com/developers/core_api/1.3/file/#zip """ return self.request('file/zip', QueryParams({ 'keys': keys, 'confirm_download': confirm_download, 'meta_only': ...
Reset all of our stateful variables
def _reset(self): '''Reset all of our stateful variables''' self._socket = None # The pending messages we have to send, and the current buffer we're # sending self._pending = deque() self._out_buffer = '' # Our read buffer self._buffer = '' # The i...