text_prompt stringlengths 157 13.1k | code_prompt stringlengths 7 19.8k ⌀ |
|---|---|
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def json(self, json_string=None):
""" Convenience method allowing easy dumping to and loading from json. """ |
if json_string is not None:
return self.__init__(loads(json_string))
dump = self
if isinstance(self, HAR.log):
dump = {"log": dump}
return dumps(dump, default=lambda x: dict(x)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def start_search(self):
""" Start the Gateway Search Request and return the address information :rtype: (string,int) :return: a tuple(string(IP),int(Port) when f... |
self._asyncio_loop = asyncio.get_event_loop()
# Creating Broadcast Receiver
coroutine_listen = self._asyncio_loop.create_datagram_endpoint(
lambda: self.KNXSearchBroadcastReceiverProtocol(
self._process_response,
self._timeout_handling,
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _process_response(self, received_data):
""" Processing the incoming UDP Datagram from the Broadcast Socket :param received_data: UDP Datagram Package to Proc... |
resp = bytearray(received_data)
self._resolved_gateway_ip_address = str.format(
"{}.{}.{}.{}", resp[8], resp[9], resp[10], resp[11])
self._resolved_gateway_ip_port = struct.unpack(
'!h', bytes(resp[12:14]))[0] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def append(self, fdata, offset, query='/content/uploads'):
""" append binary data to an upload `fdata` - binary data to send to pulp `offset` - the amount of pre... |
query = '%s/%s/%s/' % (query, self.uid, offset)
_r = self.connector.put(query, fdata, log_data=False, auto_create_json_str=False)
juicer.utils.Log.log_notice("Appending to: %s" % query)
juicer.utils.Log.log_debug("Continuing upload with append. POST returned with data: %s" % str(_r.con... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def import_upload(self, nvrea, ftype='rpm', rpm_name='', desc=None, htype='md5', lic=None, group=None, vendor=None, req=None):
""" import the completed upload in... |
query = '/repositories/%s/actions/import_upload/' % self.repoid
data = {'upload_id': self.uid,
'unit_type_id': ftype,
'unit_key': {
'name': rpm_name,
'version': nvrea[1],
'release': nvrea[2],
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def clean_upload(self, query='/content/uploads/'):
""" pulp leaves droppings if you don't specifically tell it to clean up after itself. use this to do so. """ |
query = query + self.uid + '/'
_r = self.connector.delete(query)
if _r.status_code == Constants.PULP_DELETE_OK:
juicer.utils.Log.log_info("Cleaned up after upload request.")
else:
_r.raise_for_status() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _user_config_file():
""" Check that the config file is present and readable. If not, copy a template in place. """ |
config_file = Constants.USER_CONFIG
if os.path.exists(config_file) and os.access(config_file, os.R_OK):
return config_file
elif os.path.exists(config_file) and not os.access(config_file, os.R_OK):
raise IOError("Can not read %s" % config_file)
else:
shutil.copy(Constants.EXAMPLE... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def cart_db():
""" return a pymongo db connection for interacting with cart objects """ |
config = _config_file()
_config_test(config)
juicer.utils.Log.log_debug("Establishing cart connection:")
cart_con = MongoClient(dict(config.items(config.sections()[0]))['cart_host'])
cart_db = cart_con.carts
return cart_db |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def upload_cart(cart, collection):
""" Connect to mongo and store your cart in the specified collection. """ |
cart_cols = cart_db()
cart_json = read_json_document(cart.cart_file())
try:
cart_id = cart_cols[collection].save(cart_json)
except MongoErrors.AutoReconnect:
raise JuicerConfigError("Error saving cart to `cart_host`. Ensure that this node is the master.")
return cart_id |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_login_info():
""" Give back an array of dicts with the connection information for all the environments. """ |
connections = {}
_defaults = {}
_defaults['start_in'] = ''
_defaults['rpm_sign_plugin'] = ''
config = _config_file()
_config_test(config)
juicer.utils.Log.log_debug("Loading connection information:")
for section in config.sections():
cfg = dict(config.items(section))
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_environments():
""" Return defined environments from config file for default environment values. """ |
config = ConfigParser.SafeConfigParser()
config = _config_file()
juicer.utils.Log.log_debug("Reading environment sections:")
environments = config.sections()
juicer.utils.Log.log_debug("Read environment sections: %s", ', '.join(environments))
return environments |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def env_same_host(env1, env2):
""" determine if two environments are on the same host. returns true or false """ |
config = _config_file()
h1 = dict(config.items(env1))['base_url']
h2 = dict(config.items(env2))['base_url']
return h1 == h2 |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_next_environment(env):
""" Given an environment, return the next environment in the promotion hierarchy """ |
config = _config_file()
juicer.utils.Log.log_debug("Finding next environment...")
if env not in config.sections():
raise JuicerConfigError("%s is not a server configured in juicer.conf", env)
section = dict(config.items(env))
if 'promotes_to' not in section.keys():
err = "Enviro... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def pulp_repo_path(connection, repoid):
""" Given a connection and a repoid, return the url of the repository """ |
dl_base = connection.base_url.replace('/pulp/api/v2', '/pulp/repos')
_m = re.match('(.*)-(.*)', repoid)
repo = _m.group(1)
env = _m.group(2)
return "%s/%s/%s" % (dl_base, env, repo) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def user_exists_p(login, connector):
""" Determine if user exists in specified environment. """ |
url = '/users/' + login + '/'
_r = connector.get(url)
return (_r.status_code == Constants.PULP_GET_OK) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def flatten(x):
""" Flatten an arbitrary depth nested list. """ |
# Lifted from: http://stackoverflow.com/a/406822/263969
result = []
for el in x:
if hasattr(el, "__iter__") and not isinstance(el, basestring):
result.extend(flatten(el))
else:
result.append(el)
return result |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def write_json_document(title, body):
""" `title` - Name of the file to write. `body` - Python datastructure representing the document. This method handles trans... |
if not title.endswith('.json'):
title += '.json'
json_body = create_json_str(body)
if os.path.exists(title):
juicer.utils.Log.log_warn("Cart file '%s' already exists, overwriting with new data." % title)
f = open(title, 'w')
f.write(json_body)
f.flush()
f.close() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def read_json_document(title):
""" Reads in a json document and returns a native python datastructure. """ |
if not title.endswith('.json'):
juicer.utils.Log.log_warn("File name (%s) does not end with '.json', appending it automatically." % title)
title += '.json'
if not os.path.exists(title):
raise IOError("Could not find file: '%s'" % title)
f = open(title, 'r')
doc = f.read()
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def find_pattern(search_base, pattern='*.rpm'):
""" `search_base` - The directory to begin walking down. `pattern` - File pattern to match for. This is a generat... |
# Stolen from http://rosettacode.org/wiki/Walk_a_directory/Recursively#Python
if (not os.path.isdir(search_base)) and os.path.exists(search_base):
# Adapt the algorithm to gracefully handle non-directory search paths
yield search_base
else:
for root, dirs, files in os.walk(search_ba... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def filter_package_list(package_list):
""" Filter a list of packages into local and remotes. """ |
remote_pkgs = []
local_pkgs = []
possible_remotes = filter(lambda i: not os.path.exists(i), package_list)
juicer.utils.Log.log_debug("Considering %s possible remotes" % len(possible_remotes))
for item in possible_remotes:
remote_pkgs.extend(juicer.utils.Remotes.assemble_remotes(item))
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def mute(returns_output=False):
""" `returns_output` - Returns all print output in a list. Capture or ignore all print output generated by a function. Usage: out... |
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
saved_stdout = sys.stdout
sys.stdout = cStringIO.StringIO()
try:
out = func(*args, **kwargs)
if returns_output:
out = sys.stdout.getvalue().strip()... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def save_url_as(url, save_as):
""" Download the file `url` and save it to the local disk as `save_as`. """ |
remote = requests.get(url, verify=False)
if not remote.status_code == Constants.PULP_GET_OK:
raise JuicerPulpError("A %s error occurred trying to get %s" %
(remote.status_code, url))
with open(save_as, 'wb') as data:
data.write(remote.content) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remote_url(connector, env, repo, filename):
""" return a str containing a link to the rpm in the pulp repository """ |
dl_base = connector.base_url.replace('/pulp/api/v2', '/pulp/repos')
repoid = '%s-%s' % (repo, env)
_r = connector.get('/repositories/%s/' % repoid)
if not _r.status_code == Constants.PULP_GET_OK:
# maybe the repo name is the repoid
_r = connector.get('/repositories/%s/' % repo)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def return_hdr(ts, package):
""" Hand back the hdr - duh - if the pkg is foobar handback None Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/... |
try:
fdno = os.open(package, os.O_RDONLY)
except OSError:
hdr = None
return hdr
ts.setVSFlags(~(rpm.RPMVSF_NOMD5 | rpm.RPMVSF_NEEDPAYLOAD))
try:
hdr = ts.hdrFromFdno(fdno)
except rpm.error:
hdr = None
raise rpm.error
if type(hdr) != rpm.hdr:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_sig_info(hdr):
""" hand back signature information and an error code Shamelessly stolen from Seth Vidal http://yum.baseurl.org/download/misc/checksig.py ... |
string = '%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|'
siginfo = hdr.sprintf(string)
if siginfo != '(none)':
error = 0
sigtype, sigdate, sigid = siginfo.split(',')
else:
error = 10... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def check_sig(package):
""" check if rpm has a signature, we don't care if it's valid or not at the moment Shamelessly stolen from Seth Vidal http://yum.baseurl.... |
rpmroot = '/'
ts = rpm.TransactionSet(rpmroot)
sigerror = 0
ts.setVSFlags(0)
hdr = return_hdr(ts, package)
sigerror, (sigtype, sigdate, sigid) = get_sig_info(hdr)
if sigid == 'None':
keyid = 'None'
else:
keyid = sigid[-8:]
if keyid != 'None':
return True
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def rpm_info(rpm_path):
""" Query information about the RPM at `rpm_path`. """ |
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
rpm_info = {}
rpm_fd = open(rpm_path, 'rb')
pkg = ts.hdrFromFdno(rpm_fd)
rpm_info['name'] = pkg['name']
rpm_info['version'] = pkg['version']
rpm_info['release'] = pkg['release']
rpm_info['epoch'] = 0
rpm_info['ar... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def upload_rpm(rpm_path, repoid, connector, callback=None):
"""upload an rpm into pulp rpm_path: path to an rpm connector: the connector to use for interacting w... |
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
info = rpm_info(rpm_path)
pkg_name = info['name']
nvrea = info['nvrea']
cksum = info['cksum']
size = info['size']
package_basename = info['package_basename']
juicer.utils.Log.log_notice("Expected amount to seek: %s ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def download_cart(cart_name, env):
""" accesses mongodb and return a cart spec stored there """ |
cart_con = cart_db()
carts = cart_con[env]
return carts.find_one({'_id': cart_name}) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_cart(base_url, env, cart_name):
""" returns a dict object representing a cart stored in pulp base_url: a str for the base_url (eg: http://sweet.pulp.repo... |
base_url = base_url.replace('/pulp/api/', '/pulp/repos')
url = '%s/%s/carts/%s.json' % (base_url, env, cart_name)
rsock = urllib2.urlopen(url)
data = rsock.read()
rsock.close()
return load_json_str(data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def search_carts(env, pkg_name, repos):
""" returns a list of carts containing a package with the specified name env: the name of an environment from the juicer ... |
db = cart_db()
carts = db[env]
for repo in repos:
field = 'repos_items.%s' % repo
value = '.*%s.*' % pkg_name
found_carts = []
for cart in carts.find({field: {'$regex': value}}):
found_carts.append(cart)
return found_carts |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def header(msg):
""" Wrap `msg` in bars to create a header effect """ |
# Accounting for '| ' and ' |'
width = len(msg) + 4
s = []
s.append('-' * width)
s.append("| %s |" % msg)
s.append('-' * width)
return '\n'.join(s) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def repo_in_defined_envs(repo, all_envs):
"""Raises exception if the repo references undefined environments""" |
remaining_envs = set(repo['env']) - set(all_envs)
if set(repo['env']) - set(all_envs):
raise JuicerRepoInUndefinedEnvs("Repo def %s references undefined environments: %s" %
(repo['name'], ", ".join(list(remaining_envs))))
else:
return True |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def repo_def_matches_reality(juicer_def, pulp_def):
"""Compare a juicer repo def with a given pulp definition. Compute and return the update necessary to make `p... |
return juicer.common.Repo.RepoDiff(juicer_repo=juicer_def, pulp_repo=pulp_def) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def chunk_list(l, n):
"""Return `n` size lists from a given list `l`""" |
return [l[i:i + n] for i in range(0, len(l), n)] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def readconf(conffile, section_name=None, log_name=None, defaults=None, raw=False):
""" Read config file and return config items as a dict :param conffile: path ... |
if defaults is None:
defaults = {}
if raw:
c = RawConfigParser(defaults)
else:
c = ConfigParser(defaults)
if hasattr(conffile, 'readline'):
c.readfp(conffile)
else:
if not c.read(conffile):
print ("Unable to read config file %s") % conffile
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def group_factory(bridge, number, name, led_type):
""" Make a group. :param bridge: Member of this bridge. :param number: Group number (1-4). :param name: Name o... |
if led_type in [RGBW, BRIDGE_LED]:
return RgbwGroup(bridge, number, name, led_type)
elif led_type == RGBWW:
return RgbwwGroup(bridge, number, name)
elif led_type == WHITE:
return WhiteGroup(bridge, number, name)
elif led_type == DIMMER:
return DimmerGroup(bridge, number,... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_group(self, number, name, led_type):
""" Add a group. :param number: Group number (1-4). :param name: Group name. :param led_type: Either `RGBW`, `WRGB`,... |
group = group_factory(self, number, name, led_type)
self.groups.append(group)
return group |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def send(self, command, reps=REPS, wait=MIN_WAIT):
""" Send a command to the physical bridge. :param command: A Command instance. :param reps: Number of repetiti... |
# Enqueue the command.
self._command_queue.put((command, reps, wait))
# Wait before accepting another command.
# This keeps individual groups relatively synchronized.
sleep = reps * wait * self.active
if command.select and self._selected_number != command.group_number:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _consume(self):
""" Consume commands from the queue. The command is repeated according to the configured value. Wait after each command is sent. The bridge s... |
while not self.is_closed:
# Get command from queue.
msg = self._command_queue.get()
# Closed
if msg is None:
return
# Use the lock so we are sure is_ready is not changed during execution
# and the socket is not in use
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _keep_alive(self):
""" Send keep alive messages continuously to bridge. """ |
send_next_keep_alive_at = 0
while not self.is_closed:
if not self.is_ready:
self._reconnect()
continue
if time.monotonic() > send_next_keep_alive_at:
command = KEEP_ALIVE_COMMAND_PREAMBLE + [self.wb1, self.wb2]
sel... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def close(self):
""" Closes the connection to the bridge. """ |
self.is_closed = True
self.is_ready = False
self._command_queue.put(None) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def from_body(cls, cemi):
"""Create a new CEMIMessage initialized from the given CEMI data.""" |
# TODO: check that length matches
message = cls()
message.code = cemi[0]
offset = cemi[1]
message.ctl1 = cemi[2 + offset]
message.ctl2 = cemi[3 + offset]
message.src_addr = cemi[4 + offset] * 256 + cemi[5 + offset]
message.dst_addr = cemi[6 + offset] * ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def init_group(self, dst_addr=1):
"""Initilize the CEMI frame with the given destination address.""" |
self.code = 0x11
# frametype 1, repeat 1, system broadcast 1, priority 3, ack-req 0,
# confirm-flag 0
self.ctl1 = 0xbc
self.ctl2 = 0xe0 # dst addr type 1, hop count 6, extended frame format
self.src_addr = 0
self.dst_addr = dst_addr |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def init_group_write(self, dst_addr=1, data=None, dptsize=0):
"""Initialize the CEMI frame for a group write operation.""" |
self.init_group(dst_addr)
# unnumbered data packet, group write
self.tpci_apci = 0x00 * 256 + 0x80
self.dptsize = dptsize
if data is None:
self.data = [0]
else:
self.data = data |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def init_group_read(self, dst_addr=1):
"""Initialize the CEMI frame for a group read operation.""" |
self.init_group(dst_addr)
self.tpci_apci = 0x00 # unnumbered data packet, group read
self.data = [0] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def to_body(self):
"""Convert the CEMI frame object to its byte representation.""" |
body = [self.code, 0x00, self.ctl1, self.ctl2,
(self.src_addr >> 8) & 0xff, (self.src_addr >> 0) & 0xff,
(self.dst_addr >> 8) & 0xff, (self.dst_addr >> 0) & 0xff]
if self.dptsize == 0 and (len(self.data) == 1) and ((self.data[0] & 0xC0) == 0):
# less than 6 b... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def disconnect(self):
"""Disconnect an open tunnel connection""" |
if self.connected and self.channel:
logging.debug("Disconnecting KNX/IP tunnel...")
frame = KNXIPFrame(KNXIPFrame.DISCONNECT_REQUEST)
frame.body = self.hpai_body()
# TODO: Glaube Sequence erhoehen ist nicht notwendig im Control
# Tunnel beim Disconn... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def check_connection_state(self):
"""Check the state of the connection using connection state request. This sends a CONNECTION_STATE_REQUEST. This method will on... |
if not self.connected:
self.connection_state = -1
return False
frame = KNXIPFrame(KNXIPFrame.CONNECTIONSTATE_REQUEST)
frame.body = self.hpai_body()
# Send maximum 3 connection state requests with a 10 second timeout
res = False
self.connection_s... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def hpai_body(self):
""" Create a body with HPAI information. This is used for disconnect and connection state requests. """ |
body = []
# ============ IP Body ==========
body.extend([self.channel]) # Communication Channel Id
body.extend([0x00]) # Reserverd
# =========== Client HPAI ===========
body.extend([0x08]) # HPAI Length
body.extend([0x01]) # Host Protocol
# Tunnel Cli... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def send_tunnelling_request(self, cemi, auto_connect=True):
"""Sends a tunneling request based on the given CEMI data. This method does not wait for an acknowled... |
if not self.connected:
if auto_connect:
if not self.connect():
raise KNXException("KNX tunnel not reconnected")
else:
raise KNXException("KNX tunnel not connected")
frame = KNXIPFrame(KNXIPFrame.TUNNELING_REQUEST)
# Co... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def group_read(self, addr, use_cache=True, timeout=1):
"""Send a group read to the KNX bus and return the result.""" |
if use_cache:
res = self.value_cache.get(addr)
if res:
logging.debug(
"Got value of group address %s from cache: %s", addr, res)
return res
cemi = CEMIMessage()
cemi.init_group_read(addr)
with self._lock:
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def group_write(self, addr, data, dptsize=0):
"""Send a group write to the given address. The method does not check if the address exists and the write request i... |
cemi = CEMIMessage()
cemi.init_group_write(addr, data, dptsize)
with self._lock:
self.send_tunnelling_request(cemi)
# Workaround for lost KNX packets
if self._write_delay:
time.sleep(self._write_delay) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def group_toggle(self, addr, use_cache=True):
"""Toggle the value of an 1-bit group address. If the object has a value != 0, it will be set to 0, otherwise to 1 ... |
data = self.group_read(addr, use_cache)
if len(data) != 1:
problem = "Can't toggle a {}-octet group address {}".format(
len(data), addr)
logging.error(problem)
raise KNXException(problem)
if data[0] == 0:
self.group_write(addr, [1... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def register_listener(self, address, func):
"""Adds a listener to messages received on a specific address If some KNX messages will be received from the KNX bus,... |
try:
listeners = self.address_listeners[address]
except KeyError:
listeners = []
self.address_listeners[address] = listeners
if not func in listeners:
listeners.append(func)
return True |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unregister_listener(self, address, func):
"""Removes a listener function for a given address Remove the listener for the given address. Returns true if the l... |
listeners = self.address_listeners[address]
if listeners is None:
return False
if func in listeners:
listeners.remove(func)
return True
return False |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def received_message(self, address, data):
"""Process a message received from the KNX bus.""" |
self.value_cache.set(address, data)
if self.notify:
self.notify(address, data)
try:
listeners = self.address_listeners[address]
except KeyError:
listeners = []
for listener in listeners:
listener(address, data) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def handle(self):
"""Process an incoming package.""" |
data = self.request[0]
sock = self.request[1]
frame = KNXIPFrame.from_frame(data)
if frame.service_type_id == KNXIPFrame.TUNNELING_REQUEST:
req = KNXTunnelingRequest.from_body(frame.body)
msg = CEMIMessage.from_body(req.cemi)
send_ack = False
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def float_to_knx2(floatval):
"""Convert a float to a 2 byte KNX float value""" |
if floatval < -671088.64 or floatval > 670760.96:
raise KNXException("float {} out of valid range".format(floatval))
floatval = floatval * 100
i = 0
for i in range(0, 15):
exp = pow(2, i)
if ((floatval / exp) >= -2048) and ((floatval / exp) < 2047):
break
if ... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def knx2_to_float(knxdata):
"""Convert a KNX 2 byte float object to a float""" |
if len(knxdata) != 2:
raise KNXException("Can only convert a 2 Byte object to float")
data = knxdata[0] * 256 + knxdata[1]
sign = data >> 15
exponent = (data >> 11) & 0x0f
mantisse = float(data & 0x7ff)
if sign == 1:
mantisse = -2048 + mantisse
return mantisse * pow(2, exp... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def time_to_knx(timeval, dow=0):
"""Converts a time and day-of-week to a KNX time object""" |
knxdata = [0, 0, 0]
knxdata[0] = ((dow & 0x07) << 5) + timeval.hour
knxdata[1] = timeval.minute
knxdata[2] = timeval.second
return knxdata |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def knx_to_time(knxdata):
"""Converts a KNX time to a tuple of a time object and the day of week""" |
if len(knxdata) != 3:
raise KNXException("Can only convert a 3 Byte object to time")
dow = knxdata[0] >> 5
res = time(knxdata[0] & 0x1f, knxdata[1], knxdata[2])
return [res, dow] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def date_to_knx(dateval):
"""Convert a date to a 3 byte KNX data array""" |
if (dateval.year < 1990) or (dateval.year > 2089):
raise KNXException("Year has to be between 1990 and 2089")
if dateval.year < 2000:
year = dateval.year - 1900
else:
year = dateval.year - 2000
return([dateval.day, dateval.month, year]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def knx_to_date(knxdata):
"""Convert a 3 byte KNX data object to a date""" |
if len(knxdata) != 3:
raise KNXException("Can only convert a 3 Byte object to date")
year = knxdata[2]
if year >= 90:
year += 1900
else:
year += 2000
return date(year, knxdata[1], knxdata[0]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def datetime_to_knx(datetimeval, clock_synced_external=1):
"""Convert a Python timestamp to an 8 byte KNX time and date object""" |
res = [0, 0, 0, 0, 0, 0, 0, 0]
year = datetimeval.year
if (year < 1900) or (year > 2155):
raise KNXException("Only years between 1900 and 2155 supported")
res[0] = year - 1900
res[1] = datetimeval.month
res[2] = datetimeval.day
res[3] = (datetimeval.isoweekday() << 5) + datetimeval... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def knx_to_datetime(knxdata):
"""Convert a an 8 byte KNX time and date object to its components""" |
if len(knxdata) != 8:
raise KNXException("Can only convert an 8 Byte object to datetime")
year = knxdata[0] + 1900
month = knxdata[1]
day = knxdata[2]
hour = knxdata[3] & 0x1f
minute = knxdata[4]
second = knxdata[5]
return datetime(year, month, day, hour, minute, second) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def saturation(self, saturation):
""" Set the group saturation. :param saturation: Saturation in decimal percent (0.0-1.0). """ |
if saturation < 0 or saturation > 1:
raise ValueError("Saturation must be a percentage "
"represented as decimal 0-1.0")
self._saturation = saturation
self._update_color()
if saturation == 0:
self.white()
else:
cmd... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def download_file_with_progress_bar(url):
"""Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object """ |
request = requests.get(url, stream=True)
if request.status_code == 404:
msg = ('there was a 404 error trying to reach {} \nThis probably '
'means the requested version does not exist.'.format(url))
logger.error(msg)
sys.exit()
total_size = int(request.headers["Content... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def extract_file_from_zip(bytes_io, expected_file):
"""Extracts a file from a bytes_io zip. Returns bytes""" |
zipf = zipfile.ZipFile(bytes_io)
return zipf.read(expected_file) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def extract_file_from_tar(bytes_io, expected_file):
"""extract a file from a bytes_io tar. Returns bytes""" |
with open('temp', 'wb+') as f:
bytes_io.seek(0)
shutil.copyfileobj(bytes_io, f, length=131072)
tar = tarfile.open('temp', mode='r:gz')
os.remove('temp')
return tar.extractfile(expected_file).read() |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def clean(outputdir, drivers=None):
"""Remove driver executables from the specified outputdir. drivers can be a list of drivers to filter which executables to re... |
if drivers:
# Generate a list of tuples: [(driver_name, requested_version)]
# If driver string does not contain a version, the second element
# of the tuple is None.
# Example:
# [('driver_a', '2.2'), ('driver_b', None)]
drivers_split = [helpers.split_driver_name_and... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def push(self, cart, env=None, callback=None):
""" `cart` - Release cart to push items from `callback` - Optional callback to call if juicer.utils.upload_rpm suc... |
juicer.utils.Log.log_debug("Initializing push of cart '%s'" % cart.cart_name)
if not env:
env = self._defaults['start_in']
cart.current_env = env
self.sign_cart_for_env_maybe(cart, env)
self.upload(env, cart, callback)
return True |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def publish(self, cart, env=None):
""" `cart` - Release cart to publish in json format Publish a release cart in JSON format to the pre-release environment. """ |
juicer.utils.Log.log_debug("Initializing publish of cart '%s'" % cart.cart_name)
if not env:
env = self._defaults['start_in']
cart_id = juicer.utils.upload_cart(cart, env)
juicer.utils.Log.log_debug('%s uploaded with an id of %s' %
(cart.... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_manifest(self, cart_name, manifests):
""" `cart_name` - Name of this release cart `manifests` - a list of manifest files """ |
cart = juicer.common.Cart.Cart(cart_name)
for manifest in manifests:
cart.add_from_manifest(manifest, self.connectors)
cart.save()
return cart |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list(self, cart_glob=['*.json']):
""" List all carts """ |
carts = []
for glob in cart_glob:
# Translate cart names into cart file names
if not glob.endswith('.json'):
search_glob = glob + ".json"
else:
search_glob = glob
for cart in juicer.utils.find_pattern(Constants.CART_LOCATI... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def search(self, pkg_name=None, search_carts=False, query='/content/units/rpm/search/'):
""" search for a package stored in a pulp repo `pkg_name` - substring in... |
# this data block is... yeah. searching in pulp v2 is painful
#
# https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/content/retrieval.html#search-for-units
# https://pulp-dev-guide.readthedocs.org/en/latest/rest-api/conventions/criteria.html#search-criteria
#
# t... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def merge(self, carts=None, new_cart_name=None):
""" `carts` - A list of cart names `new_cart_name` - Resultant cart name Merge the contents of N carts into a ne... |
if new_cart_name is not None:
cart_name = new_cart_name
else:
cart_name = carts[0]
result_cart = juicer.common.Cart.Cart(cart_name)
items_hash = {}
for cart in carts:
# 1. Grab items from each cart and shit them into result_cart
t... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def pull(self, cartname=None, env=None):
""" `cartname` - Name of cart Pull remote cart from the pre release (base) environment """ |
if not env:
env = self._defaults['start_in']
juicer.utils.Log.log_debug("Initializing pulling cart: %s ...", cartname)
cart_file = os.path.join(juicer.common.Cart.CART_LOCATION, cartname)
cart_file += '.json'
cart_check = juicer.utils.download_cart(cartname, env)
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def promote(self, cart_name):
""" `name` - name of cart Promote a cart from its current environment to the next in the chain. """ |
cart = juicer.common.Cart.Cart(cart_name=cart_name, autoload=True, autosync=True)
old_env = cart.current_env
cart.current_env = juicer.utils.get_next_environment(cart.current_env)
# figure out what needs to be done to promote packages. If
# packages are going between environmen... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def sign_cart_for_env_maybe(self, cart, env=None):
""" Sign the items to upload, if the env requires a signature. `cart` - Cart to sign `envs` - The cart is sign... |
if self.connectors[env].requires_signature:
cart.sync_remotes(force=True)
juicer.utils.Log.log_notice("%s requires RPM signatures", env)
juicer.utils.Log.log_notice("Checking for rpm_sign_plugin definition ...")
module_name = self._defaults['rpm_sign_plugin']
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def publish_repo(self, repo, env):
""" `repo` - Repo name. `env` - Environment. Publish a repository. This action regenerates metadata. """ |
_r = self.connectors[env].post('/repositories/%s-%s/actions/publish/' % (repo, env), {'id': 'yum_distributor'})
if _r.status_code != Constants.PULP_POST_ACCEPTED:
_r.raise_for_status()
else:
juicer.utils.Log.log_info("`%s` published in `%s`" % (repo, env)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def prune_repo(self, repo_name=None, daycount=None, envs=[], query='/repositories/'):
""" `repo_name` - name of the repository to prune """ |
orphan_query = '/content/orphans/rpm/'
t = datetime.datetime.now() - datetime.timedelta(days = daycount)
juicer.utils.Log.log_debug("Prune Repo: %s", repo_name)
juicer.utils.Log.log_debug("Pruning packages created before %s" % t)
for env in self.args.envs:
if not ju... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete(self, cartname):
""" `cartname` - name of the cart to delete Delete a cart both from your local filesystem and the mongo database """ |
cart = juicer.common.Cart.Cart(cart_name=cartname)
cart.implode(self._defaults['start_in']) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def reset(self):
"""Reset the instance - reset rows and header """ |
self._hline_string = None
self._row_size = None
self._header = []
self._rows = [] |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_cols_width(self, array):
"""Set the desired columns width - the elements of the array should be integers, specifying the width of each column. For exampl... |
self._check_row_size(array)
try:
array = map(int, array)
if reduce(min, array) <= 0:
raise ValueError
except ValueError:
sys.stderr.write("Wrong argument in column width specification\n")
raise
self._width = array |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _check_row_size(self, array):
"""Check that the specified array fits the previous rows size """ |
if not self._row_size:
self._row_size = len(array)
elif self._row_size != len(array):
raise ArraySizeError, "array should contain %d elements" \
% self._row_size |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def _check_align(self):
"""Check if alignment has been specified, set default one if not """ |
if not hasattr(self, "_align"):
self._align = ["l"]*self._row_size
if not hasattr(self, "_valign"):
self._valign = ["t"]*self._row_size |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def transition(value, maximum, start, end):
""" Transition between two values. :param value: Current iteration. :param maximum: Maximum number of iterations. :pa... |
return round(start + (end - start) * value / maximum, 2) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def steps(current, target, max_steps):
""" Steps between two values. :param current: Current value (0.0-1.0). :param target: Target value (0.0-1.0). :param max_s... |
if current < 0 or current > 1.0:
raise ValueError("current value %s is out of bounds (0.0-1.0)", current)
if target < 0 or target > 1.0:
raise ValueError("target value %s is out of bounds (0.0-1.0)", target)
return int(abs((current * max_steps) - (target * max_steps))) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def clean_email(self):
"""Check if email exists on Stormpath. The email address is unique across all Stormpath applications. The username is only unique within a... |
try:
accounts = APPLICATION.accounts.search({'email': self.cleaned_data['email']})
if len(accounts):
msg = 'User with that email already exists.'
raise forms.ValidationError(msg)
except Error as e:
raise forms.ValidationError(str(e))
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def clean_new_password2(self):
"""Check if passwords match and are valid.""" |
password1 = self.cleaned_data.get('new_password1')
password2 = self.cleaned_data.get('new_password2')
try:
directory = APPLICATION.default_account_store_mapping.account_store
directory.password_policy.strength.validate_password(password2)
except ValueError as e:... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_provider_directory(provider, redirect_uri):
"""Helper function for creating a provider directory""" |
dir = CLIENT.directories.create({
'name': APPLICATION.name + '-' + provider,
'provider': {
'client_id': settings.STORMPATH_SOCIAL[provider.upper()]['client_id'],
'client_secret': settings.STORMPATH_SOCIAL[provider.upper()]['client_secret'],
'redirect_uri': redire... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def draw_header(canvas):
""" Draws the invoice header """ |
canvas.setStrokeColorRGB(0.9, 0.5, 0.2)
canvas.setFillColorRGB(0.2, 0.2, 0.2)
canvas.setFont('Helvetica', 16)
canvas.drawString(18 * cm, -1 * cm, 'Invoice')
canvas.drawInlineImage(settings.INV_LOGO, 1 * cm, -1 * cm, 250, 16)
canvas.setLineWidth(4)
canvas.line(0, -1.25 * cm, 21.7 * cm, -1.25... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def draw_address(canvas):
""" Draws the business address """ |
business_details = (
u'COMPANY NAME LTD',
u'STREET',
u'TOWN',
U'COUNTY',
U'POSTCODE',
U'COUNTRY',
u'',
u'',
u'Phone: +00 (0) 000 000 000',
u'Email: example@example.com',
u'Website: www.example.com',
u'Reg No: 00000000'
... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def draw_footer(canvas):
""" Draws the invoice footer """ |
note = (
u'Bank Details: Street address, Town, County, POSTCODE',
u'Sort Code: 00-00-00 Account No: 00000000 (Quote invoice number).',
u'Please pay via bank transfer or cheque. All payments should be made in CURRENCY.',
u'Make cheques payable to Company Name Ltd.',
)
textobj... |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def mkmanpage(name):
"""Return man page content for the given `cmdln.Cmdln` subclass name.""" |
mod_name, class_name = name.rsplit('.', 1)
mod = __import__(mod_name)
inst = getattr(mod, class_name)()
sections = cmdln.man_sections_from_cmdln(inst)
sys.stdout.write(''.join(sections)) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def do_add(self, subcmd, opts, *args):
"""Put files and directories under version control, scheduling them for addition to repository. They will be added in next... |
print "'svn %s' opts: %s" % (subcmd, opts)
print "'svn %s' args: %s" % (subcmd, args) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def do_blame(self, subcmd, opts, *args):
"""Output the content of specified files or URLs with revision and author information in-line. usage: ${cmd_option_list}... |
print "'svn %s' opts: %s" % (subcmd, opts)
print "'svn %s' args: %s" % (subcmd, args) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def do_cat(self, subcmd, opts, *args):
"""Output the content of specified files or URLs. usage: ${cmd_option_list} """ |
print "'svn %s' opts: %s" % (subcmd, opts)
print "'svn %s' args: %s" % (subcmd, args) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def do_checkout(self, subcmd, opts, *args):
"""Check out a working copy from a repository. usage: Note: If PATH is omitted, the basename of the URL will be used ... |
print "'svn %s' opts: %s" % (subcmd, opts)
print "'svn %s' args: %s" % (subcmd, args) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.