text stringlengths 81 112k |
|---|
Upload file, returns UploadResult object
fd -- file-like object to upload from, expects exclusive access
name -- file name
folder_key -- folderkey of the target folder
path -- path to file relative to folder_key
filedrop_key -- filedrop to use instead of folder_key
actio... |
Poll upload until quickkey is found
upload_key -- upload_key returned by upload/* functions
def _poll_upload(self, upload_key, action):
"""Poll upload until quickkey is found
upload_key -- upload_key returned by upload/* functions
"""
if len(upload_key) != UPLOAD_KEY_LENGTH:
... |
Wrapper around upload/check
def _upload_check(self, upload_info, resumable=False):
"""Wrapper around upload/check"""
return self._api.upload_check(
filename=upload_info.name,
size=upload_info.size,
hash_=upload_info.hash_info.file,
folder_key=upload_info.... |
Dummy upload function for when we don't actually upload
def _upload_none(self, upload_info, check_result):
"""Dummy upload function for when we don't actually upload"""
return UploadResult(
action=None,
quickkey=check_result['duplicate_quickkey'],
hash_=upload_info.h... |
Instant upload and return quickkey
Can be used when the file is already stored somewhere in MediaFire
upload_info -- UploadInfo object
check_result -- ignored
def _upload_instant(self, upload_info, _=None):
"""Instant upload and return quickkey
Can be used when the file is al... |
Simple upload and return quickkey
Can be used for small files smaller than UPLOAD_SIMPLE_LIMIT_BYTES
upload_info -- UploadInfo object
check_result -- ignored
def _upload_simple(self, upload_info, _=None):
"""Simple upload and return quickkey
Can be used for small files smalle... |
Upload a single unit and return raw upload/resumable result
uu_info -- UploadUnitInfo instance
def _upload_resumable_unit(self, uu_info):
"""Upload a single unit and return raw upload/resumable result
uu_info -- UploadUnitInfo instance
"""
# Get actual unit size
unit_... |
Prepare and upload all resumable units and return upload_key
upload_info -- UploadInfo object
bitmap -- bitmap node of upload/check
number_of_units -- number of units requested
unit_size -- size of a single upload unit in bytes
def _upload_resumable_all(self, upload_info, bitmap,
... |
Resumable upload and return quickkey
upload_info -- UploadInfo object
check_result -- dict of upload/check call result
def _upload_resumable(self, upload_info, check_result):
"""Resumable upload and return quickkey
upload_info -- UploadInfo object
check_result -- dict of uploa... |
Remove from sys.modules the modules imported by the debuggee.
def reset(self):
"""Remove from sys.modules the modules imported by the debuggee."""
if not self.hooked:
self.hooked = True
sys.path_hooks.append(self)
sys.path.insert(0, self.PATH_ENTRY)
retur... |
The first line number of the last defined 'funcname' function.
def get_func_lno(self, funcname):
"""The first line number of the last defined 'funcname' function."""
class FuncLineno(ast.NodeVisitor):
def __init__(self):
self.clss = []
def generic_visit(self, n... |
Get the actual breakpoint line number.
When an exact match cannot be found in the lnotab expansion of the
module code object or one of its subcodes, pick up the next valid
statement line number.
Return the statement line defined by the tuple (code firstlineno,
statement line nu... |
Return the list of breakpoints set at lineno.
def get_breakpoints(self, lineno):
"""Return the list of breakpoints set at lineno."""
try:
firstlineno, actual_lno = self.bdb_module.get_actual_bp(lineno)
except BdbSourceError:
return []
if firstlineno not in self:
... |
Set or remove the trace function.
def settrace(self, do_set):
"""Set or remove the trace function."""
if do_set:
sys.settrace(self.trace_dispatch)
else:
sys.settrace(None) |
Restart the debugger after source code changes.
def restart(self):
"""Restart the debugger after source code changes."""
_module_finder.reset()
linecache.checkcache()
for module_bpts in self.breakpoints.values():
module_bpts.reset() |
Stop when the current line number in frame is greater than lineno or
when returning from frame.
def set_until(self, frame, lineno=None):
"""Stop when the current line number in frame is greater than lineno or
when returning from frame."""
if lineno is None:
lineno = frame.f_... |
Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
def set_trace(self, frame=None):
"""Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
"""
# First disable tracing temporarily as set_trac... |
Return (stop_state, delete_temporary) at a breakpoint hit event.
def process_hit_event(self, frame):
"""Return (stop_state, delete_temporary) at a breakpoint hit event."""
if not self.enabled:
return False, False
# Count every hit when breakpoint is enabled.
self.hits += 1
... |
Returns list of nested files and directories for local directory by path
:param directory: absolute or relative path to local directory
:return: list nested of file or directory names
def listdir(directory):
"""Returns list of nested files and directories for local directory by path
:param directory:... |
Extract options for specified option type from all options
:param option_type: the object of specified type of options
:param from_options: all options dictionary
:return: the dictionary of options for specified type, each option can be filled by value from all options
dictionary or blank in c... |
Returns HTTP headers of specified WebDAV actions.
:param action: the identifier of action.
:param headers_ext: (optional) the addition headers list witch sgould be added to basic HTTP headers for
the specified action.
:return: the dictionary of headers for specified ... |
Generate request to WebDAV server for specified action and path and execute it.
:param action: the action for WebDAV server which should be executed.
:param path: the path to resource for action
:param data: (optional) Dictionary or list of tuples ``[(key, value)]`` (will be form-encoded), byte... |
Validates of WebDAV and proxy settings.
:return: True in case settings are valid and False otherwise.
def valid(self):
"""Validates of WebDAV and proxy settings.
:return: True in case settings are valid and False otherwise.
"""
return True if self.webdav.valid() and self.proxy... |
Returns list of nested files and directories for remote WebDAV directory by path.
More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND
:param remote_path: path to remote directory.
:return: list of nested file or directory names.
def list(self, remote_path... |
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.
def free(self):
"""Returns an amount of free space on remote WebDAV server.
More information yo... |
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 of WebDAV.
:return: True if resource is... |
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.
def mkdir(self, remote_path):
"""Makes new dir... |
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.
def download_from(self, buff, remote_path):
"""Downloads file from WebDAV and writes it in buffer.
:param buff: buf... |
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 and directory.
:param local_path: the path to save resource loc... |
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 directory for downloading form WebDAV server.
:param local_path: the path to loc... |
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 file for opening.
def open(self, file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=No... |
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_path: the path to save file locally.
:param progress: progress func... |
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 callback: the callback which will be invoked when downloading is complete.
def ... |
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 callback: the callback which will be invoked when downloading is complete.
def ... |
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 WebDAV server.
def upload_to(self, buff, remote_p... |
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 remote_path: the path for uploading resources on WebDAV server. Can be fi... |
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 for uploading on WebDAV server.
:param local_path: the path to local di... |
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.
:param local_path: the path to local file for uploading.
:para... |
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 directory.
:param local_path: the path to local resource for uplo... |
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 and directory.
:param local_path: the path to local resource for upl... |
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_to: the path where resource will be copied.
def copy(self, r... |
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,
:param remote_path_to: the path where resource will be moved.
:param overw... |
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 resource whisch will be deleted.
def clea... |
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 following keys:
`created`:... |
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 otherwise.
def is_dir(self, remote_path):
... |
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 as dictionary with following keys:
... |
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 as dictionary with following keys:
... |
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: the property attributes as list of dictionaries with following... |
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.
def parse_get_list_response(content):
"""Par... |
Creates an XML for requesting of free space on remote WebDAV server.
:return: the XML string of request content.
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.
"""
roo... |
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 amount of free space in bytes.
def parse_free_space_response(cont... |
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.
:return: a dictionary of information attributes and ... |
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.
:return: True in case the remote resource is directo... |
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 get,
`name`: the name of property whi... |
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: the value of property if it has been found or None otherwise... |
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 for XML property which will be set,
`name`: th... |
Creates string from lxml.etree.ElementTree with XML declaration and UTF-8 encoding.
:param tree: the instance of ElementTree
:return: the string of XML.
def etree_to_string(tree):
"""Creates string from lxml.etree.ElementTree with XML declaration and UTF-8 encoding.
:param tree: the i... |
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 response for the remote resource defined by path.
def extract_respons... |
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... |
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 each line and check for an UnicodeDecodeError.
def get_descriptor_o... |
Query conversion server
hash_: 4 characters of file hash
quickkey: File quickkey
doc_type: "i" for image, "d" for documents
page: The page to convert. If page is set to 'initial', the first
10 pages of the document will be provided. (document)
output: "pdf", "img",... |
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:
... |
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(... |
Call every command that was set for the current active breakpoints.
Returns True if the normal interaction function must be called,
False otherwise.
def bp_commands(self, frame, breakpoint_hits):
"""Call every command that was set for the current active breakpoints.
Returns True if th... |
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_trace... |
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... |
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.
def onecmd(self, line):
"""Interpret the argument as though it had been typed in response
to the prom... |
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.comm... |
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.
The commands are executed when the br... |
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 that function. If a second argument is
prese... |
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... |
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-)ena... |
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):
... |
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 break... |
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_cl... |
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:... |
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.curind... |
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 ret... |
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 ... |
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 allowed -- for
instance it... |
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 (w... |
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.... |
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
... |
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(lo... |
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))
... |
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 starting at that line.
With... |
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(filenam... |
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
... |
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, ... |
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
... |
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.
def do_display(self, arg):
"""display [expression]
Display the value of the expressi... |
undisplay [expression]
Do not display the expression any more in the current frame.
Without expression, clear all display expressions for the current frame.
def do_undisplay(self, arg):
"""undisplay [expression]
Do not display the expression any more in the current frame.
Wi... |
interact
Start an interative interpreter whose global namespace
contains all the (global and local) names found in the current scope.
def do_interact(self, arg):
"""interact
Start an interative interpreter whose global namespace
contains all the (global and local) names found ... |
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
... |
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
... |
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.