query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Encodes a unicode string value. If length is not None, string will be encoded in that many bytes by padding with zero bytes at the end if necessary; otherwise, string will be encoded in the minimum number of bytes required. If string is None or empty, the minimum number of bytes required is 0.
def encode_unicode_string(string, length=None): if string is None: string = u'' return encode_string(string.encode('utf_8'), length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_string(string, length=None):\n\t\n\tif string is None:\n\t\tstring = ''\n\tif length is None:\n\t\tlength = len(string)\n\telse:\n\t\tif length < len(string):\n\t\t\traise ValueError('Cannot encode ASCII string value \\'%s\\' as it would have an encoded representation longer than %i bytes.' % (string, l...
[ "0.767021", "0.6686682", "0.6427545", "0.62561184", "0.6173009", "0.60829395", "0.604874", "0.60441947", "0.59263015", "0.5905118", "0.5867194", "0.58291274", "0.58199453", "0.5801667", "0.5739353", "0.5709479", "0.56947625", "0.5678443", "0.5666339", "0.56449556", "0.5629738...
0.80812365
0
Encodes a date (and time) value. If length is not None, it must be 8. If date is None, the current date (and time) will be encoded.
def encode_date(date, length=None): if date is None: date = datetime.datetime.utcnow() else: date = (date - date.utcoffset()).replace(tzinfo=None) if length is None: length = 8 elif length != 8: raise ValueError('Cannot encode date value %s with any length other than 8 bytes.') delta = date - datetime....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _serialize_date(val):\n return date_to_iso8601(val)", "def encode(self, out):\n out.write('<value><dateTime.iso8601>')\n out.write(self.ISO8601())\n out.write('</dateTime.iso8601></value>\\n')", "def _build_date_header_string(self, date_value):\n if isinstance(date_value, dat...
[ "0.5724597", "0.5458444", "0.53101397", "0.5277567", "0.5235816", "0.5217072", "0.5173354", "0.5105579", "0.51017845", "0.50887585", "0.50887585", "0.5072342", "0.5068085", "0.5049072", "0.50361735", "0.49964333", "0.49789947", "0.49599776", "0.4942363", "0.49380302", "0.4921...
0.7266683
0
A view to display the snap metrics page for specific snaps. This queries the snapcraft API (api.snapcraft.io) and passes some of the data through to the publisher/metrics.html template, with appropriate sanitation.
def publisher_snap_metrics(snap_name): try: details = api.get_snap_info(snap_name, flask.session) except ApiResponseErrorList as api_response_error_list: if api_response_error_list.status_code == 404: return flask.abort(404, 'No snap named {}'.format(snap_name)) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard(request):\r\n sources = (models.Source.objects.all().prefetch_related('metric_set')\r\n .order_by('name'))\r\n metrics = SortedDict([(src, src.metric_set.all()) for src in sources])\r\n no_source_metrics = models.Metric.objects.filter(source__isnull=T...
[ "0.6139491", "0.5675564", "0.56622356", "0.56502265", "0.5637216", "0.56152403", "0.55754566", "0.5571066", "0.5523046", "0.55194885", "0.5503837", "0.5472558", "0.5468756", "0.54010475", "0.53857857", "0.5364535", "0.52781934", "0.5275156", "0.5231627", "0.5185298", "0.51828...
0.63401514
0
Internal method to create the vlan
def _create_vlan(self, conn, vlan_id, vlan_name): req_js = {} req_js['vlan_id'] = vlan_id req_js['vlan_name'] = vlan_name req_js['admin_state'] = 'up' resp = conn.post(self.VLAN_REST_OBJ, req_js) self._check_process_resp(resp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vlan(module, switch, vlan_id, untagged_ports=None):\n global CHANGED_FLAG\n output = ''\n new_vlan = False\n\n cli = pn_cli(module)\n cli += ' vlan-show format id no-show-headers '\n existing_vlans = run_cli(module, cli)\n\n if existing_vlans is not None:\n existing_vlans = e...
[ "0.7631457", "0.7596661", "0.7389341", "0.6879706", "0.6829012", "0.6758097", "0.6750457", "0.6708634", "0.65839046", "0.65415335", "0.6410113", "0.6394555", "0.62769085", "0.627563", "0.62076235", "0.6198091", "0.6195562", "0.6098553", "0.60929865", "0.60900956", "0.6003036"...
0.8311395
0
Internal method to obtain a vlan list from the JSON answer from the switch
def _get_vlist(self, vlist): if vlist == "all": return list(range(1, 4095)) elif vlist == "none": return [] elif type(vlist) is not list: raise Exception("Unexpected vlan list: " + str(vlist)) else: return vlist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getvlanlistqos(self):\n self.activeL2 = []\n for _key, vals in self.activeDeltas.get('output', {}).get('vsw', {}).items():\n if self.hostname not in vals:\n continue\n if not self._started(vals):\n # This resource has not started yet. Continue....
[ "0.6287104", "0.61913794", "0.61913794", "0.6146818", "0.6119251", "0.61168694", "0.6099199", "0.6080975", "0.5961371", "0.5917994", "0.5802525", "0.57037127", "0.5664617", "0.5649243", "0.5640994", "0.5634522", "0.5574741", "0.55743223", "0.5557819", "0.5517332", "0.54337794...
0.6641528
0
Internal method to add an interface to a vlan
def _add_intf_to_vlan(self, conn, vlan_id, interface): obj = self.VLAN_IFACE_REST_OBJ + quote(interface, safe='') resp = conn.get(obj) intf_info = self._check_process_resp(resp, expected_fields=['vlans', 'pvid']) crt_vlist = self._get_vlist(intf_info['vlans']) if vlan_id in cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_vlan_interface(self, interface, vlan, vdc=None):\n\n assert isinstance(vlan, str)\n assert isinstance(interface, str)\n assert isinstance(vdc, list)\n\n self.logger.debug(\"Adding vlan {} on interface {} on {}\".format(vlan, interface, self.host))\n interface = interface....
[ "0.7485366", "0.731828", "0.6982859", "0.69538426", "0.6949254", "0.69354904", "0.6927724", "0.69218904", "0.69218534", "0.6919792", "0.67486256", "0.67223126", "0.6619775", "0.6603114", "0.6504253", "0.6485993", "0.6386412", "0.6374082", "0.63629794", "0.63511187", "0.635006...
0.81000566
0
Internal method to remove an interface from a vlan
def _rem_intf_from_vlan(self, conn, vlan_id, interface): obj = self.VLAN_IFACE_REST_OBJ + quote(interface, safe='') resp = conn.get(obj) intf_info = self._check_process_resp(resp, expected_fields=['vlans', 'pvid']) crt_vlist = self._get_vlist(intf_info['vlans']) if vlan_id not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeInterface(self, iTag):\r\n try:\r\n self._interfaces.pop(iTag).destroy()\r\n except KeyError:\r\n raise InvalidRequest('Can not remove a non existent interface '\r\n \"'{0}' from the container.\".format(iTag))", "def removeInterface(eT...
[ "0.73306924", "0.7166511", "0.71389544", "0.7129685", "0.70901126", "0.690891", "0.68292516", "0.6748917", "0.66998625", "0.6428983", "0.6420573", "0.6380873", "0.63587105", "0.631042", "0.62579733", "0.62219", "0.6208899", "0.61869425", "0.6180277", "0.6164293", "0.59940696"...
0.7742003
0
Delete a VLAN on CNOS Switch given the VLAN ID.
def delete_vlan(self, host, vlan_id): dbg_str = self._dbg_str(host, "delete", vlan_id) LOG.debug(dbg_str) conn = self._connect(host) obj = self.VLAN_REST_OBJ + str(vlan_id) resp = conn.delete(obj) conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,\n nexus_ports, nexus_ssh_port):\n with self.nxos_connect(nexus_host, int(nexus_ssh_port), nexus_user,\n nexus_password) as man:\n self.disable_vlan(man, vlan_id)\n fo...
[ "0.73512286", "0.7195779", "0.61573243", "0.5912095", "0.5757617", "0.56166625", "0.56166625", "0.5608929", "0.5604538", "0.55255765", "0.5510575", "0.5420813", "0.5378113", "0.53581333", "0.53156227", "0.53131396", "0.5274257", "0.5271216", "0.52442724", "0.52429545", "0.523...
0.8146904
0
Enable a VLAN on a trunk interface.
def enable_vlan_on_trunk_int(self, host, vlan_id, intf_type, interface): dbg_str = self._dbg_str(host, "enable", vlan_id, interface=interface, intf_type=intf_type) LOG.debug(dbg_str) conn = self._connect(host) try: if_name = self._get_ifname...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):\n confstr = snipp.CMD_VLAN_INT_SNIPPET % (interface, vlanid)\n confstr = self.create_xml_snippet(confstr)\n LOG.debug(\"NexusDriver: %s\" % confstr)\n mgr.edit_config(target='running', config=confstr)", "def enable_vlan(self,...
[ "0.7590937", "0.7415195", "0.6920978", "0.6819464", "0.6754836", "0.65986186", "0.654933", "0.6305326", "0.6186878", "0.61127704", "0.61040956", "0.60828656", "0.6076233", "0.6039879", "0.6023243", "0.5920099", "0.58604676", "0.5857415", "0.57966244", "0.5791491", "0.5783859"...
0.77450913
0
Disable a VLAN on a trunk interface.
def disable_vlan_on_trunk_int(self, host, vlan_id, intf_type, interface): dbg_str = self._dbg_str(host, "disable", vlan_id, interface=interface, intf_type=intf_type) LOG.debug(dbg_str) conn = self._connect(host) try: if_name = self._get_ifnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):\n confstr = snipp.CMD_NO_VLAN_INT_SNIPPET % (interface, vlanid)\n confstr = self.create_xml_snippet(confstr)\n LOG.debug(\"NexusDriver: %s\" % confstr)\n mgr.edit_config(target='running', config=confstr)", "def disable_vlan(...
[ "0.7633954", "0.7365873", "0.629412", "0.6195963", "0.6034605", "0.60002995", "0.586275", "0.57851255", "0.5776718", "0.5709069", "0.5685625", "0.5582934", "0.5580444", "0.5573443", "0.5540989", "0.553497", "0.5526246", "0.54849654", "0.5465475", "0.543249", "0.54125035", "...
0.7711181
0
Check if nslookupo is installed.
def nslookup_installed(self): p = subprocess.Popen(['which', 'nslookup'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() try: assert out except: raise Exception("nslookup not installed/path not set!" + err)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sox_check_is_available(self):\n result = self._process_command('sox -h', PIPE, supress_dry_run=True)\n return result[0] == 0", "def check_for_ofm():\n\n\n ofm_install_dir='/opt/OAM/oracle'\n\n if os.path.exists(ofm_install_dir):\n return True\n else:\n return False", "d...
[ "0.6332961", "0.6221205", "0.6125399", "0.60283935", "0.5855756", "0.5818892", "0.57912743", "0.5740148", "0.57179725", "0.5713891", "0.57102954", "0.5664744", "0.565263", "0.56521034", "0.5648172", "0.5633813", "0.56201327", "0.5598655", "0.5591079", "0.5537002", "0.5527956"...
0.78387725
0
Check if a valid mx is registered for email.
def valid_mx(self, domain): try: self.nslookup_installed() except: return True # Valid email as we cant check with nslookup p = subprocess.Popen(['nslookup', '-query=mx', domain], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_email_address(self, addr):\n\t\t# the call is blocking, so only syntactic analysis performed\n\t\t# To check if the SMTP server exists change check_mx to True\n\t\t# to check if email address exists change verify to true\n\t\treturn addr is not None and validate_email(addr, verify=False, check_mx=Fals...
[ "0.75095975", "0.6987129", "0.68919003", "0.68777835", "0.68476593", "0.68443197", "0.6831686", "0.67886734", "0.6766063", "0.67077845", "0.67023414", "0.669195", "0.6691277", "0.6673816", "0.6664297", "0.6645879", "0.6616947", "0.6608234", "0.6597531", "0.6597208", "0.657500...
0.8269448
0
R1.1 Write a short Python function, is multiple(n, m), that takes two integer values and returns True if n is a multiple of m, that is, n = mi for some integer i, and False otherwise.
def is_multiple(n,m): return n % m == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_multiple(n, m):\n # Check the given numbers are integer\n if m%n:\n # print('%d is NOT a multiple of %d' % (n, m))\n return False\n # print('%d is a multiple of %d' % (n, m))\n return True", "def is_multiple(m, n):\r\n return is_factor(n, m)", "def multiple(a, b):\n from fractions import...
[ "0.8371528", "0.7942244", "0.669205", "0.6469929", "0.6403683", "0.6281701", "0.6203486", "0.61840355", "0.6128225", "0.6118974", "0.6118564", "0.6103691", "0.6090323", "0.6056803", "0.60557157", "0.6026862", "0.60070634", "0.60041875", "0.6000506", "0.597297", "0.5967327", ...
0.837842
0
R1.2 Write a short Python function, is even(k), that takes an integer value and returns True if k is even, and False otherwise. However, your function cannot use the multiplication, modulo, or division operators.
def is_even(k): return k % 2 == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even(n):\n return n % 2 == 0", "def is_even(x):\n return x % 2 == 0", "def is_even(n):\r\n return n%2==0", "def even_func(n):\n if n % 2 != 0:\n\t return True\n else:\n\t return False", "def is_even(n):\n return n % 2 == 0", "def is_even(num):\n return num % 2 == 0", "def is...
[ "0.8349041", "0.8347722", "0.82932", "0.82759666", "0.82499087", "0.8155475", "0.81370467", "0.8117272", "0.8058837", "0.8041115", "0.7996009", "0.799383", "0.7927901", "0.7858357", "0.78557473", "0.7841799", "0.7677695", "0.75582236", "0.7492369", "0.7481421", "0.73071504", ...
0.87847537
0
R1.3 Write a short Python function, minmax(data), that takes a sequence of one or more numbers, and returns the smallest and largest numbers, in the form of a tuple of length two. Do not use the builtin functions min or max in implementing your solution.
def minmax(data): smallest = data[0] largest = data[0] for i in range(0,len(data)): if data[i] < smallest: smallest = data[i] elif data[i] > largest: largest = data[i] return(smallest,largest)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min_max(x):\n if not x: return None\n if len(x) == 1:\n return x[0], x[0] # the first is min and the second is max\n min_val = x[0]\n max_val = x[0]\n for i in xrange(1, len(x)):\n if x[i] < min_val:\n min_val = x[i]\n elif x[i] > max_val:\n max_val = x[i]", "def min_max(input):\...
[ "0.8156692", "0.8069395", "0.79071265", "0.7875383", "0.7786648", "0.774679", "0.7727443", "0.77216727", "0.77189654", "0.770506", "0.76852876", "0.76503164", "0.7635642", "0.7630576", "0.7630112", "0.75509715", "0.74221134", "0.7398315", "0.7334721", "0.73272157", "0.7309860...
0.8767605
0
R1.4 Write a short Python function that takes a positive integer n and returns the sum of the squares of all the positive integers smaller than n.
def sum_of_squares(n): sum = 0 for i in range(0,n): sum += i*i return sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_squares(n):\n result = i = 0\n while i < n:\n result += i\n i += 1\n return result", "def square_of_sum(n):\n return ((n * (n+1)) / 2)**2", "def get_squares(n):\n\n return sum([i * i for i in range(n)])", "def summation_i_squared(n):\n if (type(n) is not int) or (n is None) or (n...
[ "0.80294377", "0.79853344", "0.78627294", "0.77256685", "0.76655114", "0.74687475", "0.7336823", "0.7298889", "0.7235551", "0.72331804", "0.7198248", "0.71503437", "0.7097316", "0.7085109", "0.7082771", "0.70790446", "0.70434403", "0.70325416", "0.70190746", "0.70105416", "0....
0.80043674
1
R1.6 Write a short Python function that takes a positive integer n and returns the sum of the squares of all the odd positive integers smaller than n.
def sum_of_squared_odd_integers(n): sum = 0 for i in range(0,n): if not is_even(i): sum += i*i return sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_squares(n):\n result = i = 0\n while i < n:\n result += i\n i += 1\n return result", "def square_of_sum(n):\n return ((n * (n+1)) / 2)**2", "def summation_i_squared(n):\n if (type(n) is not int) or (n is None) or (n < 1):\n return None\n else:\n numbers = range(1, n +...
[ "0.7957466", "0.78197354", "0.7787986", "0.7767665", "0.7742555", "0.75771", "0.7507315", "0.73101366", "0.72760135", "0.72509027", "0.72495544", "0.71138245", "0.71133226", "0.7048654", "0.7025853", "0.7025389", "0.6998756", "0.6996542", "0.6989039", "0.69490373", "0.6906529...
0.8418517
0
Tests the FormatEventValues function.
def testFormatEventValues(self): formatter_helper = winlnk.WindowsShortcutLinkedPathFormatterHelper() output_mediator = self._CreateOutputMediator() event_values = { 'local_path': 'local', 'network_path': 'network', 'relative_path': 'relative', 'working_directory': 'cwd'} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_entry_formatted(self):\n\n valid_formats = test_case_data.get('valid_formats')\n for i, valid_entry in enumerate(test_case_data.get('valid_entries')):\n entry = [value.strip() for value in valid_entry.split(',')]\n format_fields = valid_formats[i].split(',')\n ...
[ "0.59977937", "0.5967646", "0.5820743", "0.5759357", "0.57466984", "0.56827056", "0.5622658", "0.56069773", "0.5603562", "0.55231214", "0.55042195", "0.5447949", "0.54212385", "0.5407104", "0.53939366", "0.5316329", "0.52923495", "0.5284623", "0.5283604", "0.52680486", "0.525...
0.6452932
0
Constructs blockdiagonal matrices from a list of batched 2D tensors.
def block_diagonal(matrices, dtype=tf.float32): matrices = [tf.convert_to_tensor(matrix, dtype=dtype) for matrix in matrices] blocked_rows = tf.Dimension(0) blocked_cols = tf.Dimension(0) batch_shape = tf.TensorShape(None) for matrix in matrices: full_matrix_shape = matrix.get_shape().with_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_diagonal(matrices, dtype=tf.float32):\n matrices = [tf.convert_to_tensor(matrix, dtype=dtype)\n for matrix in matrices]\n blocked_rows = tf.Dimension(0)\n blocked_cols = tf.Dimension(0)\n batch_shape = tf.TensorShape(None)\n for matrix in matrices:\n full_matrix_shape...
[ "0.6632318", "0.6613682", "0.655527", "0.5562392", "0.5511607", "0.5471755", "0.5449592", "0.54316026", "0.54224735", "0.53800976", "0.53526396", "0.53514004", "0.5349552", "0.53482145", "0.53291816", "0.52584076", "0.5256403", "0.52407396", "0.52090025", "0.51927626", "0.518...
0.6619513
1
Build the model based on input shape, Should not set the weight vector here. Add the cov_mode in 'channel' or 'feature', by using self.cov_axis. dimordering is only related to the axes
def build(self, input_shape): self.nb_samples = input_shape[0] self.nb_filter = input_shape[self.axis_filter] self.rows = input_shape[self.axis_row] self.cols = input_shape[self.axis_col] # Calculate covariance axis if self.cov_mode == 'channel' or self.cov_mode == 'mean...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self, input_shape):\n assert len(input_shape) == 4\n assert input_shape[1] == input_shape[2]\n self.out_channel = input_shape[3]\n # Create the weight vector\n self.W_shape = (input_shape[1], self.out_dim)\n if self.initial_weights is not None:\n self....
[ "0.66480196", "0.6532057", "0.6521643", "0.6499627", "0.64772135", "0.64514226", "0.6376306", "0.6376306", "0.6376306", "0.6291568", "0.620625", "0.617432", "0.61466074", "0.61054325", "0.60558105", "0.59994274", "0.59163713", "0.5893296", "0.5834461", "0.5818286", "0.5783313...
0.7741081
0
Takes state as an input and returns whether any row, column or diagonal has winning sum
def is_winning(self, curr_state): rows = [[0,1,2], [3,4,5], [6,7,8]] columns = [[0,3,6], [1,4,7], [2,5,8]] diagonal = [[0,4,8], [2,4,6]] total_checks = rows + columns + diagonal for row in total_checks: sum = 0 count = 0 for pos in row: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winGame(sub_state):\n for i in range(sub_state.shape[0] - 4):\n for j in range(sub_state.shape[1] - 4):\n\n horizontal = sub_state[i][j: j+5]\n if (horizontal == 1).all():\n return True\n\n vertical = [sub_state[i+k, j] for k in range(5)]\n i...
[ "0.749284", "0.72384614", "0.7143826", "0.71347356", "0.7003789", "0.6942889", "0.6825872", "0.68218696", "0.6766257", "0.6758062", "0.6746142", "0.6694622", "0.6652599", "0.6483859", "0.64308137", "0.64195764", "0.63758814", "0.63756716", "0.63717294", "0.63413304", "0.63279...
0.7706659
0
Takes player name and state("Tie", "Wins", "Resume") and returns the reward point.
def reward(self, player, winning_state): if winning_state == "Tie": return 1 elif winning_state == "Resume": return -1 else: if player == "agent": return 10 else: return -10
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reward(self, winner):\n if winner == self.side:\n return self.win\n elif winner == VALUES.NOT_FINISHED:\n return self.not_finished\n elif winner == VALUES.DRAW:\n return self.draw\n else:\n return self.lose", "def get_reward(self, state,...
[ "0.6712124", "0.66703135", "0.65894747", "0.65396965", "0.65204036", "0.6474245", "0.64200145", "0.6408229", "0.639958", "0.63809127", "0.6360077", "0.6195324", "0.6176956", "0.61682147", "0.61333364", "0.6126034", "0.6121866", "0.60988754", "0.6092131", "0.60882723", "0.6087...
0.77530974
0
Takes current state and action and calculates the next state, reward and whether the state is terminal. if the state is terminal then return "next state, reward and whether the state is terminal" else moves a action on behalf of the environment then check for the terminal state. return "next state, reward and whether t...
def step(self, curr_state, curr_action): next_state = self.state_transition(curr_state, curr_action) terminal_state = self.is_terminal(next_state) if terminal_state[0]: r = self.reward("agent", terminal_state[1]) return (next_state, r, terminal_state[0]) env_actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(action, state):\n observation = state\n reward = 0\n done = False\n if action == \"right\":\n if state == N_STATES - 2:\n observation = \"terminal\"\n reward = 1\n done = True\n else:\n observation = state + 1\n else:\n # move...
[ "0.7807881", "0.7628696", "0.74845535", "0.74601513", "0.7446418", "0.7419306", "0.74050623", "0.72824574", "0.7213155", "0.7183857", "0.71431434", "0.7132698", "0.7128764", "0.71049887", "0.7084979", "0.69734377", "0.6946418", "0.6937675", "0.6924034", "0.6917707", "0.690555...
0.7817324
0
Update the fuel level
def update_fuel_level(self, new_level): if new_level <= self.fuel_capacity: self.fuel_level = new_level else: print("The tank can't hold that much!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_fuel_level(self, new_level):\n if new_level <= self.fuel_capacity:\n self.fuel_level = new_level\n else:\n print(\"The tank can't hold that much!\")", "def fill_tank(self):\r\n self.fuel_level = self.fuel_capacity", "def fill_tank(self):\r\n self.fue...
[ "0.8437978", "0.6978361", "0.6875886", "0.6734152", "0.6734152", "0.66126984", "0.6569627", "0.65478694", "0.6462265", "0.6368785", "0.6341359", "0.63005227", "0.62760615", "0.62532747", "0.6235668", "0.61944497", "0.6095531", "0.60919964", "0.60911334", "0.60762244", "0.5965...
0.8435869
1
Fully charge the battery
def charge(self): self.charge_level = 100 print("The battery is fully charged.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge(self):\n self.battery.charge_level = 100\n print(\"The vehicle is fully charged.\")", "def recharge(self):\n self.battery=self.full\n return self", "def chargeBatteries(self):\n self.currentBattery = self.maxBattery", "def upgrade_battery(self):\n if self....
[ "0.84390914", "0.80580604", "0.79568815", "0.7461432", "0.7429325", "0.72544545", "0.69099885", "0.67663544", "0.6754951", "0.67086416", "0.6643831", "0.6616191", "0.6572158", "0.65373915", "0.6528965", "0.64400667", "0.62993145", "0.6283104", "0.62727743", "0.62706697", "0.6...
0.8490588
0
Fully charge the battery
def charge(self): self.charge_level = 100 print("The battery is fully charged.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charge(self):\n self.battery.charge_level = 100\n print(\"The vehicle is fully charged.\")", "def recharge(self):\n self.battery=self.full\n return self", "def chargeBatteries(self):\n self.currentBattery = self.maxBattery", "def upgrade_battery(self):\n if self....
[ "0.84390914", "0.80580604", "0.79568815", "0.7461432", "0.7429325", "0.72544545", "0.69099885", "0.67663544", "0.6754951", "0.67086416", "0.6643831", "0.6616191", "0.6572158", "0.65373915", "0.6528965", "0.64400667", "0.62993145", "0.6283104", "0.62727743", "0.62706697", "0.6...
0.8490588
1
Detect langauge with single files Print top 3 languages by calculated probabilities
def test_with_file(filename) : if not os.path.exists(filename) : print('File not exists: ' + filename) sys.exit(-1) with open(filename, 'r') as file : code = file.read() probabilities = shaman.Shaman.default().detect( code ) for index, (lang, prob) in enumerate(probabilities) : if index > 3: break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def languages_under_threshold(threshold):\n pattern = os.path.join(RAW_UD_DIR, \"**/stats.xml\")\n filenames = glob.glob(pattern, recursive=True)\n counts = {}\n for filename in filenames:\n dirname = os.path.split(os.path.split(filename)[0])[1]\n language = re.match(r\"UD_(\\w+)-\\w+\", ...
[ "0.6627985", "0.65451485", "0.6435339", "0.61776924", "0.61239266", "0.5942132", "0.59307855", "0.5883459", "0.5802732", "0.56879264", "0.56686944", "0.565978", "0.56555307", "0.5653617", "0.5626676", "0.5623794", "0.5621633", "0.56032014", "0.55965644", "0.556146", "0.555210...
0.6800087
0
Test shaman with code bunch and show statistics
def test_with_bunch(filename) : if not os.path.exists(filename) : print('File not exists: ' + filename) sys.exit(-1) # Read CSV file print('Load CSV file') csv.field_size_limit(sys.maxsize) # Set CSV limit to sys.maxsize filedata = [] with open(filename) as csvfile : reader = csv.reader(csvfile, delimit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advancedStats():", "def main():\n run_test_summary1a()\n run_test_summary1c()\n run_test_summary1c()", "def main():\n # openfile allows for CSV files with stored data of two columns\n # data = openfile(\"filename\")\n data = get_data()\n abtest = AB_test(data)\n abtest.stats()\n ...
[ "0.6047608", "0.6001579", "0.58882236", "0.58697474", "0.58620924", "0.5858933", "0.57972574", "0.5764803", "0.57267463", "0.5726342", "0.5672119", "0.5661863", "0.56588745", "0.56380284", "0.5638001", "0.5629084", "0.5626391", "0.56104237", "0.5604936", "0.56042784", "0.5594...
0.70309174
0
Retrieve all items from feedparser and return item group.
def get_item_group_from_feedparser(parser): items = list() logging.info('Loop for retrieving items.') for item in parser.entries: try: text, img_links = format_description(item.description) except AttributeError: continue if text: new_item = Item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_items(self) -> ItemGroup:\n return self.items + self.end_items", "def get_feed(self):\n possible_endings = ('rss', 'rss/')\n if not self.url or not self.url.endswith(possible_endings):\n print('Please check URL(is RSS?) and Internet connection')\n sys.exit()\n ...
[ "0.66909057", "0.6207676", "0.61145794", "0.60692966", "0.60141987", "0.59390336", "0.5935426", "0.58712643", "0.5840736", "0.5837247", "0.57131827", "0.5699384", "0.56978893", "0.569534", "0.5644567", "0.56367207", "0.56265616", "0.5611839", "0.5596622", "0.5581888", "0.5536...
0.8022566
0
Register new trait validators Validators are functions that take two arguments. The trait instance The proposed value Validators return the (potentially modified) value, which is either assigned to the HasTraits attribute or input into the next validator. They are evaluated in the order in which they are provided to th...
def valid(self, *validators): self.validators.extend(validators) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_validators__(cls) -> Generator:\n yield cls.validate_type\n yield cls.validate_strip\n yield cls.validate_allow_empty\n yield cls.validate_max_length\n yield cls.validate_min_length\n yield cls.validate_regex", "def run_validators(self, instance):\n runn...
[ "0.5872323", "0.5561476", "0.54354924", "0.5431917", "0.5313896", "0.5311366", "0.53065985", "0.53034836", "0.5269713", "0.5268002", "0.52480537", "0.52373815", "0.52329606", "0.52086073", "0.5208008", "0.5201789", "0.5191008", "0.51678544", "0.51134926", "0.5109251", "0.5103...
0.55916035
1
Respond to webhooks from GitHub, and schedule a deploy of openprescribing if required.
def handle_github_webhook(): verify_signature(request) logger.info("Received webhook") if should_deploy(request): schedule_deploy() return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_webhook():\n client = MongoClient(os.getenv('MONGODB_URI', 'mongodb://localhost:27017'))\n database = client.get_database()\n content = {\n \"event\": request.headers['X-GitHub-Event'],\n \"payload\" : request.json,\n \"date\": datetime.utcnow()\n }\n log.info(\"Content ...
[ "0.6360004", "0.62451583", "0.62366015", "0.6221253", "0.6029288", "0.5992066", "0.5974245", "0.59179014", "0.5909998", "0.5874397", "0.5837264", "0.5785646", "0.5744007", "0.5672457", "0.56719", "0.565825", "0.56557244", "0.5649183", "0.5608287", "0.5601791", "0.5566462", ...
0.765132
0
Return whether webhook is notification of merged PR.
def should_deploy(request): data = json.loads(request.data.decode()) if not data.get("pull_request"): return False return data["action"] == "closed" and data["pull_request"]["merged"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_requests_events(self) -> bool:\n return pulumi.get(self, \"merge_requests_events\")", "def developer_can_merge(self) -> bool:\n return pulumi.get(self, \"developer_can_merge\")", "def webhook(self) -> bool:\n return self._webhook", "def is_merged(self):\r\n url = '{0}/me...
[ "0.66809094", "0.61913437", "0.61083573", "0.6078729", "0.6057896", "0.6039898", "0.59575474", "0.58515614", "0.58104223", "0.56069255", "0.55534685", "0.55518025", "0.5517688", "0.5508094", "0.54978657", "0.54821813", "0.5456276", "0.54196197", "0.5404536", "0.5354527", "0.5...
0.6450411
1
Schedule a deploy of openprescribing.
def schedule_deploy(): logger.info("Scheduling deploy") scheduler.schedule_job("op_deploy", {}, "#general", 60)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy(self):\n\n if config.DISABLED:\n self.slacker.send_message(text=\"Automated deployment is currently disabled\")\n return\n\n error_message = None\n error_handling_message = None\n\n try:\n self.slacker.send_initial_message()\n self....
[ "0.5758096", "0.57364506", "0.5693856", "0.56879514", "0.5663628", "0.56551844", "0.56467056", "0.55459577", "0.5520883", "0.54729706", "0.5471408", "0.5468614", "0.54596496", "0.5452686", "0.54093903", "0.540098", "0.539234", "0.5377278", "0.5361808", "0.5356667", "0.5319141...
0.7438951
0
Reads the factory out calibration data from the sensor.
def _read_calibration_data(self): #Declare global variables. global calT1 global calT2 global calT3 global calP1 global calP2 global calP3 global calP4 global calP5 global calP6 global calP7 global calP8 global calP9...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_calibration_data(self):\n #Declare global variables.\n global calDig_T1\n global calDig_T2\n global calDig_T3\n global calDig_P1\n global calDig_P2\n global calDig_P3\n global calDig_P4\n global calDig_P5\n global calDig_P6\n gl...
[ "0.71217024", "0.6906478", "0.65084976", "0.6448128", "0.6225708", "0.61312425", "0.6033311", "0.6025293", "0.59822017", "0.5944658", "0.5881605", "0.58794683", "0.5878723", "0.5760936", "0.57594275", "0.5746166", "0.57372993", "0.5686483", "0.56592095", "0.5649173", "0.56101...
0.7414844
0
Reads the temperature in Celcius.
def read_temperature(self): self._force_read(False) tempADC = (self._read_register_1ubyte(self.BME680_TEMP_MSB) << 12) | (self._read_register_1ubyte(self.BME680_TEMP_LSB) << 4) | (self._read_register_1ubyte(self.BME680_TEMP_XLSB) >> 4) return float(self._compensate_temperature(tempADC))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_temperature(self):\n tRaw = self._read_multiple_bytes_as_array(self.BME280_TEMP_MSB, 3)\n\n return float(self._compensate_temperature((tRaw[0] << 12) + (tRaw[1] << 4) + (tRaw[2] >> 4)))", "def temperature(self):\r\n self._read_temperature()\r\n return self._t_fine / 5120.0", ...
[ "0.7472332", "0.7413375", "0.71938884", "0.71922195", "0.71804285", "0.7115894", "0.71154666", "0.71138585", "0.7070442", "0.7042722", "0.6996327", "0.69946086", "0.69454575", "0.69238776", "0.6917074", "0.6873807", "0.6859635", "0.68142503", "0.6769418", "0.67422277", "0.672...
0.74448055
1
Reads the gas resistance.
def read_gas_resistance(self): #Declare global variables global calAmbTemp self._force_read(True) tempADC = (self._read_register_1ubyte(self.BME680_TEMP_MSB) << 12) | (self._read_register_1ubyte(self.BME680_TEMP_LSB) << 4) | (self._read_register_1ubyte(self.BME680_TEMP_XLSB) >> 4) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calculate_gas_resistance(self, gasResADC, gasRange):\n var1 = (1340.0 + 5.0 * calRangeSwErr) * self.const_array1[gasRange]\n gasres = var1 * self.const_array2[gasRange] / (gasResADC - 512.0 + var1)\n\n return gasres", "def read_sensor(self):\n if not(self._GPS.inWaiting()):\n ...
[ "0.6827065", "0.61720914", "0.6020506", "0.5917194", "0.58992565", "0.5854627", "0.5616965", "0.55800164", "0.5470072", "0.539753", "0.53426933", "0.5341491", "0.530876", "0.5298415", "0.5279264", "0.5218888", "0.52117836", "0.5207684", "0.5201896", "0.5201896", "0.5201896", ...
0.8165772
0
Turns gas measurement on of off.
def _set_gas_measurement(self, state): configValue = self._read_register_1ubyte(self.BME680_CTRL_GAS_1) if state: configValue |= 0b00010000 else: configValue &= 0b11101111 self._write_register(self.BME680_CTRL_GAS_1, configValue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_off():\n print(\"Climate is within set parameters; toggling systems off if any are on\")\n GPIO.output(HEATPIN, RELAYOFF)\n GPIO.output(COOLPIN, RELAYOFF)\n GPIO.output(FANPIN, RELAYOFF)\n time.sleep(30)", "def turn_off(self) -> None:\n self._monoprice.set_power(self._zone_id, False...
[ "0.66417676", "0.6389058", "0.6315945", "0.62162507", "0.62027514", "0.6153018", "0.6067793", "0.6031992", "0.6024829", "0.60168517", "0.5983468", "0.59813344", "0.5962303", "0.5934796", "0.5877114", "0.5857398", "0.58535224", "0.5846446", "0.58265656", "0.58204895", "0.58173...
0.70230895
0
Selects heater setpoints of the sensor that will be used in forced mode.
def _select_heater_profile_setpoint(self, heaterProfileSetPoint): self._write_register(self.BME680_CTRL_GAS_1, heaterProfileSetPoint)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_temperature_setpoint(self, sensor: int = 0) -> float:\n\n return self.send(self.cmd.GET_HEATING_SET)", "def selectPointsUnderCursor(self):\n spw = self.spw\n sw = spw.windows['Sort']\n #if clear:\n # sw.uslist.clearSelection()\n # sw.nlist.clearSelection()\...
[ "0.60011315", "0.5823642", "0.58023965", "0.5757047", "0.5636404", "0.55220574", "0.5483506", "0.54810137", "0.54692733", "0.5395391", "0.539065", "0.539065", "0.53760564", "0.5352368", "0.5352368", "0.5352368", "0.53485", "0.53194255", "0.5300638", "0.52894765", "0.525459", ...
0.6833454
0
Gets the measuring status from the measuring bit.
def _get_measuring_status(self): readValue = self._read_register_1ubyte(self.BME680_EAS_STATUS_0) return True if ((readValue & 0b00100000) == 0b00100000) else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_measuring(self):\n # 5.4.4 of the datasheet indicates the relevant bit\n return bool(self.read_register(STATUS_REGISTER) & 0b1000)", "def get_status(self):\n return self.read_register(259, 0, 3)", "def _get_gas_measuring_status(self):\n readValue = self._read_register_1ubyte(...
[ "0.74913454", "0.6834237", "0.67496985", "0.66019297", "0.6462662", "0.6429869", "0.63869196", "0.6380483", "0.6370173", "0.62545604", "0.61403817", "0.60864043", "0.6005302", "0.5991951", "0.5972578", "0.5960065", "0.59573734", "0.59388775", "0.5938068", "0.58929276", "0.589...
0.7793847
0
Gets the gas measurement running status from the gas_measuring bit.
def _get_gas_measuring_status(self): readValue = self._read_register_1ubyte(self.BME680_EAS_STATUS_0) return True if ((readValue & 0b01000000) == 0b01000000) else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_measuring_status(self):\n readValue = self._read_register_1ubyte(self.BME680_EAS_STATUS_0)\n\n return True if ((readValue & 0b00100000) == 0b00100000) else False", "def _get_state(self):\n # gst's get_state function returns a 3-tuple; we just want the\n # status flag in posit...
[ "0.64783454", "0.6166575", "0.60416126", "0.58871764", "0.57596236", "0.5689763", "0.5662393", "0.5607609", "0.5563968", "0.54711574", "0.54394174", "0.543099", "0.5428076", "0.53595954", "0.5358985", "0.53451943", "0.5344086", "0.5331095", "0.5327449", "0.5326428", "0.532067...
0.7603017
0
Gets the new data status from the new_data_0 bit.
def _get_new_data_status(self): readValue = self._read_register_1ubyte(self.BME680_EAS_STATUS_0) return True if ((readValue & 0b10000000) == 0b10000000) else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_status(self):\n return self._data_status", "def get_status_change(self):\n if self.sync:\n raise EvseError\n else:\n self.s.timeout = STATUS_SERIAL_TIMEOUT\n try:\n # Wait to have read all status changes, only r...
[ "0.6424852", "0.6095555", "0.605685", "0.5687604", "0.5621028", "0.55922186", "0.5559561", "0.5553617", "0.553137", "0.54944646", "0.54361564", "0.543615", "0.54132366", "0.5403323", "0.5380978", "0.5380281", "0.5365272", "0.53526986", "0.5352144", "0.5324474", "0.5282123", ...
0.7379734
0
Calculates the gas resistance value.
def _calculate_gas_resistance(self, gasResADC, gasRange): var1 = (1340.0 + 5.0 * calRangeSwErr) * self.const_array1[gasRange] gasres = var1 * self.const_array2[gasRange] / (gasResADC - 512.0 + var1) return gasres
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_gas_resistance(self):\n #Declare global variables\n global calAmbTemp\n\n self._force_read(True)\n\n tempADC = (self._read_register_1ubyte(self.BME680_TEMP_MSB) << 12) | (self._read_register_1ubyte(self.BME680_TEMP_LSB) << 4) | (self._read_register_1ubyte(self.BME680_TEMP_XLSB)...
[ "0.7424543", "0.6458559", "0.62149584", "0.60597813", "0.5962129", "0.5946117", "0.5726567", "0.57199657", "0.5710259", "0.5682893", "0.56405044", "0.5573024", "0.55585086", "0.55473596", "0.5523489", "0.55159694", "0.5502452", "0.54643905", "0.5432481", "0.54260075", "0.5403...
0.8136932
0
Calculates the heater resistance value for target heater resistance (Res_Heat_X) registers.
def _calculate_heater_resistance(self, target_temp): if target_temp > 400: #Maximum temperature target_temp = 400 var1 = (calGH1 / 16.0) + 49.0 var2 = ((calGH2 / 32768.0) * 0.0005) + 0.00235 var3 = calGH3 / 1024.0 var4 = var1 * (1.0 + (var2 * target_temp)) va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_rh(self):\n # Check for existence of relative humidity and mixing ratio\n if self.data.get('Relative_Humidity') is None:\n if self.data.get('Mixing_Ratio') is None:\n raise KeyError('Calculate mixing ratio first!')\n else:\n # Convert ...
[ "0.6653677", "0.63635665", "0.627075", "0.6125248", "0.61126965", "0.596542", "0.59286654", "0.5855786", "0.58437425", "0.5801681", "0.575991", "0.5756518", "0.5743732", "0.57369804", "0.571821", "0.5709005", "0.56955355", "0.56486726", "0.56474954", "0.5625354", "0.56228983"...
0.8003939
0
Calculates the heat duration value for gas sensor wait time (Gas_Wait_X) registers.
def _calculate_heat_duration(self, dur): factor = 0 if dur >= 0xFC: durval = 0xFF #Max duration else: while dur > 0x3F: dur = dur / 4 factor += 1 durval = dur + (factor * 64) return durval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration_heat(hobo, start, stop):\n alltimes = []\n heat = 0\n numsecs = 0\n for i, t in enumerate(hobo[\"Temp\"][start:stop]):\n if t > TEMP_FLOOR:\n alltimes.append(hobo[\"Time\"][start:stop][i])\n heat += 1/60.0 * t\n numsecs+=1\n if len(alltimes) <...
[ "0.599682", "0.59321666", "0.5847238", "0.5448632", "0.5400374", "0.5340993", "0.53396577", "0.5307082", "0.52992976", "0.5287324", "0.52762055", "0.5265241", "0.5240982", "0.5224939", "0.5192386", "0.51915663", "0.5187416", "0.51819605", "0.5175851", "0.5164746", "0.51548237...
0.61812806
0
Displays a list of frames as a gif, with controls
def display_frames_as_gif(frames): fig=e.cube.show_layout(frames[0]) print("Drawn") def animate(i): return e.cube.update_plot(frames[i]) anim = animation.FuncAnimation(fig, animate, frames = len(frames), interval=50,blit=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_frames_as_gif(frames, video_name):\n Writer = animation.writers['ffmpeg']\n writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)\n #plt.figure(figsize=(frames[0].shape[1] / 72.0, frames[0].shape[0] / 72.0), dpi = 72)\n patch = plt.imshow(frames[0])\n plt.axis('off')\n\n d...
[ "0.76119715", "0.71236277", "0.7042929", "0.6867904", "0.67848575", "0.6775757", "0.65968764", "0.65791255", "0.65526974", "0.64830047", "0.6472306", "0.63823146", "0.6369557", "0.63643175", "0.63487417", "0.62859285", "0.6275347", "0.62657946", "0.6251682", "0.6240307", "0.6...
0.7992077
0
Unpacks PulsOn 440 radar data from input file
def unpack(file, legacy=False): with open(file, 'rb') as f: # Read configuration part of data config = read_config_data(f, legacy) # Compute range bins in datas scan_start_time = float(config['scan_start']) start_range = SPEED_OF_LIGHT * ((scan_start...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ultrasound_file(ult_file):\n\n return np.fromfile(open(ult_file, \"rb\"), dtype=np.uint8)", "def read_file(file_name):\n with open(file_name) as _r:\n _pixlst = []\n for line in _r:\n if line != \"P3\\n\":\n _new = (line[0:len(line)-1]).split()\n ...
[ "0.6108896", "0.60031384", "0.5972908", "0.58290946", "0.5767763", "0.5736228", "0.5688039", "0.5659347", "0.56520563", "0.5646419", "0.56407017", "0.56059176", "0.5591827", "0.5586289", "0.55750364", "0.555982", "0.5557788", "0.55496544", "0.5542967", "0.55423784", "0.549800...
0.6623841
0
Toplevel function; parses input arguments, unpacks, data, visualizes, and saves as specified.
def main(args): args = parse_args(args) data = unpack(args.file, args.legacy) # Save (pickle) unpacked data if args.output: with open(args.output, 'wb') as o: pickle.dump(data, o) # Visualize RTI of unpacked data plt.ioff() if args.visualize: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args):\n store = load_store(args[0])\n plot_results(store)", "def main(self, args):\n for plot in args.plots:\n if plot == 'no_plot':\n break\n print \"plotting\", plot\n\n fig = self.plot_figure(plot)\n\n fformat = '{plot}_{index}....
[ "0.6782887", "0.6492774", "0.6399592", "0.6310535", "0.63039184", "0.62853914", "0.62499887", "0.6249845", "0.62321824", "0.62204987", "0.6176843", "0.6153333", "0.6132459", "0.61147785", "0.6088031", "0.60847205", "0.60838467", "0.6082143", "0.60812175", "0.6076454", "0.6059...
0.65542376
1
Attempts posting the given message object to the Slack webhook URL. Returns whether it was successful and a message.
def post_message(webhook_url, message): try: r = requests.post(webhook_url, json=message) return (True, 'success') except Exception as e: return (False, 'Encountered exception:\n' + render_exception(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def POST(self):\n\t\t\n\t\tjson_data = web.data()\t\t# Get the POST data sent from Webex Teams\n\t\t#print(\"\\nWEBHOOK POST RECEIVED:\")\n\t\t#print(json_data, \"\\n\")\n\n\t\twebhook_obj = Webhook(json_data)\t\t\t\t\t# Create a Webhook object from the JSON data\n\t\troom = api.rooms.get(webhook_obj.data.roomId)\...
[ "0.6807432", "0.67728895", "0.6759316", "0.67405164", "0.66744787", "0.65220207", "0.6502214", "0.64369917", "0.63452196", "0.62901783", "0.6260779", "0.6220804", "0.6216543", "0.62135977", "0.6197983", "0.6164749", "0.6160069", "0.6132825", "0.61189944", "0.61077684", "0.608...
0.77357167
0
Devuelve la suma vectorial del punto con otro
def suma(self, punto): return Punto(self.x + punto.x, self.y + punto.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_u(self):\r\n try:\r\n # add the velocity to the sum\r\n self.usum.vector()[:] += self.u.vector()[:]\r\n except AttributeError:\r\n # initialize the sum\r\n self.usum = self.u.copy(deepcopy=True)", "def sum(self, vector):\n\n # return (self....
[ "0.71630436", "0.69149196", "0.6770859", "0.67064846", "0.6686128", "0.66519445", "0.66498464", "0.6621804", "0.6469203", "0.6439289", "0.63715935", "0.62124455", "0.61895216", "0.61871326", "0.6182731", "0.61651784", "0.61395836", "0.6125996", "0.612322", "0.6100205", "0.609...
0.7140406
1
Devuelve la distancia que hay entre un punto y otro
def distancia(self, punto): return math.hypot(self.x - punto.x, self.y - punto.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distancia_puntos(c, p):\n return sqrt((c[0] - p[0]) ** 2 + (c[1] - p[1]) ** 2)", "def distancia_entre_pontos(self,alvo2):\r\n dx=(self.x-alvo2.x)\r\n dy=(self.y-alvo2.y)\r\n d= (dx**2+dy**2)**(0.5)\r\n return (d)", "def longitud_traza(self):\n ret = 0\n for p in...
[ "0.6478211", "0.638097", "0.6140013", "0.60774446", "0.58267605", "0.5753614", "0.57391477", "0.57173127", "0.5672191", "0.56569993", "0.56324476", "0.5625881", "0.55910504", "0.55438286", "0.55047625", "0.54844713", "0.54778695", "0.5465789", "0.5450436", "0.54482967", "0.54...
0.71193194
0
Devuelve la suma de la distancia entre todos los puntos de la traza
def longitud_traza(self): ret = 0 for p in range(len(self.trazado) - 1): ret += self.trazado[p].distancia(self.trazado[p + 1]) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __puntuacion_total(self):\n disparos = []\n for disparo in self.__disparos:\n total = 0\n for puntaje in disparo['disparos']:\n total += puntaje\n disparo['puntaje_total'] = total\n disparos.append(disparo)\n return disparos", "d...
[ "0.63509035", "0.63000715", "0.6285634", "0.6270727", "0.6205262", "0.6132128", "0.61022985", "0.60933185", "0.60696536", "0.60631347", "0.60308516", "0.6000166", "0.59741116", "0.5951304", "0.5924809", "0.59240574", "0.5920021", "0.5906155", "0.59006757", "0.588481", "0.5870...
0.6934641
0
Guardamos la traza en un fichero de trazas
def dump_traza(self, fichero='traza.txt'): fichero = open(fichero, 'w', encoding="utf-8") for punto in self.trazado: fichero.write("{},{}\n".format(punto.x, punto.y)) fichero.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sauvegarde(self):\r\n\r\n # On vérifie que le fichier existe\r\n # 'exists' est un booléen\r\n exists = os.path.isfile(\"cartes/Save.txt\")\r\n if exists:\r\n # Le fichier existe => On l'ouvre en écriture 'r'\r\n with open (\"cartes/Save.txt\",\"w\") as f: ...
[ "0.63704485", "0.5973614", "0.5912231", "0.58983153", "0.5778904", "0.574426", "0.56545985", "0.55945206", "0.5563073", "0.5560659", "0.5557928", "0.55568653", "0.5552029", "0.5526614", "0.5488401", "0.54509485", "0.5440159", "0.54183996", "0.5412198", "0.5400755", "0.5335931...
0.61642146
1
A function which uses the terminal to obtain league type (PPR or STD), football position to analyze (WR, RB, QB, or TE), count of players to consider in analysis, and the ranking system which will be used in comparing players (ADP or 2020 points). All input is validated, and user is prompted to reenter value if invalid...
def obtain_user_input(): league_types = ['PPR', 'STD'] # possible acceptable league types while True: # continue till valid entry given try: league_type = input("Enter a League Type (PPR or STD): ").upper() # obtain value from user if league_type in league_types: # check i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n rows, columns = 4, 4 # Default values , but code still raises error for invalid values\n player = utils.ChompConstants.RANDOM_PLAYER\n try:\n print \"please enter number of rows and columns in the format rows,columns\"\n\n line = sys.stdin.readline()\n rows, columns = i...
[ "0.6069962", "0.59162676", "0.59067506", "0.5811739", "0.5786312", "0.5738742", "0.570796", "0.5704204", "0.5641191", "0.5592344", "0.5560812", "0.55152655", "0.55101913", "0.547794", "0.5470004", "0.54673237", "0.539613", "0.5393253", "0.53876203", "0.5368746", "0.53557014",...
0.7307757
0
Function to check validity of geometry. Returns message from shapely explain_validity if geometry is not 'Valid Geometry'
def checkGeom(geodataframe): for geometry in geodataframe.geometry: if explain_validity(geometry) != 'Valid Geometry': print(explain_validity(geometry))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(geometry, **kwargs):\n # GEOS is valid will emit warnings for invalid geometries. Suppress them.\n with warnings.catch_warnings():\n warnings.simplefilter(\"ignore\")\n result = lib.is_valid(geometry, **kwargs)\n return result", "def is_valid_input(geometry, **kwargs):\n re...
[ "0.7565475", "0.73883", "0.7276694", "0.68129945", "0.6384362", "0.61632794", "0.5965307", "0.5846777", "0.57979864", "0.57457507", "0.5741132", "0.57201403", "0.5715252", "0.5680332", "0.56434864", "0.56265503", "0.56112087", "0.559224", "0.55789375", "0.5569323", "0.5562957...
0.7736684
0
Function to calculate area in an elevation bin
def areaDiff(outline, elevation_bin): # clip outlines by selected elevation range outline_elev_range = gpd.clip(outline, elevation_bin, keep_geom_type=(True)) # check that clipped dataframe is not empty if outline_elev_range.empty == True: return # compute area in km2 elev_range_area = o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _area(bounds):\n return (bounds[0, 1] - bounds[0, 0]) * (bounds[1, 1] - bounds[1, 0])", "def area(base, height):\n\n return base * height", "def area(self):\n area = 0\n last = self._coordinates[-1]\n for c in self._coordinates:\n area += (last[0] * c[1] - last[1] * c[...
[ "0.7171744", "0.71552455", "0.6993266", "0.69465905", "0.69129664", "0.6903076", "0.6811765", "0.6786784", "0.67410374", "0.67035943", "0.6682889", "0.6672353", "0.6643346", "0.664125", "0.66277117", "0.66274273", "0.6622953", "0.6606407", "0.65836245", "0.6577894", "0.657150...
0.7495222
0
Return a new unique sync tag
def new_tag(): le = string.ascii_lowercase t = ''.join(random.choices(le, k=20)) while t in all_sync_tags: t = ''.join(random.choices(le, k=20)) all_sync_tags.add(t) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tag_id():\n return uuid.uuid1().int", "def createTag(self, authenticationToken, tag):\r\n self.send_createTag(authenticationToken, tag)\r\n return self.recv_createTag()", "def getTag(self, authenticationToken, guid):\r\n pass", "def make_new_tag():\n return render_template('tags/new...
[ "0.62505513", "0.56550485", "0.56387246", "0.5599261", "0.558294", "0.55687135", "0.5543639", "0.5533843", "0.5482269", "0.5446016", "0.544561", "0.5414786", "0.54113275", "0.54055285", "0.5397922", "0.5373642", "0.53623354", "0.53584146", "0.5357138", "0.53550625", "0.534264...
0.7618487
0
registers new employee if it doesn't exist already, this endpoint simulates assigning a new ID card to an employee, clearly it should be more safe, but it's just a proofofconcept
def post(self): data = EmployeeRegister.parser.parse_args() new_employee_id = str(uuid.uuid4()) while EmployeeModel.find_by_id(new_employee_id): # if this id is already in use new_employee_id = str(uuid.uuid4()) employee = EmployeeModel(**data, employee_id=new_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_employee(self, emp):\n if emp not in self.employees: \n self.employees.append(emp)", "def post(self):\n try:\n employee = self.service.add_employee(self.schema, request.json)\n except ValidationError as error:\n return error.messages, 400\n ret...
[ "0.6609442", "0.64850783", "0.6450674", "0.6334512", "0.6303371", "0.6245234", "0.62444776", "0.62165225", "0.6213903", "0.5938434", "0.5893202", "0.5867312", "0.58529997", "0.5807562", "0.57994485", "0.57916015", "0.57680196", "0.5753179", "0.5741416", "0.57294977", "0.56830...
0.76200646
0
Method to update employee's leaving hour
def put(self, employee_id): employee = EmployeeModel.find_by_id(employee_id) if employee is None: return {'message': "There is no employee with this ID, or your access_token is invalid."}, 404 else: """ check if employee entered the building today""" if Workd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_employee_hours(employee_id):\n\n if not g.user:\n flash(\"Please login to access\", \"danger\")\n return redirect(\"/\")\n \n if g.user.is_admin == False:\n flash (\"Unauthorized\", \"danger\")\n return redirect(\"/login\")\n\n employee = Employee.query.get_or_404(e...
[ "0.64333826", "0.5945568", "0.57471985", "0.5737567", "0.5651217", "0.5611653", "0.5606795", "0.54742", "0.54296553", "0.5410231", "0.53905296", "0.5327935", "0.5319459", "0.5316585", "0.52996814", "0.52969134", "0.5270735", "0.52602905", "0.5255247", "0.52484876", "0.5234647...
0.627576
1
Print a block comment.
def visit_BlockComment(self, node): self.statement(node, '# ', node.text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_comment(text, print_it=verbose):\n prefix = \"OpenCortex >>> \"\n if not isinstance(text, str): text = text.decode('ascii')\n if print_it:\n \n print(\"%s%s\"%(prefix, text.replace(\"\\n\", \"\\n\"+prefix)))", "def print_comment(comment):\n shell_type = get_shell_type()\n i...
[ "0.7078967", "0.7035818", "0.7000854", "0.695872", "0.6889346", "0.68382823", "0.6794366", "0.67424977", "0.65199393", "0.6411115", "0.6377719", "0.63107145", "0.6256651", "0.62330985", "0.6216712", "0.6200628", "0.6191166", "0.61645734", "0.61290085", "0.6125789", "0.6109207...
0.73441315
0
Generate a fixture of a N boxes stacked on top of each other.
def generate_fixture(args): numpy.random.seed(0) fixture = generate_custom_fixture(args) rigid_bodies = fixture["rigid_body_problem"]["rigid_bodies"] # Add the walls around the scene rigid_bodies.append(generate_walls_body(5, 2.5, numpy.zeros(2), 0.1)) # Compactor Box hx = hy = 2.49 co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate_fixtures(x_width = 36, y_height = 18, total = 250, x_offset = 0):\n locations = make_locations(x_width, y_height, total, x_offset)\n fixtures = []\n i, j = 0, 0\n count = 0\n for grid_loc in locations:\n strand = int(count >= total/2)\n address = j if strand else i\n ...
[ "0.66509384", "0.6036204", "0.59422326", "0.5922679", "0.5865083", "0.58285034", "0.57747674", "0.5755702", "0.57453465", "0.568772", "0.5643712", "0.56390977", "0.5622649", "0.5610604", "0.5604136", "0.559819", "0.5593206", "0.55846983", "0.5539007", "0.55231494", "0.5519309...
0.6461276
1
Calculating the normalized neighbourhood overlap.
def normalized_overlap(g, node_1, node_2): inter = len(set(nx.neighbors(g, node_1)).intersection(set(nx.neighbors(g, node_2)))) unio = len(set(nx.neighbors(g, node_1)).union(set(nx.neighbors(g, node_2)))) return float(inter)/float(unio)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOverlap(self):\n return 0.5", "def compute_overlap(*skymaps):\n unnormalized_overlap = PosteriorOverlap.compute_overlap(*skymaps)\n normalization = np.prod([np.sqrt(PosteriorOverlap.compute_overlap(m, m)) for m in skymaps])\n return unnormalized_overlap/normalization", "def i...
[ "0.66266763", "0.6368387", "0.6056134", "0.5999228", "0.5978528", "0.59704894", "0.59460926", "0.5935743", "0.58963656", "0.5891573", "0.58719146", "0.5843902", "0.5823797", "0.5811197", "0.57964134", "0.57797056", "0.57779235", "0.57479924", "0.574257", "0.57185054", "0.5651...
0.73428935
0
Calculating the neighbourhood overlap.
def overlap(g, node_1, node_2): inter = len(set(nx.neighbors(g, node_1)).intersection(set(nx.neighbors(g, node_2)))) return float(inter)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOverlap(self):\n return 0.5", "def test_compute_overlap(self):\n # box1 contained in box2\n box1 = ((1, 2), (1, 2), (1, 2))\n box2 = ((1, 3), (1, 3), (1, 3))\n mapping = {box1: [1, 2, 3, 4], box2: [1, 2, 3, 4, 5]}\n # box1 in box2, so complete overlap\n np.testing.assert_almost_eq...
[ "0.6983282", "0.6632185", "0.6528971", "0.6492257", "0.6400367", "0.6400291", "0.63989437", "0.63979554", "0.6350108", "0.6338968", "0.62794214", "0.62794214", "0.62794214", "0.62617904", "0.624703", "0.62280715", "0.6203708", "0.6187105", "0.6181", "0.6174696", "0.61660254",...
0.6898663
1
Return versioned array id (vaid) of given array.
def vaid_of(array_name): out, err = _iquery("project(filter(list(), name='%s'), aid)" % array_name) assert not err, "vaid_of(%s): %s" % (array_name, err) return int(out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_array(self):\n arr = vtk.vtkIdTypeArray()\n arr.SetNumberOfTuples(10)\n for i in range(10):\n arr.SetValue(i, i)\n\n np = array_handler.vtk2array(arr)\n self.assertEqual(numpy.all(np == range(10)), True)", "def var_id(v):\n return int(sort_vid_split(v)...
[ "0.61143994", "0.5726958", "0.56174165", "0.54893047", "0.5298593", "0.5218144", "0.52055526", "0.5196827", "0.5168587", "0.5163445", "0.51513404", "0.5083556", "0.50828665", "0.50716835", "0.5052853", "0.50496644", "0.5016242", "0.4994614", "0.49887702", "0.49685732", "0.496...
0.70972586
0
Return number of chunks belonging to versioned array id.
def chunk_count(vaid): out, err = _iquery("op_count(filter(list('chunk map'), aid=%s))" % vaid) assert not err, "chunk_count(%d): %s" % (vaid, err) return int(out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_chunks(self) -> int:", "def __len__(self):\n return len(self.chunk_idxes)", "def __len__(self):\n return int(np.floor(len(self.ids) / self.batch_size))", "def __len__(self):\n return int(np.ceil(len(self.ids) / self.batch_size))", "def nbytes_at(self, device_id:int):\n ...
[ "0.71213675", "0.6593226", "0.65833646", "0.6546409", "0.6395126", "0.6382367", "0.63469714", "0.6336943", "0.63361317", "0.63361317", "0.63361317", "0.6185124", "0.6171325", "0.6039143", "0.6017741", "0.5986888", "0.5986888", "0.5986888", "0.5922008", "0.5917017", "0.5905501...
0.7171841
0
Check that op_sum(A, v) has not changed.
def check_v_sum(array_name, _cache=[]): out, err = _iquery("op_sum(%s, v)" % array_name) assert not err, err if _cache: assert int(out) == _cache[0], "Botched v_sum for %s, %d != %d" % ( array_name, int(out), _cache[0]) else: _cache.append(int(out)) # first time called
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSum(self):\n v1 = Vector(1, 2, 3)\n v2 = Vector(4, 5, 6)\n v1 += v2\n assert(len(v1) == 3)\n assert v1[0] == 5\n assert v1[1] == 7\n assert v1[2] == 9\n\n v1 = Vector(9, 8, 7)\n v2 = Vector(3, 2, 1)\n v1 -= v2\n assert len(v1) == ...
[ "0.637257", "0.5820792", "0.5779", "0.5767484", "0.56957155", "0.5638339", "0.5478448", "0.5453015", "0.5421094", "0.54178804", "0.5413575", "0.5394133", "0.53363997", "0.5283651", "0.52814555", "0.52740484", "0.5267448", "0.5267146", "0.5264312", "0.525895", "0.5255837", "...
0.7003059
0
Create and populate a sparse 1D array
def test_00_create_sparse_1d_array(self): ncells = 100 sparsity = 3.0 # 1 / density _, err = _iquery("create array SPARSE <v:int64>[i=0:{0}:0:5]".format( ncells - 1)) assert not err, err self._array_cleanups.append('SPARSE') _, err = _iquery(""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_sparse_array(nrows, ncols, numdense):\n i = np.random.randint(0, nrows, numdense)\n j = np.random.randint(0, ncols, numdense)\n data = np.random.randint(1,6, numdense)\n ij = np.vstack((i,j))\n return coo_matrix((data, ij), shape=(nrows, ncols))", "def sparse_arrays(self):\n ...
[ "0.71825373", "0.66514", "0.6513404", "0.6452924", "0.6380768", "0.6377167", "0.6348528", "0.6330041", "0.6302284", "0.6241798", "0.61816955", "0.6154298", "0.613083", "0.6126021", "0.61147606", "0.6100277", "0.60781777", "0.6071155", "0.6064589", "0.6050834", "0.60501486", ...
0.7363228
0
Store sparse array as dataframe, count its chunks
def test_01_sparse_to_dataframe(self): # Flatten it... _, err = _iquery("store(flatten(SPARSE, _fast:1), DF1)") assert not err, err self._array_cleanups.append('DF1') check_v_sum('DF1') self._df1_chunks = chunk_count(vaid_of("DF1")) prt("DF1 has", self._df1_chunks...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_03_dataframe_to_dataframe_w_chunksize(self):\n _, err = _iquery(\"store(flatten(DF1, cells_per_chunk:5), DF3)\")\n assert not err, err\n self._array_cleanups.append('DF3')\n check_v_sum('DF3')\n nchunks = chunk_count(vaid_of('DF3'))\n prt(\"DF3 has\", nchunks, \"c...
[ "0.6456923", "0.5865638", "0.56612635", "0.55825573", "0.554153", "0.5540921", "0.5509572", "0.54847276", "0.5471713", "0.5466125", "0.54371566", "0.54337186", "0.54298437", "0.5423725", "0.53340304", "0.53340304", "0.53180075", "0.5286216", "0.52625686", "0.52534467", "0.524...
0.7013152
0
Flatten dataframe, count its chunks
def test_03_dataframe_to_dataframe_w_chunksize(self): _, err = _iquery("store(flatten(DF1, cells_per_chunk:5), DF3)") assert not err, err self._array_cleanups.append('DF3') check_v_sum('DF3') nchunks = chunk_count(vaid_of('DF3')) prt("DF3 has", nchunks, "chunks") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataframe(df, size=10*1024*1024):\n \n # size of each row\n row_size = df.memory_usage().sum() / len(df)\n # maximum number of rows in each segment\n row_limit = int(size // row_size)\n # number of segments\n seg_num = (len(df)+row_limit-1)//row_limit\n # split df into segments\n ...
[ "0.55937415", "0.5507937", "0.54977316", "0.5456596", "0.5417001", "0.5410339", "0.5401076", "0.53553766", "0.5336983", "0.5258876", "0.5255928", "0.5173464", "0.51511943", "0.51219285", "0.5075425", "0.5065466", "0.50600725", "0.5052522", "0.5038662", "0.5030685", "0.5019869...
0.69134265
0
Backup existing files on the brick
def backup(self): print('Backing up old files...') # Connect with SSH-PubKey and execute backup script subprocess.run( ['ssh', '-i', self.ssh_key, '-o', 'StrictHostKeyChecking=no', 'robot@{}'.format(self.settings['ip']), '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup(self):\n import datetime\n suffix = datetime.datetime.now().strftime('%Y-%m-%d--%H-%M-%S')\n self.host.run(\"test -f '%s' && cp --archive '%s' '%s.%s'\" % (\n esc1(self.remote_path), esc1(self.remote_path), esc1(self.remote_path), esc1(suffix)), use_sudo=self....
[ "0.7280091", "0.72603893", "0.7211053", "0.70917225", "0.6888577", "0.6637755", "0.66374135", "0.6588424", "0.6553806", "0.6354943", "0.6346993", "0.6306411", "0.62706614", "0.6256193", "0.62332964", "0.62142336", "0.6199961", "0.6179149", "0.61658937", "0.6149443", "0.614350...
0.7271961
1
Sync tmux log files from the brick
def sync_log(self): print('Synchronizing log files...') # Connect with SSH-PubKey and synchronize files subprocess.run( ['scp', '-i', self.ssh_key, '-o', 'StrictHostKeyChecking=no', 'robot@{}:/home/robot/.bin/*_tmux.log'.format(self.set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_log(self):\n path = 'cluster_test_%d/*.log' % self.address[1]\n src = \"%s@%s:%s\" % (self.user_name, self.address[0], path)\n dest = console_config._log_path\n self._rsync(src, dest)", "def on_sync(self):\r\n self.log()", "def syncfolder():", "def half_sync(sel...
[ "0.547929", "0.5306486", "0.5175514", "0.51524365", "0.5145392", "0.51048654", "0.5079055", "0.50145", "0.49152136", "0.48880646", "0.48853272", "0.48685476", "0.4839569", "0.48215026", "0.48070493", "0.4798888", "0.47862107", "0.47659576", "0.47457623", "0.47331905", "0.4709...
0.68553907
0
Spawn or enter tmux session on brick
def start_session(self): print('Executing code by running main.run()...') print('This will open a tmux session...') print('Detach by pressing CTRL + B and then D') # Connect with SSH-PubKey and execute tmux script subprocess.run( ['ssh', '-i', se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spawn_new_player(self):\n tmux_invocation = [\n \"tmux\",\n \"new-session\",\n \"-s\" + TMUX_SESSION,\n \"-d\",\n \"mpv\",\n \"--no-video\",\n \"--term-playing-msg='${media-title}'\",\n \"--idle\",\n \"--i...
[ "0.68385357", "0.6351222", "0.5950426", "0.59079456", "0.56734586", "0.55592453", "0.5482646", "0.54711634", "0.5442813", "0.5436716", "0.5426566", "0.5411375", "0.5282083", "0.527828", "0.52543235", "0.52416134", "0.5238465", "0.5235764", "0.52201277", "0.51940924", "0.51906...
0.7530098
0
Encode image with a string message
def encode(self, message: str) -> None: image = self._original_image.copy() width, height = image.size pixels = image.load() binary_string = self._str_to_binary_string(message + self._end_message) tribit_list = self._split(binary_string, 3) for x_pixel in range(width): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_image(text_to_encode, template_image=\"images/template_image.jpg\"):\n raw_image = Image.open(template_image)\n hidden_message = write_text(text_to_encode,raw_image.size)\n\n x_size = raw_image.size[0]\n y_size = raw_image.size[1]\n\n red_channel = raw_image.split()[0]\n green_channe...
[ "0.76174825", "0.73806465", "0.72276026", "0.70634276", "0.7042137", "0.7014503", "0.69983274", "0.69705254", "0.6827233", "0.6813788", "0.6795161", "0.6782491", "0.67447793", "0.67383826", "0.670622", "0.66467685", "0.6555731", "0.65072614", "0.6477626", "0.647758", "0.64643...
0.7751032
0
Writes tribit to least significant bit from rgb_binary
def _write_to_lsb(tribit: str, rgb_binary: tuple): pixel = [] for idx, bit in enumerate(tribit): color = rgb_binary[idx] color = color[:-1] + bit pixel.append(color) return pixel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_bin(raw):\n a = raw.astype('i1')\n b = a.reshape((-1,2))\n\n b[:,1] = b[:,1] << 4\n\n c = np.bitwise_or(b[:,0], b[:,1]).astype('i1')\n\n return c", "def bits_trippling_1(self):\n bits = np.array((self.image_bits))\n trippled_binary_image_bits = np.repeat(bits, 3)\n r...
[ "0.6628151", "0.64629143", "0.61405724", "0.5996231", "0.5852563", "0.57310355", "0.56961316", "0.56845534", "0.5677184", "0.5675389", "0.56743044", "0.55681384", "0.5384145", "0.53511864", "0.5309095", "0.5308535", "0.5290116", "0.5257985", "0.5249753", "0.5248542", "0.52226...
0.71159714
0
Split string every n characters.
def _split(string: str, n: int): return [string[start : start + n] for start in range(0, len(string), n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_n(s, n):\n return [s[k:k + n] for k in range(0, len(s), n)]", "def split_string(self, string, n):\n if len(string) == 0:\n return ['']\n blocks = []\n while len(string) > 0:\n blocks.append(string[:n])\n string = string[n:]\n return blocks", "def split_text(text, n=...
[ "0.80854625", "0.7924512", "0.75947547", "0.7311565", "0.7300342", "0.71256155", "0.71256155", "0.68727595", "0.6869807", "0.6779561", "0.6720155", "0.6628983", "0.65802544", "0.6482735", "0.6408883", "0.6385943", "0.63355434", "0.6279037", "0.62563705", "0.6196401", "0.61926...
0.8229423
0
Completes to_complete with values from from_complete If to_complete has 1 elements and from_complete as 3, to_complete will use the second and third element from from_complete so it also has 3 elements.
def _complete_list(to_complete: list, from_complete: list): to_complete_ = list(to_complete).copy() from_complete_ = list(from_complete).copy() if len(to_complete_) < len(from_complete_): n_missing_elements = len(from_complete_) - len(to_complete_) start = n_missing_ele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete_from(items):\n\tdef _complete_from(value):\n\t\treturn [item for item in items if item.startswith(value)]\n\treturn _complete_from", "def updateComplete(self, *complete):\n logging.debug(\"TrackerPlugin.updateComplete\")\n for compId in complete:\n logging.debug(\" ==> %s\" ...
[ "0.5467402", "0.5387442", "0.52731854", "0.5196483", "0.51670575", "0.51334935", "0.50406903", "0.50155085", "0.49640566", "0.49159864", "0.48628876", "0.48535612", "0.48504254", "0.4824803", "0.47936085", "0.47081947", "0.47073206", "0.47061732", "0.4705893", "0.46864438", "...
0.76695764
0
Returns filepath with PNG extension if it's a file.
def _path_as_png(filepath: str): if filepath.strip() == "": raise ValueError("filepath can't be an empty string.") path = pathlib.Path(filepath) suffixes = "".join(path.suffixes) if os.path.exists(filepath): if os.path.isfile(filepath): if suffixe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_png(filename):\n return filename.endswith(b'.png')", "def is_png(filename):\n return '.png' in filename", "def _find_image_ext(path):\n path = os.path.splitext(path)[0]\n for ext in _KNOWN_IMG_EXTS:\n this_path = '%s.%s' % (path, ext)\n if os.path.isfile(this_path):\n ...
[ "0.7268116", "0.71624845", "0.69784033", "0.672529", "0.66180915", "0.6581395", "0.6564302", "0.6558797", "0.6526752", "0.64238316", "0.6350032", "0.6303604", "0.6257442", "0.62152123", "0.6204774", "0.6203161", "0.6196211", "0.6186159", "0.61727136", "0.61570424", "0.6152094...
0.7661993
0
Found and display substitutes for a product
def substitutes(request, product_id): init_product = get_object_or_404(Products, pk=product_id) products_found = ProductSearch.found_substitutes(init_product.id) messages.info(request, "Nous avons trouvé {0} produits de substitution dans les mêmes catégories." .format(len(products_found)))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_substitutes(cls, product):\n\n category = product.categories.filter(\n searched_substitutes=True,\n productcategory__hierarchy=1).first()\n\n subsitutes = None\n\n if category:\n return cls.generate_substitutes(\n product.bar_code,\n ...
[ "0.67562854", "0.6741626", "0.66725636", "0.6664862", "0.66409796", "0.6627699", "0.6562932", "0.6493325", "0.63820267", "0.63766164", "0.6330927", "0.6310053", "0.6287836", "0.626841", "0.6152721", "0.6040688", "0.5910014", "0.58678854", "0.58667576", "0.5832024", "0.5771979...
0.6868002
0
Display de detail from a product or a substitute
def details(request, product_id): product_details = get_object_or_404(Products, pk=product_id) nutriments = Nutriments_for_100g.objects.filter(product__id=product_id).order_by('name') context = { 'product_details': product_details, 'nutriments': nutriments } return render(request, 's...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_product(product):\r\n try:\r\n print(\"\\n \\\r\n Name : {} \\n \\\r\n Categories : {} \\n \\\r\n Nutri-score : {} \\n \\\r\n Stores : {} \\n \\\r\n URL : {}\".format(product.name, product.category, product.nutri_score, product.stores, product.url))\r\n exc...
[ "0.7263358", "0.71141523", "0.6908048", "0.68864816", "0.67568904", "0.6677145", "0.6650507", "0.6637801", "0.6524712", "0.6523428", "0.64774793", "0.64149374", "0.64149374", "0.6338022", "0.6332276", "0.6321999", "0.6311512", "0.6261198", "0.62156713", "0.61998343", "0.61792...
0.7369542
0
Save a substitute to user favorites
def save_substitute(request, product_id, substitute_id): if request.user.is_authenticated: user = User.objects.get(email=request.user) product = Products.objects.get(pk=product_id) substitute = Products.objects.get(pk=substitute_id) favorite, created = User_Favorites_Substitutes.obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_save(request):\n user = request.user\n substitue = request.GET.get(\"substitute\")\n substitue_save = Product.objects.get(bar_code=substitue)\n Favorite().save_substitute(user, substitue_save)\n return render(request, \"product_save.html\")", "def save(self, substitute_choice, product_...
[ "0.71354175", "0.7133762", "0.6571042", "0.63845503", "0.6290186", "0.6239941", "0.6232621", "0.61713314", "0.6128515", "0.6091594", "0.6022413", "0.59865403", "0.5984862", "0.5930945", "0.58496684", "0.5839323", "0.58326", "0.57967466", "0.5777408", "0.5763475", "0.573645", ...
0.72641677
0
Display legal information page
def legal_informations(request): search_form = SearchForm() return render(request, 'store/legal_informations.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about_us():\r\n return render_template(\"about_us.html\")", "def about():\n return render_template('about.html', name=\"COMP3161\")", "def about(display=True):\n\n ABOUT_TEXT = \"\"\"\nPre-release version %s (%s) of Topographica; an updated\nversion may be available from topographica.org.\n\nThis ...
[ "0.65167505", "0.6457249", "0.64172536", "0.6407424", "0.63967574", "0.63759035", "0.635504", "0.6349891", "0.6302798", "0.62222546", "0.6198414", "0.61954117", "0.61598647", "0.61598545", "0.6151713", "0.6129883", "0.612893", "0.6119594", "0.611289", "0.60535777", "0.6033135...
0.67501324
0
List all running tasks in celery cluster.
def list_running_tasks(): inspector = current_app.control.inspect() return inspector.active()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def list_tasks():", "def list_tasks(ctx):\n ctx.run(\"invoke --list\")", "def get_all_tasks(self):\n \n sql = \"select * from tasks;\"\n return self._query_all(sql)", "def running_celery_tasks(request):\n active_dict = CELERY_INSPECT.active()\n active_tasks = []\n if ac...
[ "0.7468916", "0.7429295", "0.7344537", "0.72350264", "0.72047365", "0.7158147", "0.7124159", "0.704976", "0.7041104", "0.70325136", "0.6956148", "0.68982744", "0.68271524", "0.6805224", "0.6719134", "0.66953963", "0.66717124", "0.66668403", "0.6621016", "0.6605144", "0.660193...
0.7789473
0
List all pending tasks in celery cluster.
def list_pending_tasks(): inspector = current_app.control.inspect() return inspector.reserved()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def list_tasks():", "def get_all_tasks(self):\n \n sql = \"select * from tasks;\"\n return self._query_all(sql)", "def get_tasks(self):\n res = self.conn.cursor().execute(\"SELECT * FROM tasks\")\n return res.fetchall()", "def list_tasks(ctx):\n ctx.run(\"invoke --...
[ "0.72895366", "0.7213486", "0.69447947", "0.69211185", "0.6787877", "0.6744746", "0.66711265", "0.6660217", "0.66435874", "0.6641994", "0.6600015", "0.6590029", "0.6586447", "0.6581198", "0.6568957", "0.6564936", "0.65496856", "0.6547459", "0.65401983", "0.65289634", "0.64908...
0.7790457
0
List all cubebuilder queues from RabbitMQ.
def list_queues(): url = urlparse(Config.RABBIT_MQ_URL) response = requests.get(f'http://{url.hostname}:{15672}/api/queues?columns=name,messages,'\ 'messages_ready,messages_unacknowledged', auth=(url.username, url.password)) tasks = dict() for ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_queues(self, rabbitmq):\n assert rabbitmq.list_queues() == []\n self.declare_queue(rabbitmq, \"q1\")\n self.declare_queue(rabbitmq, \"q2\")\n assert sorted(rabbitmq.list_queues()) == [('q1', '0'), ('q2', '0')]", "def get_queues(client, vhost):\n queues = [q['name'] fo...
[ "0.7151527", "0.6858554", "0.66987884", "0.6643073", "0.6562609", "0.6492137", "0.6451427", "0.6451427", "0.6451427", "0.6451427", "0.6451427", "0.6451427", "0.6451427", "0.6451427", "0.6451427", "0.643472", "0.64085114", "0.64054704", "0.63528615", "0.63358766", "0.63355196"...
0.80229163
0
override in derived classes for sync message handling.
def on_bus_sync_message(self, bus, message): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ServerSyncReceived(self,message):", "def handle_message(self, message):", "def _process_message(self, obj):\n pass", "def _post_sync(self):", "def receive_message(self, message):", "def receive(self, message):", "def handle(self, message):", "def handle_sync(self, msg):\r\n sync_tim...
[ "0.7478748", "0.6711212", "0.6566708", "0.6561405", "0.65306646", "0.6376309", "0.63734615", "0.63328946", "0.63304394", "0.62693197", "0.6239421", "0.62309617", "0.62223047", "0.6183614", "0.61670405", "0.61285347", "0.6119206", "0.61129934", "0.61129934", "0.6110656", "0.60...
0.71168035
1
Creates a GstElement with given gst_element_name and given name. The element is added to the pipeline and then returned.
def make_add_element(self, gst_element_name, name): gst_element = Gst.ElementFactory.make(gst_element_name, name) self.pipeline.add(gst_element) return gst_element
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_name(self, name: str) -> Gst.Element:\n return self._pipeline.get_by_name(name)", "def create_element(self, identifier: str, element_name: str) -> Device:\n return self.create_device(identifier, element_name)", "def do_create_element(self, url):\n return Gst.parse_launch(self.la...
[ "0.7124529", "0.62078166", "0.5940582", "0.5928817", "0.57957655", "0.57712245", "0.56956804", "0.5585596", "0.5563", "0.55610055", "0.55026335", "0.5501805", "0.54937184", "0.53615123", "0.5342537", "0.53318554", "0.5249141", "0.5218752", "0.51981115", "0.51981115", "0.51896...
0.89544076
0
Links srcpad of src GstElement to sinkpad of sink GstElement.
def link_elements(self, src, sink): if not src.link(sink): print("## link_elements") print(" > could not link") print(" > src", src.get_name()) print(" > sink", sink.get_name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_tee(self, src, dsts, add=0):\n\n assert len(dsts) > 0, \"Can't create tee with no sink elements\"\n print(dsts)\n\n if len(dsts) == 1:\n dst = dsts[0]\n if add:\n try:\n self.player.add(dst)\n except gi.overrides.G...
[ "0.61755735", "0.6094177", "0.57895654", "0.54711366", "0.5314869", "0.53079176", "0.52786434", "0.5232174", "0.5232174", "0.51972157", "0.5194326", "0.5159687", "0.5120356", "0.50792754", "0.4984781", "0.49830544", "0.49303395", "0.48805597", "0.48634282", "0.48546082", "0.4...
0.6440755
0
Connects callback function to signal referenced by signal_name of given GstElement.
def register_callback(self, gst_element, signal_name, function): gst_element.connect(signal_name, function)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe_signal(self, callback, path, interface, member):\n self.signal_callbacks[(path, interface, member)] = callback", "def listen(obj, name, func):\n _signals(obj, name).append(func)", "def connect(signal):\n def wrapper(func):\n REGISTRY.setdefault(signal, Signal(signal)).connect(...
[ "0.6389137", "0.58640015", "0.5755713", "0.57476836", "0.56703514", "0.55926126", "0.5354876", "0.5258272", "0.5236602", "0.5223873", "0.5129828", "0.5115865", "0.51120317", "0.5089601", "0.50870824", "0.50854546", "0.5078233", "0.5072436", "0.5070898", "0.50288254", "0.50162...
0.82274467
0
Extract the target_image option.
def parse_options(self, extra): options = super().parse_options(extra) self.target_image = options.pop("target") return options
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_options(self, command):\n super().clone_options(command)\n self.target_image = command.target_image", "def builder_will_create_target_image(self, builder, target, image_id, template, parameters):", "def get_target(self, ):\n return self.get_parameter('target')", "def create_tar...
[ "0.6502962", "0.61017686", "0.5989055", "0.5977115", "0.5965406", "0.591007", "0.585244", "0.58426154", "0.57694507", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.57648814", "0.5...
0.7482775
0
Clone the target_image option.
def clone_options(self, command): super().clone_options(command) self.target_image = command.target_image
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_target_image(self):\n\n if not self.generating:\n options = QtWidgets.QFileDialog.Options()\n options |= QtWidgets.QFileDialog.DontUseNativeDialog\n file_path, _ = QtWidgets.QFileDialog.getOpenFileName(self, 'Select Target Image', '..',\n ...
[ "0.68449223", "0.6412034", "0.61233586", "0.6092937", "0.60426134", "0.60021657", "0.59819186", "0.5874984", "0.5687195", "0.56403023", "0.56037587", "0.5580726", "0.5562792", "0.5538017", "0.55336696", "0.5488659", "0.536049", "0.53528816", "0.53517675", "0.53507346", "0.534...
0.84945214
0
Determine the glibc version. If running in Docker, this is done by interrogating libc.so.6; outside docker, we can use os.confstr().
def target_glibc_version(self, app): if self.use_docker: try: output = self.tools.docker.check_output( ["ldd", "--version"], image_tag=app.target_image, ) # On Debian/Ubuntu, ldd --version will give you output of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kernel_version():\r\n try:\r\n return utils.run('uname -r').stdout.strip()\r\n except:\r\n logging.info(\"Not Found\")\r\n return -1", "def osversion():\n return platform()", "def libc_ver(executable=None, lib='', version='', chunksize=16384):\n if not executable:\n ...
[ "0.67481524", "0.6445227", "0.63593394", "0.63422006", "0.6330256", "0.63095325", "0.6250788", "0.6247566", "0.612814", "0.61073667", "0.6093997", "0.6072668", "0.6072668", "0.60015935", "0.59942347", "0.5980634", "0.5978849", "0.59579396", "0.59515923", "0.59385496", "0.5924...
0.7560223
0
Finalize app configuration. Linux .deb app configurations are deeper than other platforms, because they need to include components that are dependent on the target vendor and codename. Those properties are extracted from commandline options. The final app configuration merges the targetspecific configuration into the g...
def finalize_app_config(self, app: AppConfig): self.logger.info("Finalizing application configuration...", prefix=app.app_name) if self.use_docker: # Preserve the target image on the command line as the app's target app.target_image = self.target_image # Ensure that ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_linux_app(self, app, **kargs):\n app_builddir = \"%s/%s\" % (self.linux_build_dir(), app)\n \n # Export env and args to the app SConstruct\n env = self\n Export(\"env\")\n args = kargs\n args[\"install_dir\"] = self.linux_install_dir()\n args[\"buil...
[ "0.63554126", "0.59914476", "0.5776532", "0.56899667", "0.5537475", "0.5466082", "0.5456141", "0.54462266", "0.5423489", "0.54164773", "0.5401561", "0.53482723", "0.53386545", "0.5328161", "0.5321827", "0.5316554", "0.5313894", "0.5312306", "0.5305946", "0.52975184", "0.52792...
0.78062594
0
The Docker image tag for an app.
def docker_image_tag(self, app): return f"briefcase/{app.bundle}.{app.app_name.lower()}:{app.target_vendor}-{app.target_codename}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_tag(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"image_tag\")", "def image(self):\n return \"{}/{}:{}\".format(\n self.namespace,\n self.name,\n self.build.commit.tag if self.build.commit.tag\n else self...
[ "0.6631285", "0.66244906", "0.65574026", "0.6544671", "0.6429471", "0.63669485", "0.63392276", "0.631756", "0.63062376", "0.6117049", "0.6077721", "0.60664666", "0.60215396", "0.5999348", "0.5997951", "0.5936384", "0.59169096", "0.5890594", "0.58686674", "0.58462656", "0.5816...
0.82153183
0
Verify that the version of Python being used to build the app in Docker is compatible with the version being used to run Briefcase. Will raise an exception if the Python version is fundamentally incompatible (i.e., if Briefcase doesn't support it); any other version discrepancy will log a warning, but continue. Require...
def verify_python(self, app): output = self.tools[app].app_context.check_output( [ f"python{app.python_version_tag}", "-c", ( "import sys; " "print(f'{sys.version_info.major}.{sys.version_info.minor}')" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_python_version(self):\n python_exe = tools.which(\"python\")\n if not python_exe:\n msg = (\"Python must be available in PATH \"\n \"in order to build v8\")\n raise ConanInvalidConfiguration(msg)\n # In any case, check its actual version for ...
[ "0.68430823", "0.6801859", "0.6785404", "0.6757041", "0.6711023", "0.66248536", "0.6623438", "0.66070175", "0.659782", "0.6532271", "0.650727", "0.64691776", "0.643781", "0.64026624", "0.6401549", "0.6401549", "0.6401549", "0.63851583", "0.63834256", "0.63140565", "0.6303263"...
0.8388611
0
Verify that the Python being used to run Briefcase is the default system python. Will raise an exception if the system Python isn't an obvious Python3, or the Briefcase Python isn't the same version as the system Python. Requires that the app tools have been verified.
def verify_system_python(self): system_python_bin = Path("/usr/bin/python3").resolve() system_version = system_python_bin.name.split(".") if system_version[0] != "python3" or len(system_version) == 1: raise BriefcaseCommandError("Can't determine the system python version") i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_python(self, app):\n output = self.tools[app].app_context.check_output(\n [\n f\"python{app.python_version_tag}\",\n \"-c\",\n (\n \"import sys; \"\n \"print(f'{sys.version_info.major}.{sys.version_info....
[ "0.78281075", "0.6029602", "0.60002583", "0.60002583", "0.60002583", "0.5965939", "0.59237105", "0.59107774", "0.586113", "0.57760423", "0.569254", "0.5691426", "0.5686937", "0.566019", "0.5654829", "0.5644463", "0.5630514", "0.5601303", "0.5566802", "0.553877", "0.54553926",...
0.8208065
0
Utility method returning the packages and tools needed to verify system requirements.
def _system_requirement_tools(self, app: AppConfig): if app.target_vendor_base == DEBIAN: base_system_packages = ["python3-dev", "build-essential"] system_verify = ["dpkg", "-s"] system_installer = "apt" elif app.target_vendor_base == RHEL: base_system_pac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_system_packages(self, app: AppConfig):\n (\n base_system_packages,\n system_verify,\n system_installer,\n ) = self._system_requirement_tools(app)\n\n if system_installer is None:\n self.logger.warning(\n \"\"\"\n************...
[ "0.7373791", "0.72976935", "0.706689", "0.69316834", "0.6931413", "0.692653", "0.6882297", "0.6857839", "0.68539405", "0.6799883", "0.6763911", "0.6756704", "0.6728771", "0.66728157", "0.66713697", "0.6636746", "0.66252655", "0.66243476", "0.6559719", "0.65442145", "0.653833"...
0.8096628
0
Verify that the required system packages are installed.
def verify_system_packages(self, app: AppConfig): ( base_system_packages, system_verify, system_installer, ) = self._system_requirement_tools(app) if system_installer is None: self.logger.warning( """ ******************************...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_packages_present(self):\n packages = [\"ca-certificates\", \"sudo\", \"wget\", \"unzip\"]\n for pkg in packages:\n with self.subTest(package=pkg):\n self.assertTrue(self.host.package(pkg).is_installed)", "def check_requirements():\n\n # Which programs are r...
[ "0.7784559", "0.76185006", "0.7530881", "0.74233377", "0.73340124", "0.73053426", "0.72583896", "0.72399837", "0.7219237", "0.7197551", "0.7182645", "0.71785045", "0.71041757", "0.7099952", "0.70999336", "0.70856017", "0.706371", "0.7025919", "0.6994592", "0.69634837", "0.686...
0.79480386
0
Verify App environment is prepared and available. When Docker is used, create or update a Docker image for the App. Without Docker, the host machine will be used as the App environment.
def verify_app_tools(self, app: AppConfig): # Verifying the App context is idempotent; but we have some # additional logic that we only want to run the first time through. # Check (and store) the pre-verify app tool state. verify_python = not hasattr(self.tools[app], "app_context") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_env():\n logger.debug(\"Checking enviroment\")\n if os.getuid() != 0:\n exit_on_error(\"twindb-register-storage.py must be run by root\")\n logger.debug(\"Enviroment is OK\")\n return True", "def check_test_environment(context, coreapi_url):\n if context.running_locally:\n ...
[ "0.67695004", "0.63969225", "0.62896675", "0.62205946", "0.6209798", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344", "0.6118344",...
0.6544571
1
Generate a Debian multiline description string. The long description in a Debian control file must not contain any blank lines, and each line must start with a single space. Convert a long description into Debian format.
def debian_multiline_description(description): return "\n ".join(line for line in description.split("\n") if line.strip() != "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_description(self):\n description = self.description\n if description is not None:\n lines = description.splitlines()\n title = []\n for line in lines:\n line = line.strip()\n if line == \"\":\n if len(title) >...
[ "0.69024396", "0.6816094", "0.6750336", "0.6696345", "0.63702685", "0.636368", "0.6347964", "0.62856084", "0.62586933", "0.6220251", "0.6220251", "0.6220251", "0.6182932", "0.6165127", "0.61154526", "0.6071974", "0.6005147", "0.5977242", "0.5959085", "0.5952946", "0.59253097"...
0.81254303
0
Verify that the local environment contains the debian packaging tools.
def _verify_deb_tools(self): if not Path("/usr/bin/dpkg-deb").exists(): raise BriefcaseCommandError( "Can't find the dpkg tools. Try running `sudo apt install dpkg-dev`." )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_platform():\n if os.getcwd() != os.path.dirname(os.path.abspath(__file__)):\n error = \"must be ran in the directory it's located at\"\n if os.path.sep != '/':\n error = \"a unix-like operating system is required\"\n elif not shutil.which('dpkg-deb'):\n error = \"cannot find...
[ "0.6673955", "0.66321385", "0.6631946", "0.6550651", "0.6459654", "0.6290576", "0.62822133", "0.6248049", "0.62273544", "0.61786383", "0.6174341", "0.6173714", "0.6100051", "0.60993564", "0.60895354", "0.607039", "0.6056485", "0.6055791", "0.6053403", "0.60518175", "0.6037582...
0.74080604
0
Verify that the local environment contains the redhat packaging tools.
def _verify_rpm_tools(self): if not Path("/usr/bin/rpmbuild").exists(): raise BriefcaseCommandError( "Can't find the rpm-build tools. Try running `sudo dnf install rpm-build`." )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_environment():\n if 'OS_USERNAME' not in os.environ:\n print \"Error gathering facts! Please ensure that the openstack\" +\\\n \" credentials of an admin user are set as environment\" + \\\n \" variables.\"\n sys.exit(-1)\n if not find_executable('nova'):\n ...
[ "0.6837803", "0.6681198", "0.6664853", "0.6627895", "0.66141164", "0.6612847", "0.65976423", "0.6571565", "0.6484835", "0.64412624", "0.64277124", "0.6384105", "0.6378137", "0.6366998", "0.6314988", "0.6300467", "0.6297646", "0.62955505", "0.6250084", "0.62148196", "0.6198165...
0.6778493
1