query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Compute and return the value of addition operation.
def compute_output(self): x, y = self.input_nodes self.output_value = backend.add(x.output_value, y.output_value) return self.output_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self):\n return self._do_calc(self.adder)", "def add(self):\n return self._do_calc(self.adder)", "def add(self):\n return self._do_calc(self.adder)", "def addition(self, first_value, second_value):\n return first_value + second_value", "def addition(a, b):\r\n\r\n resu...
[ "0.8168641", "0.8168641", "0.8168641", "0.7837437", "0.7704095", "0.7474225", "0.73802626", "0.736307", "0.730536", "0.728264", "0.72668445", "0.7235886", "0.7205479", "0.71878326", "0.7183775", "0.7182901", "0.7154208", "0.710332", "0.7075838", "0.7075838", "0.7075838", "0...
0.0
-1
Compute and return the value of Add operation
def compute_gradient(self, grad=None): if grad is None: grad = backend.ones_like(self.output_value) x, y = [node.output_value for node in self.input_nodes] grad_wrt_x = grad while backend.ndim(grad_wrt_x) > len(backend.shape(x)): grad_wrt_x = backend.sum(grad_wrt_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self):\n return self._do_calc(self.adder)", "def add(self):\n return self._do_calc(self.adder)", "def add(self):\n return self._do_calc(self.adder)", "def add(self, value):\n return self.number + value", "def __add__(self, value):\n out = self.copy()\n ...
[ "0.83119005", "0.83119005", "0.83119005", "0.77592415", "0.76831627", "0.7610447", "0.7597428", "0.7573949", "0.75670546", "0.74767745", "0.7463074", "0.7450606", "0.7420506", "0.74187076", "0.74167746", "0.7381426", "0.736897", "0.736897", "0.736897", "0.736897", "0.736897",...
0.0
-1
Compute and return the multiplication operation result.
def compute_output(self): x, y = self.input_nodes self.output_value = backend.multiply(x.output_value, y.output_value) return self.output_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def mul(a, b):\n c = Calculator()\n result = c.mul(a, b)\n click.echo('{} * {} = {}'.forma...
[ "0.82732904", "0.82732904", "0.82732904", "0.7692702", "0.7597504", "0.7511706", "0.7486996", "0.74654824", "0.7429868", "0.73813534", "0.73813534", "0.7323267", "0.7300083", "0.7300083", "0.7300083", "0.72988147", "0.7292858", "0.72552335", "0.72552335", "0.7253738", "0.7235...
0.0
-1
Compute and return the value of Multiply operation
def compute_gradient(self, grad=None): x, y = [node.output_value for node in self.input_nodes] if grad is None: grad = backend.ones_like(self.output_value) grad_wrt_x = grad * y while backend.ndim(grad_wrt_x) > len(backend.shape(x)): grad_wrt_x = backend.sum(grad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiplier(self) -> global___Expression:", "def multiply(value, multiplier):\n return valu...
[ "0.8545484", "0.8545484", "0.8545484", "0.83366656", "0.8187452", "0.8016551", "0.7971153", "0.79382086", "0.78632605", "0.7852112", "0.7828216", "0.777473", "0.7771584", "0.77632725", "0.7747894", "0.7747894", "0.7747894", "0.7747894", "0.7747894", "0.77434623", "0.77434623"...
0.0
-1
Compute and return the multiplication operation result.
def compute_output(self): x, y = self.input_nodes print(x.name, y.name) self.output_value = backend.dot(x.output_value, y.output_value) return self.output_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def multiply(self):\n return self._do_calc(self.multiplier)", "def mul(a, b):\n c = Calculator()\n result = c.mul(a, b)\n click.echo('{} * {} = {}'.forma...
[ "0.82729405", "0.82729405", "0.82729405", "0.7691176", "0.7594816", "0.7509676", "0.7484784", "0.746403", "0.74275154", "0.73794293", "0.73794293", "0.7321041", "0.72983307", "0.72982085", "0.72982085", "0.72982085", "0.72902554", "0.7253367", "0.7253367", "0.7250322", "0.723...
0.0
-1
Compute and return the value of MatMul operation
def compute_gradient(self, grad=None): if grad is None: grad = backend.ones_like(self.output_value) x, y = [node.output_value for node in self.input_nodes] dx = backend.dot(grad, backend.transpose(y)) dy = backend.dot(backend.transpose(x), grad) return [dx, dy]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mul(*args):\n\treturn functools.reduce(numpy.dot, args)", "def __matmul__(self, tensor):\n return self.matmul(tensor)", "def __matmul__(self, other):\n return F.MatMul.apply(self, other)", "def matmul(x, y):\n return np.matmul(x, y)", "def __matmul__(self, q: np.ndarray) -> np.ndarray...
[ "0.70653635", "0.7030295", "0.7012756", "0.69836116", "0.6937651", "0.68797034", "0.68560153", "0.6773936", "0.67671573", "0.6741326", "0.67168695", "0.66877943", "0.66726565", "0.6665352", "0.66612875", "0.66546845", "0.6640587", "0.66297746", "0.65662175", "0.65662175", "0....
0.0
-1
Compute and return the value of Negative operation
def compute_gradient(self, grad=None): if grad is None: grad = backend.ones_like(self.output_value) dx = -grad return dx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __neg__(self):\n return self.__mul__(-1)", "def __neg__(self):\n return (-1)*self", "def __neg__(self):\n return self.coeff_mul(-1)", "def __neg__(self):\n return 0 - self", "def neg(a):\n return -a;", "def neg(self, a):\n return -a", "def negative(data):\n ...
[ "0.78516746", "0.7822449", "0.7800353", "0.7756876", "0.76866513", "0.7554685", "0.75289315", "0.7497992", "0.73951286", "0.7336812", "0.7320498", "0.72434306", "0.7211344", "0.71997476", "0.71508557", "0.7139919", "0.71298915", "0.70214325", "0.70214325", "0.70214325", "0.70...
0.0
-1
Compute and return the value of Log operation
def compute_gradient(self, grad=None): x = self.input_nodes[0].output_value if grad is None: grad = backend.ones_like(self.output_value) if x == float('inf') or x == float('-inf'): return grad * float('inf') else: return grad * 1 / x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self):\n return F.Log.apply(self)", "def Log(num):\n return math.log(float(num))", "def get_log(p):\n if p==0:\n return 0.\n return p*np.log2(p)", "def ln(x):\n return log(x, const.e)", "def weight_log(val):\n return val * math.log(val)", "def log(self, base):\n\n\t\t...
[ "0.7668993", "0.76594985", "0.74319863", "0.7391935", "0.7390644", "0.73224735", "0.7276084", "0.7267572", "0.7253843", "0.7219932", "0.71597886", "0.7138484", "0.7119296", "0.70882255", "0.70882255", "0.70256233", "0.7015593", "0.70155007", "0.70150936", "0.70122904", "0.701...
0.0
-1
Compute and return the value of Square operation
def compute_gradient(self, grad=None): input_value = self.input_nodes[0].output_value if grad is None: grad = backend.ones_like(self.output_value) return grad * backend.multiply(2.0, input_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square(value):\n return value ** 2", "def square_value(s):\n return s ** 2", "def square(x):\n\n\treturn x * x", "def R_square(self,parameterValues):\n sst = self.SST(parameterValues)\n cost = self.Cost(parameterValues)\n return 1.- cost/sst", "def my_square(y):\n\treturn (y ...
[ "0.77852505", "0.77071613", "0.75154287", "0.7510058", "0.7492183", "0.74733704", "0.74538463", "0.7449998", "0.74409896", "0.7423898", "0.7406456", "0.7368862", "0.73493433", "0.7312246", "0.72920024", "0.72787845", "0.72662735", "0.7245569", "0.7211031", "0.7168125", "0.706...
0.0
-1
Compute and return the value of Exp operation
def compute_gradient(self, grad=None): if grad is None: grad = backend.ones_like(self.output_value) x, = self.input_nodes[0].output_value return backend.exp(x) * grad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp(x):\n raise NotImplementedError", "def Exp(num):\n return math.exp(float(num))", "def exp(data):\n return _make.exp(data)", "def exp(self):\n\t\tval = np.exp(self.val)\n\t\tif len(self.der.shape):\n\t\t\tto_multiply = np.exp(self.val)\n\t\t\tto_multiply = np.expand_dims(to_multiply, 1) i...
[ "0.7808823", "0.7771139", "0.769081", "0.7412776", "0.7410773", "0.7321018", "0.7265798", "0.72565985", "0.71782935", "0.7066095", "0.70549774", "0.7020123", "0.69882745", "0.69186115", "0.6897709", "0.68683153", "0.68660593", "0.6861107", "0.68211436", "0.6772736", "0.676565...
0.0
-1
function that sum two floats
def floor(n: float) -> int: return int(n // 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(*args):\n #convert args to floats so we can do the maths\n values = list(args)\n for x in range(len(values)):\n values[x] = float(values[x])\n \n summation = str(ft.reduce(oper.add,values))\n return summation", "def add(self, *args):\n sum = 0\n for arg in args:\...
[ "0.73616356", "0.73420405", "0.70904213", "0.7062333", "0.6848363", "0.68475425", "0.68398845", "0.6837578", "0.6837578", "0.68218607", "0.68185145", "0.6800912", "0.6783136", "0.6758411", "0.67489964", "0.6708706", "0.66087234", "0.6569757", "0.65688646", "0.65655714", "0.65...
0.0
-1
Queries qstat for the information of a completed task
def get_metadata(self, db_running_task: SchedulerTask, task_logger: Logger): cmd = [f"qstat -f -F json -x {db_running_task.job_id}"] out, err = self._run_command_and_wait(cmd, shell=True) # remove values that contains backslash # several GPU-related variables contains only a single back...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qstat(self, *options):\n if self.in_queue():\n jobid = self.get_db('jobid')\n cmd = ['qstat'] + list(options) + [jobid]\n\n status, output, err = getstatusoutput(cmd,\n stdout=subprocess.PIPE,\n st...
[ "0.749695", "0.6928691", "0.6489987", "0.6445606", "0.63147813", "0.63140684", "0.6289372", "0.62361026", "0.6231401", "0.61956203", "0.6121048", "0.6078729", "0.59458965", "0.5909262", "0.59033716", "0.589774", "0.5789233", "0.5743389", "0.57411927", "0.5735587", "0.5735587"...
0.6716205
2
Checks the given job_id if it has failed due to Wall Clock Time
def check_wct_hit(self, job_id: int): cmd = f"qstat -x {job_id} -f -F json | grep walltime" output, err = self._run_command_and_wait(cmd=[cmd], shell=True) walltime_split = output.split() _, limit_hour, limit_min, limit_sec = ( walltime_split[1].replace('"', "").split(":") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_job_status_by_id(job_id):\n print('=' * 40)\n print('check_status_by_job_id', job_id)\n print('=' * 40)\n\n it_worked = check_job_status(job)\n if it_worked:\n return ok_resp(job)\n\n user_msg = ('PreprocessJob still in process: %s') % (job_id)\n return err_resp(user_msg)", ...
[ "0.6274467", "0.5929514", "0.58271253", "0.5742374", "0.57365143", "0.56687313", "0.56491256", "0.5644406", "0.5643484", "0.56422216", "0.5603327", "0.5548267", "0.552676", "0.55206394", "0.5519704", "0.55171937", "0.5463247", "0.54274446", "0.541504", "0.5409407", "0.5378929...
0.72177875
0
keys in arguments must match whatever the pbs script is expecting, otherwise will fail
def process_arguments( script_path: str, arguments: Dict[str, str], scheduler_arguments: Dict[str, str] = [], ): # maps scheduler specific args with commands scheduler_header_command_dict = { "time": "-l walltime={value}", "job_name": "-N {value}", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def _verify_arguments(self):\n # if self.options.action == \"create\":\n # if self.options.encrypt_payload and not self.options.payload_secret:\n # self.parser.error('A secret must be supplied with --payload-secret option when the --encrypt-payload o...
[ "0.6142303", "0.61410135", "0.61319065", "0.61220825", "0.6102524", "0.6053793", "0.5988628", "0.5977642", "0.5959369", "0.5934559", "0.5915339", "0.5895315", "0.5876424", "0.5858718", "0.58408886", "0.5797747", "0.5797747", "0.5787802", "0.5762945", "0.57523495", "0.57461905...
0.0
-1
Reads a commaseparated csv file (with header) and write in Parquet
def csv_to_parquet(filename, schema, input_dir=DIR_DATA_CSV, output_dir=DIR_DATA_PARQUET): df = spark.read.load(input_dir + "/" + filename + ".csv", format='com.databricks.spark.csv', header='true', schema=schema, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_file_to_parquet(input_file, output_file):\n df = pd.read_csv(input_file)\n df.to_parquet(output_file)", "def sandia2parquet(csvPaths, outputPath):\r\n df = pd.concat(pd.read_csv(p, parse_dates=[[0, 1]], index_col=0) for p in csvPaths)\r\n df.drop_duplicates(inplace=True)\r\n df.sort_index(...
[ "0.798741", "0.7135128", "0.6974975", "0.6251544", "0.6232588", "0.6227769", "0.6079703", "0.60275185", "0.59676653", "0.5946072", "0.59393716", "0.57928514", "0.5785504", "0.57794386", "0.5753632", "0.5752843", "0.57419115", "0.57325166", "0.57178354", "0.56992704", "0.56793...
0.77135056
1
Returns a feed containing the entrys
def search_youtube(self, search_terms, orderby="relevance", racy="include"): service = gdata.youtube.service.YouTubeService() query = gdata.youtube.service.YouTubeVideoQuery() query.vq = search_terms query.orderby = orderby query.racy = racy feed = service.YouTubeQuery(qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed(self):\n feed_dict = feedparser.parse(self.URL)\n return [self.entry_dict(entry) for entry in feed_dict['entries']]", "def fetch_entries(self):\n entries = []\n rss_list = self.__data_adapter.fetch_rss()\n for rss in rss_list:\n rss_href = rss.get('url', Non...
[ "0.8146135", "0.7554539", "0.7358995", "0.73021305", "0.7196763", "0.71774864", "0.71108234", "0.7068216", "0.7061277", "0.7045857", "0.69915897", "0.6973551", "0.69140273", "0.6907507", "0.6902944", "0.6898393", "0.68478787", "0.67750895", "0.6668646", "0.6623172", "0.657356...
0.0
-1
Parses the coordinates from a GeoDatFrame in a format that rasterio wants them
def getFeatures(gdf): import json return [json.loads(gdf.to_json())['features'][0]['geometry']]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_coords(geom):\n # Return a tuple with the x/y point coordinate for a GeoDataFrame geometry\n return list(geom.coords)[0] # Just get first tuple in list, since it's a point", "def _parse_coordinate_data(frame, args, kwargs):\n valid_skycoord_kwargs = {}\n valid_components = {}\n info = No...
[ "0.63186353", "0.61775887", "0.61121625", "0.6109966", "0.6055323", "0.6046246", "0.60322875", "0.5964567", "0.59609", "0.59376866", "0.59201103", "0.5907443", "0.5906299", "0.58455616", "0.5823993", "0.58206755", "0.580848", "0.57805276", "0.57714295", "0.57690257", "0.57587...
0.0
-1
Transform Django ValidationError into an equivalent DRF ValidationError. Note that even if this approach is not technically recommended, this is still the most convenient way to handle shared validation between Django admin and API.
def transform_exception_to_drf(exception: Exception) -> Exception: if isinstance(exception, DjangoValidationError): detail: Any = str(exception) if hasattr(exception, "message_dict"): detail = exception.message_dict elif hasattr(exception, "messages"): detail = except...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_validation_error(self, error, bundle_errors):\n \n error_str = six.text_type(error)\n error_msg = self.help.format(error_msg=error_str) if self.help else error_str\n msg = {self.name: error_msg}\n\n if bundle_errors:\n return error, msg\n flask_restfu...
[ "0.59149027", "0.5802986", "0.5730593", "0.5652993", "0.5632285", "0.56285733", "0.56061673", "0.55691904", "0.55682784", "0.54951966", "0.5435993", "0.53793496", "0.53500307", "0.5321213", "0.53003645", "0.5265524", "0.52309984", "0.5222705", "0.5215385", "0.52040416", "0.52...
0.64906365
0
Custom DRF exception handler which converts Django ValidationError to DRF ValidationError. Note that even if this approach is not technically recommended, this is still the most convenient way to handle shared validation between Django admin and API.
def custom_exception_handler(exc, context): if isinstance(exc, DjangoValidationError): exc = transform_exception_to_drf(exc) return drf_exception_handler(exc, context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_handler(exception, context):\n\n if isinstance(exception, DjangoValidationError):\n if isinstance(exception, DjangoValidationError):\n if hasattr(exception, 'message_dict'):\n detail = exception.message_dict\n elif hasattr(exception, 'message'):\n ...
[ "0.75938827", "0.69092166", "0.6425186", "0.63345057", "0.63084227", "0.6122498", "0.60641307", "0.60489315", "0.59760827", "0.5902956", "0.5901507", "0.58674586", "0.5848629", "0.58323437", "0.58078736", "0.57541656", "0.574886", "0.5721575", "0.570441", "0.5695655", "0.5677...
0.7843261
0
Return number as base64 string value.
def encode(n): encode = [] if n < 0: return '' while n >= 58: remainder = n % 58 encode.append(LETTERS[remainder]) n = n / 58 if n: encode.append(LETTERS[n]) return ''.join(reversed(encode))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _NumToB64(num):\r\n return base64.urlsafe_b64encode(number.long_to_bytes(num))", "def serialize_number(n):\n return str(n)", "def base64_string(self) -> global___Expression:", "def itob64(n):\n c = hex(n)\n c = c[2:-1] if c[-1] == 'L' else c[2:]\n if len(c)%2:\n c = '0'+c\n x = bas...
[ "0.74863905", "0.7096734", "0.68272793", "0.6718298", "0.663255", "0.64544064", "0.6423512", "0.63805586", "0.6329148", "0.62453985", "0.6234952", "0.6203418", "0.61396235", "0.6089041", "0.6076224", "0.601378", "0.5982342", "0.5949797", "0.59487015", "0.594549", "0.5930528",...
0.0
-1
Decode a base58 encoded string into an integer.
def decode(s): start = 0 multiplier = 1 for char in s[::-1]: start += multiplier * LETTERS.index(char) multiplier = multiplier * 58 return start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(s):\n try:\n if not s:\n return b''\n\n # Convert the string to an integer\n n = 0\n for c in s:\n n *= 58\n if c not in b58_digits:\n raise InvalidBase58Error('Character %r is not a valid base58 character' % c)\n digit = b58_digits.index(c)\n ...
[ "0.74239606", "0.7298524", "0.699828", "0.68491185", "0.6731669", "0.6685489", "0.66765356", "0.6515013", "0.6509682", "0.64163655", "0.6396006", "0.6340968", "0.63229686", "0.6293517", "0.627055", "0.6266807", "0.62661505", "0.62444985", "0.62362254", "0.6226504", "0.6214298...
0.5973529
28
Get parameters for ``rotate`` for a random rotation.
def get_params(degrees): angle = random.uniform(degrees[0], degrees[1]) return angle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(degrees):\r\n angle = np.random.uniform(degrees[0], degrees[1])\r\n\r\n return angle", "def get_params(degrees, translate, scale_ranges, shears, img_size):\n angle = np.random.uniform(degrees[0], degrees[1])\n if translate is not None:\n max_dx = translate[0]...
[ "0.66462475", "0.65740985", "0.6535509", "0.5788123", "0.57785267", "0.576172", "0.5759544", "0.57201487", "0.5681243", "0.5631103", "0.5580636", "0.55774826", "0.55569464", "0.5549427", "0.55484426", "0.5545225", "0.5545225", "0.5545225", "0.5545225", "0.5545225", "0.5545225...
0.6891688
1
Instantiate a CSRFaware test client and verify that the CSRF Middleware is working in the most basic functionality.
def test_csrf(self): csrf_client = Client(enforce_csrf_checks=True) csrf_client.login(username='archen', password='mytestpassword') # todo: add settings for test URL response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1})) csrf_token = "{0}".format(respons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():\n\n app.testing = True\n app.config[\"WTF_CSRF_ENABLED\"] = False\n client = app.test_client()\n\n\n return client", "def client():\n\n app.testing = True\n app.config[\"WTF_CSRF_ENABLED\"] = False\n client = app.test_client()\n\n\n return client", "def test_api_csrf_failu...
[ "0.6613592", "0.6613592", "0.622089", "0.61650765", "0.6091536", "0.60119987", "0.59627104", "0.5916682", "0.5916682", "0.58998346", "0.5868517", "0.5835162", "0.5829793", "0.5795184", "0.57920474", "0.57910436", "0.57616854", "0.5741856", "0.57105625", "0.56895846", "0.56636...
0.5925359
7
Instantiate a CSRFaware test client and verify that the CSRF Middleware rotates the CSRF token per session by logging in getting token1, logging out and back in, getting token2, then assert that token1 does not equal token2.
def test_csrf_token_session_rotation(self): csrf_client = Client(enforce_csrf_checks=True) csrf_client.login(username='archen', password='mytestpassword') # todo: add settings for test URL response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1})) token1 = "{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_csrf_token_request_rotation(self):\n\n csrf_client = Client(enforce_csrf_checks=True)\n csrf_client.login(username='archen', password='mytestpassword')\n\n # todo: add settings for test URL\n response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))\n ...
[ "0.7902339", "0.6988401", "0.6771556", "0.66788286", "0.6662817", "0.6656818", "0.65886146", "0.65124655", "0.62826264", "0.62812984", "0.625079", "0.62410915", "0.61570483", "0.61082435", "0.6089133", "0.6068556", "0.6063395", "0.603713", "0.6002983", "0.5986709", "0.5982652...
0.77802
1
Instantiate a CSRFaware test client and verify that the CSRF Middleware rotates the CSRF token per request by logging in getting token1, getting token2, then assert that token1 does not equal token2.
def test_csrf_token_request_rotation(self): csrf_client = Client(enforce_csrf_checks=True) csrf_client.login(username='archen', password='mytestpassword') # todo: add settings for test URL response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1})) token1 = "{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_csrf_token_session_rotation(self):\n\n csrf_client = Client(enforce_csrf_checks=True)\n csrf_client.login(username='archen', password='mytestpassword')\n\n # todo: add settings for test URL\n response = csrf_client.get(reverse('hackme:vote', kwargs={'question_id': 1}))\n ...
[ "0.75068396", "0.67863727", "0.6705328", "0.66953987", "0.65281594", "0.64516985", "0.6424007", "0.6370507", "0.636057", "0.6342661", "0.63172245", "0.6177671", "0.6174722", "0.613412", "0.6096326", "0.6073039", "0.6046885", "0.60453147", "0.601192", "0.60011077", "0.5999106"...
0.798472
0
Signal that a method mutates its class Here, mutates means that it clears the caches on any memomethods on the class calling the method
def mutates(func): @wraps(func) def inner(self, *args, **kwargs): self.mutate() return inner.__wrapped__(self, *args, **kwargs) inner.__wrapped__ = func return inner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate(self, _stack=None):\n if not hasattr(self, \"_memo_init\"):\n return\n if self.is_locked:\n raise ValueError(\"Cannot mutate locked object {0}\".format(self) )\n if _stack is None:\n _stack = set()\n elif id(self) in _stack:\n # avo...
[ "0.62497944", "0.6164148", "0.60884356", "0.59414697", "0.589391", "0.5805972", "0.5805972", "0.5773688", "0.56945825", "0.5694122", "0.56938845", "0.5661086", "0.5583335", "0.5572407", "0.5534683", "0.5532564", "0.55176854", "0.551574", "0.5494042", "0.54761684", "0.5470468"...
0.60481
3
List the memomethods associated with this class
def _memomethods(cls, base=True, clsmethods=False): if not base: return set(k for k, v in iteritems(cls.__dict__) if isinstance(v, MemoMethod) and (clsmethods or not isinstance(v, MemoClsMethod) ) ) else: return set().union(*( s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_methods(self):\n return list(self.methods.keys())", "def __methods(cls):\n _dict = {}\n __methodDict(cls, _dict)\n return _dict.keys()", "def listMethods(self):\r\n methods = self._listMethods()\r\n keys = list(methods.keys())\r\n keys.sort()\r\n return keys...
[ "0.70443636", "0.6637453", "0.6556638", "0.6555706", "0.64970905", "0.63522935", "0.63453037", "0.61935425", "0.6121395", "0.60850805", "0.60794735", "0.60586596", "0.5946513", "0.5932714", "0.5922627", "0.5846858", "0.58021754", "0.5788156", "0.5743604", "0.572228", "0.57138...
0.71347845
0
Return an iterable of objects whose mutate method should be called when this one is
def mutates_with_this(self): return ()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__():", "def __iter__():", "def __iter__():", "def __iter__():", "def __iter__(self):\n\n return [self]", "def __iter__(self):\n\n return [self]", "def mutator(mutate):\r\n @functools.wraps(mutate)\r\n def ecspy_mutator(random, candidates, args):\r\n mutants = []\r\...
[ "0.6278695", "0.6278695", "0.6278695", "0.6278695", "0.6145818", "0.6145818", "0.60620075", "0.5990411", "0.59757745", "0.59053135", "0.59053135", "0.59053135", "0.59053135", "0.59053135", "0.58846", "0.5859928", "0.585732", "0.5830972", "0.5826536", "0.5826536", "0.5826536",...
0.0
-1
Signal that something has changed in this object Raises a ValueError if this object is locked Clears the caches on this object, then calls 'mutate' on anything returned by self.mutates_with_this()
def mutate(self, _stack=None): if not hasattr(self, "_memo_init"): return if self.is_locked: raise ValueError("Cannot mutate locked object {0}".format(self) ) if _stack is None: _stack = set() elif id(self) in _stack: # avoid infinite recur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock (self):\n self.locked = True\n self._changed = False", "def reset(self, owner):\n if self.cached:\n oldvalue = self.get_slot(owner)\n self.del_slot(owner)\n if self.has_observers() or owner.has_observers(self.name):\n newvalue = self.d...
[ "0.60226405", "0.57842845", "0.5725537", "0.5721362", "0.57192576", "0.57150596", "0.56712085", "0.5663763", "0.5658444", "0.5652563", "0.56195235", "0.56181794", "0.5615706", "0.56071895", "0.5597781", "0.5595289", "0.55938435", "0.559223", "0.5587769", "0.5576639", "0.55678...
0.6292293
0
Enable the cache on all memomethods
def enable_caches(self, clsmethods=False): if not hasattr(self, "_memo_init"): return self._caches_enabled = True for m in self._memomethods(clsmethods=clsmethods): getattr(self, m).enable_cache()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_caches(self, clsmethods=False):\n if not hasattr(self, \"_memo_init\"):\n return\n self._caches_enabled = False\n for m in self._memomethods(clsmethods=clsmethods):\n getattr(self, m).disable_cache()", "def enable_cache(self, **kwargs: Dict[str, Any]) -> Non...
[ "0.74225974", "0.7077383", "0.689496", "0.6892741", "0.66630596", "0.66365635", "0.6579165", "0.65108114", "0.6508244", "0.6482745", "0.6480428", "0.6444183", "0.6429827", "0.63991463", "0.6329355", "0.6286894", "0.6266778", "0.6248951", "0.6218654", "0.6218115", "0.62179226"...
0.8367143
0
Disable the cache on all memomethods
def disable_caches(self, clsmethods=False): if not hasattr(self, "_memo_init"): return self._caches_enabled = False for m in self._memomethods(clsmethods=clsmethods): getattr(self, m).disable_cache()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_caches(self, clsmethods=False):\n if not hasattr(self, \"_memo_init\"):\n return\n self._caches_enabled = True\n for m in self._memomethods(clsmethods=clsmethods):\n getattr(self, m).enable_cache()", "def clearmemo(self):\n # see utils.memozie_method\n...
[ "0.71638656", "0.70316917", "0.6965892", "0.68943864", "0.68892354", "0.6815377", "0.6801101", "0.66888326", "0.66416496", "0.6572776", "0.65559536", "0.6547328", "0.6539086", "0.65341306", "0.64940375", "0.64625096", "0.64194775", "0.638353", "0.63695186", "0.63673973", "0.6...
0.82815826
0
Clear the cache on all memomethods
def clear_caches(self, clsmethods=False): if not hasattr(self, "_memo_init"): return for m in self._memomethods(clsmethods=clsmethods): getattr(self, m).clear_cache()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearmemo(self):\n # see utils.memozie_method\n if hasattr(self, '_cache'):\n self._cache.clear()", "def clear_cache():\n # TODO\n pass", "def cache_clear(self):\n\t\tself.__cache = {}", "def clear_cache(self):\n pass", "def clear_all(self) -> None:\n ...
[ "0.8305153", "0.8063542", "0.8048527", "0.79982877", "0.78870875", "0.76729065", "0.7611736", "0.7596422", "0.7585412", "0.7551643", "0.744164", "0.74281377", "0.74196523", "0.74128884", "0.74125355", "0.73761576", "0.7359436", "0.7351489", "0.7349383", "0.73434705", "0.72377...
0.8368596
0
Is this class locked
def is_locked(self): if not hasattr(self, "_memo_init"): return False else: return self._locked
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(self):\r\n pass", "def Locked(self) -> bool:", "def i_am_locking(self):\r\n pass", "def locked(self):\n return self._owner is not None", "def locked(self) -> bool:\n return self.__locked", "def locked(self):\n\t\treturn self.__locked", "def locked(self):\n ...
[ "0.87449557", "0.84991175", "0.8111238", "0.8056842", "0.79599226", "0.7952831", "0.7933114", "0.78107566", "0.7793206", "0.77849245", "0.7752765", "0.7728482", "0.763824", "0.7617176", "0.7614378", "0.75262403", "0.7520465", "0.75083154", "0.749433", "0.749433", "0.749433", ...
0.7381714
23
Lock the class A locked class' caches are always enabled and calling a mutating method on it results in a ValueError
def lock(self): if not hasattr(self, "_memo_init"): raise ValueError( "Cannot lock MemoClass before MemoClass.__init__" + "is finished!") self.enable_caches() self._locked = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(self):\n raise NotImplementedError", "def __setattr__(self, key, value):\n if not hasattr(self, \"_memo_init\"):\n # If we haven't finished initialising the memoclass, the class acts\n # like it's unlocked\n pass\n elif key == \"_locked\" or self._mu...
[ "0.723524", "0.6595321", "0.6561136", "0.64092267", "0.6290298", "0.6239937", "0.6218193", "0.6098448", "0.6024287", "0.5995096", "0.5908495", "0.58645964", "0.57786083", "0.5771644", "0.57694465", "0.5726698", "0.5706033", "0.5695505", "0.5678543", "0.56641036", "0.56514704"...
0.6666595
1
A context manager that temporarily locks the class Does nothing if the class is already locked
def locked(self, clear_on_unlock=None): if not hasattr(self, "_memo_init"): raise ValueError( "Cannot lock MemoClass before MemoClass.__init__" + "is finished!") if clear_on_unlock is None: # Clear and disable the caches when unlocking if t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(self):\n raise NotImplementedError", "def __enter__(self):\r\n if not self.is_locked:\r\n self.acquire()\r\n return self", "def __enter__(self):\r\n self.acquire()\r\n return self", "def i_am_locking(self):\r\n pass", "def __enter__(self):\n ...
[ "0.690449", "0.6820002", "0.6793229", "0.67404705", "0.6740129", "0.67275786", "0.67211294", "0.6686372", "0.6686372", "0.6684637", "0.66462415", "0.66223514", "0.6566061", "0.64780515", "0.64759773", "0.64710057", "0.64528394", "0.64315253", "0.6415128", "0.6414493", "0.6383...
0.6317001
21
A context manager that temporarily unlocks the class Does nothing if the class is already unlocked
def unlocked(self, clear_caches=True): if not hasattr(self, "_memo_init"): raise ValueError( "Cannot unlock MemoClass before MemoClass.__init__" + "is finished!") if self.is_locked: self.unlock(clear_caches) yield se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlocked():\r\n return Lock(None)", "def unlock(self):\n raise NotImplementedError", "def unlock(*args):", "def f_unlock(self):\n self._locked = False", "def cleanup(self):\r\n # XXX should be fixed properly!!!\r\n try:\r\n self.unlock()\r\n except:\r\n ...
[ "0.6780711", "0.6759618", "0.65783143", "0.6529333", "0.65048325", "0.63810986", "0.62082255", "0.61783284", "0.6168313", "0.61564094", "0.61486435", "0.6066959", "0.60568166", "0.6052731", "0.60509914", "0.6045715", "0.6011727", "0.60101867", "0.59980786", "0.5994963", "0.59...
0.6054537
13
By default, setting an attribute on a class should mutate it
def __setattr__(self, key, value): if not hasattr(self, "_memo_init"): # If we haven't finished initialising the memoclass, the class acts # like it's unlocked pass elif key == "_locked" or self._mutable_attrs is None or \ key in self._mutable_attrs: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_attribute(self, attr, value):\n super().set_attribute(attr, value) # Keep this line, it triggers the parent class method.\n setattr(self, attr, value)", "def __setattr__(self, attr, value):\n super().__setattr__(attr, value)", "def __set__(self, instance, val):\n raise Attr...
[ "0.7856065", "0.77613187", "0.7737396", "0.7627099", "0.7446861", "0.7427877", "0.72968787", "0.72517556", "0.721572", "0.7182125", "0.71538717", "0.71538717", "0.71538717", "0.71538717", "0.71538717", "0.71538717", "0.71538717", "0.70777094", "0.70421183", "0.7017415", "0.68...
0.0
-1
returns a functions that takes an image in range [0,1] and outputs a feature embedding vector
def build_feature_extractor(name="torchscript_inception", device=torch.device("cuda")): if name == "torchscript_inception": model = InceptionV3W("/tmp", download=True).to(device) def model_fn(x): return model(x * 255.0) elif name == "pytorch_inception": model = InceptionV3(output_blocks=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, image):\n with torch.no_grad():\n img_feature = self.model(image) # [batch_size, vgg16(19)_fc=4096]\n img_feature = self.fc(img_feature) # [batch_size, embed_size]\n\n l2_norm = img_feature.norm(p=2, dim=1, keepdim=True).detach()\...
[ "0.6836496", "0.6563781", "0.6522787", "0.6491395", "0.6466069", "0.6378211", "0.62545997", "0.61833024", "0.6136691", "0.6132516", "0.6089139", "0.6087218", "0.6064759", "0.605419", "0.6051478", "0.6007163", "0.5978078", "0.5955613", "0.5950858", "0.58988076", "0.5879968", ...
0.5345539
97
Trasforma il sistema (M,b) in un sistema (M1,b1) equivalente e triangolare Superiore
def gauss_naive (M, b) -> list: dim = len(b) #Itero sulle Incognite da Trovare for i in range(dim): #Itero sulle righe su cui devo cancellare un elemento for j in range(i+1,dim): m__j_i = M[j][i] / M[i][i] M[j][i] = 0.0 for k in range (i+1,dim)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def mover_bm_izquierda(self):\n self.nueva_posicion_posible_parte_superior = self.mapa.consultar_casilla_por_movimiento([self.casilla[0] - 1,\n self.casilla[1]],\n ...
[ "0.5900163", "0.5681189", "0.56063914", "0.54657096", "0.5442821", "0.54004544", "0.5381123", "0.53206813", "0.53185594", "0.53091234", "0.52948785", "0.5235593", "0.5218128", "0.5204042", "0.5201873", "0.5158357", "0.51445913", "0.5139531", "0.5131728", "0.51265883", "0.5110...
0.5462028
4
Fattorizzazione LU della Matrice M
def lu_factorization (M) -> list: dim = len(M) L = np.eye(dim) #Itero sulle Incognite da Trovare for i in range(dim-1): #Itero sulle righe su cui devo cancellare un elemento for j in range(i+1,dim): m__j_i = M[j][i] / M[i][i] L[j][i] = m__j_i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LU(A):\n m, n = A.shape\n L, U = np.zeros([m, n]), np.zeros([m, n])\n for i in range(n):\n L[i][i] = 1\n\n for i in range(n):\n\n # Upper triangular matrix\n for j in range(i, n):\n summ = 0\n for k in range(0, i):\n summ += L[i][k]*U[k][j]\...
[ "0.7611546", "0.75616324", "0.7394273", "0.7262564", "0.71507025", "0.6908415", "0.68621296", "0.68161327", "0.6717512", "0.66513824", "0.65111864", "0.6496647", "0.6335854", "0.62893224", "0.62775815", "0.6270898", "0.6247874", "0.617779", "0.61640173", "0.6152998", "0.61210...
0.74678934
2
Implementa la strategia di RowPivoting
def row_pivoting (M,b, target_col): dim = len(b) #Find Pivot actual_pivot = abs(M[target_col][target_col]) pivot_idx = target_col for j in range(target_col+1,dim): if ( abs(M[j][target_col]) > actual_pivot): actual_pivot = M[j][target_col] pivot_idx = j ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recalculate_pivots(self):\n pass", "def pivot(self, columns, rows, values, collect=lambda s:s, zero=None):\n selected = self.select([columns, rows, values])\n grouped = selected.groups([columns, rows], collect)\n row_values = np.unique(self._get_column(rows))\n pivoted = Ta...
[ "0.64214516", "0.60986143", "0.59966606", "0.5895714", "0.5787107", "0.5755707", "0.5647966", "0.5647966", "0.55703896", "0.5510929", "0.5485293", "0.54802555", "0.54664457", "0.5414945", "0.5369022", "0.52761596", "0.52208734", "0.5209889", "0.51625884", "0.50895804", "0.507...
0.5855979
4
Implementa una strategia FullPivoting
def row_pivoting_full (M,b): dim = len(b) #Itero sulle colonne dei moltiplicatori for i in range(dim-1): #Find Pivot actual_pivot = abs(M[i][i]) pivot_idx = i for j in range(i+1,dim): if ( abs(M[j][i]) > actual_pivot): actual_pivot = M[j][i]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recalculate_pivots(self):\n pass", "def get_pivot(self, aggfunc, values='m'):\n\n # stack all galaxies in a pandas dataframe\n gals_df = self.get_full_df()\n\n # create some better column names\n types = {1: '1 Halo', 2: '2 Disk', 3: '3 Bulge'}\n gals_df['typename'] ...
[ "0.5924383", "0.55929524", "0.55135375", "0.5370124", "0.53467566", "0.5161271", "0.5091397", "0.50755394", "0.50668985", "0.5033122", "0.50249434", "0.50198156", "0.5005797", "0.49849704", "0.49674788", "0.49617568", "0.49593857", "0.4951756", "0.49030793", "0.48666635", "0....
0.5105565
6
Initialize object as excel workbook
def __init__(self, filename=None): self.name = filename self.wb = None if os.path.exists(filename): try: self.wb = xlrd.open_workbook(filename) except: print("not an excel file") else: self.set_amiSheetNames() self.filename = os.path.splitext(os.path.abspath...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initWorkbook(outfile):\n workbook = xlsxwriter.Workbook(outfile)\n return workbook", "def create_workbook(self):\n try:\n if '.xlsm' in self.file_name or '.xltm' in self.file_name:\n self.wb = load_workbook(self.file_path, keep_vba=True)\n else:\n ...
[ "0.7587639", "0.7087423", "0.7003733", "0.6741436", "0.6597349", "0.6574045", "0.64653397", "0.6346369", "0.6299423", "0.6272914", "0.6266638", "0.621135", "0.62060034", "0.6148154", "0.6134809", "0.61302346", "0.6073902", "0.6054141", "0.5996383", "0.5987162", "0.5909062", ...
0.6651306
4
Check the preservation sheet against expectations of Media Ingest.
def validate_workbook(self): valid = True #Check for a sheet that should have preservation metadata data try: self.check_presSheetExists() except AMIExcelError as e: print("Error in workbook sheets: ", e.value) valid = False #Check that preservation sheet contains required heade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_monitor_correctly_does_not_process_already_processed_pages(self):\n # Arrange\n # There are two pages: page # 1 and page # 2\n feeds = [fixtures.PROQUEST_FEED_PAGE_1, fixtures.PROQUEST_FEED_PAGE_2]\n # But only the page # 1 will be processed\n expected_calls = [call(fixt...
[ "0.5778201", "0.57246935", "0.5717508", "0.5711417", "0.57104516", "0.57044643", "0.57044643", "0.57044643", "0.5680794", "0.55978537", "0.556326", "0.55619204", "0.55233854", "0.5514667", "0.5509379", "0.54983896", "0.5490243", "0.5474077", "0.5471501", "0.54564965", "0.5453...
0.66293484
0
Identifies sheets that should contain data about preservation files, edit master files, and untransferred objects.
def set_amiSheetNames(self): self.pres_sheetname = None self.edit_sheetname = None self.notransfer_sheetname = None for sheet in self.wb.sheet_names(): sheet_lower = sheet.lower() #Check if two sheets get identfied by regex below? if re.match("(original|preservation|file|full|archive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n if len(self.handle.sheet_names) > 1: self.multi_sheet()\n else: self.mono_sheet()", "def sync_spreadsheet(self):\n\n\t\t# Open up the main sheet\n\n\t\t# Glob in columns to let us figure out which row each parent is in\n\n\t\t# For each parent\n\...
[ "0.58607453", "0.58228004", "0.5529762", "0.55206317", "0.5505007", "0.5484701", "0.5476601", "0.541435", "0.5361357", "0.5333867", "0.5233947", "0.52256787", "0.5194104", "0.51663905", "0.5108304", "0.50837946", "0.5076943", "0.50490385", "0.5043912", "0.5030903", "0.5010544...
0.6074781
0
Checks if a preservation sheet has been identified by set_amiSheetNames()
def check_presSheetExists(self): if not self.pres_sheetname: self.raise_excelerror("Required sheet for preservation files" + "could not be found in workbook.") return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_amiSheetNames(self):\n\n self.pres_sheetname = None\n self.edit_sheetname = None\n self.notransfer_sheetname = None\n\n for sheet in self.wb.sheet_names():\n sheet_lower = sheet.lower()\n #Check if two sheets get identfied by regex below?\n if re.match(\"(original|preservation|fi...
[ "0.66302073", "0.65046644", "0.5886013", "0.5579476", "0.5479899", "0.54747397", "0.53408045", "0.52864134", "0.5272514", "0.52497303", "0.5119719", "0.5086039", "0.5080697", "0.5060596", "0.49829373", "0.49792847", "0.4975354", "0.49734163", "0.4972198", "0.49180233", "0.491...
0.68520504
0
Return normalized values from a single row of headers on a specified sheet. Newline characters are retained.
def get_headerRow(self, sheetname, row): sheet = self.wb.sheet_by_name(sheetname) headers = [] for i in range(0, sheet.ncols): value = str(sheet.cell(row, i).value) if value: headers.append(value.lower()) return headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_clean_row(row_of_data):\n header = row_of_data.get('header')[1]\n z = list(set(remove_filler_words([header])))\n return z", "def normalize_columns_separately(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tcolumn_max=column_matrix.max(1)\n\tcolumn_min=column_matrix.min(1)\n\trange=...
[ "0.5955093", "0.5862677", "0.57885176", "0.5694795", "0.5683874", "0.5663597", "0.5579662", "0.5545275", "0.53721654", "0.5349391", "0.5349019", "0.5303909", "0.529971", "0.529876", "0.5280982", "0.52768624", "0.5258287", "0.52513075", "0.5238778", "0.51832134", "0.5182358", ...
0.68116575
0
Convenience method to return all header tuples.
def get_headerEntries(self, sheetname): sheet = self.wb.sheet_by_name(sheetname) header_entries = [] for i in range(0, sheet.ncols): header_entries.append(self.get_headerEntryAsTuple(sheetname, i)) return header_entries
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headers(self):\n payload = {inflection.underscore(k): v for k, v, in self._headers.items()}\n HeadersTuple = namedtuple('HeadersTuple', sorted(payload))\n the_tuple = HeadersTuple(**payload)\n return the_tuple", "def headers(self):\n return [h for h, _ in self.data]", "de...
[ "0.76452845", "0.752276", "0.7356992", "0.72599196", "0.70323384", "0.69783163", "0.68258137", "0.6778952", "0.6686625", "0.66815674", "0.66525185", "0.66184497", "0.6550123", "0.65409064", "0.65375787", "0.6494653", "0.6486296", "0.64685285", "0.6464969", "0.64335847", "0.64...
0.6161711
40
Returns tuple of header archiving by stepping backwards from a 3rdlevel header.
def get_headerEntryAsTuple(self, sheetname, column): sheet = self.wb.sheet_by_name(sheetname) key1, key2, key3 = None, None, None key3 = sheet.cell(2, column).value j = column key2 = sheet.cell(1, j).value while not key2: j -= 1 if j == -1: key2 = "" j = column ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpackRecHeader(self):\n return self.unpack('4s3i',16,'REC_HEAD')", "def read_header(stream: IO[bytes]) -> Tuple[int, int]:\n type_id = stream.read(4)\n if type_id != b\"DIRC\":\n raise AssertionError(\"Invalid index file header: %r\" % type_id)\n unpacked = cast(Tuple[int, int], unpac...
[ "0.5732473", "0.5263339", "0.5090131", "0.50557137", "0.504689", "0.5043671", "0.50036097", "0.4988983", "0.49864137", "0.49794218", "0.49668103", "0.49660572", "0.49570334", "0.4956655", "0.4944855", "0.49374002", "0.48744106", "0.48686293", "0.48508886", "0.48493242", "0.48...
0.44124407
81
Returns delimited string based on the output of get_headerEntryAsTuple()
def get_headerEntryAsString(self, sheetname, column, delimiter = "|"): header_entry = self.get_headerEntryAsTuple(sheetname, column) #remove empty tuple values before adding delimiter header_string = delimiter.join(filter(None, header_entry)) #remove newlines since they're inconsistent header_strin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_text(self):\n return os.linesep.join(map(str, self.headers))", "def header(self, as_list=False, separator='\\t'):\n if not self.attrs():\n return None\n if as_list:\n return self.attrs()\n else:\n return separator.join(self.attrs())", "def...
[ "0.6526169", "0.6299746", "0.62636864", "0.62408084", "0.61534923", "0.6079989", "0.60790026", "0.5927346", "0.59263724", "0.5761145", "0.57610416", "0.5759684", "0.5710751", "0.5688107", "0.5626773", "0.56125677", "0.56002694", "0.5573979", "0.5566358", "0.55484164", "0.5548...
0.7469031
0
Convenience function to remove items with XOR requirements
def remove_annoying(self, val1, val2, expected, found): if ((val1 in expected and val1 in found) and (val2 not in found)): expected.remove(val2) if ((val2 in expected and val2 in found) and (val1 not in found)): expected.remove(val1) return expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor_inplace(a,b):", "def __xor__(self, other):\n\n sym_diff = [value for value in self if value not in other]\n sym_diff.extend([value for value in other if value not in self])\n\n return sym_diff", "def double_xor(it):\n\n return [xor(it[2*i:2*i+2]) for i in range(len(it)/2)]", "...
[ "0.6677582", "0.65986776", "0.6539711", "0.6410722", "0.63988817", "0.63445055", "0.6204855", "0.61990845", "0.6167694", "0.6135819", "0.599498", "0.5984301", "0.59648687", "0.59405094", "0.5940398", "0.5923722", "0.58852065", "0.5808719", "0.5793807", "0.5792659", "0.5775063...
0.0
-1
Check that a row of headers contains all the required values
def check_headerRow(self, expected, found): # spreadsheets must have either a barcode field or a object ID field, but both are not required header1 = 'barcode' header2 = ('object identifier\n(edit heading to specify type' + ' - e.g. barcode)') expected = self.remove_annoying(header1, header2, exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_header(self, header_row):\n\n self.logger.info(\"Validating header row.\")\n \n # assume value.\n is_valid = True\n\n # check if @header_row is perfect.\n required_keys = tuple(self.required_headers.keys())\n if sorted(header_row) == sorted(required_ke...
[ "0.73380065", "0.6967268", "0.6915856", "0.6891492", "0.6657438", "0.6634957", "0.66104305", "0.65021867", "0.6489007", "0.64572406", "0.6453303", "0.6440663", "0.64279026", "0.6417046", "0.6379434", "0.63733184", "0.6361163", "0.63432103", "0.6335669", "0.63233525", "0.63167...
0.7477214
0
Check that a sheet contains the required heirarchy of headers
def check_headerEntries(self, expected, found): # spreadsheets must have either a barcode field or a object ID field, but both are not required header1 = ('original master', 'object', 'barcode') header2 = ('original master', 'object', 'object identifier\n(edit heading to specify type ' + '- e.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_headerRow(self, expected, found):\n\n # spreadsheets must have either a barcode field or a object ID field, but both are not required\n header1 = 'barcode'\n header2 = ('object identifier\\n(edit heading to specify type' +\n ' - e.g. barcode)')\n expected = self.remove_annoying(header1, ...
[ "0.7131683", "0.6868942", "0.6488493", "0.64007354", "0.6346215", "0.61032695", "0.60922384", "0.6072071", "0.6069789", "0.6030912", "0.59228843", "0.5911827", "0.59027445", "0.58506954", "0.5840867", "0.5775385", "0.5770583", "0.574336", "0.5699513", "0.565149", "0.5625152",...
0.7361219
0
Verify that no column in a sheet contains an equation Based on checking every cell in the 4th row
def check_noequations(self, sheetname): self.wb_open = load_workbook(self.name, read_only = True) sheet = self.wb_open.get_sheet_by_name(sheetname) for i in range(1, self.wb.sheet_by_name(sheetname).ncols): value = sheet.cell(row = 4, column = i).value # equation check logic, might be better c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(l):\n rows = split_rows(l)\n columns = split_columns(l)\n for r in rows + columns:\n if 0 in r:\n continue\n if sum(r) != row_sum:\n return False\n return True", "def is_valid_number(self):\n for condition in [self.game.getRow(self.pos), self.game.getC...
[ "0.6211021", "0.6107029", "0.6034179", "0.60124844", "0.60116315", "0.59965813", "0.5968232", "0.59513086", "0.59452796", "0.5932194", "0.591399", "0.59075063", "0.58937216", "0.5892847", "0.58496976", "0.5845121", "0.5805711", "0.57959926", "0.57858694", "0.5783577", "0.5775...
0.7303464
0
Convert Excel sheet into pandas dataframe Each list represents one row of the spreadsheets Header values are normalized based on dictionary Datetime values are automatically converted to ISO formats Row values are normalized based on dictionary
def normalize_excelSheet(self, sheetname, conversion_dictionary): sheet = self.wb.sheet_by_name(sheetname) ami_data = [] date_headers = ["bibliographic.date", "technical.dateCreated"] time_headers = ["technical.durationHuman"] #copy everything from the 3rd row to the last row with a filename ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_xls_sheet_to_df(sheet: opxl.workbook,\n min_row: Optional[int] = 1,\n relevant_cols: Optional[list] = None,\n irrelevant_cols: Optional[list] = None) -> pd.DataFrame:\n parsed_sheet_dict = {}\n\n for col in sheet.iter_cols(m...
[ "0.65646905", "0.6434385", "0.62506163", "0.6013509", "0.5990602", "0.5971323", "0.59404683", "0.5817023", "0.58159024", "0.5812178", "0.5791551", "0.57195747", "0.5708776", "0.56478894", "0.5630219", "0.56153893", "0.56145465", "0.5602438", "0.55972296", "0.5595342", "0.5594...
0.7525733
0
Returns a normalized dotformatted string based on the heirarchy of headers from the first three rows of the Excel sheet.
def normalize_headerEntry(self, header_entry, conversion_dictionary): if header_entry not in conversion_dictionary.keys(): print(sheetname, column, self.get_headerEntryAsTuple(sheetname, column), header_entry) return conversion_dictionary[header_entry]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_headers(worksheet):\n headers = {}\n cell_idx = 0\n while cell_idx < worksheet.ncols:\n cell_type = worksheet.cell_type(0, cell_idx)\n if cell_type == 1:\n header = slughifi(worksheet.cell_value(0, cell_idx))\n if not header.startswith(\"_\"):\n ...
[ "0.62073743", "0.5903757", "0.5876956", "0.58371", "0.5636468", "0.56299734", "0.5621793", "0.5609981", "0.5609981", "0.55955076", "0.5558388", "0.5539309", "0.54997975", "0.54631686", "0.5458954", "0.54494286", "0.5446778", "0.54431134", "0.5438566", "0.5435848", "0.54301476...
0.0
-1
Converts Excel's decimal encoded datetimes into ISO format strings. Returns blank string if xldate conversion fails, otherwise, ISO string.
def convert_excelDateTime(self, value, return_type): try: converted_value = xldate.xldate_as_datetime(value, self.wb.datemode) if return_type == "date": converted_value = converted_value.date().isoformat() if return_type == "time": converted_value = converted_value.time()....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xlDateISO(xdate):\n # QuantLib doesn't support dates prior to 1901\n # which saves us from dealing with the leap year problem\n if xdate < 367:\n return \"#Date prior to 1901-01-01\"\n \n # python dates are from year zero, excel from 1900\n return date.fromordinal(693594 + int(xdate))....
[ "0.6687495", "0.6378532", "0.62396353", "0.6211592", "0.61276424", "0.60303116", "0.5965535", "0.5956032", "0.593373", "0.58780867", "0.5857199", "0.5848956", "0.58450204", "0.5841669", "0.5823431", "0.58074826", "0.5777569", "0.5769459", "0.57469666", "0.57438207", "0.573501...
0.59779614
6
Normalize all entries via dictionaries defined in the ami_md_constants module. Returns a list of lists
def normalize_values(self, data): df = pd.DataFrame(data[1:], columns = data[0]).astype(str) df = df.replace(ami_md_constants.NAS) df = df.replace(ami_md_constants.REGEX_REPLACE_DICT, regex=True) df = df.replace(ami_md_constants.STRING_REPLACE_DICT) df['source.object.format_type'] = df['source.ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_metadata(self, md):\n md = ast.literal_eval(md)\n dd = defaultdict(list)\n\n for entry in md:\n try:\n for k, v in entry.items():\n dd[k].append(v)\n except AttributeError:\n continue\n return dd", "def ...
[ "0.5396862", "0.5393085", "0.53370476", "0.5333234", "0.5234334", "0.5232578", "0.52290213", "0.5222074", "0.519915", "0.5179328", "0.50804114", "0.504555", "0.50220764", "0.50206935", "0.5009291", "0.5001079", "0.49918917", "0.49794748", "0.49771154", "0.4963656", "0.4960963...
0.61622775
0
Conditionally map units for columns with measures
def map_value(self, df, from_column, to_column, value = None, values_map_column = None, values_map = None): if from_column not in df.columns: return df if value: df[to_column] = np.where(df[from_column].notnull(), value, None) elif values_map_column and values_map: #add unit value reg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_units(dfcols):\n ncols = {}\n for col in dfcols:\n for key, value in _units.items():\n if (key in col and \"value_\" in col) or key == col:\n ncols[col] = f\"{col}:{value}\"\n return ncols", "def unit_convert(df, coln1, coln2, unit, conversion_factor, coln3):\n ...
[ "0.6571898", "0.63297296", "0.61398256", "0.6058238", "0.60402095", "0.59321755", "0.58655155", "0.5862122", "0.5845653", "0.5816054", "0.5816054", "0.5781387", "0.5766385", "0.5753213", "0.5712268", "0.568601", "0.5676514", "0.56731987", "0.56537414", "0.56137884", "0.558996...
0.56623447
18
Convert a single Excel sheet into a CSV with normalized contents.
def write_amiCSV(self, sheetname, conversion_dictionary, csv_filename): ami_data = self.normalize_excelSheet(sheetname, conversion_dictionary) with open(csv_filename, 'w') as f: cw = csv.writer(f, quoting = csv.QUOTE_ALL) for rownum in range(0, len(ami_data)): cw.writerow(ami_data[ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mono_sheet(self):\n xls = pandas.read_excel(str(self.source))\n xls.to_csv(str(self.dest), **self.kwargs)", "def xlsx_to_csv(xlsx_file):\n csv_file = xlsx_file[:-5] + '.csv'\n with xlrd.open_workbook(xlsx_file) as wb:\n sh = wb.sheet_by_index(0)\n with open(csv_file, 'w') as...
[ "0.7540895", "0.7341542", "0.6940045", "0.6435473", "0.62311727", "0.6181006", "0.61594075", "0.6036186", "0.5988358", "0.59864724", "0.59474045", "0.59055513", "0.5903179", "0.5824314", "0.5712355", "0.56872237", "0.56752133", "0.5671983", "0.563416", "0.5577001", "0.5522592...
0.60417354
7
Convert all rows in an Excel sheet into JSON files with normalized data. Filename is based on described file's name.
def convert_amiExcelToJSON(self, sheetname, json_directory, conversion_dictionary = HEADER_CONVERSION): ami_data = self.normalize_excelSheet(sheetname, conversion_dictionary) cols = len(ami_data[0]) headers = ami_data[0] json_directory = os.path.abspath(json_directory) for row in ami...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def excel_to_json(file_path, sheet=None):\n df = pd.read_excel(file_path, sheet_name=sheet)\n columns = [str(k) for k in df.columns]\n data = [dict(zip(columns, row)) for row in df.values]\n return data", "def nodes_data_excel_to_json(excel_path,json_path,**kwargs):\n if not os.path.isfile(excel_p...
[ "0.70595056", "0.6563447", "0.6152082", "0.60554063", "0.5985892", "0.59744626", "0.5919833", "0.5697941", "0.5653924", "0.5568321", "0.5554736", "0.5531523", "0.5522933", "0.5502785", "0.5476106", "0.5474166", "0.54540044", "0.5443829", "0.5430915", "0.54281086", "0.5397335"...
0.7532426
0
Recursive method that takes a dotdelimited header and returns a nested dictionary.
def convert_dotKeyToNestedDict(self, tree, key, value): t = tree if "." in key: key, rest = key.split(".", 1) if key not in tree: t[key] = {} self.convert_dotKeyToNestedDict(t[key], rest, value) else: t[key] = value return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __recursive_build_header((name, di), heads_cont, left, depth):\n if not(isinstance(di, Mapping)) or not(isinstance(di, Sequence)):\n return left\n\n right = left\n di_iter = (di.iteritems() if isinstance(di, Mapping) else enumerate(di))\n for k, v in di_iter:\n right = __recursive_bui...
[ "0.5982864", "0.5912503", "0.57652426", "0.5646806", "0.5514801", "0.54978234", "0.5491676", "0.5361056", "0.533602", "0.52913904", "0.52825874", "0.52657944", "0.52200145", "0.5194124", "0.51674414", "0.51603013", "0.51241136", "0.510537", "0.508426", "0.5064947", "0.5034687...
0.560003
4
Creates a ListNode out of a list of values
def create_node_list(values: list[int]) -> ListNode: head = ListNode(values[0]) last_node = head for value in values[1:]: node = ListNode(value) last_node.next = node last_node = node return head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constructList(vals):\n # Current method is iterative, recursive soln also exists\n head = ListNode(val=vals.pop(0))\n current = head\n while len(vals) > 0:\n nex = ListNode(val=vals.pop(0))\n current.next = nex; current = nex\n return head", "def create_list(nums):\n return_no...
[ "0.7668803", "0.7625678", "0.76216567", "0.7119708", "0.7033482", "0.6983948", "0.6870438", "0.6869323", "0.685177", "0.6708658", "0.6708658", "0.6691854", "0.66799533", "0.6566763", "0.6503184", "0.64228106", "0.64188063", "0.6257366", "0.62438476", "0.6127412", "0.61024964"...
0.8245124
0
Returns the values in linked list
def get_values(node: ListNode) -> list[int]: values = [node.val] curr = node.next while curr is not None: values.append(curr.val) curr = curr.next return values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __to_list__(self):\r\n out = []\r\n node = self.head\r\n while node:\r\n out.append(node.value)\r\n node = node.next\r\n return out", "def printlist(self):\n current_element = self.head\n items = []\n while current_element:\n i...
[ "0.7188965", "0.6925471", "0.6883925", "0.68687975", "0.68568766", "0.6756867", "0.6735603", "0.6717372", "0.66654414", "0.6618168", "0.65939355", "0.6582247", "0.65145826", "0.6504266", "0.64761305", "0.6446153", "0.6434364", "0.6402573", "0.63876903", "0.63876903", "0.63695...
0.70627177
1
Configure the platform and add the sensors.
def setup_platform(hass, config, add_entities, discovery_info=None): name = config.get(CONF_NAME) token = config.get(CONF_API_KEY) latitude = config.get(CONF_LATITUDE, hass.config.latitude) longitude = config.get(CONF_LONGITUDE, hass.config.longitude) _LOGGER.debug("Using latitude and longitude: %s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')", "def setup_platform(hass, config, add_sensors_callback, discovery_info=None):\n\n flo = hass.data[FLO_SERVICE]\n if flo is None or not flo.is_connected:\n LOG.warning(\"No connection ...
[ "0.74864894", "0.7239367", "0.7238194", "0.72378623", "0.7099067", "0.69818896", "0.69631433", "0.69562775", "0.6948777", "0.69465494", "0.6945056", "0.69391507", "0.6869754", "0.6851387", "0.6831462", "0.68086", "0.6788309", "0.6771401", "0.6759165", "0.67398715", "0.6727710...
0.67472076
19
Return the device state attributes.
def device_state_attributes(self): if self._type == ATTR_CAQI: self._attrs[ATTR_CAQI_LEVEL] = self.data[ATTR_CAQI_LEVEL] if self._type == ATTR_PM25: self._attrs[ATTR_LIMIT] = self.data[ATTR_PM25_LIMIT] self._attrs[ATTR_PERCENT] = round(self.data[ATTR_PM25_PERCENT]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\r\n return self.attributes", "def device_state_attributes(self):\r\n return self._attributes", "def device_state_attributes(self):\n return self._attrs", "def device_state_attributes(self):\n return self.attr", "def device_state_attributes(self...
[ "0.9317156", "0.92453825", "0.92205626", "0.9214834", "0.9214834", "0.9210406", "0.9210406", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9190629", "0.9143603", ...
0.8124515
63
Return a unique_id for this entity.
def unique_id(self): return '{}-{}-{}'.format(self._latitude, self._longitude, self._type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._uuid", "def unique_id(self):\n return self._uuid", "def unique_id(self) -> str:\n return self._unique_id", "def unique_id(self) -> str:\n retur...
[ "0.8327206", "0.8327206", "0.8272821", "0.8272821", "0.82371587", "0.82371587", "0.82371587", "0.82371587", "0.82371587", "0.82371587", "0.82371587", "0.82371587", "0.82110804", "0.82110804", "0.82110804", "0.82110804", "0.82110804", "0.82110804", "0.82110804", "0.82110804", ...
0.7599431
54
Return the unit the value is expressed in.
def unit_of_measurement(self): return SENSOR_TYPES[self._type][1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unit(self):\n return self.unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_measurement(self):\n return self._unit", "def unit_of_...
[ "0.8310562", "0.82990766", "0.82990766", "0.82990766", "0.82990766", "0.82990766", "0.82990766", "0.82990766", "0.8288592", "0.8219499", "0.8198925", "0.8180697", "0.8128963", "0.8128963", "0.810741", "0.8106213", "0.80781543", "0.80738926", "0.8067357", "0.8056088", "0.80560...
0.7663991
90
Get the data from Airly.
def update(self): url = 'https://airapi.airly.eu/v2/measurements/point' \ '?lat={}&lng={}&maxDistanceKM=2'.format(self._latitude, self._longitude) headers = {'Accept': CONTENT_TYPE_JSON, 'apikey': self._token} request = requests...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data():\n pass", "def get_data(self):", "def get_data():\n return", "def data_airline():\n return load_airline()", "def get_data():\n pass", "def get_data():\n pass", "def get_data():\n pass", "def get_data(self):\n pass", "def get_data(self):\n pass", ...
[ "0.7121551", "0.69282097", "0.68754494", "0.68604296", "0.68405515", "0.68405515", "0.68405515", "0.68041074", "0.68041074", "0.6746953", "0.6448279", "0.6406572", "0.6399576", "0.6364607", "0.6357176", "0.6322595", "0.6285306", "0.6256383", "0.6256383", "0.6256383", "0.62495...
0.0
-1
Return a new state based on the type.
def get_data(self, data): self.data = {} self.data[ATTR_PM1] = data['current']['values'][0]['value'] self.data[ATTR_PM25] = data['current']['values'][1]['value'] self.data[ATTR_PM25_LIMIT] = data['current']['standards'][0]['limit'] self.data[ATTR_PM25_PERCENT] = (data['current'][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_state(self, key, content_type=\"data\", **kwargs):\n\n return State(project=self._project_name, plugin=self.name, key=key,\n content_type=content_type, **kwargs)", "def makeState(self):\n state = None\n\n if self.ai == True:\n state = AIState(self.game,...
[ "0.67703027", "0.67536527", "0.6576292", "0.6475518", "0.6349362", "0.624299", "0.61938703", "0.61094", "0.6087952", "0.602376", "0.5984257", "0.59742534", "0.5973566", "0.5879578", "0.58726144", "0.5871349", "0.57733697", "0.5768514", "0.5755685", "0.5740098", "0.5711539", ...
0.0
-1
This gets called when we have some new events we might want to send out to other servers.
def notify_new_events(self, current_id): self._last_poked_id = max(current_id, self._last_poked_id) if self._is_processing: return # fire off a processing loop in the background run_as_background_process( "process_event_queue_for_federation", self._p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_new_events(self, events):\n for event in events:\n self.events.append(\n self.create_event_object(\n event[0],\n event[1],\n int(event[2])))", "def handleEvents(self, events):\n pass", "def send_messages...
[ "0.6743674", "0.666075", "0.6521072", "0.62937635", "0.627517", "0.6272705", "0.6248134", "0.6237723", "0.6236486", "0.6236104", "0.62294984", "0.61761016", "0.6165806", "0.6108414", "0.6098768", "0.606632", "0.6063825", "0.60432625", "0.6040443", "0.60383534", "0.6000116", ...
0.0
-1
Send the new presence states to the appropriate destinations. This actually queues up the presence states ready for sending and triggers a background task to process them and send out the transactions.
def send_presence(self, states): if not self.hs.config.use_presence: # No-op if presence is disabled. return # First we queue up the new presence by user ID, so multiple presence # updates in quick successtion are correctly handled # We only want to send presence...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_presence_inner(self, states):\n hosts_and_states = yield get_interested_remotes(self.store, states, self.state)\n\n for destinations, states in hosts_and_states:\n for destination in destinations:\n if destination == self.server_name:\n contin...
[ "0.63299507", "0.62768155", "0.6022448", "0.58827865", "0.5726486", "0.5599578", "0.5594017", "0.5575293", "0.54970497", "0.5493874", "0.5484622", "0.54680294", "0.5442738", "0.5420104", "0.54031575", "0.52907646", "0.5263941", "0.5263679", "0.5166595", "0.51161945", "0.51116...
0.748558
0
Given a list of states populate self.pending_presence_by_dest and poke to send a new transaction to each destination
def _process_presence_inner(self, states): hosts_and_states = yield get_interested_remotes(self.store, states, self.state) for destinations, states in hosts_and_states: for destination in destinations: if destination == self.server_name: continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_presence(self, states):\n if not self.hs.config.use_presence:\n # No-op if presence is disabled.\n return\n\n # First we queue up the new presence by user ID, so multiple presence\n # updates in quick successtion are correctly handled\n # We only want to s...
[ "0.6810247", "0.5623089", "0.5551934", "0.5548037", "0.54922086", "0.5445148", "0.5405358", "0.53879744", "0.52504075", "0.5156768", "0.5064558", "0.50595564", "0.50569946", "0.504726", "0.504384", "0.50202674", "0.50122774", "0.5000987", "0.49834234", "0.49677846", "0.496333...
0.69715214
0
Try to start a new transaction to this destination If there is already a transaction in progress to this destination, returns immediately. Otherwise kicks off the process of sending a transaction in the background.
def _attempt_new_transaction(self, destination): # list of (pending_pdu, deferred, order) if destination in self.pending_transactions: # XXX: pending_transactions can get stuck on by a never-ending # request at which point pending_pdus_by_dest just keeps growing. # we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startTransaction(self):\n if self._transaction is None:\n d = self._config.startTxn()\n\n def processTxn(result):\n self._transaction = result\n return self._transaction\n\n d.addCallback(processTxn)\n retu...
[ "0.7000915", "0.67738664", "0.6762412", "0.6707133", "0.6538464", "0.6440339", "0.62238014", "0.6156051", "0.6078979", "0.59524673", "0.5896528", "0.58385485", "0.5802584", "0.57806635", "0.5777683", "0.57267606", "0.5691366", "0.56613284", "0.5601267", "0.5547398", "0.55116"...
0.7620211
0
Update the browser object with the url that is passed to the class.
def get_page(self): self.browser.get(self.url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_url(self): \n self.url = self.geturl()", "def set_url(self, url):\n self.url = url", "def set_url(self, url):\n self.url = url", "def url(self, url):\n\n self._url = url", "def url(self, url):\n\n self._url = url", "def url(self, url):\n\n self._url =...
[ "0.73725235", "0.73231465", "0.71038073", "0.68593585", "0.68593585", "0.68593585", "0.68593585", "0.68593585", "0.68593585", "0.68593585", "0.684815", "0.6782225", "0.67121196", "0.6707749", "0.6707749", "0.6707749", "0.665657", "0.65594506", "0.6520095", "0.6477725", "0.642...
0.60827136
36
Filter objects small and/or large objects from a segmentation and set them to 0. By default this functions relabels the segmentation result consecutively. Set relabel=False to avoid this behavior.
def size_filter(data, out, min_size=None, max_size=None, block_shape=None, n_threads=None, mask=None, verbose=False, roi=None, relabel=True): assert (min_size is not None) or (max_size is not None) ids, counts = unique(data, return_counts=True, block_shape=block_shape, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_and_relabel_blobs(labeled, wanted_blobs):\n labeled = labeled.copy()\n wanted_blobs = np.array(wanted_blobs)\n no_blobs = len(wanted_blobs)\n unwanted_blobs = np.arange(1, no_blobs+1)[np.logical_not(wanted_blobs)]\n wanted_blobs = np.arange(1, no_blobs+1)[wanted_blobs]\n\n for unwante...
[ "0.6220534", "0.61371964", "0.5886777", "0.5772912", "0.5748246", "0.5691252", "0.55321515", "0.5441326", "0.5394852", "0.53849643", "0.53832376", "0.5380843", "0.53665656", "0.5361937", "0.53473145", "0.53028536", "0.530139", "0.530139", "0.5282939", "0.52733177", "0.5244627...
0.5066465
28
Runs the test script over the specified packages and records anomalies.
def run(self): print('Quality script: ' + self.script) print('Report file: ' + self.report) print('Base dir: ' + self.baseDir) cont = raw_input('Are these values correct? ' + \ 'Press "A" to abbort or any other key to proceed ') if cont == 'A':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n run_test_summary1a()\n run_test_summary1c()\n run_test_summary1c()", "def run_tests(args, applog):\n try:\n additional_args = []\n additional_args.extend([\"--pyargs\", \"dent_os_testbed.test.test_suite\", \"--strict-markers\"])\n additional_args.append(\"--duration...
[ "0.63612777", "0.6300278", "0.61056405", "0.6047974", "0.6019787", "0.59900594", "0.5932907", "0.5910972", "0.58891124", "0.58593696", "0.5804588", "0.578558", "0.5778875", "0.5775472", "0.5771944", "0.57594794", "0.57347435", "0.5726955", "0.5715525", "0.5690489", "0.5683379...
0.0
-1
Parses a cvs log to information to generate a style quality test.
def parseCVS(self, cvsLog, pathCut, moduleCut, maxVotes): # pathCuts the path from e.g. # cvmsserver/repositories/CMSSW/WMCore/src/python/WMCore) # to src/python/WMCore # moduleCut ensures that non relevant modules are not incorporated. e.g. # src/python/WMCore becomes WMCore ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_log(self,filename,log_year):\n\n \n download_filename=os.sep.join([self.source_dir,filename])\n my_logger.debug(\"parsing log file: %s\" % download_filename)\n try:\n f = open(download_filename,mode='rt')\n except IOError:\n my_logger.debug( \"can't op...
[ "0.66938066", "0.58697355", "0.5732533", "0.5718906", "0.56865495", "0.55905217", "0.55761844", "0.5561141", "0.54948694", "0.54944205", "0.546756", "0.54136455", "0.54129696", "0.5412739", "0.5395959", "0.5341783", "0.5321524", "0.5316403", "0.5310842", "0.5306918", "0.53042...
0.5425658
11
Does some preprocessinc on information. If submodules of a module are the responsbility of one developer we aggregrate them in our style check.
def preProcess(self): for moduleName in self.module.keys(): # find the one with the most votes per module: votes = 0 winner = '' for voter in self.module[moduleName].keys(): if self.module[moduleName][voter] > votes: votes = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_module_list(self, modules):", "def process_module(self, node):\n code = node.file_stream.read()\n\n try:\n tree = compile(code, node.file, \"exec\", ast.PyCF_ONLY_AST)\n except SyntaxError:\n # Pylint would have already failed\n return\n\n ...
[ "0.54041815", "0.5396395", "0.5298839", "0.52766603", "0.52583736", "0.51609725", "0.5023325", "0.50173897", "0.50173897", "0.50173897", "0.50173175", "0.50173175", "0.50173175", "0.50173175", "0.50173175", "0.49220988", "0.492106", "0.49128735", "0.48859426", "0.48705772", "...
0.56209105
0
Generates a python file that uses the result of parsing and this class to generate a script that checks to code quality.
def generate(self, fileName): self.preProcess() styleFile = open(fileName, 'w') # write head part head = """#!/usr/bin/env python import os from WMQuality.Code import Code # output of the log files # prefix of the files in cvs # quality script for using pylint: qualityScript = '%s' # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n logger=self.logger\n outputter=self.OutputType()\n outputter.make_runner(parser=self.parser,dry_run=self.dry_run,\n setarith=self.setarith)\n con=fileless_context(\n scopes=[self.parse_result],verbose=self.verbose,logger=logg...
[ "0.67679656", "0.66761065", "0.6591752", "0.65536964", "0.6444953", "0.6438405", "0.62742144", "0.615006", "0.61399806", "0.6091215", "0.6081134", "0.59454465", "0.5871897", "0.58534235", "0.5835145", "0.5828372", "0.5812517", "0.5808845", "0.5806871", "0.57893455", "0.576894...
0.7254187
0
Prints a summary of the run
def summaryText(self): print('\nReport Summary:\n') for author in self.lowQuality.keys(): if len(self.lowQuality[author]) > 0: print('Author: ' + author) print('---------------------') # do some sorting for readability files = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_summary(self):\n #outcomes = self.get_outcomes()\n #passes = 'Passes: %i' % sum(1 for outcome in outcomes if outcome == Result.PASS)\n #untested = 'Untested: %i' % sum(1 for outcome in outcomes if outcome == Result.UNTESTED)\n #errors = 'Errors: %i' % sum(1 for outcome...
[ "0.78791", "0.7874764", "0.74773556", "0.74062145", "0.73486876", "0.7348604", "0.72328347", "0.72125745", "0.71955603", "0.7164168", "0.71501046", "0.7143704", "0.7138837", "0.71243864", "0.7120223", "0.7025844", "0.69765854", "0.6959708", "0.69594544", "0.6959164", "0.69480...
0.0
-1
diffuse diffuse color (RGB) Kd diffuse intensity [0,1] specular specular color (RGB) Ks specular intensity [0,1] shininess specular falloff; lower values means higher spreading out of specular highlight. Kt How transmissive the material is. Clear glass is fully transmissive. Stained glass only so much so. [0,1] ior Ind...
def __init__(self, diffuse=RGB(1,1,1), Kd=1.0, specular=RGB(1,1,1), Ks=0.0, shininess=8.0, Kt=0.0, ior=1.0, name=None): if name is None: name = "Material %d" % Material._num_materials Material._num_materials += 1 self.name = name self.diffuse = diffuse self.Kd = Kd self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, diffuseColor, ambientIntensity = .2,\n specularColor = (0,0,0), shininess = .2,\n emissiveColor = (0,0,0), transparency = 0):\n self.diffuseColor = diffuseColor\n self.ambientIntensity = ambientIntensity\n self.specularColor = specularColor\n ...
[ "0.645248", "0.64114743", "0.61629355", "0.5979592", "0.59120864", "0.5853777", "0.5826172", "0.5797646", "0.5677648", "0.56749535", "0.56060797", "0.54900175", "0.54776514", "0.54744554", "0.5469744", "0.5450914", "0.54474854", "0.54351616", "0.5381109", "0.5372256", "0.5365...
0.5798116
7
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7797633", "0.77625954", "0.77602196", "0.7757519", "0.76584935", "0.76584935", "0.76584935", "0.76584935", "0.7589092", "0.7433975", "0.7410552", "0.7397003", "0.7360935", "0.73204947", "0.7271785", "0.72655344", "0.7264959", "0.7259807", "0.72332364", "0.72179425", "0.720...
0.7093289
58
Converts a label (int or string) into the corresponding emoji code (string) ready to be printed
def label_to_emoji(label): return emoji.emojize(emoji_dictionary[str(label)], use_aliases=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_to_emoji(label):\n return emoji.emojize(emoji_dictionary[str(label)], use_aliases=True)", "def enlabel(mi_, ma_):\n\treturn \"Unicode characters from {} to {} codepoints\".format(mi_, ma_)", "def encode_label(label: str) -> int:\n\tif not label:\n\t\treturn 0\n\t# part after letter if it has a...
[ "0.7272648", "0.69121975", "0.6714614", "0.6622562", "0.65761894", "0.63744277", "0.6343508", "0.6291406", "0.6272418", "0.6255976", "0.6253193", "0.6230639", "0.61966836", "0.6166489", "0.6116947", "0.60760766", "0.59760815", "0.5971965", "0.59579533", "0.5914526", "0.590115...
0.7409943
2
Set initial conditions using dictionary and file
def x_test_initial_conditions(self): dr = DataRequest() dr.created_by = 'aduser01' dr.type = 'Debug' dr.subject = '65nm_Fuji' dr.priority = 2 dr.deadline = '2011-01-01' dr.test = 'Jitter Generation' dr.initial_conditions = exepat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init() -> None:\n init_dict()\n parse_file(\"alphabet.txt\", letters)\n parse_file(\"numbers.txt\", numbers)\n parse_file(\"symbols.txt\", symbols)", "def __init__(self, file):\n\n self.read(file)\n\n for key in [\"sqlite3dir\", \"htmldir\"]:\n print(key)\n if ...
[ "0.61755854", "0.5979943", "0.59359956", "0.59050786", "0.5900806", "0.5842487", "0.579445", "0.5688119", "0.5631115", "0.5629196", "0.56257194", "0.56257194", "0.5621554", "0.561113", "0.5606248", "0.56019634", "0.55999345", "0.55968344", "0.5571558", "0.55638313", "0.555568...
0.57847023
7
Determine the URL corresponding to Python object Notes
def linkcode_resolve(domain, info): # NOQA: C901 if domain != 'py': return None modname = info['module'] fullname = info['fullname'] submod = sys.modules.get(modname) if submod is None: return None obj = submod for part in fullname.split('.'): try: obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object_view_url(self, nuxeo_id):\n parts = urlparse.urlsplit(self.nx.conf[\"api\"])\n url = \"{}://{}/Nuxeo/nxdoc/default/{}/view_documents\".format(parts.scheme, parts.netloc, nuxeo_id) \n return url", "def Url(self) -> str:", "def getLink(self):", "def getURLForThing(thing):", ...
[ "0.67361546", "0.6619578", "0.65973395", "0.6481267", "0.6355462", "0.62002313", "0.62002313", "0.6164911", "0.61543", "0.61456114", "0.6114633", "0.610115", "0.6096105", "0.6011674", "0.6000248", "0.5998818", "0.5998818", "0.59857607", "0.5966627", "0.5955182", "0.5950999", ...
0.0
-1
Batch normalization on convolutional maps.
def batch_norm(in_tensor, phase_train, name, reuse=None, data_format='NHWC', center=True, scale=True): axis = -1 if data_format == 'NHWC' else 1 with tf.variable_scope(name): # return tf.contrib.layers.batch_norm(in_tensor, is_training=phase_train, scope=scope, reuse=reuse) return tf.layers.batc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(batch_img: np.ndarray) -> np.ndarray:\n batch_img = batch_img.astype('float32')\n return batch_img / 127.5 - 1", "def batch_norm(self, inputs):\n x = inputs\n x = self.bn(x)\n return x", "def normalize_data(batch_data):\n B, N, C = batch_data.shape\n normal_data =...
[ "0.6930834", "0.68679607", "0.6794758", "0.67577684", "0.672155", "0.6657451", "0.66176784", "0.6499254", "0.6441095", "0.6425998", "0.6425998", "0.6392341", "0.6389387", "0.6377298", "0.63615394", "0.63531184", "0.63373864", "0.6333414", "0.63091886", "0.6295941", "0.6292918...
0.6269631
21
From the dictionary generate next hyparameter and save_dir
def get_hparam_generator(hparam_ranges): def generator(): iteratable_keys = [key for key, r in hparam_ranges.items() if isinstance(r, list)] non_iteratable_keys = [key for key, r in hparam_ranges.items() if not isinstance(r, list)] for iteratable_values in product(*[hparam_ranges[k] for k in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_out_path(d):\n assert \"output_dir\" in d, \"Dictionary must have output dir\"\n\n path = d.pop(\"output_dir\")\n\n weights_path = path + \"weights_\"\n log_path = path + \"log_\"\n train_data_path = path + \"train_data_\"\n\n # Sort dictionary for consistency\n odict = OrderedDict(s...
[ "0.59171665", "0.5565412", "0.53348255", "0.5334701", "0.5310792", "0.52287525", "0.52108014", "0.51943827", "0.51653135", "0.51300305", "0.51137793", "0.5107134", "0.5050201", "0.5043229", "0.50364536", "0.50231034", "0.5020535", "0.5018681", "0.5017332", "0.5011019", "0.498...
0.0
-1
Test for Library System creation
def test_System_creation(self): s1 = System() self.assertEqual(s1.get_library_name(), "default")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_system_entire(self):\n pass", "def test_library(self):\n self.assertEqual(LibraryConfig.name, \"library\")", "def test_create_software_bundle_from_system_module(self):\n pass", "def test_get_system(self):\n pass", "def test_list_available_libraries(self):\n ...
[ "0.7114945", "0.7110992", "0.69046354", "0.6895962", "0.6762503", "0.6724689", "0.67044646", "0.6660487", "0.6562099", "0.6488525", "0.6482666", "0.6377499", "0.6375429", "0.63601446", "0.6281375", "0.627325", "0.62369835", "0.62260705", "0.6192796", "0.61692935", "0.61692935...
0.8082865
0
Test for set_get_library_name methods
def test_set_library_name(self): s1 = System() s1.set_library_name("Andreson") self.assertEqual(s1.get_library_name(), "Andreson")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_library(self):\n self.assertEqual(LibraryConfig.name, \"library\")", "def test_get_module_name_alternate(self):\n target = Mock(['__name__'])\n target.__name__ = 'hello'\n self.assertEqual('hello', reloading.get_module_name(target))", "def test_System_creation(self):\n ...
[ "0.6658442", "0.6303437", "0.61149365", "0.6047091", "0.5958926", "0.5918382", "0.5897615", "0.5862234", "0.5839088", "0.5758882", "0.5628555", "0.56156504", "0.55159885", "0.5514347", "0.54656523", "0.5462677", "0.54573643", "0.5456163", "0.5449216", "0.5434502", "0.5413884"...
0.7909149
0
Test for set_get_address methods
def test_set_address(self): s1 = System() s1.set_address("101 St James Rd") self.assertEqual(s1.get_address(), "101 St James Rd")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_client_address_retrieve(self):\n pass", "def test_client_address_update(self):\n pass", "def test_address_info(self):\n from supvisors.rpcinterface import RPCInterface\n # prepare context\n self.supervisor.supvisors.context.addresses = {\n '10.0.0.1': Mock...
[ "0.7707231", "0.7532003", "0.7299374", "0.71625394", "0.714698", "0.677194", "0.67455375", "0.66716015", "0.6585854", "0.6518641", "0.6498674", "0.6489233", "0.64433426", "0.6354058", "0.6336124", "0.6326224", "0.62694657", "0.62578624", "0.62524426", "0.6246869", "0.62225807...
0.80260247
0
Test for get_catalogue method
def test_get_catalogue(self): s1 = System() self.assertEqual(len(s1.get_catalogue()), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_ucs_get_catalog(self):\n api_data = request(\"get\", \"/sys\")\n self.assertEqual(api_data['status'], 200,\n 'Incorrect HTTP return code, expected 200, got:' + str(api_data['status']))\n total_elements = 0\n for elementTypes in api_data[\"json\"]:\n ...
[ "0.6866592", "0.6642273", "0.65242225", "0.64913774", "0.63869", "0.63858384", "0.6321552", "0.63013244", "0.62671864", "0.62502635", "0.6246352", "0.6245286", "0.62361485", "0.6227771", "0.6207126", "0.6173256", "0.61397535", "0.6139452", "0.6126137", "0.6113673", "0.6067933...
0.7337848
0
Test for add_resource method
def test_add_resource(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") self.assertNotIn(b1, s1.catalogue) s1.add_resource(b1) self.assertIn(b1, s1.catalogue) s1.add_resource(b1) self.assertEqual(len(s1.catalogue),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_resource_user_resource_add_user_post(self):\n pass", "def test_add_resource(self):\n self.login_editor() \n\n # invalid submission with missing required fields\n form_data = minimal_form_data()\n response = self.client.post('/resource/new', form_data )\n ...
[ "0.75176287", "0.7469037", "0.737283", "0.72444254", "0.7171602", "0.68219227", "0.66673607", "0.66355", "0.6561624", "0.6520029", "0.65143245", "0.65109766", "0.6500391", "0.6483741", "0.6471121", "0.64403176", "0.64361775", "0.63794154", "0.6364287", "0.6359559", "0.6358183...
0.78162867
0
Test for get_catalogue_lengh method
def test_get_catalogue_lengh(self): s1 = System() self.assertEqual(s1.get_catalogue_lengh(), 0) b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") s1.add_resource(b1) self.assertEqual(s1.get_catalogue_lengh(), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_catalog_size() -> int:\n return len(gift_catalog)", "def test_get_catalogue(self):\n s1 = System()\n self.assertEqual(len(s1.get_catalogue()), 0)", "def get_lengte(self):", "def test_default_num_products(self):\r\n prod = generate_products()\r\n self.assertEqual(len(pro...
[ "0.75294435", "0.7064883", "0.64226764", "0.6203608", "0.6200589", "0.6065192", "0.6011624", "0.6011624", "0.6011624", "0.5977219", "0.59744227", "0.59733105", "0.59733105", "0.5972438", "0.59704494", "0.59694606", "0.59691674", "0.5932574", "0.5910652", "0.5908123", "0.59081...
0.7648255
0
Test for check_resource method
def test_check_resource(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") self.assertEqual(s1.check_resource(b1), False) s1.add_resource(b1) self.assertEqual(s1.check_resource(b1), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_resource():\n mock_name = \"rg-001\"\n output = sh.is_valid_resource(mock_name)\n assert output is True", "def ResourceExists(self, name):\n pass", "def _resource_name_check(self, resource_name):\n return self._name_check(resource_name, 'resources')", "def resources():\n ...
[ "0.73959047", "0.71328235", "0.70060706", "0.6716015", "0.6670783", "0.66292065", "0.6610881", "0.65043044", "0.649458", "0.6476513", "0.6467334", "0.6438803", "0.64315283", "0.63967735", "0.63661104", "0.6344003", "0.6321799", "0.63212746", "0.62832993", "0.62726897", "0.625...
0.81357706
0
Test for edit_resource method
def test_edit_resource(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") s1.edit_resource(b1, "Animal Farm") self.assertEqual(b1.get_title(), "1984") s1.add_resource(b1) s1.edit_resource(b1, "Animal Farm") self.ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_edit(self):\n response = self.get('/study/edit/1')\n self.assertEqual(response.code, 200)\n self.assertNotEqual(str(response.body), \"\")", "def test_offers_edit(self, mock_find):\n mock_find.return_value = sample_offer\n\n result = self.client.get(f'/offers/{sampl...
[ "0.73706436", "0.7300331", "0.7283525", "0.6929135", "0.6886645", "0.68010265", "0.67788994", "0.67335325", "0.66969943", "0.66636723", "0.6662277", "0.6639534", "0.6626035", "0.6625544", "0.6624509", "0.6613107", "0.6602862", "0.658556", "0.6576637", "0.65542984", "0.653163"...
0.7786377
0
Test for search_resource method
def test_search_resource(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") self.assertEqual(s1.search_resource(b1), None) s1.add_resource(b1) self.assertEqual(s1.search_resource(b1), b1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_search_term_found_in_titl...
[ "0.75347525", "0.75347525", "0.75347525", "0.7347876", "0.70456636", "0.6963902", "0.6943536", "0.69269586", "0.6910861", "0.690744", "0.6829568", "0.6813505", "0.6797388", "0.6785908", "0.67844117", "0.67436486", "0.6666172", "0.66304046", "0.659121", "0.6566244", "0.6546078...
0.8162452
0
Test for search_by_ISBN method
def test_search_by_ISBN(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") self.assertEqual(s1.search_by_ISBN("0123456789123"), 0) s1.add_resource(b1) self.assertEqual(s1.search_by_ISBN("0123456789123"), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_client_by_isbn(self, mock_get):\n\n response = isbn_utils.search_by(self.filter_isbn, self.ISBN)\n self.assertEqual(response.data, json.loads(open(UNIT_TEST_RESOURCES_FOLDER +\n FILE_NAME_ISBN_SEARCH_RESPONSE).read())[\"data\"])", "d...
[ "0.77695554", "0.72875947", "0.714704", "0.6777699", "0.67719877", "0.675688", "0.67482865", "0.6720576", "0.6668579", "0.6662156", "0.6598414", "0.657023", "0.6536934", "0.64985555", "0.6488425", "0.6473168", "0.6417611", "0.64053017", "0.6354876", "0.6300086", "0.62986517",...
0.8734922
0
Test for search_by_author method
def test_search_by_author(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") self.assertEqual(s1.search_by_author("George Orwell"), 0) s1.add_resource(b1) self.assertEqual(s1.search_by_author("George Orwell"), 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_author(self):\n\n\t\titem_id = mock_item(title='Dummy Title', author='Made Up Author')[0]\n\n\t\titem = models.search('Made')[0]\n\t\tself.assertEqual(item['id'], item_id)", "def test_absorbs_naked_author_search(self):\n invenio_search = \"author:ellis\"\n spi_search = \"aut...
[ "0.8368521", "0.82203734", "0.80754197", "0.79184866", "0.7810743", "0.7788319", "0.7780222", "0.7542295", "0.7385078", "0.73468894", "0.7330463", "0.72824466", "0.7165914", "0.71103066", "0.71090764", "0.70983607", "0.69483745", "0.69440126", "0.6858059", "0.6829173", "0.679...
0.8337529
1
Test for remove_resource method
def test_remove_resource(self): s1 = System() b1 = Books("1984", "George Orwell", "Harvill Secker", "1949", "0123456789123") self.assertEqual(s1.remove_resource(b1), print()) s1.add_resource(b1) self.assertIn(b1, s1.catalogue) s1.remove_resource(b1) self.assertNot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_objectresource_remove(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjectWithName(\"...
[ "0.7665867", "0.75597936", "0.7369516", "0.68952036", "0.6845173", "0.6773295", "0.6739468", "0.67386067", "0.67290366", "0.66695964", "0.66498464", "0.6646193", "0.6591958", "0.6567395", "0.6535467", "0.65260106", "0.6509816", "0.6509816", "0.65032136", "0.649242", "0.646448...
0.80478346
0