repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
Nukesor/pueue | pueue/client/socket.py | receive_data | def receive_data(socket):
"""Receive an answer from the daemon and return the response.
Args:
socket (socket.socket): A socket that is connected to the daemon.
Returns:
dir or string: The unpickled answer.
"""
answer = b""
while True:
packet = socket.recv(4096)
if n... | python | def receive_data(socket):
"""Receive an answer from the daemon and return the response.
Args:
socket (socket.socket): A socket that is connected to the daemon.
Returns:
dir or string: The unpickled answer.
"""
answer = b""
while True:
packet = socket.recv(4096)
if n... | [
"def",
"receive_data",
"(",
"socket",
")",
":",
"answer",
"=",
"b\"\"",
"while",
"True",
":",
"packet",
"=",
"socket",
".",
"recv",
"(",
"4096",
")",
"if",
"not",
"packet",
":",
"break",
"answer",
"+=",
"packet",
"response",
"=",
"pickle",
".",
"loads"... | Receive an answer from the daemon and return the response.
Args:
socket (socket.socket): A socket that is connected to the daemon.
Returns:
dir or string: The unpickled answer. | [
"Receive",
"an",
"answer",
"from",
"the",
"daemon",
"and",
"return",
"the",
"response",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/client/socket.py#L7-L23 |
Nukesor/pueue | pueue/client/socket.py | connect_socket | def connect_socket(root_dir):
"""Connect to a daemon's socket.
Args:
root_dir (str): The directory that used as root by the daemon.
Returns:
socket.socket: A socket that is connected to the daemon.
"""
# Get config directory where the daemon socket is located
config_dir = os.pa... | python | def connect_socket(root_dir):
"""Connect to a daemon's socket.
Args:
root_dir (str): The directory that used as root by the daemon.
Returns:
socket.socket: A socket that is connected to the daemon.
"""
# Get config directory where the daemon socket is located
config_dir = os.pa... | [
"def",
"connect_socket",
"(",
"root_dir",
")",
":",
"# Get config directory where the daemon socket is located",
"config_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root_dir",
",",
"'.config/pueue'",
")",
"# Create Socket and exit with 1, if socket can't be created",
"tr... | Connect to a daemon's socket.
Args:
root_dir (str): The directory that used as root by the daemon.
Returns:
socket.socket: A socket that is connected to the daemon. | [
"Connect",
"to",
"a",
"daemon",
"s",
"socket",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/client/socket.py#L34-L58 |
dlecocq/nsq-py | nsq/response.py | Response.from_raw | def from_raw(conn, raw):
'''Return a new response from a raw buffer'''
frame_type = struct.unpack('>l', raw[0:4])[0]
message = raw[4:]
if frame_type == FRAME_TYPE_MESSAGE:
return Message(conn, frame_type, message)
elif frame_type == FRAME_TYPE_RESPONSE:
re... | python | def from_raw(conn, raw):
'''Return a new response from a raw buffer'''
frame_type = struct.unpack('>l', raw[0:4])[0]
message = raw[4:]
if frame_type == FRAME_TYPE_MESSAGE:
return Message(conn, frame_type, message)
elif frame_type == FRAME_TYPE_RESPONSE:
re... | [
"def",
"from_raw",
"(",
"conn",
",",
"raw",
")",
":",
"frame_type",
"=",
"struct",
".",
"unpack",
"(",
"'>l'",
",",
"raw",
"[",
"0",
":",
"4",
"]",
")",
"[",
"0",
"]",
"message",
"=",
"raw",
"[",
"4",
":",
"]",
"if",
"frame_type",
"==",
"FRAME_... | Return a new response from a raw buffer | [
"Return",
"a",
"new",
"response",
"from",
"a",
"raw",
"buffer"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L19-L30 |
dlecocq/nsq-py | nsq/response.py | Response.pack | def pack(cls, data):
'''Pack the provided data into a Response'''
return struct.pack('>ll', len(data) + 4, cls.FRAME_TYPE) + data | python | def pack(cls, data):
'''Pack the provided data into a Response'''
return struct.pack('>ll', len(data) + 4, cls.FRAME_TYPE) + data | [
"def",
"pack",
"(",
"cls",
",",
"data",
")",
":",
"return",
"struct",
".",
"pack",
"(",
"'>ll'",
",",
"len",
"(",
"data",
")",
"+",
"4",
",",
"cls",
".",
"FRAME_TYPE",
")",
"+",
"data"
] | Pack the provided data into a Response | [
"Pack",
"the",
"provided",
"data",
"into",
"a",
"Response"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L33-L35 |
dlecocq/nsq-py | nsq/response.py | Message.fin | def fin(self):
'''Indicate that this message is finished processing'''
self.connection.fin(self.id)
self.processed = True | python | def fin(self):
'''Indicate that this message is finished processing'''
self.connection.fin(self.id)
self.processed = True | [
"def",
"fin",
"(",
"self",
")",
":",
"self",
".",
"connection",
".",
"fin",
"(",
"self",
".",
"id",
")",
"self",
".",
"processed",
"=",
"True"
] | Indicate that this message is finished processing | [
"Indicate",
"that",
"this",
"message",
"is",
"finished",
"processing"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L86-L89 |
dlecocq/nsq-py | nsq/response.py | Message.req | def req(self, timeout):
'''Re-queue a message'''
self.connection.req(self.id, timeout)
self.processed = True | python | def req(self, timeout):
'''Re-queue a message'''
self.connection.req(self.id, timeout)
self.processed = True | [
"def",
"req",
"(",
"self",
",",
"timeout",
")",
":",
"self",
".",
"connection",
".",
"req",
"(",
"self",
".",
"id",
",",
"timeout",
")",
"self",
".",
"processed",
"=",
"True"
] | Re-queue a message | [
"Re",
"-",
"queue",
"a",
"message"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L91-L94 |
dlecocq/nsq-py | nsq/response.py | Message.handle | def handle(self):
'''Make sure this message gets either 'fin' or 'req'd'''
try:
yield self
except:
# Requeue the message and raise the original exception
typ, value, trace = sys.exc_info()
if not self.processed:
try:
... | python | def handle(self):
'''Make sure this message gets either 'fin' or 'req'd'''
try:
yield self
except:
# Requeue the message and raise the original exception
typ, value, trace = sys.exc_info()
if not self.processed:
try:
... | [
"def",
"handle",
"(",
"self",
")",
":",
"try",
":",
"yield",
"self",
"except",
":",
"# Requeue the message and raise the original exception",
"typ",
",",
"value",
",",
"trace",
"=",
"sys",
".",
"exc_info",
"(",
")",
"if",
"not",
"self",
".",
"processed",
":"... | Make sure this message gets either 'fin' or 'req'd | [
"Make",
"sure",
"this",
"message",
"gets",
"either",
"fin",
"or",
"req",
"d"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L105-L123 |
dlecocq/nsq-py | nsq/response.py | Error.find | def find(cls, name):
'''Find the exception class by name'''
if not cls.mapping: # pragma: no branch
for _, obj in inspect.getmembers(exceptions):
if inspect.isclass(obj):
if issubclass(obj, exceptions.NSQException): # pragma: no branch
... | python | def find(cls, name):
'''Find the exception class by name'''
if not cls.mapping: # pragma: no branch
for _, obj in inspect.getmembers(exceptions):
if inspect.isclass(obj):
if issubclass(obj, exceptions.NSQException): # pragma: no branch
... | [
"def",
"find",
"(",
"cls",
",",
"name",
")",
":",
"if",
"not",
"cls",
".",
"mapping",
":",
"# pragma: no branch",
"for",
"_",
",",
"obj",
"in",
"inspect",
".",
"getmembers",
"(",
"exceptions",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"obj",
")... | Find the exception class by name | [
"Find",
"the",
"exception",
"class",
"by",
"name"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L134-L145 |
dlecocq/nsq-py | nsq/response.py | Error.exception | def exception(self):
'''Return an instance of the corresponding exception'''
code, _, message = self.data.partition(' ')
return self.find(code)(message) | python | def exception(self):
'''Return an instance of the corresponding exception'''
code, _, message = self.data.partition(' ')
return self.find(code)(message) | [
"def",
"exception",
"(",
"self",
")",
":",
"code",
",",
"_",
",",
"message",
"=",
"self",
".",
"data",
".",
"partition",
"(",
"' '",
")",
"return",
"self",
".",
"find",
"(",
"code",
")",
"(",
"message",
")"
] | Return an instance of the corresponding exception | [
"Return",
"an",
"instance",
"of",
"the",
"corresponding",
"exception"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/response.py#L147-L150 |
corpusops/pdbclone | lib/pdb_clone/attach.py | parse_gdb_version | def parse_gdb_version(line):
r"""Parse the gdb version from the gdb header.
From GNU coding standards: the version starts after the last space of the
first line.
>>> DOCTEST_GDB_VERSIONS = [
... r'~"GNU gdb (GDB) 7.5.1\n"',
... r'~"GNU gdb (Sourcery CodeBench Lite 2011.09-69) 7.2.50.20100908-c... | python | def parse_gdb_version(line):
r"""Parse the gdb version from the gdb header.
From GNU coding standards: the version starts after the last space of the
first line.
>>> DOCTEST_GDB_VERSIONS = [
... r'~"GNU gdb (GDB) 7.5.1\n"',
... r'~"GNU gdb (Sourcery CodeBench Lite 2011.09-69) 7.2.50.20100908-c... | [
"def",
"parse_gdb_version",
"(",
"line",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"'~\"'",
")",
"and",
"line",
".",
"endswith",
"(",
"r'\\n\"'",
")",
":",
"version",
"=",
"line",
"[",
"2",
":",
"-",
"3",
"]",
".",
"rsplit",
"(",
"' '",
",",
... | r"""Parse the gdb version from the gdb header.
From GNU coding standards: the version starts after the last space of the
first line.
>>> DOCTEST_GDB_VERSIONS = [
... r'~"GNU gdb (GDB) 7.5.1\n"',
... r'~"GNU gdb (Sourcery CodeBench Lite 2011.09-69) 7.2.50.20100908-cvs\n"',
... r'~"GNU gdb (GDB)... | [
"r",
"Parse",
"the",
"gdb",
"version",
"from",
"the",
"gdb",
"header",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/attach.py#L466-L497 |
corpusops/pdbclone | lib/pdb_clone/attach.py | spawn_gdb | def spawn_gdb(pid, address=DFLT_ADDRESS, gdb='gdb', verbose=False,
ctx=None, proc_iut=None):
"""Spawn gdb and attach to a process."""
parent, child = socket.socketpair()
proc = Popen([gdb, '--interpreter=mi', '-nx'],
bufsize=0, stdin=child, stdout=child, stderr=STDOUT)
... | python | def spawn_gdb(pid, address=DFLT_ADDRESS, gdb='gdb', verbose=False,
ctx=None, proc_iut=None):
"""Spawn gdb and attach to a process."""
parent, child = socket.socketpair()
proc = Popen([gdb, '--interpreter=mi', '-nx'],
bufsize=0, stdin=child, stdout=child, stderr=STDOUT)
... | [
"def",
"spawn_gdb",
"(",
"pid",
",",
"address",
"=",
"DFLT_ADDRESS",
",",
"gdb",
"=",
"'gdb'",
",",
"verbose",
"=",
"False",
",",
"ctx",
"=",
"None",
",",
"proc_iut",
"=",
"None",
")",
":",
"parent",
",",
"child",
"=",
"socket",
".",
"socketpair",
"(... | Spawn gdb and attach to a process. | [
"Spawn",
"gdb",
"and",
"attach",
"to",
"a",
"process",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/attach.py#L503-L519 |
corpusops/pdbclone | lib/pdb_clone/attach.py | attach_loop | def attach_loop(argv):
"""Spawn the process, then repeatedly attach to the process."""
# Check if the pdbhandler module is built into python.
p = Popen((sys.executable, '-X', 'pdbhandler', '-c',
'import pdbhandler; pdbhandler.get_handler().host'),
stdout=PIPE, stderr=STDOUT)
... | python | def attach_loop(argv):
"""Spawn the process, then repeatedly attach to the process."""
# Check if the pdbhandler module is built into python.
p = Popen((sys.executable, '-X', 'pdbhandler', '-c',
'import pdbhandler; pdbhandler.get_handler().host'),
stdout=PIPE, stderr=STDOUT)
... | [
"def",
"attach_loop",
"(",
"argv",
")",
":",
"# Check if the pdbhandler module is built into python.",
"p",
"=",
"Popen",
"(",
"(",
"sys",
".",
"executable",
",",
"'-X'",
",",
"'pdbhandler'",
",",
"'-c'",
",",
"'import pdbhandler; pdbhandler.get_handler().host'",
")",
... | Spawn the process, then repeatedly attach to the process. | [
"Spawn",
"the",
"process",
"then",
"repeatedly",
"attach",
"to",
"the",
"process",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/attach.py#L521-L570 |
corpusops/pdbclone | lib/pdb_clone/attach.py | StatementLine.skip | def skip(self):
"""Skip this py-pdb command to avoid attaching within the same loop."""
line = self.line
self.line = ''
# 'line' is the statement line of the previous py-pdb command.
if line in self.lines:
if not self.skipping:
self.skipping = True
... | python | def skip(self):
"""Skip this py-pdb command to avoid attaching within the same loop."""
line = self.line
self.line = ''
# 'line' is the statement line of the previous py-pdb command.
if line in self.lines:
if not self.skipping:
self.skipping = True
... | [
"def",
"skip",
"(",
"self",
")",
":",
"line",
"=",
"self",
".",
"line",
"self",
".",
"line",
"=",
"''",
"# 'line' is the statement line of the previous py-pdb command.",
"if",
"line",
"in",
"self",
".",
"lines",
":",
"if",
"not",
"self",
".",
"skipping",
":"... | Skip this py-pdb command to avoid attaching within the same loop. | [
"Skip",
"this",
"py",
"-",
"pdb",
"command",
"to",
"avoid",
"attaching",
"within",
"the",
"same",
"loop",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/attach.py#L242-L259 |
Nukesor/pueue | pueue/daemon/logger.py | Logger.rotate | def rotate(self, log):
"""Move the current log to a new file with timestamp and create a new empty log file."""
self.write(log, rotate=True)
self.write({}) | python | def rotate(self, log):
"""Move the current log to a new file with timestamp and create a new empty log file."""
self.write(log, rotate=True)
self.write({}) | [
"def",
"rotate",
"(",
"self",
",",
"log",
")",
":",
"self",
".",
"write",
"(",
"log",
",",
"rotate",
"=",
"True",
")",
"self",
".",
"write",
"(",
"{",
"}",
")"
] | Move the current log to a new file with timestamp and create a new empty log file. | [
"Move",
"the",
"current",
"log",
"to",
"a",
"new",
"file",
"with",
"timestamp",
"and",
"create",
"a",
"new",
"empty",
"log",
"file",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/logger.py#L72-L75 |
Nukesor/pueue | pueue/daemon/logger.py | Logger.write | def write(self, log, rotate=False):
"""Write the output of all finished processes to a compiled log file."""
# Get path for logfile
if rotate:
timestamp = time.strftime('-%Y%m%d-%H%M')
logPath = os.path.join(self.log_dir, 'queue{}.log'.format(timestamp))
else:
... | python | def write(self, log, rotate=False):
"""Write the output of all finished processes to a compiled log file."""
# Get path for logfile
if rotate:
timestamp = time.strftime('-%Y%m%d-%H%M')
logPath = os.path.join(self.log_dir, 'queue{}.log'.format(timestamp))
else:
... | [
"def",
"write",
"(",
"self",
",",
"log",
",",
"rotate",
"=",
"False",
")",
":",
"# Get path for logfile",
"if",
"rotate",
":",
"timestamp",
"=",
"time",
".",
"strftime",
"(",
"'-%Y%m%d-%H%M'",
")",
"logPath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"... | Write the output of all finished processes to a compiled log file. | [
"Write",
"the",
"output",
"of",
"all",
"finished",
"processes",
"to",
"a",
"compiled",
"log",
"file",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/logger.py#L77-L129 |
Nukesor/pueue | pueue/daemon/logger.py | Logger.remove_old | def remove_old(self, max_log_time):
"""Remove all logs which are older than the specified time."""
files = glob.glob('{}/queue-*'.format(self.log_dir))
files = list(map(lambda x: os.path.basename(x), files))
for log_file in files:
# Get time stamp from filename
n... | python | def remove_old(self, max_log_time):
"""Remove all logs which are older than the specified time."""
files = glob.glob('{}/queue-*'.format(self.log_dir))
files = list(map(lambda x: os.path.basename(x), files))
for log_file in files:
# Get time stamp from filename
n... | [
"def",
"remove_old",
"(",
"self",
",",
"max_log_time",
")",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"'{}/queue-*'",
".",
"format",
"(",
"self",
".",
"log_dir",
")",
")",
"files",
"=",
"list",
"(",
"map",
"(",
"lambda",
"x",
":",
"os",
".",
"pa... | Remove all logs which are older than the specified time. | [
"Remove",
"all",
"logs",
"which",
"are",
"older",
"than",
"the",
"specified",
"time",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/logger.py#L131-L152 |
dlecocq/nsq-py | nsq/http/__init__.py | wrap | def wrap(function, *args, **kwargs):
'''Wrap a function that returns a request with some exception handling'''
try:
req = function(*args, **kwargs)
logger.debug('Got %s: %s', req.status_code, req.content)
if req.status_code == 200:
return req
else:
raise C... | python | def wrap(function, *args, **kwargs):
'''Wrap a function that returns a request with some exception handling'''
try:
req = function(*args, **kwargs)
logger.debug('Got %s: %s', req.status_code, req.content)
if req.status_code == 200:
return req
else:
raise C... | [
"def",
"wrap",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"req",
"=",
"function",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"logger",
".",
"debug",
"(",
"'Got %s: %s'",
",",
"req",
".",
"status_code",
... | Wrap a function that returns a request with some exception handling | [
"Wrap",
"a",
"function",
"that",
"returns",
"a",
"request",
"with",
"some",
"exception",
"handling"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/http/__init__.py#L12-L24 |
dlecocq/nsq-py | nsq/http/__init__.py | json_wrap | def json_wrap(function, *args, **kwargs):
'''Return the json content of a function that returns a request'''
try:
# Some responses have data = None, but they generally signal a
# successful API call as well.
response = json.loads(function(*args, **kwargs).content)
if 'data' in re... | python | def json_wrap(function, *args, **kwargs):
'''Return the json content of a function that returns a request'''
try:
# Some responses have data = None, but they generally signal a
# successful API call as well.
response = json.loads(function(*args, **kwargs).content)
if 'data' in re... | [
"def",
"json_wrap",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"# Some responses have data = None, but they generally signal a",
"# successful API call as well.",
"response",
"=",
"json",
".",
"loads",
"(",
"function",
"(",
"*"... | Return the json content of a function that returns a request | [
"Return",
"the",
"json",
"content",
"of",
"a",
"function",
"that",
"returns",
"a",
"request"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/http/__init__.py#L28-L39 |
dlecocq/nsq-py | nsq/http/__init__.py | ok_check | def ok_check(function, *args, **kwargs):
'''Ensure that the response body is OK'''
req = function(*args, **kwargs)
if req.content.lower() != 'ok':
raise ClientException(req.content)
return req.content | python | def ok_check(function, *args, **kwargs):
'''Ensure that the response body is OK'''
req = function(*args, **kwargs)
if req.content.lower() != 'ok':
raise ClientException(req.content)
return req.content | [
"def",
"ok_check",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"req",
"=",
"function",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"req",
".",
"content",
".",
"lower",
"(",
")",
"!=",
"'ok'",
":",
"raise",
"C... | Ensure that the response body is OK | [
"Ensure",
"that",
"the",
"response",
"body",
"is",
"OK"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/http/__init__.py#L43-L48 |
dlecocq/nsq-py | nsq/http/__init__.py | BaseClient.get | def get(self, path, *args, **kwargs):
'''GET the provided endpoint'''
target = self._host.relative(path).utf8
if not isinstance(target, basestring):
# on older versions of the `url` library, .utf8 is a method, not a property
target = target()
params = kwargs.get('... | python | def get(self, path, *args, **kwargs):
'''GET the provided endpoint'''
target = self._host.relative(path).utf8
if not isinstance(target, basestring):
# on older versions of the `url` library, .utf8 is a method, not a property
target = target()
params = kwargs.get('... | [
"def",
"get",
"(",
"self",
",",
"path",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"target",
"=",
"self",
".",
"_host",
".",
"relative",
"(",
"path",
")",
".",
"utf8",
"if",
"not",
"isinstance",
"(",
"target",
",",
"basestring",
")",
":... | GET the provided endpoint | [
"GET",
"the",
"provided",
"endpoint"
] | train | https://github.com/dlecocq/nsq-py/blob/3ecacf6ab7719d38031179277113d875554a0c16/nsq/http/__init__.py#L67-L77 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | decode_resumable_upload_bitmap | def decode_resumable_upload_bitmap(bitmap_node, number_of_units):
"""Decodes bitmap_node to hash of unit_id: is_uploaded
bitmap_node -- bitmap node of resumable_upload with
'count' number and 'words' containing array
number_of_units -- number of units we are uploading to
... | python | def decode_resumable_upload_bitmap(bitmap_node, number_of_units):
"""Decodes bitmap_node to hash of unit_id: is_uploaded
bitmap_node -- bitmap node of resumable_upload with
'count' number and 'words' containing array
number_of_units -- number of units we are uploading to
... | [
"def",
"decode_resumable_upload_bitmap",
"(",
"bitmap_node",
",",
"number_of_units",
")",
":",
"bitmap",
"=",
"0",
"for",
"token_id",
"in",
"range",
"(",
"int",
"(",
"bitmap_node",
"[",
"'count'",
"]",
")",
")",
":",
"value",
"=",
"int",
"(",
"bitmap_node",
... | Decodes bitmap_node to hash of unit_id: is_uploaded
bitmap_node -- bitmap node of resumable_upload with
'count' number and 'words' containing array
number_of_units -- number of units we are uploading to
define the number of bits for bitmap | [
"Decodes",
"bitmap_node",
"to",
"hash",
"of",
"unit_id",
":",
"is_uploaded"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L117-L136 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | compute_hash_info | def compute_hash_info(fd, unit_size=None):
"""Get MediaFireHashInfo structure from the fd, unit_size
fd -- file descriptor - expects exclusive access because of seeking
unit_size -- size of a single unit
Returns MediaFireHashInfo:
hi.file -- sha256 of the whole file
hi.units -- list of sha256 ... | python | def compute_hash_info(fd, unit_size=None):
"""Get MediaFireHashInfo structure from the fd, unit_size
fd -- file descriptor - expects exclusive access because of seeking
unit_size -- size of a single unit
Returns MediaFireHashInfo:
hi.file -- sha256 of the whole file
hi.units -- list of sha256 ... | [
"def",
"compute_hash_info",
"(",
"fd",
",",
"unit_size",
"=",
"None",
")",
":",
"logger",
".",
"debug",
"(",
"\"compute_hash_info(%s, unit_size=%s)\"",
",",
"fd",
",",
"unit_size",
")",
"fd",
".",
"seek",
"(",
"0",
",",
"os",
".",
"SEEK_END",
")",
"file_si... | Get MediaFireHashInfo structure from the fd, unit_size
fd -- file descriptor - expects exclusive access because of seeking
unit_size -- size of a single unit
Returns MediaFireHashInfo:
hi.file -- sha256 of the whole file
hi.units -- list of sha256 hashes for each unit | [
"Get",
"MediaFireHashInfo",
"structure",
"from",
"the",
"fd",
"unit_size"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L139-L184 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader.upload | def upload(self, fd, name=None, folder_key=None, filedrop_key=None,
path=None, action_on_duplicate=None):
"""Upload file, returns UploadResult object
fd -- file-like object to upload from, expects exclusive access
name -- file name
folder_key -- folderkey of the target fo... | python | def upload(self, fd, name=None, folder_key=None, filedrop_key=None,
path=None, action_on_duplicate=None):
"""Upload file, returns UploadResult object
fd -- file-like object to upload from, expects exclusive access
name -- file name
folder_key -- folderkey of the target fo... | [
"def",
"upload",
"(",
"self",
",",
"fd",
",",
"name",
"=",
"None",
",",
"folder_key",
"=",
"None",
",",
"filedrop_key",
"=",
"None",
",",
"path",
"=",
"None",
",",
"action_on_duplicate",
"=",
"None",
")",
":",
"# Get file handle content length in the most reli... | 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... | [
"Upload",
"file",
"returns",
"UploadResult",
"object"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L198-L289 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._poll_upload | 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:
# not a regular 11-char-long upload key
# There is no API to poll filedrop upl... | python | 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:
# not a regular 11-char-long upload key
# There is no API to poll filedrop upl... | [
"def",
"_poll_upload",
"(",
"self",
",",
"upload_key",
",",
"action",
")",
":",
"if",
"len",
"(",
"upload_key",
")",
"!=",
"UPLOAD_KEY_LENGTH",
":",
"# not a regular 11-char-long upload key",
"# There is no API to poll filedrop uploads",
"return",
"UploadResult",
"(",
"... | Poll upload until quickkey is found
upload_key -- upload_key returned by upload/* functions | [
"Poll",
"upload",
"until",
"quickkey",
"is",
"found"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L292-L351 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._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.folder_key,
filed... | python | 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.folder_key,
filed... | [
"def",
"_upload_check",
"(",
"self",
",",
"upload_info",
",",
"resumable",
"=",
"False",
")",
":",
"return",
"self",
".",
"_api",
".",
"upload_check",
"(",
"filename",
"=",
"upload_info",
".",
"name",
",",
"size",
"=",
"upload_info",
".",
"size",
",",
"h... | Wrapper around upload/check | [
"Wrapper",
"around",
"upload",
"/",
"check"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L353-L363 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._upload_none | 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.hash_info.file,
filename=upload_info.name,
... | python | 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.hash_info.file,
filename=upload_info.name,
... | [
"def",
"_upload_none",
"(",
"self",
",",
"upload_info",
",",
"check_result",
")",
":",
"return",
"UploadResult",
"(",
"action",
"=",
"None",
",",
"quickkey",
"=",
"check_result",
"[",
"'duplicate_quickkey'",
"]",
",",
"hash_",
"=",
"upload_info",
".",
"hash_in... | Dummy upload function for when we don't actually upload | [
"Dummy",
"upload",
"function",
"for",
"when",
"we",
"don",
"t",
"actually",
"upload"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L367-L377 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._upload_instant | def _upload_instant(self, upload_info, _=None):
"""Instant upload and return quickkey
Can be used when the file is already stored somewhere in MediaFire
upload_info -- UploadInfo object
check_result -- ignored
"""
result = self._api.upload_instant(
upload_i... | python | def _upload_instant(self, upload_info, _=None):
"""Instant upload and return quickkey
Can be used when the file is already stored somewhere in MediaFire
upload_info -- UploadInfo object
check_result -- ignored
"""
result = self._api.upload_instant(
upload_i... | [
"def",
"_upload_instant",
"(",
"self",
",",
"upload_info",
",",
"_",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"_api",
".",
"upload_instant",
"(",
"upload_info",
".",
"name",
",",
"upload_info",
".",
"size",
",",
"upload_info",
".",
"hash_info",
... | Instant upload and return quickkey
Can be used when the file is already stored somewhere in MediaFire
upload_info -- UploadInfo object
check_result -- ignored | [
"Instant",
"upload",
"and",
"return",
"quickkey"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L380-L407 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._upload_simple | def _upload_simple(self, upload_info, _=None):
"""Simple upload and return quickkey
Can be used for small files smaller than UPLOAD_SIMPLE_LIMIT_BYTES
upload_info -- UploadInfo object
check_result -- ignored
"""
upload_result = self._api.upload_simple(
uplo... | python | def _upload_simple(self, upload_info, _=None):
"""Simple upload and return quickkey
Can be used for small files smaller than UPLOAD_SIMPLE_LIMIT_BYTES
upload_info -- UploadInfo object
check_result -- ignored
"""
upload_result = self._api.upload_simple(
uplo... | [
"def",
"_upload_simple",
"(",
"self",
",",
"upload_info",
",",
"_",
"=",
"None",
")",
":",
"upload_result",
"=",
"self",
".",
"_api",
".",
"upload_simple",
"(",
"upload_info",
".",
"fd",
",",
"upload_info",
".",
"name",
",",
"folder_key",
"=",
"upload_info... | Simple upload and return quickkey
Can be used for small files smaller than UPLOAD_SIMPLE_LIMIT_BYTES
upload_info -- UploadInfo object
check_result -- ignored | [
"Simple",
"upload",
"and",
"return",
"quickkey"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L409-L432 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._upload_resumable_unit | 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_size = uu_info.fd.len
if uu_info.hash_ is None:
raise ValueError('UploadUnitInfo.has... | python | 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_size = uu_info.fd.len
if uu_info.hash_ is None:
raise ValueError('UploadUnitInfo.has... | [
"def",
"_upload_resumable_unit",
"(",
"self",
",",
"uu_info",
")",
":",
"# Get actual unit size",
"unit_size",
"=",
"uu_info",
".",
"fd",
".",
"len",
"if",
"uu_info",
".",
"hash_",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'UploadUnitInfo.hash_ is now requir... | Upload a single unit and return raw upload/resumable result
uu_info -- UploadUnitInfo instance | [
"Upload",
"a",
"single",
"unit",
"and",
"return",
"raw",
"upload",
"/",
"resumable",
"result"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L434-L456 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._upload_resumable_all | def _upload_resumable_all(self, upload_info, bitmap,
number_of_units, unit_size):
"""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 reque... | python | def _upload_resumable_all(self, upload_info, bitmap,
number_of_units, unit_size):
"""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 reque... | [
"def",
"_upload_resumable_all",
"(",
"self",
",",
"upload_info",
",",
"bitmap",
",",
"number_of_units",
",",
"unit_size",
")",
":",
"fd",
"=",
"upload_info",
".",
"fd",
"upload_key",
"=",
"None",
"for",
"unit_id",
"in",
"range",
"(",
"number_of_units",
")",
... | 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 | [
"Prepare",
"and",
"upload",
"all",
"resumable",
"units",
"and",
"return",
"upload_key"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L458-L500 |
MediaFire/mediafire-python-open-sdk | mediafire/uploader.py | MediaFireUploader._upload_resumable | def _upload_resumable(self, upload_info, check_result):
"""Resumable upload and return quickkey
upload_info -- UploadInfo object
check_result -- dict of upload/check call result
"""
resumable_upload = check_result['resumable_upload']
unit_size = int(resumable_upload['u... | python | def _upload_resumable(self, upload_info, check_result):
"""Resumable upload and return quickkey
upload_info -- UploadInfo object
check_result -- dict of upload/check call result
"""
resumable_upload = check_result['resumable_upload']
unit_size = int(resumable_upload['u... | [
"def",
"_upload_resumable",
"(",
"self",
",",
"upload_info",
",",
"check_result",
")",
":",
"resumable_upload",
"=",
"check_result",
"[",
"'resumable_upload'",
"]",
"unit_size",
"=",
"int",
"(",
"resumable_upload",
"[",
"'unit_size'",
"]",
")",
"number_of_units",
... | Resumable upload and return quickkey
upload_info -- UploadInfo object
check_result -- dict of upload/check call result | [
"Resumable",
"upload",
"and",
"return",
"quickkey"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/uploader.py#L502-L549 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | ModuleFinder.reset | 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)
return
for modname in self:
if modname in sys.m... | python | 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)
return
for modname in self:
if modname in sys.m... | [
"def",
"reset",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"hooked",
":",
"self",
".",
"hooked",
"=",
"True",
"sys",
".",
"path_hooks",
".",
"append",
"(",
"self",
")",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",",
"self",
".",
"PATH_EN... | Remove from sys.modules the modules imported by the debuggee. | [
"Remove",
"from",
"sys",
".",
"modules",
"the",
"modules",
"imported",
"by",
"the",
"debuggee",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L56-L76 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | BdbModule.get_func_lno | 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, node):
for child in ast.iter_child_nodes(node):
... | python | 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, node):
for child in ast.iter_child_nodes(node):
... | [
"def",
"get_func_lno",
"(",
"self",
",",
"funcname",
")",
":",
"class",
"FuncLineno",
"(",
"ast",
".",
"NodeVisitor",
")",
":",
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"clss",
"=",
"[",
"]",
"def",
"generic_visit",
"(",
"self",
",",
"n... | The first line number of the last defined 'funcname' function. | [
"The",
"first",
"line",
"number",
"of",
"the",
"last",
"defined",
"funcname",
"function",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L255-L288 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | BdbModule.get_actual_bp | def get_actual_bp(self, lineno):
"""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 ... | python | def get_actual_bp(self, lineno):
"""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 ... | [
"def",
"get_actual_bp",
"(",
"self",
",",
"lineno",
")",
":",
"def",
"_distance",
"(",
"code",
",",
"module_level",
"=",
"False",
")",
":",
"\"\"\"The shortest distance to the next valid statement.\"\"\"",
"subcodes",
"=",
"dict",
"(",
"(",
"c",
".",
"co_firstline... | 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... | [
"Get",
"the",
"actual",
"breakpoint",
"line",
"number",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L290-L349 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | ModuleBreakpoints.get_breakpoints | 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:
return []
code_bps = self[f... | python | 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:
return []
code_bps = self[f... | [
"def",
"get_breakpoints",
"(",
"self",
",",
"lineno",
")",
":",
"try",
":",
"firstlineno",
",",
"actual_lno",
"=",
"self",
".",
"bdb_module",
".",
"get_actual_bp",
"(",
"lineno",
")",
"except",
"BdbSourceError",
":",
"return",
"[",
"]",
"if",
"firstlineno",
... | Return the list of breakpoints set at lineno. | [
"Return",
"the",
"list",
"of",
"breakpoints",
"set",
"at",
"lineno",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L417-L429 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | Tracer.settrace | def settrace(self, do_set):
"""Set or remove the trace function."""
if do_set:
sys.settrace(self.trace_dispatch)
else:
sys.settrace(None) | python | def settrace(self, do_set):
"""Set or remove the trace function."""
if do_set:
sys.settrace(self.trace_dispatch)
else:
sys.settrace(None) | [
"def",
"settrace",
"(",
"self",
",",
"do_set",
")",
":",
"if",
"do_set",
":",
"sys",
".",
"settrace",
"(",
"self",
".",
"trace_dispatch",
")",
"else",
":",
"sys",
".",
"settrace",
"(",
"None",
")"
] | Set or remove the trace function. | [
"Set",
"or",
"remove",
"the",
"trace",
"function",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L587-L592 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | Bdb.restart | 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() | python | 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() | [
"def",
"restart",
"(",
"self",
")",
":",
"_module_finder",
".",
"reset",
"(",
")",
"linecache",
".",
"checkcache",
"(",
")",
"for",
"module_bpts",
"in",
"self",
".",
"breakpoints",
".",
"values",
"(",
")",
":",
"module_bpts",
".",
"reset",
"(",
")"
] | Restart the debugger after source code changes. | [
"Restart",
"the",
"debugger",
"after",
"source",
"code",
"changes",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L631-L636 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | Bdb.set_until | 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_lineno + 1
self._set_stopinfo(frame, lineno) | python | 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_lineno + 1
self._set_stopinfo(frame, lineno) | [
"def",
"set_until",
"(",
"self",
",",
"frame",
",",
"lineno",
"=",
"None",
")",
":",
"if",
"lineno",
"is",
"None",
":",
"lineno",
"=",
"frame",
".",
"f_lineno",
"+",
"1",
"self",
".",
"_set_stopinfo",
"(",
"frame",
",",
"lineno",
")"
] | Stop when the current line number in frame is greater than lineno or
when returning from frame. | [
"Stop",
"when",
"the",
"current",
"line",
"number",
"in",
"frame",
"is",
"greater",
"than",
"lineno",
"or",
"when",
"returning",
"from",
"frame",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L713-L718 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | Bdb.set_trace | 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_trace() may be called while
# tracing is in use. For example when called from a signal handler and
... | python | 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_trace() may be called while
# tracing is in use. For example when called from a signal handler and
... | [
"def",
"set_trace",
"(",
"self",
",",
"frame",
"=",
"None",
")",
":",
"# First disable tracing temporarily as set_trace() may be called while",
"# tracing is in use. For example when called from a signal handler and",
"# within a debugging session started with runcall().",
"self",
".",
... | Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame. | [
"Start",
"debugging",
"from",
"frame",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L732-L763 |
corpusops/pdbclone | lib/pdb_clone/bdb.py | Breakpoint.process_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
# A conditional breakpoint.
if self.cond:
... | python | 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
# A conditional breakpoint.
if self.cond:
... | [
"def",
"process_hit_event",
"(",
"self",
",",
"frame",
")",
":",
"if",
"not",
"self",
".",
"enabled",
":",
"return",
"False",
",",
"False",
"# Count every hit when breakpoint is enabled.",
"self",
".",
"hits",
"+=",
"1",
"# A conditional breakpoint.",
"if",
"self"... | Return (stop_state, delete_temporary) at a breakpoint hit event. | [
"Return",
"(",
"stop_state",
"delete_temporary",
")",
"at",
"a",
"breakpoint",
"hit",
"event",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/bdb.py#L1061-L1080 |
kamikaze/webdav | src/webdav/client.py | listdir | def listdir(directory):
"""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
"""
file_names = list()
for filename in os.listdir(directory):
file_path = o... | python | def listdir(directory):
"""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
"""
file_names = list()
for filename in os.listdir(directory):
file_path = o... | [
"def",
"listdir",
"(",
"directory",
")",
":",
"file_names",
"=",
"list",
"(",
")",
"for",
"filename",
"in",
"os",
".",
"listdir",
"(",
"directory",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"filename",
")",
"i... | 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 | [
"Returns",
"list",
"of",
"nested",
"files",
"and",
"directories",
"for",
"local",
"directory",
"by",
"path"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L28-L40 |
kamikaze/webdav | src/webdav/client.py | get_options | def get_options(option_type, from_options):
"""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 fro... | python | def get_options(option_type, from_options):
"""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 fro... | [
"def",
"get_options",
"(",
"option_type",
",",
"from_options",
")",
":",
"_options",
"=",
"dict",
"(",
")",
"for",
"key",
"in",
"option_type",
".",
"keys",
":",
"key_with_prefix",
"=",
"f'{option_type.prefix}{key}'",
"if",
"key",
"not",
"in",
"from_options",
"... | 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... | [
"Extract",
"options",
"for",
"specified",
"option",
"type",
"from",
"all",
"options"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L43-L62 |
kamikaze/webdav | src/webdav/client.py | Client.get_headers | def get_headers(self, action, headers_ext=None):
"""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 actio... | python | def get_headers(self, action, headers_ext=None):
"""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 actio... | [
"def",
"get_headers",
"(",
"self",
",",
"action",
",",
"headers_ext",
"=",
"None",
")",
":",
"if",
"action",
"in",
"Client",
".",
"http_header",
":",
"try",
":",
"headers",
"=",
"Client",
".",
"http_header",
"[",
"action",
"]",
".",
"copy",
"(",
")",
... | 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 ... | [
"Returns",
"HTTP",
"headers",
"of",
"specified",
"WebDAV",
"actions",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L107-L129 |
kamikaze/webdav | src/webdav/client.py | Client.execute_request | def execute_request(self, action, path, data=None, headers_ext=None):
"""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: (optio... | python | def execute_request(self, action, path, data=None, headers_ext=None):
"""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: (optio... | [
"def",
"execute_request",
"(",
"self",
",",
"action",
",",
"path",
",",
"data",
"=",
"None",
",",
"headers_ext",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"session",
".",
"request",
"(",
"method",
"=",
"Client",
".",
"requests",
"[",
"action... | 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... | [
"Generate",
"request",
"to",
"WebDAV",
"server",
"for",
"specified",
"action",
"and",
"path",
"and",
"execute",
"it",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L147-L172 |
kamikaze/webdav | src/webdav/client.py | Client.valid | 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.valid() else False | python | 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.valid() else False | [
"def",
"valid",
"(",
"self",
")",
":",
"return",
"True",
"if",
"self",
".",
"webdav",
".",
"valid",
"(",
")",
"and",
"self",
".",
"proxy",
".",
"valid",
"(",
")",
"else",
"False"
] | Validates of WebDAV and proxy settings.
:return: True in case settings are valid and False otherwise. | [
"Validates",
"of",
"WebDAV",
"and",
"proxy",
"settings",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L227-L232 |
kamikaze/webdav | src/webdav/client.py | Client.list | def list(self, remote_path=root):
"""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... | python | def list(self, remote_path=root):
"""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... | [
"def",
"list",
"(",
"self",
",",
"remote_path",
"=",
"root",
")",
":",
"directory_urn",
"=",
"Urn",
"(",
"remote_path",
",",
"directory",
"=",
"True",
")",
"if",
"directory_urn",
".",
"path",
"(",
")",
"!=",
"Client",
".",
"root",
":",
"if",
"not",
"... | 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. | [
"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",
... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L235-L251 |
kamikaze/webdav | src/webdav/client.py | Client.free | 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()
... | python | 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()
... | [
"def",
"free",
"(",
"self",
")",
":",
"data",
"=",
"WebDavXmlUtils",
".",
"create_free_space_request_content",
"(",
")",
"response",
"=",
"self",
".",
"execute_request",
"(",
"action",
"=",
"'free'",
",",
"path",
"=",
"''",
",",
"data",
"=",
"data",
")",
... | 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. | [
"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"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L254-L262 |
kamikaze/webdav | src/webdav/client.py | Client.check | 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... | python | 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... | [
"def",
"check",
"(",
"self",
",",
"remote_path",
"=",
"root",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"try",
":",
"response",
"=",
"self",
".",
"execute_request",
"(",
"action",
"=",
"'check'",
",",
"path",
"=",
"urn",
".",
"quote",
"("... | 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... | [
"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#r... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L265-L281 |
kamikaze/webdav | src/webdav/client.py | Client.mkdir | 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.
"""
... | python | 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.
"""
... | [
"def",
"mkdir",
"(",
"self",
",",
"remote_path",
")",
":",
"directory_urn",
"=",
"Urn",
"(",
"remote_path",
",",
"directory",
"=",
"True",
")",
"try",
":",
"response",
"=",
"self",
".",
"execute_request",
"(",
"action",
"=",
"'mkdir'",
",",
"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. | [
"Makes",
"new",
"directory",
"on",
"WebDAV",
"server",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"html#METHOD_MKCOL"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L284-L302 |
kamikaze/webdav | src/webdav/client.py | Client.download_from | 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()):... | python | 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()):... | [
"def",
"download_from",
"(",
"self",
",",
"buff",
",",
"remote_path",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"self",
".",
"is_dir",
"(",
"urn",
".",
"path",
"(",
")",
")",
":",
"raise",
"OptionNotValid",
"(",
"name",
"=",
"'remot... | 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. | [
"Downloads",
"file",
"from",
"WebDAV",
"and",
"writes",
"it",
"in",
"buffer",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L305-L319 |
kamikaze/webdav | src/webdav/client.py | Client.download | 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 ... | python | 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 ... | [
"def",
"download",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"progress",
"=",
"None",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"self",
".",
"is_dir",
"(",
"urn",
".",
"path",
"(",
")",
")",
":",
"self",
".",
"downl... | 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",
"remote",
"resource",
"from",
"WebDAV",
"and",
"save",
"it",
"in",
"local",
"path",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"html#rfc",
".",
... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L321-L333 |
kamikaze/webdav | src/webdav/client.py | Client.download_directory | 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... | python | 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... | [
"def",
"download_directory",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"progress",
"=",
"None",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
",",
"directory",
"=",
"True",
")",
"if",
"not",
"self",
".",
"is_dir",
"(",
"urn",
".",
"pa... | 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",
"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",
"crea... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L335-L355 |
kamikaze/webdav | src/webdav/client.py | Client.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... | python | 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... | [
"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 file for opening. | [
"Downloads",
"file",
"from",
"WebDAV",
"server",
"and",
"saves",
"it",
"temprorary",
"then",
"opens",
"it",
"for",
"further",
"manipulations",
".",
"Has",
"the",
"same",
"interface",
"as",
"built",
"-",
"in",
"open",
"()"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L359-L390 |
kamikaze/webdav | src/webdav/client.py | Client.download_file | 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... | python | 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... | [
"def",
"download_file",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"progress",
"=",
"None",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"self",
".",
"is_dir",
"(",
"urn",
".",
"path",
"(",
")",
")",
":",
"raise",
"Option... | 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",
"file",
"from",
"WebDAV",
"server",
"and",
"save",
"it",
"locally",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"html#rfc",
".",
"section",
".",
... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L393-L417 |
kamikaze/webdav | src/webdav/client.py | Client.download_sync | 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... | python | 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... | [
"def",
"download_sync",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"callback",
"=",
"None",
")",
":",
"self",
".",
"download",
"(",
"local_path",
"=",
"local_path",
",",
"remote_path",
"=",
"remote_path",
")",
"if",
"callback",
":",
"callback",... | 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. | [
"Downloads",
"remote",
"resources",
"from",
"WebDAV",
"server",
"synchronously",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L419-L428 |
kamikaze/webdav | src/webdav/client.py | Client.download_async | 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... | python | 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... | [
"def",
"download_async",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"callback",
"=",
"None",
")",
":",
"target",
"=",
"(",
"lambda",
":",
"self",
".",
"download_sync",
"(",
"local_path",
"=",
"local_path",
",",
"remote_path",
"=",
"remote_path"... | 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. | [
"Downloads",
"remote",
"resources",
"from",
"WebDAV",
"server",
"asynchronously"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L430-L438 |
kamikaze/webdav | src/webdav/client.py | Client.upload_to | 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... | python | 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... | [
"def",
"upload_to",
"(",
"self",
",",
"buff",
",",
"remote_path",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"urn",
".",
"is_dir",
"(",
")",
":",
"raise",
"OptionNotValid",
"(",
"name",
"=",
"'remote_path'",
",",
"value",
"=",
"remote_... | 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. | [
"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"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L441-L455 |
kamikaze/webdav | src/webdav/client.py | Client.upload | 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... | python | 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... | [
"def",
"upload",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"progress",
"=",
"None",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"local_path",
")",
":",
"self",
".",
"upload_directory",
"(",
"local_path",
"=",
"local_path",
",",
... | 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",
"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",... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L457-L469 |
kamikaze/webdav | src/webdav/client.py | Client.upload_directory | 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 ... | python | 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 ... | [
"def",
"upload_directory",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"progress",
"=",
"None",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
",",
"directory",
"=",
"True",
")",
"if",
"not",
"urn",
".",
"is_dir",
"(",
")",
":",
"raise",... | 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",
"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",
"director... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L471-L498 |
kamikaze/webdav | src/webdav/client.py | Client.upload_file | 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.
... | python | 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.
... | [
"def",
"upload_file",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"progress",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"local_path",
")",
":",
"raise",
"LocalResourceNotFound",
"(",
"local_path",
")",
"urn",
... | 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",
"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"... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L501-L527 |
kamikaze/webdav | src/webdav/client.py | Client.upload_sync | 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... | python | 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... | [
"def",
"upload_sync",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"callback",
"=",
"None",
")",
":",
"self",
".",
"upload",
"(",
"local_path",
"=",
"local_path",
",",
"remote_path",
"=",
"remote_path",
")",
"if",
"callback",
":",
"callback",
"... | 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",
"synchronously",
".",
"In",
"case",
"resource",
"is",
"directory",
"it",
"will",
"upload",
"all",
"nested",
"files",
"and",
"directories",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L529-L540 |
kamikaze/webdav | src/webdav/client.py | Client.upload_async | 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... | python | 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... | [
"def",
"upload_async",
"(",
"self",
",",
"remote_path",
",",
"local_path",
",",
"callback",
"=",
"None",
")",
":",
"target",
"=",
"(",
"lambda",
":",
"self",
".",
"upload_sync",
"(",
"local_path",
"=",
"local_path",
",",
"remote_path",
"=",
"remote_path",
... | 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... | [
"Uploads",
"resource",
"to",
"remote",
"path",
"on",
"WebDAV",
"server",
"asynchronously",
".",
"In",
"case",
"resource",
"is",
"directory",
"it",
"will",
"upload",
"all",
"nested",
"files",
"and",
"directories",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L542-L551 |
kamikaze/webdav | src/webdav/client.py | Client.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_... | python | 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_... | [
"def",
"copy",
"(",
"self",
",",
"remote_path_from",
",",
"remote_path_to",
")",
":",
"urn_from",
"=",
"Urn",
"(",
"remote_path_from",
")",
"if",
"not",
"self",
".",
"check",
"(",
"urn_from",
".",
"path",
"(",
")",
")",
":",
"raise",
"RemoteResourceNotFoun... | 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. | [
"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"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L554-L570 |
kamikaze/webdav | src/webdav/client.py | Client.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... | python | 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... | [
"def",
"move",
"(",
"self",
",",
"remote_path_from",
",",
"remote_path_to",
",",
"overwrite",
"=",
"False",
")",
":",
"urn_from",
"=",
"Urn",
"(",
"remote_path_from",
")",
"if",
"not",
"self",
".",
"check",
"(",
"urn_from",
".",
"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
: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... | [
"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"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L573-L591 |
kamikaze/webdav | src/webdav/client.py | Client.clean | 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... | python | 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... | [
"def",
"clean",
"(",
"self",
",",
"remote_path",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"self",
".",
"execute_request",
"(",
"action",
"=",
"'clean'",
",",
"path",
"=",
"urn",
".",
"quote",
"(",
")",
")"
] | 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. | [
"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",
... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L594-L602 |
kamikaze/webdav | src/webdav/client.py | Client.info | 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... | python | 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... | [
"def",
"info",
"(",
"self",
",",
"remote_path",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"not",
"self",
".",
"check",
"(",
"urn",
".",
"path",
"(",
")",
")",
"and",
"not",
"self",
".",
"check",
"(",
"Urn",
"(",
"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 following keys:
`created`:... | [
"Gets",
"information",
"about",
"resource",
"on",
"WebDAV",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"html#METHOD_PROPFIND"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L605-L622 |
kamikaze/webdav | src/webdav/client.py | Client.is_dir | 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... | python | 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... | [
"def",
"is_dir",
"(",
"self",
",",
"remote_path",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"parent_urn",
"=",
"Urn",
"(",
"urn",
".",
"parent",
"(",
")",
")",
"if",
"not",
"self",
".",
"check",
"(",
"urn",
".",
"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 otherwise. | [
"Checks",
"is",
"the",
"remote",
"resource",
"directory",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"html#METHOD_PROPFIND"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L625-L639 |
kamikaze/webdav | src/webdav/client.py | Client.get_property | 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... | python | 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... | [
"def",
"get_property",
"(",
"self",
",",
"remote_path",
",",
"option",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"not",
"self",
".",
"check",
"(",
"urn",
".",
"path",
"(",
")",
")",
":",
"raise",
"RemoteResourceNotFound",
"(",
"urn",
... | 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:
... | [
"Gets",
"metadata",
"property",
"of",
"remote",
"resource",
"on",
"WebDAV",
"server",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"html#METHOD_PROPFIND"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L642-L658 |
kamikaze/webdav | src/webdav/client.py | Client.set_property | 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 ... | python | 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 ... | [
"def",
"set_property",
"(",
"self",
",",
"remote_path",
",",
"option",
")",
":",
"self",
".",
"set_property_batch",
"(",
"remote_path",
"=",
"remote_path",
",",
"option",
"=",
"[",
"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 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"
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L661-L671 |
kamikaze/webdav | src/webdav/client.py | Client.set_property_batch | 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: ... | python | 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: ... | [
"def",
"set_property_batch",
"(",
"self",
",",
"remote_path",
",",
"option",
")",
":",
"urn",
"=",
"Urn",
"(",
"remote_path",
")",
"if",
"not",
"self",
".",
"check",
"(",
"urn",
".",
"path",
"(",
")",
")",
":",
"raise",
"RemoteResourceNotFound",
"(",
"... | 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... | [
"Sets",
"batch",
"metadata",
"properties",
"of",
"remote",
"resource",
"on",
"WebDAV",
"server",
"in",
"batch",
".",
"More",
"information",
"you",
"can",
"find",
"by",
"link",
"http",
":",
"//",
"webdav",
".",
"org",
"/",
"specs",
"/",
"rfc4918",
".",
"h... | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L674-L689 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.parse_get_list_response | 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.
... | python | 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.
... | [
"def",
"parse_get_list_response",
"(",
"content",
")",
":",
"try",
":",
"tree",
"=",
"etree",
".",
"fromstring",
"(",
"content",
")",
"hrees",
"=",
"[",
"Urn",
".",
"separate",
"+",
"unquote",
"(",
"urlsplit",
"(",
"hree",
".",
"text",
")",
".",
"path"... | 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. | [
"Parses",
"of",
"response",
"content",
"XML",
"from",
"WebDAV",
"server",
"and",
"extract",
"file",
"and",
"directory",
"names",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L852-L863 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.create_free_space_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.
"""
root = etree.Element('propfind', xmlns='DAV:')
prop = etree.SubElement(root, 'prop')
etree.SubElement(prop, 'q... | python | 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... | [
"def",
"create_free_space_request_content",
"(",
")",
":",
"root",
"=",
"etree",
".",
"Element",
"(",
"'propfind'",
",",
"xmlns",
"=",
"'DAV:'",
")",
"prop",
"=",
"etree",
".",
"SubElement",
"(",
"root",
",",
"'prop'",
")",
"etree",
".",
"SubElement",
"(",... | Creates an XML for requesting of free space on remote WebDAV server.
:return: the XML string of request content. | [
"Creates",
"an",
"XML",
"for",
"requesting",
"of",
"free",
"space",
"on",
"remote",
"WebDAV",
"server",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L866-L876 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.parse_free_space_response | 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... | python | 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... | [
"def",
"parse_free_space_response",
"(",
"content",
",",
"hostname",
")",
":",
"try",
":",
"tree",
"=",
"etree",
".",
"fromstring",
"(",
"content",
")",
"node",
"=",
"tree",
".",
"find",
"(",
"'.//{DAV:}quota-available-bytes'",
")",
"if",
"node",
"is",
"not"... | 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. | [
"Parses",
"of",
"response",
"content",
"XML",
"from",
"WebDAV",
"server",
"and",
"extract",
"an",
"amount",
"of",
"free",
"space",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L879-L896 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.parse_info_response | 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.... | python | 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.... | [
"def",
"parse_info_response",
"(",
"content",
",",
"path",
",",
"hostname",
")",
":",
"response",
"=",
"WebDavXmlUtils",
".",
"extract_response_for_path",
"(",
"content",
"=",
"content",
",",
"path",
"=",
"path",
",",
"hostname",
"=",
"hostname",
")",
"find_at... | 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",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L899-L921 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.parse_is_dir_response | 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... | python | 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... | [
"def",
"parse_is_dir_response",
"(",
"content",
",",
"path",
",",
"hostname",
")",
":",
"response",
"=",
"WebDavXmlUtils",
".",
"extract_response_for_path",
"(",
"content",
"=",
"content",
",",
"path",
"=",
"path",
",",
"hostname",
"=",
"hostname",
")",
"resou... | 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... | [
"Parses",
"of",
"response",
"content",
"XML",
"from",
"WebDAV",
"server",
"and",
"extract",
"an",
"information",
"about",
"resource",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L924-L940 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.create_get_property_request_content | 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 ... | python | 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 ... | [
"def",
"create_get_property_request_content",
"(",
"option",
")",
":",
"root",
"=",
"etree",
".",
"Element",
"(",
"'propfind'",
",",
"xmlns",
"=",
"'DAV:'",
")",
"prop",
"=",
"etree",
".",
"SubElement",
"(",
"root",
",",
"'prop'",
")",
"etree",
".",
"SubEl... | 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... | [
"Creates",
"an",
"XML",
"for",
"requesting",
"of",
"getting",
"a",
"property",
"value",
"of",
"remote",
"WebDAV",
"resource",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L943-L955 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.parse_get_property_response | 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... | python | 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... | [
"def",
"parse_get_property_response",
"(",
"content",
",",
"name",
")",
":",
"tree",
"=",
"etree",
".",
"fromstring",
"(",
"content",
")",
"return",
"tree",
".",
"xpath",
"(",
"'//*[local-name() = $name]'",
",",
"name",
"=",
"name",
")",
"[",
"0",
"]",
"."... | 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... | [
"Parses",
"of",
"response",
"content",
"XML",
"from",
"WebDAV",
"server",
"for",
"getting",
"metadata",
"property",
"value",
"for",
"some",
"resource",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L958-L966 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.create_set_property_batch_request_content | 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... | python | 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... | [
"def",
"create_set_property_batch_request_content",
"(",
"options",
")",
":",
"root_node",
"=",
"etree",
".",
"Element",
"(",
"'propertyupdate'",
",",
"xmlns",
"=",
"'DAV:'",
")",
"set_node",
"=",
"etree",
".",
"SubElement",
"(",
"root_node",
",",
"'set'",
")",
... | 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",
"an",
"XML",
"for",
"requesting",
"of",
"setting",
"a",
"property",
"values",
"for",
"remote",
"WebDAV",
"resource",
"in",
"batch",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L969-L985 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.etree_to_string | 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... | python | 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... | [
"def",
"etree_to_string",
"(",
"tree",
")",
":",
"buff",
"=",
"BytesIO",
"(",
")",
"tree",
".",
"write",
"(",
"buff",
",",
"xml_declaration",
"=",
"True",
",",
"encoding",
"=",
"'UTF-8'",
")",
"return",
"buff",
".",
"getvalue",
"(",
")"
] | Creates string from lxml.etree.ElementTree with XML declaration and UTF-8 encoding.
:param tree: the instance of ElementTree
:return: the string of XML. | [
"Creates",
"string",
"from",
"lxml",
".",
"etree",
".",
"ElementTree",
"with",
"XML",
"declaration",
"and",
"UTF",
"-",
"8",
"encoding",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L988-L996 |
kamikaze/webdav | src/webdav/client.py | WebDavXmlUtils.extract_response_for_path | 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... | python | 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... | [
"def",
"extract_response_for_path",
"(",
"content",
",",
"path",
",",
"hostname",
")",
":",
"try",
":",
"tree",
"=",
"etree",
".",
"fromstring",
"(",
"content",
")",
"responses",
"=",
"tree",
".",
"findall",
"(",
"'{DAV:}response'",
")",
"n_path",
"=",
"Ur... | 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. | [
"Extracts",
"single",
"response",
"for",
"specified",
"remote",
"resource",
"."
] | train | https://github.com/kamikaze/webdav/blob/6facff7224023d3e28c8e1592f3c58401c91a0e6/src/webdav/client.py#L999-L1020 |
Nukesor/pueue | pueue/daemon/files.py | cleanup | 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):
... | python | 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):
... | [
"def",
"cleanup",
"(",
"config_dir",
")",
":",
"stdout_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config_dir",
",",
"'pueue.stdout'",
")",
"stderr_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config_dir",
",",
"'pueue.stderr'",
")",
"if",
"os... | Remove temporary stderr and stdout files as well as the daemon socket. | [
"Remove",
"temporary",
"stderr",
"and",
"stdout",
"files",
"as",
"well",
"as",
"the",
"daemon",
"socket",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/files.py#L5-L16 |
Nukesor/pueue | pueue/daemon/files.py | get_descriptor_output | 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... | python | 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... | [
"def",
"get_descriptor_output",
"(",
"descriptor",
",",
"key",
",",
"handler",
"=",
"None",
")",
":",
"line",
"=",
"'stub'",
"lines",
"=",
"''",
"while",
"line",
"!=",
"''",
":",
"try",
":",
"line",
"=",
"descriptor",
".",
"readline",
"(",
")",
"lines"... | 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. | [
"Get",
"the",
"descriptor",
"output",
"and",
"handle",
"incorrect",
"UTF",
"-",
"8",
"encoding",
"of",
"subprocess",
"logs",
"."
] | train | https://github.com/Nukesor/pueue/blob/f1d276360454d4dd2738658a13df1e20caa4b926/pueue/daemon/files.py#L19-L38 |
MediaFire/mediafire-python-open-sdk | mediafire/media/conversion_server_client.py | ConversionServerClient.request | 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... | python | 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... | [
"def",
"request",
"(",
"self",
",",
"hash_",
",",
"quickkey",
",",
"doc_type",
",",
"page",
"=",
"None",
",",
"output",
"=",
"None",
",",
"size_id",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"request_conversion_only",
"=",
"None",
")",
":",
"if",... | 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",... | [
"Query",
"conversion",
"server"
] | train | https://github.com/MediaFire/mediafire-python-open-sdk/blob/8f1f23db1b16f16e026f5c6777aec32d00baa05f/mediafire/media/conversion_server_client.py#L36-L80 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | user_method | 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... | python | 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... | [
"def",
"user_method",
"(",
"user_event",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
")",
":",
"stdin",
"=",
"self",
".",
"stdin",
"is_sock",
"=",
"isinstance",
"(",
"stdin",
",",
"RemoteSocket",
")",
"try",
":",
"try",
":",
"if",
"is_... | Decorator of the Pdb user_* methods that controls the RemoteSocket. | [
"Decorator",
"of",
"the",
"Pdb",
"user_",
"*",
"methods",
"that",
"controls",
"the",
"RemoteSocket",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L115-L131 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.user_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:
... | python | 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:
... | [
"def",
"user_line",
"(",
"self",
",",
"frame",
",",
"breakpoint_hits",
"=",
"None",
")",
":",
"if",
"not",
"breakpoint_hits",
":",
"self",
".",
"interaction",
"(",
"frame",
",",
"None",
")",
"else",
":",
"commands_result",
"=",
"self",
".",
"bp_commands",
... | This function is called when we stop or break at this line. | [
"This",
"function",
"is",
"called",
"when",
"we",
"stop",
"or",
"break",
"at",
"this",
"line",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L518-L532 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.bp_commands | 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... | python | 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... | [
"def",
"bp_commands",
"(",
"self",
",",
"frame",
",",
"breakpoint_hits",
")",
":",
"# Handle multiple breakpoints on the same line (issue 14789)",
"effective_bp_list",
",",
"temporaries",
"=",
"breakpoint_hits",
"silent",
"=",
"True",
"doprompt",
"=",
"False",
"atleast_on... | Call every command that was set for the current active breakpoints.
Returns True if the normal interaction function must be called,
False otherwise. | [
"Call",
"every",
"command",
"that",
"was",
"set",
"for",
"the",
"current",
"active",
"breakpoints",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L534-L564 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.user_return | 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) | python | 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) | [
"def",
"user_return",
"(",
"self",
",",
"frame",
",",
"return_value",
")",
":",
"frame",
".",
"f_locals",
"[",
"'__return__'",
"]",
"=",
"return_value",
"self",
".",
"message",
"(",
"'--Return--'",
")",
"self",
".",
"interaction",
"(",
"frame",
",",
"None"... | This function is called when a return trap is set here. | [
"This",
"function",
"is",
"called",
"when",
"a",
"return",
"trap",
"is",
"set",
"here",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L567-L571 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.user_exception | 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... | python | 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... | [
"def",
"user_exception",
"(",
"self",
",",
"frame",
",",
"exc_info",
")",
":",
"exc_type",
",",
"exc_value",
",",
"exc_traceback",
"=",
"exc_info",
"frame",
".",
"f_locals",
"[",
"'__exception__'",
"]",
"=",
"exc_type",
",",
"exc_value",
"# An 'Internal StopIter... | This function is called if an exception occurs,
but only if we are to stop at or just below this level. | [
"This",
"function",
"is",
"called",
"if",
"an",
"exception",
"occurs",
"but",
"only",
"if",
"we",
"are",
"to",
"stop",
"at",
"or",
"just",
"below",
"this",
"level",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L574-L589 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.precmd | 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 = ... | python | 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 = ... | [
"def",
"precmd",
"(",
"self",
",",
"line",
")",
":",
"if",
"not",
"line",
".",
"strip",
"(",
")",
":",
"return",
"line",
"args",
"=",
"line",
".",
"split",
"(",
")",
"while",
"args",
"[",
"0",
"]",
"in",
"self",
".",
"aliases",
":",
"line",
"="... | Handle alias expansion and ';;' separator. | [
"Handle",
"alias",
"expansion",
"and",
";;",
"separator",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L683-L706 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.onecmd | 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... | python | 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... | [
"def",
"onecmd",
"(",
"self",
",",
"line",
")",
":",
"if",
"not",
"self",
".",
"commands_defining",
":",
"return",
"cmd",
".",
"Cmd",
".",
"onecmd",
"(",
"self",
",",
"line",
")",
"else",
":",
"return",
"self",
".",
"handle_command_def",
"(",
"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. | [
"Interpret",
"the",
"argument",
"as",
"though",
"it",
"had",
"been",
"typed",
"in",
"response",
"to",
"the",
"prompt",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L708-L718 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.handle_command_def | 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 ... | python | 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 ... | [
"def",
"handle_command_def",
"(",
"self",
",",
"line",
")",
":",
"cmd",
",",
"arg",
",",
"line",
"=",
"self",
".",
"parseline",
"(",
"line",
")",
"if",
"not",
"cmd",
":",
"return",
"if",
"cmd",
"==",
"'silent'",
":",
"self",
".",
"commands_silent",
"... | Handles one command line during command list definition. | [
"Handles",
"one",
"command",
"line",
"during",
"command",
"list",
"definition",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L720-L746 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_commands | 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.
... | python | 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.
... | [
"def",
"do_commands",
"(",
"self",
",",
"arg",
")",
":",
"if",
"not",
"arg",
":",
"bnum",
"=",
"len",
"(",
"bdb",
".",
"Breakpoint",
".",
"bpbynumber",
")",
"-",
"1",
"else",
":",
"try",
":",
"bnum",
"=",
"int",
"(",
"arg",
")",
"except",
"Except... | 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... | [
"commands",
"[",
"bpnumber",
"]",
"(",
"com",
")",
"...",
"(",
"com",
")",
"end",
"(",
"Pdb",
")"
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L815-L890 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_break | 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... | python | 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... | [
"def",
"do_break",
"(",
"self",
",",
"arg",
",",
"temporary",
"=",
"0",
")",
":",
"if",
"not",
"arg",
":",
"all_breaks",
"=",
"'\\n'",
".",
"join",
"(",
"bp",
".",
"bpformat",
"(",
")",
"for",
"bp",
"in",
"bdb",
".",
"Breakpoint",
".",
"bpbynumber"... | 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... | [
"b",
"(",
"reak",
")",
"[",
"(",
"[",
"filename",
":",
"]",
"lineno",
"|",
"function",
")",
"[",
"condition",
"]",
"]",
"Without",
"argument",
"list",
"all",
"breaks",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L894-L970 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.defaultFile | 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 | python | 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 | [
"def",
"defaultFile",
"(",
"self",
")",
":",
"filename",
"=",
"self",
".",
"curframe",
".",
"f_code",
".",
"co_filename",
"if",
"filename",
"==",
"'<string>'",
"and",
"self",
".",
"mainpyfile",
":",
"filename",
"=",
"self",
".",
"mainpyfile",
"return",
"fi... | Produce a reasonable default. | [
"Produce",
"a",
"reasonable",
"default",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L973-L978 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_enable | 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... | python | 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... | [
"def",
"do_enable",
"(",
"self",
",",
"arg",
")",
":",
"args",
"=",
"arg",
".",
"split",
"(",
")",
"for",
"i",
"in",
"args",
":",
"try",
":",
"bp",
"=",
"self",
".",
"get_bpbynumber",
"(",
"i",
")",
"except",
"ValueError",
"as",
"err",
":",
"self... | enable bpnumber [bpnumber ...]
Enables the breakpoints given as a space separated list of
breakpoint numbers. | [
"enable",
"bpnumber",
"[",
"bpnumber",
"...",
"]",
"Enables",
"the",
"breakpoints",
"given",
"as",
"a",
"space",
"separated",
"list",
"of",
"breakpoint",
"numbers",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L998-L1011 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_disable | 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... | python | 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... | [
"def",
"do_disable",
"(",
"self",
",",
"arg",
")",
":",
"args",
"=",
"arg",
".",
"split",
"(",
")",
"for",
"i",
"in",
"args",
":",
"try",
":",
"bp",
"=",
"self",
".",
"get_bpbynumber",
"(",
"i",
")",
"except",
"ValueError",
"as",
"err",
":",
"sel... | 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... | [
"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"... | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1015-L1031 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_condition | 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... | python | 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... | [
"def",
"do_condition",
"(",
"self",
",",
"arg",
")",
":",
"args",
"=",
"arg",
".",
"split",
"(",
"' '",
",",
"1",
")",
"try",
":",
"cond",
"=",
"args",
"[",
"1",
"]",
"except",
"IndexError",
":",
"cond",
"=",
"None",
"try",
":",
"bp",
"=",
"sel... | 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. | [
"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",
... | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1035-L1058 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_ignore | 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... | python | 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... | [
"def",
"do_ignore",
"(",
"self",
",",
"arg",
")",
":",
"args",
"=",
"arg",
".",
"split",
"(",
"' '",
",",
"1",
")",
"try",
":",
"count",
"=",
"int",
"(",
"args",
"[",
"1",
"]",
".",
"strip",
"(",
")",
")",
"except",
"Exception",
":",
"count",
... | 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... | [
"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",
"... | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1062-L1093 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_clear | 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... | python | 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... | [
"def",
"do_clear",
"(",
"self",
",",
"arg",
")",
":",
"if",
"not",
"arg",
":",
"try",
":",
"if",
"PY3",
":",
"reply",
"=",
"input",
"(",
"'Clear all breaks? '",
")",
"else",
":",
"reply",
"=",
"raw_input",
"(",
"'Clear all breaks? '",
")",
"except",
"E... | 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. | [
"cl",
"(",
"ear",
")",
"filename",
":",
"lineno",
"\\",
"ncl",
"(",
"ear",
")",
"[",
"bpnumber",
"[",
"bpnumber",
"...",
"]]",
"With",
"a",
"space",
"separated",
"list",
"of",
"breakpoint",
"numbers",
"clear",
"those",
"breakpoints",
".",
"Without",
"arg... | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1100-L1148 |
corpusops/pdbclone | lib/pdb_clone/pdb.py | Pdb.do_up | 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... | python | 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... | [
"def",
"do_up",
"(",
"self",
",",
"arg",
")",
":",
"if",
"self",
".",
"curindex",
"==",
"0",
":",
"self",
".",
"error",
"(",
"'Oldest frame'",
")",
"return",
"try",
":",
"count",
"=",
"int",
"(",
"arg",
"or",
"1",
")",
"except",
"ValueError",
":",
... | u(p) [count]
Move the current frame count (default one) levels up in the
stack trace (to an older frame). | [
"u",
"(",
"p",
")",
"[",
"count",
"]",
"Move",
"the",
"current",
"frame",
"count",
"(",
"default",
"one",
")",
"levels",
"up",
"in",
"the",
"stack",
"trace",
"(",
"to",
"an",
"older",
"frame",
")",
"."
] | train | https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1171-L1188 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.