Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Here is a snippet: <|code_start|># DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS... | if not self.parsed: |
Predict the next line for this snippet: <|code_start|># Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions o... | def getCanName(self, name, compact = False): |
Given the following code snippet before the placeholder: <|code_start|> nworkers = self.uopts.nworkers
for i in range(0, nworkers):
self.asenders.append(AsyncSender(self))
self.areceivers.append(AsyncReceiver(self))
def send_to(self, data, address, delayed = False):
... | if self.uopts.ploss_in_rate > 0.0 and not delayed: |
Given the code snippet: <|code_start|> rsth = None
state_lock = Lock()
state = RTPGenInit
userv = None
target = None
pl_queue = None
plq_lock = Lock()
def __init__(self):
Thread.__init__(self)
self.setDaemon(True)
self.pl_queue = []
def start(self, userv, tar... | self.plq_lock.release() |
Based on the snippet: <|code_start|> else:
etext = 'suspend() is called in the wrong state: %s' % self.state
self.state_lock.release()
raise Exception(etext)
self.state_lock.release()
class FakeUserv(object):
nsent = 0
def send_to(self, *args):
self.n... | nsent_base = 135 |
Based on the snippet: <|code_start|># Copyright (c) 2006-2016 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must... | return 'Diversion' |
Predict the next line for this snippet: <|code_start|># Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions o... | return 'P-Asserted-Identity' |
Using the snippet: <|code_start|> self.startline = startline
def getSL(self):
return self.startline
def getHFs(self, name):
return [x for x in self.headers if x.name == name]
def countHFs(self, name):
return len([x for x in self.headers if x.name == name])
def delHFs(s... | self.headers[self.headers.index(oheader)] = nheader |
Using the snippet: <|code_start|> self.source = address
def getTId(self, wCSM = False, wBRN = False, wTTG = False):
headers_dict = dict([(x.name, x) for x in self.headers if x.name in ('cseq', 'call-id', 'from')])
cseq, method = headers_dict['cseq'].getBody().getCSeq()
rval = [str(he... | cself.nated = self.nated |
Next line prediction: <|code_start|>
def localStr(self, local_addr = None, local_port = None, compact = False):
s = self.getSL() + '\r\n'
for header in self.headers:
s += header.localStr(local_addr, local_port, compact) + '\r\n'
if self.body != None:
mbody = self.body... | def countHFs(self, name): |
Predict the next line after this snippet: <|code_start|> else:
self.headers.append(header)
header_names.append(header.name)
except ESipHeaderCSV as einst:
for body in einst.bodys:
header = SipHeader(name = einst.name,... | mblen = len(self.__mbody) |
Given the code snippet: <|code_start|> raise ESipParseException('Truncated SIP body, %d bytes expected, %d received' % (blen, mblen))
elif blen < mblen:
self.__mbody = self.__mbody[:blen]
mblen = blen
if self.__mbody != None:
if self.__c... | s += 'c: %s\r\n' % self.body.mtype |
Given the following code snippet before the placeholder: <|code_start|>#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditi... | else: |
Predict the next line after this snippet: <|code_start|>#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the fol... | return 'Max-Forwards' |
Given the following code snippet before the placeholder: <|code_start|># SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CALL_ID_CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.!%*_+`\'~()<>:\\"/[]?{}'
_clen = len(CALL_ID_CHARSET)
DEFAULT_TEST_LEN = (32, 16)
def gen_test_cid(l... | def genCallId(self): |
Given the code snippet: <|code_start|> else:
self.hostport = route[0]
if not self.hostport.startswith('['):
hostport = self.hostport.split(':', 1)
af = 0
self.hostonly = hostport[0]
else:
hostport = self.hostport[1:].split(']', 1)
... | if self.expires < 0: |
Given snippet: <|code_start|> try:
event.reason = req.getHFBody('reason')
except:
pass
self.ua.equeue.append(event)
self.ua.cancelCreditTimer()
self.ua.disconnect_ts = req.rtime
return (UaStateDisconnected, self.ua.di... | return (UaStateConnected,) |
Continue the code snippet: <|code_start|> return None
elif req.getMethod() == 'BYE':
self.ua.global_config['_sip_tm'].cancelTransaction(self.ua.tr)
self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(200, 'OK', server = self.ua.local_ua))
#print 'BYE rece... | self.ua.on_remote_sdp_change(body, cb_func, en_excpt = True) |
Based on the snippet: <|code_start|> self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(200, 'OK', server = self.ua.local_ua))
#print 'BYE received in the Updating state, going to the Disconnected state'
event = CCEventDisconnect(rtime = req.rtime, origin = self.ua.origin)
... | event.setWarning('Malformed SDP Body received from ' \ |
Here is a snippet: <|code_start|> redirects = tuple(x.getUri().getCopy() for x in resp.getHFBodys('contact'))
scode = (code, reason, body, redirects)
event = CCEventRedirect(scode, rtime = resp.rtime, origin = self.ua.origin)
else:
event = CCEventFail(scode, rtime ... | origin = self.ua.origin)) |
Continue the code snippet: <|code_start|> except:
pass
if code in (408, 481):
# If the response for a request within a dialog is a 481
# (Call/Transaction Does Not Exist) or a 408 (Request Timeout), the
# UAC SHOULD terminate the dialog. A UAC SHO... | req = self.ua.genRequest('BYE', reason = event.reason) |
Predict the next line for this snippet: <|code_start|>
def recvRequest(self, req):
if req.getMethod() == 'INVITE':
self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(491, 'Request Pending', server = self.ua.local_ua))
return None
elif req.getMethod() == 'BYE':
... | if body != None: |
Given the following code snippet before the placeholder: <|code_start|># 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the fo... | return self.address.url.getAddr() |
Based on the snippet: <|code_start|># ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
f_types = {'m':SdpMedia, 'i':SdpGeneric, 'c':SdpConnecton, 'b':Sd... | s = '' |
Based on the snippet: <|code_start|> 'k':SdpGeneric}
class SdpMediaDescription(object):
m_header = None
i_header = None
c_header = None
b_header = None
k_header = None
a_headers = None
all_headers = ('m', 'i', 'c', 'b', 'k')
needs_update = True
def __init__(self, cself = None):
... | s += 'a=%s\r\n' % str(header) |
Given snippet: <|code_start|> s += 'a=%s\r\n' % str(header)
return s
def __iadd__(self, other):
self.addHeader(*other.strip().split('=', 1))
return self
def getCopy(self):
return SdpMediaDescription(cself = self)
def addHeader(self, name, header):
if nam... | self.a_headers = new_a_headers |
Using the snippet: <|code_start|># 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentatio... | self.cseq = cseq |
Here is a snippet: <|code_start|>
def _prepare_attributes(self, type, attributes):
data = [type]
for a, v in attributes:
if a in self._avpair_names:
v = '%s=%s' % (str(a), str(v))
a = 'Cisco-AVPair'
elif a in self._cisco_vsa_names:
... | v = v[len(a) + 1:] |
Predict the next line after this snippet: <|code_start|> return
self.__play(None, rtpps, prompt_name, times, result_callback, index)
def _stop_play(self, rtpps, result_callback = None, index = 0):
if not self.session_exists:
ED2.callFromThread(rtpps.command_result, None, resu... | return |
Next line prediction: <|code_start|> def gettags(self, rtpps):
if self not in (rtpps.caller, rtpps.callee):
raise Exception("Corrupt Rtp_proxy_session")
if self == rtpps.caller:
return (rtpps.from_tag, rtpps.to_tag)
else:
return (rtpps.to_tag, rtpps.from_ta... | return |
Given the code snippet: <|code_start|># THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT H... | return self.__class__(name = self.name) |
Given snippet: <|code_start|>
class RadiusAuthorisation(Radius_client):
def do_auth(self, username, caller, callee, sip_cid, remote_ip, res_cb, \
realm = None, nonce = None, uri = None, response = None, extra_attributes = None):
sip_cid = str(sip_cid)
attributes = None
if None not in (... | else: |
Based on the snippet: <|code_start|> 'SHA-256':(sha256, DGST_SHA256), 'SHA-256-sess':(sha256, DGST_SHA256SESS), \
'SHA-512-256':(sha512_256, DGST_SHA512), 'SHA-512-256-sess':(sha512_256, DGST_SHA512SESS)}
class SipAuthorization(SipGenericHF):
hf_names = ('authorization',)
username = None
uri = None
... | self.cnonce = cself.cnonce |
Continue the code snippet: <|code_start|>class SipAuthorization(SipGenericHF):
hf_names = ('authorization',)
username = None
uri = None
realm = None
nonce = None
response = None
qop = None
cnonce = None
nc = None
algorithm = None
otherparams = None
ho = HashOracle()
... | self.otherparams = cself.otherparams[:] |
Here is a snippet: <|code_start|> return 'Authorization'
def IsDigestAlgSupported(algorithm):
return (algorithm in _HASH_FUNC)
def NameList2AlgMask(nlist):
return tuple([_HASH_FUNC[x][1] for x in nlist])
def DigestCalcHA1(pszAlg, pszUserName, pszRealm, pszPassword, pszNonce, pszCNonce):
delim = ':... | hashfunc = _HASH_FUNC[pszAlg][0] |
Given the following code snippet before the placeholder: <|code_start|> if not self.parsed:
self.parse()
HA1 = DigestCalcHA1(self.algorithm, self.username, self.realm, password, self.nonce, self.cnonce)
return self.verifyHA1(HA1, method, body)
def verifyHA1(self, HA1, method, bod... | hashfunc = _HASH_FUNC[pszAlg][0] |
Predict the next line after this snippet: <|code_start|> def genAuthResponse(self, password, method, body):
HA1 = DigestCalcHA1(self.algorithm, self.username, self.realm, password, \
self.nonce, self.cnonce)
self.response = DigestCalcResponse(self.algorithm, HA1, self.nonce, \
sel... | def verifyHA1(self, HA1, method, body): |
Predict the next line for this snippet: <|code_start|> m.update(pszRealm.encode())
m.update(delim)
m.update(pszPassword.encode())
HA1 = m.hexdigest().encode()
if pszAlg and pszAlg.endswith('-sess'):
m = hashfunc()
m.update(HA1)
m.update(delim)
m.update(pszNonce.encode(... | m = hashfunc() |
Given the following code snippet before the placeholder: <|code_start|> HA1 = DigestCalcHA1(self.algorithm, self.username, self.realm, password, \
self.nonce, self.cnonce)
self.response = DigestCalcResponse(self.algorithm, HA1, self.nonce, \
self.nc, self.cnonce, self.qop, method, sel... | if not self.parsed: |
Given the following code snippet before the placeholder: <|code_start|> if cself != None:
self.username = cself.username
self.uri = cself.uri
self.realm = cself.realm
self.nonce = cself.nonce
self.response = cself.response
self.qop = cself.q... | self.nonce = value.strip('"') |
Using the snippet: <|code_start|> hf_names = ('replaces',)
call_id = None
from_tag = None
to_tag = None
early_only = False
params = None
def __init__(self, body = None, call_id = None, from_tag = None, to_tag = None, \
early_only = False, params = None):
SipGenericHF.__init__(s... | elif param == 'early-only': |
Based on the snippet: <|code_start|> return cself
# Speacial method allowing tweaking internal parameters of the UAC
# after everything has been setup but before INVITE goes out.
def onUacSetupComplete(self, uac):
pass
class CCEventRing(CCEventGeneric):
name = 'CCEventRing'
pass
cl... | pass |
Given the code snippet: <|code_start|> cself = CCEventGeneric.getCopy(self)
cself.max_forwards = self.max_forwards
return cself
# Speacial method allowing tweaking internal parameters of the UAC
# after everything has been setup but before INVITE goes out.
def onUacSetupComplete(self... | class CCEventInfo(CCEventGeneric): |
Based on the snippet: <|code_start|> master = None
def __init__(self, command, master):
Thread.__init__(self)
self.command = command
self.master = master
self.setDaemon(True)
self.start()
def run(self):
need_close_fds = True
if platform == 'win32':
... | wi.callback_parameters = None |
Next line prediction: <|code_start|># Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must... | agent = socket.gethostname() |
Based on the snippet: <|code_start|># ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXE... | self.ua.changeState((UaStateDead,)) |
Here is a snippet: <|code_start|> return
self.parsed = True
if ciscoGUID != None:
self.ciscoGUID = ciscoGUID
else:
salt = str((random() * 1000000000) + time())
s = md5(salt.encode()).hexdigest()
self.ciscoGUID = (int(s[0:8], 16), int(s[8... | def getCopy(self): |
Next line prediction: <|code_start|># (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class SipNumericHF(SipGenericHF):
number = None
def __init__(self, body = None, number = 0):
SipGenericHF.__init__(self, b... | def incNum(self): |
Based on the snippet: <|code_start|># THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOL... | if not self.parsed: |
Based on the snippet: <|code_start|> if not self.parsed:
return self.body
if local_addr != None and 'my' in dir(self.hostname):
s = self.sipver + ' ' + local_addr
else:
s = self.sipver + ' ' + str(self.hostname)
if self.port != None:
if loca... | self.params[name] = value |
Given the code snippet: <|code_start|> def localStr(self, local_addr = None, local_port = None):
if not self.parsed:
return self.body
if local_addr != None and 'my' in dir(self.hostname):
s = self.sipver + ' ' + local_addr
else:
s = self.sipver + ' ' + str(... | def setParam(self, name, value = None): |
Here is a snippet: <|code_start|>
default_logger = getLogger()
default_logger.setLevel(DEBUG if IS_DEVELOPMENT else WARNING)
log_console = StreamHandler()
log_format = '%(name)-12s %(levelname)-7s %(message)s'
log_console.setFormatter(Formatter(log_format))
<|code_end|>
. Write the next line using the current file im... | default_logger.addHandler(log_console) |
Predict the next line after this snippet: <|code_start|>
class ForwardReverseTest(TestCase):
def __ssh_cb(self, ssh):
def build_body(status_code, status_string, content):
replacements = { 'scode': status_code,
'sstring': status_string,
'... | return """HTTP/1.1 %(scode)d %(sstring)s |
Next line prediction: <|code_start|>
class BinaryReadTest(TestCase):
def __sftp_cb(self, ssh, sftp):
# print("Opening file.")
with SftpFile(sftp, 'test_libgksu2.so.0', 'r') as sf:
buffer_ = sf.read()
<|code_end|>
. Use current file imports:
(from unittest import TestCase
from pyse... | with open('/tmp/sftp_dump', 'wb') as f: |
Here is a snippet: <|code_start|>
class BinaryReadTest(TestCase):
def __sftp_cb(self, ssh, sftp):
# print("Opening file.")
with SftpFile(sftp, 'test_libgksu2.so.0', 'r') as sf:
<|code_end|>
. Write the next line using the current file imports:
from unittest import TestCase
from pysecure.adapte... | buffer_ = sf.read() |
Given the following code snippet before the placeholder: <|code_start|>
class SftpLsTest(TestCase):
def __sftp_cb(self, ssh, sftp):
# print("Name Size Perms Owner\tGroup\n")
for attributes in sftp.listdir('.'):
print("%-40s %10d %.8o %s(%d)\t%s(%d)" %
... | attributes.uid, attributes.group, attributes.gid)) |
Based on the snippet: <|code_start|>c_sftp_statvfs_free = libssh.sftp_statvfs_free
c_sftp_statvfs_free.argtypes = [c_void_p]
c_sftp_statvfs_free.restype = None
# libssh2_sftp_symlink(sftp, orig, linkpath)
# int sftp_symlink (sftp_session sftp, const char *target, const char *dest)
c_sftp_symlink = libssh.sftp_symlink... | c_sftp_unlink.restype = c_int |
Predict the next line for this snippet: <|code_start|>
class ForwardLocalTest(TestCase):
def __ssh_cb(self, ssh):
host_remote = 'localhost'
port_remote = 80
host_source = 'localhost'
<|code_end|>
with the help of current file imports:
from unittest import TestCase
from pysecure.adapters.c... | port_local = 1111 |
Next line prediction: <|code_start|>
class ForwardLocalTest(TestCase):
def __ssh_cb(self, ssh):
host_remote = 'localhost'
port_remote = 80
host_source = 'localhost'
port_local = 1111
data = b"GET / HTTP/1.1\nHost: localhost\n\n"
with SshChannel(ssh) as sc:
... | port_local) |
Given the code snippet: <|code_start|>
class SftpMirror(object):
def __init__(self, sftp, allow_creates=True, allow_deletes=True,
create_cb=None, delete_cb=None):
self.__sftp_session = sftp
self.__allow_creates = allow_creates
self.__allow_deletes = allow_deletes
<|code... | self.__create_cb = create_cb |
Given the code snippet: <|code_start|>
class SftpMirror(object):
def __init__(self, sftp, allow_creates=True, allow_deletes=True,
create_cb=None, delete_cb=None):
self.__sftp_session = sftp
self.__allow_creates = allow_creates
self.__allow_deletes = allow_deletes
<|code... | self.__create_cb = create_cb |
Based on the snippet: <|code_start|>#!/usr/bin/env python2.7
sys.path.insert(0, '..')
def _configure_logging():
_FMT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
_FORMATTER = logging.Formatter(_FMT)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandl... | def sftp_cb(ssh, sftp): |
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python2.7
sys.path.insert(0, '..')
def _configure_logging():
_FMT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
_FORMATTER = logging.Formatter(_FMT)
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch =... | logger.addHandler(ch) |
Next line prediction: <|code_start|>
def connect_sftp_test(sftp_cb):
print("Connecting SFTP with key: %s" % (key_filepath))
auth_cb = get_key_auth_cb(key_filepath)
connect_sftp_with_cb(sftp_cb, user, host, auth_cb, verbosity=verbosity)
<|code_end|>
. Use current file imports:
(from pysecure import log_con... | def connect_ssh_test(ssh_cb): |
Next line prediction: <|code_start|>
def connect_sftp_test(sftp_cb):
print("Connecting SFTP with key: %s" % (key_filepath))
auth_cb = get_key_auth_cb(key_filepath)
connect_sftp_with_cb(sftp_cb, user, host, auth_cb, verbosity=verbosity)
<|code_end|>
. Use current file imports:
(from pysecure import log_con... | def connect_ssh_test(ssh_cb): |
Using the snippet: <|code_start|>
def connect_sftp_test(sftp_cb):
print("Connecting SFTP with key: %s" % (key_filepath))
auth_cb = get_key_auth_cb(key_filepath)
connect_sftp_with_cb(sftp_cb, user, host, auth_cb, verbosity=verbosity)
<|code_end|>
, determine the next line of code. You have imports:
from py... | def connect_ssh_test(ssh_cb): |
Continue the code snippet: <|code_start|>
class DirManipTest(TestCase):
def __sftp_cb(self, ssh, sftp):
# print("Creating directory.")
sftp.mkdir("xyz")
# print("Removing directory.")
<|code_end|>
. Use current file imports:
from unittest import TestCase
from pysecure.test.test_base... | sftp.rmdir("xyz") |
Given the code snippet: <|code_start|>
def dumphex(data):
data_len = len(data)
row_size = 16
i = 0
while i < data_len:
stdout.write('%05X:' % (i))
# Display bytes as hex.
j = 0
while j < row_size:
<|code_end|>
, generate the next line using the imports in this fil... | index = i + j |
Continue the code snippet: <|code_start|>
class TextIterateTest(TestCase):
def __sftp_cb(self, ssh, sftp):
with SftpFile(sftp, 'test_doc_rfc1958.txt') as sf:
i = 0
for data in sf:
# stdout.write("> " + data)
if i >= 30:
<|code_end|>
. Use current fil... | break |
Here is a snippet: <|code_start|>
# Auxiliary calls.
c_strerror = libssh.strerror
c_free = libssh.free
# Function calls.
# LIBSSH_API ssh_session ssh_new(void);
c_ssh_new = libssh.ssh_new
c_ssh_new.argtypes = []
c_ssh_new.restype = c_ssh_session
# LIBSSH_API int ssh_options_set(ssh_session session, enum ssh_options... | c_ssh_disconnect.argtypes = [c_ssh_session] |
Continue the code snippet: <|code_start|>
class SftpNoCbTest(TestCase):
def __init__(self, *args, **kwargs):
super(SftpNoCbTest, self).__init__(*args, **kwargs)
self.__log = logging.getLogger('SftpNoCb')
def setUp(self):
auth_cb = get_key_auth_cb(key_filepath)
self.__easy =... | self.__easy.close_ssh() |
Given snippet: <|code_start|>
class SftpNoCbTest(TestCase):
def __init__(self, *args, **kwargs):
super(SftpNoCbTest, self).__init__(*args, **kwargs)
self.__log = logging.getLogger('SftpNoCb')
def setUp(self):
auth_cb = get_key_auth_cb(key_filepath)
self.__easy = EasySsh(use... | self.__easy.close_ssh() |
Continue the code snippet: <|code_start|>
class SftpNoCbTest(TestCase):
def __init__(self, *args, **kwargs):
super(SftpNoCbTest, self).__init__(*args, **kwargs)
self.__log = logging.getLogger('SftpNoCb')
def setUp(self):
auth_cb = get_key_auth_cb(key_filepath)
self.__easy =... | self.__easy.close_sftp() |
Given the code snippet: <|code_start|> raise SshError("Could not open channel: %s" % (error))
return result
def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
host_source, port_local):
logging.debug("Requesting forward on channel.")
result = c_... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Continue the code snippet: <|code_start|>
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh_get_error(ssh_session_int)
raise SshError("Could not open channel: %s" % (error))
return result
def _ssh... | data_len = len(data) |
Here is a snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Next line prediction: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ... | c_int(port_remote), |
Next line prediction: <|code_start|> logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh_get_error(ssh_session_int)
raise SshError("Could not open channel:... | def _ssh_channel_write(ssh_channel_int, data): |
Here is a snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Based on the snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
<|code_end|>
, predict the immediate next line with the help of imports:
import log... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Predict the next line for this snippet: <|code_start|>def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
host_source, port_local):
logging.debug("Requesting forward on channel.")
result = c_ssh_channel_open_forward(ssh_channel_int,
... | elif sent_bytes != data_len: |
Given the code snippet: <|code_start|>
result = c_ssh_channel_open_forward(ssh_channel_int,
c_char_p(bytify(host_remote)),
c_int(port_remote),
c_char_p(bytify(host_source)),
... | def _ssh_channel_read(ssh_channel_int, count, is_stderr): |
Given the following code snippet before the placeholder: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_sessio... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Predict the next line for this snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int... | c_int(port_local)) |
Here is a snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh... | def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote, |
Using the snippet: <|code_start|> raise SshError("Could not open channel: %s" % (error))
return result
def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
host_source, port_local):
logging.debug("Requesting forward on channel.")
result = c_ssh_c... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Given snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh_get... | def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote, |
Here is a snippet: <|code_start|>
logging.debug("Requesting forward on channel.")
result = c_ssh_channel_open_forward(ssh_channel_int,
c_char_p(bytify(host_remote)),
c_int(port_remote),
c_... | "written data." % (data_len, sent_bytes)) |
Given snippet: <|code_start|> raise SshError("Could not open channel: %s" % (error))
return result
def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
host_source, port_local):
logging.debug("Requesting forward on channel.")
result = c_ssh_chann... | ssh_session_int = _ssh_channel_get_session(ssh_channel_int) |
Next line prediction: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ... | logging.debug("Requesting forward on channel.") |
Given snippet: <|code_start|>def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
host_source, port_local):
logging.debug("Requesting forward on channel.")
result = c_ssh_channel_open_forward(ssh_channel_int,
c_char_p(... | elif sent_bytes != data_len: |
Next line prediction: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
<|code_end|>
. Use current file imports:
(import logging
from ctypes import c_char_p, c_void_p, cast, c_ui... | if result is None: |
Given snippet: <|code_start|>
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh_get_error(ssh_session_int)
raise SshError("Could not open channel: %s" % (error))
return result
def _ssh_channel_ope... | data_len = len(data) |
Given the following code snippet before the placeholder: <|code_start|>def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
host_source, port_local):
logging.debug("Requesting forward on channel.")
result = c_ssh_channel_open_forward(ssh_channel_int,
... | elif sent_bytes != data_len: |
Continue the code snippet: <|code_start|> ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ssh_get_error(ssh_session_int)
raise SshError("Could not open channel: %s" % (error))
return result
def _ssh_channel_open_forward(ssh_channel_int, host_remote, port_remote,
... | c_uint32(data_len)) |
Given the code snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error ... | return result |
Next line prediction: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ... | host_source, port_local): |
Next line prediction: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int)
error = ... | return result |
Predict the next line for this snippet: <|code_start|>
def _ssh_channel_new(ssh_session_int):
logging.debug("Opening channel on session.")
result = c_ssh_channel_new(ssh_session_int)
if result is None:
ssh_session_int = _ssh_channel_get_session(ssh_channel_int... | return result |
Using the snippet: <|code_start|>c_ssh_channel_change_pty_size.restype = c_int
# int ssh_channel_is_eof(ssh_channel channel)
c_ssh_channel_is_eof = libssh.ssh_channel_is_eof
c_ssh_channel_is_eof.argtypes = [c_ssh_channel]
c_ssh_channel_is_eof.restype = c_int
# int ssh_channel_read_nonblocking(ssh_channel channel, voi... | c_ssh_channel_request_x11.restype = c_int |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.