query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Copies a value from return the stack to the data stack.
def op_fetch_rs(state): state.data_stack.push(state.return_stack.pop())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_value_to_stack(self, stack: \"stack.Stack\", value: Any):\n pass", "def push(stack: List[U256], value: U256) -> None:\n if len(stack) == 1024:\n raise StackOverflowError\n\n return stack.append(value)", "def push(self, value):\n # If the stack is full, then display an erro...
[ "0.67705816", "0.642983", "0.6420873", "0.63490814", "0.6339164", "0.616684", "0.6161441", "0.6161441", "0.61558676", "0.6138761", "0.6124832", "0.6040684", "0.59214175", "0.59141594", "0.590348", "0.58965135", "0.5884357", "0.58256316", "0.5803744", "0.5791848", "0.5782037",...
0.0
-1
Copies a value from return the stack to the data stack.
def op_dupn(state): state.data_stack.dupn(state.data_stack.pop())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_value_to_stack(self, stack: \"stack.Stack\", value: Any):\n pass", "def push(stack: List[U256], value: U256) -> None:\n if len(stack) == 1024:\n raise StackOverflowError\n\n return stack.append(value)", "def push(self, value):\n # If the stack is full, then display an erro...
[ "0.67705816", "0.642983", "0.6420873", "0.63490814", "0.6339164", "0.616684", "0.6161441", "0.6161441", "0.61558676", "0.6138761", "0.6124832", "0.6040684", "0.59214175", "0.59141594", "0.590348", "0.58965135", "0.5884357", "0.58256316", "0.5803744", "0.5791848", "0.5782037",...
0.0
-1
Returns a signed value that can be decoded using decode_signed_value. key is a secret. val value to be signed.
def create_signed_value(key, val): val = base64.b64encode(str(val)) signature = _sign(key, val) return b'|'.join([val, signature])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_signed_value(key, signed_val):\n try:\n (val, signature) = str(signed_val).split(b'|')\n except ValueError:\n return None\n if signature != _sign(key, val):\n return None\n return base64.b64decode(val)", "def sign(message, key):\n return chopstring(message, key['d']...
[ "0.7569393", "0.5571644", "0.5558935", "0.54287916", "0.52915406", "0.52623624", "0.52623624", "0.523161", "0.5226403", "0.5200945", "0.51985765", "0.51930183", "0.5186615", "0.51738083", "0.51442343", "0.5104157", "0.50948226", "0.5073581", "0.50670904", "0.50617415", "0.506...
0.7019958
1
Inserts a value to the set. Returns true if the set did not already contain the specified element.
def insert(self, val: int) -> bool: if val not in self.hash_map: self.hash_map[val] = 1 self.keys_set.add(val) return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, val: int) -> bool:\n if val in self.setlist :\n return False\n self.setlist.add(val)\n return True", "def insert(self, val: int) -> bool:\n if val in self.sett:\n return False\n self.sett.add(val)\n return True", "def insert(self,...
[ "0.78744835", "0.77808934", "0.7596912", "0.7450075", "0.7372999", "0.7346674", "0.72753483", "0.70917314", "0.7089391", "0.7078725", "0.70697796", "0.7038377", "0.70064014", "0.69760734", "0.69307214", "0.691181", "0.68781555", "0.68768567", "0.6854704", "0.68453157", "0.682...
0.7029064
12
Given a list of integers [i_0,i_1,...,i_m] it returns a list of int8 integers as follows [0,0,...,1,1,...,2,2....,....,m,m,m...] where 0 is repated i_0 times, 1 is repated i_1 times and so on and so forth
def gen_indices(l): x = np.zeros(sum(l), dtype=np.uint8) ss = 0 for i, ii in enumerate(l): for j in range(ii): x[j+ss] = i ss += l[i] return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ex8(n):\r\n v = [0 for i in range(n)]\r\n for i in range(n):\r\n v[i] = numpy.binary_repr(i+1)\r\n return v", "def make_big(number): #8\n return list(range(number))", "def IntArr(prefix, sz, N):\n return [ BitVec('%s__%s' % (prefix, i), sz) for ...
[ "0.6451219", "0.6376258", "0.62835985", "0.6184438", "0.60130304", "0.600788", "0.60059214", "0.59735477", "0.5971742", "0.5941354", "0.5923417", "0.5915944", "0.5913418", "0.5873554", "0.584031", "0.5797987", "0.57728875", "0.5768078", "0.5747268", "0.57166815", "0.5709408",...
0.69288343
0
Test the parse_zpe() function for parsing zero point energies
def test_parse_zpe(self): path1 = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'C2H6_freq_QChem.out') path2 = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'CH2O_freq_molpro.out') path3 = os.path.join(ARC_PATH, 'arc', 'testing', 'freq', 'NO3_freq_QChem_fails_on_cclib.out') path4 =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zpves(output_string):\n\n # Patterns for the ZPVE of a rotor\n num_patterns = (app.EXPONENTIAL_FLOAT, app.FLOAT)\n pattern1 = (app.escape('minimum energy[kcal/mol]') +\n app.one_or_more(app.SPACE) +\n '=' +\n app.one_or_more(app.SPACE) +\n ap...
[ "0.6365714", "0.5812142", "0.5705641", "0.5679024", "0.56075406", "0.5576571", "0.557385", "0.552737", "0.54501987", "0.5438234", "0.5412254", "0.5410799", "0.538994", "0.5386335", "0.5368752", "0.53323317", "0.52930075", "0.51928943", "0.5182828", "0.51707774", "0.51554203",...
0.78157085
0
Test get_user_skill invalid repo response.
def test_get_user_skill_when_invalid_or_missing(self, mock_user_skill_repo_get): # Arrange with self.app.app_context(): mock_user_skill_repo_get.return_value = None user_skill_controller = UserSkillController(self.request_context) # Act result = user_skil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_skill_ok_response(self, mock_user_skill_repo_get):\n # Arrange\n with self.app.app_context():\n mock_user_skill_repo_get.return_value = self.mock_user_skill\n user_skill_controller = UserSkillController(self.request_context)\n\n # Act\n re...
[ "0.71854556", "0.7032831", "0.6548899", "0.6402017", "0.6343964", "0.6205863", "0.61347854", "0.59524405", "0.58490133", "0.5693709", "0.5693293", "0.5688293", "0.5685908", "0.5663988", "0.5663271", "0.5652456", "0.56431895", "0.56198394", "0.5619316", "0.55866444", "0.558660...
0.81289923
0
Calculate final score from player 0 perspective, negative is lost by X, 0 is a tie and positive is won by X
def calculate_score_player_0(self): if len(self.player_board[0].minions) == 0: return - self.player_board[1].score() else: return self.player_board[0].score()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opponent_score(score):\n return 1 - score", "def final_strategy(score, opponent_score):\n return 5", "def score_wonder(scores):\n reg = mscore(scores[0][1], scores[1][1])\n if reg < 0:\n return 0\n return mscore(scores[0][0], scores[1][0]) - reg", "def custom_score_11(game, play...
[ "0.73239756", "0.70481753", "0.69673723", "0.683453", "0.67954314", "0.6751064", "0.6730404", "0.67284966", "0.66994256", "0.66964436", "0.66964436", "0.66943276", "0.6694105", "0.6679982", "0.6679406", "0.6666518", "0.66591096", "0.66432923", "0.66399276", "0.66260684", "0.6...
0.7088247
1
Iterator to compute positions for straight segments. This produces point pairs which fill the space from 0dist. Neighbouring sections will be merged when they have the same type.
def broken_iter( self, chance: float, ) -> Iterator[tuple[Vec, Vec, bool]]: rng = rand.seed(b'ant_broken', self.start, self.end, chance) offset = self.end - self.start dist = offset.mag() // 16 norm = 16 * offset.norm() if dist < 3 or chance == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_pair_iterator(self):\n queue = deque()\n while True:\n if len(queue) < 1:\n pairs = self.generate_pairs(self.sample_size)\n labels = None\n for label_name in self.labels:\n if label_name in ('geo_dist', '2d_dist', '3...
[ "0.6414344", "0.6276582", "0.6167202", "0.6107403", "0.6082632", "0.59812886", "0.59729517", "0.59067297", "0.58766425", "0.5742658", "0.57256615", "0.56763065", "0.56337637", "0.5616666", "0.5599853", "0.5574308", "0.55507666", "0.5550424", "0.55366063", "0.5524797", "0.5522...
0.0
-1
Return a configuration with static batch size and (local) epochs.
def fit_config(server_round: int) -> Dict[str, fl.common.Scalar]: config: Dict[str, fl.common.Scalar] = { "epoch_global": str(server_round), "epochs": str(1), "batch_size": str(64), } return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config() -> Config:\n cfg = Config()\n cfg.BATCH_SIZE = 2\n cfg.TRAIN_TEST_SPLIT = 0.8\n cfg.IMAGE_H = 120\n cfg.IMAGE_W = 160\n cfg.IMAGE_DEPTH = 3\n cfg.PRINT_MODEL_SUMMARY = True\n cfg.EARLY_STOP_PATIENCE = 1000\n cfg.MAX_EPOCHS = 3\n cfg.MODEL_CATEGORICAL_MAX_THROTTLE_RANGE = ...
[ "0.72661006", "0.6692449", "0.6671212", "0.6644183", "0.66303015", "0.6608439", "0.64865834", "0.6374462", "0.6373342", "0.63431484", "0.62913036", "0.6263202", "0.62340975", "0.6227405", "0.6227405", "0.6221853", "0.6221853", "0.6221853", "0.62154037", "0.62069565", "0.61936...
0.68003994
1
Return a shaded image using the matplotlib lightsource based shading engine
def _get_image_object(self): # Hill shade props lightsource_default_props = {'azdeg': 315.0, 'altdeg': 45.0} shade_default_props = {'blend_mode': 'soft', 'vert_exag': 2.5} # Colormap cmap = truncate_colormap(cmocean.cm.ice, 0.25, 0.95) cmap.set_bad("white") # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pseudo(img):\n map = {\n 0: (0, 0, 128), # (darkblue)\n 0.25: (0, 255, 0), # (green)\n 0.5: (255, 255, 0), # (yellow)\n 0.75: (255, 128, 0), # (orange)\n 1.0: (255, 0, 0) # (red)\n }\n pix = img.load()\n for i in range(img.width):\n for j in range(img....
[ "0.5956573", "0.5873337", "0.57937336", "0.57684815", "0.56332713", "0.5630307", "0.5478522", "0.5466588", "0.54255646", "0.54234546", "0.54229784", "0.5377254", "0.534948", "0.5344859", "0.5339937", "0.5303741", "0.5301701", "0.52668244", "0.5252278", "0.5238936", "0.5218535...
0.5794044
2
Return default_headers if param 'headers' is None, else return combination of default header and param headers
def get_headers(cls, headers=None) : if headers is not None : for key, val in cls.HEADERS.items() : if key not in headers : headers[key] = val return headers else : return cls.HEADERS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _http_req_apply_default_headers(self, request_headers,\n content_type, body):\n if not request_headers:\n request_headers = {}\n request_headers.setdefault(\n 'Accept', ', '.join([str(ct) for ct in AVAILABLE_CONTENT_TYPES]))\n if...
[ "0.69761205", "0.676144", "0.67221946", "0.66876215", "0.66423875", "0.66423875", "0.66370255", "0.66145116", "0.6600037", "0.65912867", "0.6589311", "0.6568687", "0.6532551", "0.65278316", "0.6508639", "0.6415495", "0.63916236", "0.63362986", "0.6317503", "0.61623985", "0.61...
0.67126817
3
Initialize an instance of the Nefnir lemmatizer.
def __init__(self): nefnir_dir = os.path.dirname(sys.argv[0]) # Load rules rules_path = os.path.join(nefnir_dir, 'rules.json') with open(rules_path, encoding='utf-8') as f: self.rules = json.load(f) # Load tagset tag_path = os.path.join(nefnir_dir, 'tags.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, N, tokens):\n\n\n self.N = N\n\n ngrams = self.create_ngrams(tokens)\n\n\n self.ngrams = ngrams\n\n self.mdl = self.train(ngrams)\n\n\n if N < 2:\n\n raise Exception('N must be greater than 1')\n\n elif N == 2:\n\n self.prev_mdl = U...
[ "0.6827061", "0.6807098", "0.6787802", "0.64200634", "0.64200634", "0.640933", "0.640933", "0.640933", "0.640933", "0.60838187", "0.60460585", "0.6005756", "0.588342", "0.5824718", "0.5781343", "0.5682249", "0.5637546", "0.56281686", "0.5625722", "0.5619548", "0.5612129", "...
0.5795252
14
Initialize unique keys tracker instance
def __init__(self, cache_size=30000): self._cache_size = cache_size self._filter = BloomFilter(cache_size) self._lock = threading.RLock() self._cache = {} self._queue_full_hook = None self._current_cache_size = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.hash_map = dict()\n self.keys_set = set()", "def _set_unique_keys(self):\n raise NotImplementedError", "def __init__(self):\n self.map = []\n self.keys = set()", "def __init__(self):\n self.keys = set()\n self.table = set()", "def ...
[ "0.72520095", "0.69180816", "0.684587", "0.67937756", "0.67430735", "0.6729254", "0.67036325", "0.66570354", "0.6649498", "0.6624021", "0.6520985", "0.6517785", "0.6505724", "0.6468173", "0.6446079", "0.644584", "0.6437862", "0.6424764", "0.6418748", "0.6373169", "0.6352428",...
0.0
-1
Mock getting the request headers.
def _set_headers(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request_headers(mocker):\n mocker.patch.object(noclist.request.Auth, '_fetch', return_value=AUTHKEY)\n user = User()\n assert(CHECKSUM_TOKEN_KEY in user._request_headers())", "def test_headers(self):\n host = 'divmod.com'\n req = FakeRequest()\n req.setHeader('host', host)\...
[ "0.8139763", "0.7471269", "0.7390282", "0.73778814", "0.7370815", "0.71924657", "0.71887577", "0.7175399", "0.7080314", "0.7070485", "0.7029951", "0.6808329", "0.65809613", "0.65609443", "0.65595233", "0.65518844", "0.65282875", "0.64878786", "0.64758927", "0.64208937", "0.64...
0.0
-1
Test notify alarm when not authenticated with keystone.
def test_notify_alarm_unauth(self, perf_req, auth, endpoint): # Response request will not be performed unless there is a valid # auth_token and endpoint # Invalid auth_token and endpoint auth.return_value = None endpoint.return_value = None self.handler.notify_alarm(json....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_alert(self):\n self.assertEqual(conf.LOGIN_GUARD_FREQUENCY_ALERT_ON, False)\n self._try_patched_login_ko('alert_off_login')\n time.sleep(3)\n self._try_patched_login_ko('alert_off_login')\n mails = [m.body for m in mail.outbox]\n self.assertEqual(len(mails), 0)", ...
[ "0.6682377", "0.6672803", "0.63480437", "0.6229651", "0.6220541", "0.61328536", "0.60960907", "0.60566264", "0.5967869", "0.59663814", "0.5961522", "0.5949107", "0.59475183", "0.59443897", "0.5923055", "0.5901051", "0.58656824", "0.58639973", "0.5853988", "0.584978", "0.58362...
0.6373279
2
Constructs a custom ResNet backbone and modifies for fully convolutional, semantic segmentation
def build_fcn_resnet(name, backbone_fct, num_classes, aux, layers, pretrained_backbone=False): backbone = backbone_fct(layers=layers, pretrained=pretrained_backbone, replace_stride_with_dilation=[False, True, True]) return_layers = {'layer4': 'out'} if aux: return_layers['layer3'] = 'aux' backb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ResNet(self):\r\n self.model = tf.keras.Sequential([\r\n # The following layers are the same as b1 that we created earlier\r\n tf.keras.layers.Conv2D(64, kernel_size=7, strides=2, padding='same'),\r\n tf.keras.layers.BatchNormalization(),\r\n tf.keras.layers.Activation('relu'...
[ "0.7155", "0.7024311", "0.69053626", "0.6884419", "0.669277", "0.6675799", "0.6670104", "0.6670104", "0.6581525", "0.6551125", "0.65414786", "0.6540549", "0.6526244", "0.65131277", "0.65047884", "0.64856815", "0.64767754", "0.64556664", "0.64368653", "0.64199704", "0.6407156"...
0.61719733
69
Constructs a fullyconvolutional network model with a custom ResNet backbone.
def load_resnet_model(layers, arch_type='fcn', backbone=custom_resnet, pretrained=False, progress=True, num_classes=1, aux_loss=None, **kwargs): if pretrained: aux_loss = True model = build_fcn_resnet(arch_type, backbone, num_classes, aux_loss, layers, **kwargs) if pretrained: arch = arch_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ResNet(self):\r\n self.model = tf.keras.Sequential([\r\n # The following layers are the same as b1 that we created earlier\r\n tf.keras.layers.Conv2D(64, kernel_size=7, strides=2, padding='same'),\r\n tf.keras.layers.BatchNormalization(),\r\n tf.keras.layers.Activation('relu'...
[ "0.77063227", "0.72166", "0.7050142", "0.70094424", "0.7002692", "0.6867392", "0.6768407", "0.6757235", "0.6697265", "0.6689378", "0.66263425", "0.6611355", "0.6598454", "0.65699893", "0.6547317", "0.6540146", "0.6520693", "0.6512965", "0.6510973", "0.6503588", "0.6503132", ...
0.0
-1
This function generates a random list of genomes that is equivalent to the number of individuals. in the list, there are lists of genes (the individuals genomes) with a random number in the range between 1 and the number of machines
def generate_initial_population(numberofindividuals, numberofgenes, numberofmachines): initialgenes = [] for individual in numberofindividuals: genome = [] genes = numberofgenes while genes != 0: genome.append(random.randint(1, numberofmachines)) numberofgenes -= ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_initial_population(numberofindividuals):\n initialgenes = []\n genecount = len(joblist)\n\n for individual in range(numberofindividuals):\n genome = []\n genes = genecount\n while genes != 0:\n genome.append(random.randint(1, numberofmachines))\n gen...
[ "0.76210743", "0.73127824", "0.70786977", "0.69620144", "0.6949664", "0.6811037", "0.6763338", "0.6700226", "0.66118", "0.653904", "0.65259445", "0.6516342", "0.6516342", "0.6496047", "0.64541125", "0.6452499", "0.6452156", "0.6427091", "0.64042157", "0.63944685", "0.6391217"...
0.8033652
0
returns highest value in unimodal array via ~binary search
def find_max_val_unimodal_arr(arr): itop = len(arr)-1 ibtm = 0 imid = int((itop-ibtm)/2+ibtm) exit_case = arr[imid]>arr[imid+1] and ((imid-1<0) or arr[imid]>arr[imid-1]) while not (exit_case): # only one of these needs to be true # determine which side of the arr we're on, and always move ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_local_max(arr):\n b1 = arr[:-1] <= arr[1:]\n b2 = arr[:-1] > arr[1:]\n k = np.where(b1[:-1] & b2[1:])[0] + 1\n if arr[0] > arr[1]:\n k = np.append(k, 0)\n if arr[-1] > arr[-2]:\n k = np.append(k, len(arr) - 1)\n return k", "def find_max(arr):\n max = arr[0]\n return_v...
[ "0.71278435", "0.7110527", "0.6990239", "0.688612", "0.687274", "0.6865133", "0.682652", "0.6805582", "0.6805582", "0.6766609", "0.67306095", "0.67251205", "0.6707128", "0.67059493", "0.66960245", "0.66919506", "0.6634249", "0.66121066", "0.6558534", "0.6545112", "0.6543315",...
0.6853617
6
Checks if token is an operand AZ or 09, etc.
def is_operand(token): return token.isalpha() or token.isdigit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_operator(token):\n return token in '-+/*'", "def is_operator(self, token):\n if token['value'] in ['(', ')', '*', '/', '+', '-']:\n return True\n else:\n return False", "def __checkOperator(self, operator):\n\n validOperators = [\"+\",\"-\",\"*\",\"/\",\"%\"...
[ "0.7376472", "0.7346488", "0.66471595", "0.65958154", "0.65356475", "0.6479591", "0.6405901", "0.6385515", "0.63504875", "0.6324837", "0.62421054", "0.61956704", "0.61018115", "0.59230125", "0.58724475", "0.5821935", "0.5809577", "0.58063155", "0.57857543", "0.5772139", "0.57...
0.81868225
0
Checks if token is an operator '+/'.
def is_operator(token): return token in '-+/*'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_operator(self, token):\n if token['value'] in ['(', ')', '*', '/', '+', '-']:\n return True\n else:\n return False", "def is_operand(token):\n return token.isalpha() or token.isdigit()", "def identify_operators(self, context: TokenContext) -> bool:\n ch = co...
[ "0.8413856", "0.75664306", "0.7433057", "0.7423045", "0.73912144", "0.7312465", "0.7246336", "0.70645964", "0.6801559", "0.67047167", "0.66984224", "0.6671226", "0.6648137", "0.6568672", "0.6565278", "0.65127623", "0.6488198", "0.6478552", "0.64666486", "0.64149153", "0.63162...
0.85543185
0
Returns the length of the stringcontent of this node. Mind that len(node) returns the number of children of this node!
def strlen(self) -> int: if self._children: return sum(child.strlen() for child in self._children) else: return len(self._result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return len(self.content)", "def __len__(self):\n return len(self.text)", "def __len__(self):\n return len(self.string[self.pos:])", "def length(self):\n return _yarp.ConstString_length(self)", "def __len__(self):\r\n return self.length_helper(self.root...
[ "0.70831", "0.6996196", "0.69172144", "0.6855438", "0.68434745", "0.6698129", "0.6681542", "0.66460395", "0.6598717", "0.65399516", "0.65329224", "0.65171707", "0.6514614", "0.64899164", "0.6443995", "0.64272517", "0.64272517", "0.64187187", "0.64053017", "0.6377895", "0.6375...
0.77734226
0
Initializes the node's position value. Usually, the parser takes care of assigning the positions in the document to the nodes of the parsetree. However, when Nodes are created outside the reach of the parser guard, their documentposition must be assigned manually. Position values of the child nodes are assigned
def with_pos(self, pos: cython.int) -> Node: # condition self.pos == pos cannot be assumed when tokens or whitespace are dropped early! if pos != self._pos >= 0: raise AssertionError(f"Position value {self._pos} of node {self.name} cannot be " f"reassigned to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos(self) -> int:\n if self._pos < 0:\n raise AssertionError(\"Position value not initialized! Use Node.with_pos()\")\n return self._pos", "def _make_position(self, node):\r\n return self.Position(self, node) if node is not None else None", "def _make_position(self,node):\n ...
[ "0.67749435", "0.65862745", "0.65738475", "0.64844376", "0.6445508", "0.64123607", "0.63145846", "0.62907046", "0.61919427", "0.6165075", "0.6089746", "0.607992", "0.6043233", "0.60392565", "0.60107774", "0.59707755", "0.58380765", "0.5834199", "0.58247477", "0.58232605", "0....
0.67307234
1
Returns True, if `self` and `other` have the same attributes with the same attribute values. If `ignore_order` is False, the attributes must also appear in the same order.
def has_equal_attr(self, other: Node, ignore_order: bool = True) -> bool: if self.has_attr(): if other.has_attr(): if ignore_order: return set(self.attr.items()) == set(other.attr.items()) return self.attr == other.attr return len(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if (sorted([c.record['tag'] for c in self]) !=\n sorted([c.record['tag'] for c in other])):\n return False\n if self.__class__.__name__ != other.__class__.__name__:\n return False\n for attrib in ['metaname', 'namespace', 'metaval...
[ "0.659538", "0.65248305", "0.65248305", "0.64265245", "0.6361035", "0.6340546", "0.63119817", "0.630424", "0.62701964", "0.62528205", "0.6249545", "0.62324756", "0.6211881", "0.6194972", "0.6178855", "0.61572695", "0.61537755", "0.6137145", "0.61148524", "0.6111317", "0.60663...
0.8392754
0
Returns true if at least one child that matches the given criterion
def __contains__(self, selector: NodeSelector) -> bool: mf = create_match_function(selector) for child in self._children: if mf(child): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any_of_validator(self, verbose=1):\n assert self.children\n result = False\n for child in self.children:\n if child.validate():\n result = True\n\n if not result and verbose > 1:\n for child in self.children:\n child.validate(verbo...
[ "0.6430117", "0.64255565", "0.6339587", "0.6335917", "0.63254476", "0.6239028", "0.6213534", "0.6197816", "0.6189805", "0.6172294", "0.61671174", "0.61659706", "0.61646223", "0.61399734", "0.61399734", "0.61293226", "0.6033242", "0.6000167", "0.5993062", "0.59763455", "0.5974...
0.6595359
0
Returns the index of the first child that fulfills the criterion `what`. If the parameters start and stop are given, the search is restricted to the children with indices from the halfopen interval
def index(self, selector: NodeSelector, start: int = 0, stop: int = 2 ** 30) -> int: assert 0 <= start < stop if not self.children: raise ValueError('Node.index(x): Called on a Node without children') mf = create_match_function(selector) for i, child in enumerate(self._childr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, current_index, start, end):\n node = self.tree[current_index]\n if start <= node.start and end >= node.end:\n return node\n elif node.end < start or node.start > end:\n return None\n else:\n return self.merge(self.query(current_index*2+1,...
[ "0.5877263", "0.5793056", "0.5703982", "0.5609561", "0.555519", "0.55066115", "0.5490787", "0.54298824", "0.5418198", "0.5388537", "0.5379138", "0.53465396", "0.5333895", "0.5311922", "0.5293504", "0.52892786", "0.5268818", "0.52401197", "0.5230177", "0.5216462", "0.5208857",...
0.6483221
0
Yields all nodes of the tree. (Faster than select())
def walk_tree(self, include_root: bool = False, reverse: bool = False) -> Iterator[Node]: def walk_recursive(nd: Node) -> Iterator[Node]: nonlocal reverse child_iterator = reversed(nd._children) if reverse else nd._children for child in child_iterator: yield c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_nodes(self) -> Generator['Node', None, None]:\n for node in self._nodes:\n yield node\n yield from node.walk_nodes()", "def get_all(self):\n node = self.first\n while node:\n yield node\n node = node.next", "def nodes(self):\n for...
[ "0.7567586", "0.74500763", "0.734723", "0.73204076", "0.7270202", "0.71646035", "0.71341056", "0.7081585", "0.7012063", "0.69741035", "0.6944507", "0.69232005", "0.6848439", "0.6843178", "0.6832658", "0.68148005", "0.6783144", "0.67304313", "0.67204463", "0.6699674", "0.66590...
0.0
-1
Picks the first (or last if run in reverse mode) descendant for which the matchfunctions returns True. Or, returns None if no matching node exists.
def pick_if(self, match_func: NodeMatchFunction, include_root: bool = False, reverse: bool = False, skip_subtree: NodeSelector = NO_NODE) -> Optional[Node]: try: return next(self.select_if(match_func, include_root, reverse, skip_subtree)) excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, function: SearchFunction) -> Optional['NodeWrapper']:\n for node in self.get_all_descendants():\n if function(node):\n return node", "def _descendant(a, b):\n # type: (PredContext, PredContext) -> PredContext\n if _is_parent(a, b):\n return b\n if _...
[ "0.71926516", "0.65265036", "0.6502304", "0.6410749", "0.63933736", "0.62742573", "0.6261745", "0.6251021", "0.62138015", "0.6108183", "0.60483855", "0.60389113", "0.6031451", "0.6012694", "0.594974", "0.5921391", "0.58895886", "0.58793485", "0.58234876", "0.5808148", "0.5802...
0.6608613
1
Finds and returns the parent of `node` within the tree represented by `self`. If the tree does not contain `node`, the value `None` is returned.
def find_parent(self, node) -> Optional[Node]: for nd in self.select_if(lambda nd: bool(nd._children), include_root=True): if node in nd._children: return nd return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_node(self):\n if self._parent_node:\n return self._nodes.get_by_id(self._parent_node)\n return None", "def getNodeParent(self, node):\n return node.parent", "def find_parent(node, target):\n try:\n parent = node.parent\n if isinstance(parent, target):...
[ "0.7628158", "0.7593289", "0.74100304", "0.7262813", "0.7120161", "0.7110949", "0.7053535", "0.69969875", "0.6967573", "0.69638306", "0.6824358", "0.66120493", "0.6601267", "0.65966177", "0.6579792", "0.6546068", "0.6525958", "0.65153325", "0.64761174", "0.6464093", "0.646302...
0.8299304
0
Serializes the tree as Sexpression, i.e. in lisplike form. If this method is called on a RootNodeobject, error strings will be displayed as pseudoattributes of the nodes where the error is located.
def as_sxpr(self, src: Optional[str] = None, indentation: int = 2, compact: bool = True, flatten_threshold: int = 92, sxml: int = 0) -> str: left_bracket, right_bracket, density = ('(', ')', 1) if compact else ('(', ')', 0) lbreaks = linebr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_tree(self) -> str:\n sxpr = self.as_sxpr(flatten_threshold=0, compact=True)\n lines = sxpr.split('\\n')\n for i, line in enumerate(lines):\n # Admittedly, the following transformations are sloppy\n # and my lead to wrong output, when there are strings\n ...
[ "0.6248061", "0.586623", "0.5842924", "0.5821914", "0.5821914", "0.57628936", "0.5725416", "0.57207566", "0.57153636", "0.5712265", "0.56975186", "0.56209904", "0.5594089", "0.5563192", "0.5500535", "0.5489159", "0.5458764", "0.545683", "0.5454322", "0.54499984", "0.54499984"...
0.0
-1
Returns True, if the Sexpressionserialization of the tree rooted in `node` would exceed a certain number of lines and should therefore be rendered in a more compact form.
def exceeds_compact_threshold(node: Node, threshold: int) -> bool: vsize = 0 for nd in node.select_if(lambda _: True, include_root=True): vsize += 1 if vsize > threshold: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match_larger(self):\n return os.path.getsize(self.ctx.path) > self.args[\"n\"]", "def _match_smaller(self):\n return os.path.getsize(self.ctx.path) < self.args[\"n\"]", "def is_tree(x_step, y_step, line, y_pos, stderr):\n\n debug = f\"{x_step},{y_step} \"\n\n if y_pos % y_step == 0:\n...
[ "0.6064711", "0.5906179", "0.5548569", "0.55326444", "0.5462701", "0.53506845", "0.534476", "0.53238225", "0.5319322", "0.5312666", "0.5288464", "0.52875394", "0.5270356", "0.52548635", "0.5231014", "0.5208013", "0.52044", "0.51757485", "0.5144018", "0.51098824", "0.5105077",...
0.6182492
0
Returns the path of the predecessor of the last node in the path. The predecessor is the sibling of the same parentnode preceding the node, or, if it already is the first sibling, the parent's sibling preceding the parent, or grandparent's sibling and so on. In case no predecessor is found, when the first ancestor has ...
def prev_path(path: Path) -> Optional[Path]: assert isinstance(path, list) node = path[-1] for i in range(len(path) - 2, -1, -1): siblings = path[i]._children if node is not siblings[0]: for k in range(1, len(siblings)): if node is siblings[k]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preorder_predecessor(self):\n\n if not self.parent:\n return None\n\n idx = bisect.bisect_left(self.parent.children, self)\n\n if idx == 0:\n return self.parent\n\n return self.parent.children[idx - 1].last_preorder_child()", "def predecessor(self):\n ...
[ "0.7694742", "0.73970675", "0.7190394", "0.70197594", "0.668656", "0.6676927", "0.6626556", "0.64299864", "0.6424149", "0.6421599", "0.64064777", "0.6401583", "0.6313465", "0.62714916", "0.6201232", "0.6002305", "0.5989563", "0.5934743", "0.59041077", "0.5845465", "0.5842734"...
0.7369665
2
Returns the path of a descendant that follows `steps` generations up the tree originating in 'path[1]`. If `steps` < 0 this will be as many generations as are needed to reach a leafnode. The function `pick_child` determines which branch to follow during each iteration, as long as the top of the path is not yet a leaf n...
def zoom_into_path(path: Optional[Path], pick_child: PickChildFunction, steps: int) \ -> Optional[Path]: if path: trl = path.copy() top = trl[-1] while top.children and steps != 0: top = pick_child(top) trl.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deepening_search_step(self, task, state, depth, step, path):\n if step < depth:\n nextstep = step + 1\n # remember the actual state\n path.add(state)\n for operator, successor_state in task.get_successor_states(state):\n self.explorednodes += 1\...
[ "0.5602847", "0.53841317", "0.52965164", "0.51979226", "0.518822", "0.5175564", "0.5162868", "0.5118714", "0.5115548", "0.51033956", "0.50272304", "0.49945927", "0.4898471", "0.4858058", "0.47997335", "0.47850108", "0.47835618", "0.47763833", "0.47618592", "0.4761754", "0.475...
0.6861928
0
Returns `length` characters from the string content preceding the path.
def foregoing_str(path: Path, length: int = -1) -> str: N = 0 l = [] trl = prev_path(path) while trl and (N < length or length < 0): s = trl[-1].content l.append(s) N += len(s) trl = prev_path(trl) foregoing = ''.join(reversed(l)) return foregoing if length < 0 el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_length(self):\n return self.path_length", "def length(string):\n return len(undecorate(string))", "def __len__(self):\n return len(self.string[self.pos:])", "def __getLength(string, index):\n endIndex = string.find(\":\", index)\n return int(string[index:endIndex]), endIndex +...
[ "0.67478824", "0.6491051", "0.63889503", "0.6215646", "0.6173777", "0.6173123", "0.601779", "0.595884", "0.5906985", "0.5889678", "0.5884122", "0.58823735", "0.58775306", "0.58454025", "0.5838946", "0.5801171", "0.57982266", "0.57982266", "0.57982266", "0.57982266", "0.579822...
0.5715193
32
Returns `length` characters from the string content succeeding the path.
def ensuing_str(path: Path, length: int = -1) -> str: N = 0 l = [] trl = next_path(path) while trl and (N < length or length < 0): s = trl[-1].content l.append(s) N += len(s) trl = next_path(trl) following = ''.join(l) return following if length < 0 else following...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_length(self):\n return self.path_length", "def length(string):\n return len(undecorate(string))", "def __len__(self):\n return len(self.string[self.pos:])", "def _get_len(data: str) -> str:\n return str(len(data))", "def __getLength(string, index):\n endIndex = string.find...
[ "0.6933628", "0.6335986", "0.6202601", "0.6189858", "0.6172615", "0.6121316", "0.6082255", "0.6038993", "0.60368425", "0.6018965", "0.6009135", "0.60089785", "0.5981576", "0.5976623", "0.59152484", "0.5861468", "0.5832452", "0.5792871", "0.5770995", "0.57623935", "0.5740654",...
0.61573666
5
Picks the first node from the path for which match_func is True. Returns `None` if the path does not contain any node for which this is the case.
def pick_from_path_if(path: Path, match_func: NodeMatchFunction, reverse: bool=False) -> Optional[Node]: try: return next(select_from_path(path, match_func, reverse=reverse)) except StopIteration: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_path_if(start_path: Path,\n match_func: PathMatchFunction,\n include_root: bool = False,\n reverse: bool = False,\n skip_subtree: PathSelector = NO_PATH) -> Optional[Path]:\n try:\n return next(select_path_if(\n start_pat...
[ "0.71079", "0.68142354", "0.65188485", "0.6256153", "0.59301424", "0.5784237", "0.57660943", "0.5765718", "0.5711702", "0.5664991", "0.5651366", "0.5647323", "0.5632354", "0.5631976", "0.5576601", "0.5569303", "0.5569024", "0.5554159", "0.5553528", "0.5528778", "0.5528741", ...
0.77529085
0
Split all nodes from the end of the path up to the ith element, but excluding the first node in the path. Returns the index of the splitlocation in the first node of the path.
def deep_split(path: Path, i: cython.int, left_biased: bool=True, greedy: bool=True, match_func: PathMatchFunction = ANY_PATH, skip_func: PathMatchFunction = NO_PATH, chain_attr_name: str = '') -> int: # match_func = create_path_match_function(select) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_path(path):\n rest, tail = os.path.split(path)\n if len(rest) == 0:\n return (tail,)\n return Utils.split_path(rest) + (tail,)", "def path_split(path):\n return path.rsplit('/', 1)", "def splitall(self):\n parts = []\n loc = self\n while loc != ...
[ "0.6093139", "0.5888041", "0.5675901", "0.5630482", "0.5552637", "0.5520547", "0.55179733", "0.55064607", "0.55045843", "0.54965067", "0.5483449", "0.5373658", "0.53514147", "0.53494024", "0.5348694", "0.53474987", "0.5268731", "0.5226938", "0.5203563", "0.51605886", "0.51217...
0.57736146
2
Yields all paths from position ``start_pos`` up to and including
def iterate_paths(self, start_pos: cython.int, end_pos: cython.int, left_biased: bool = False) \ -> Iterator[Path]: index_a = self.get_path_index(start_pos, left_biased) index_b = self.get_path_index(end_pos, left_biased) for i in range(index_a, index_b + 1): yield self._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_to(self, end):\n path = [tuple(end)]\n while self._pred[path[-1]] != self.start:\n path.append(self._pred[path[-1]])\n path.append(self.start)\n for ijk in reversed(path):\n yield ijk", "def dfs(self, pos, visited): \n shift = lambda l, i: l[i:] + l[:...
[ "0.6526539", "0.6407869", "0.6376091", "0.6252286", "0.62253124", "0.6179909", "0.6081772", "0.6075319", "0.6056163", "0.6044196", "0.6044196", "0.6044196", "0.6023083", "0.59543806", "0.594727", "0.59431386", "0.59171873", "0.58840597", "0.58646244", "0.58646244", "0.5862723...
0.76776946
0
Returns True, if `token_sequence` is properly formed. Token sequences are strings or words which are separated by single blanks with no leading or trailing blank.
def validate_token_sequence(token_sequence: str) -> bool: return token_sequence[:1] != ' ' and token_sequence[-1:] != ' ' \ and token_sequence.find(' ') < 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_token(token_sequence: str, tokens: str) -> bool:\n # assert validate_token_sequence(token_sequence)\n # assert validate_token_sequence(token)\n return not tokens or set(tokens.split(' ')) <= set(token_sequence.split(' '))", "def is_valid(self):\n return bool(re.match('^[ACGT]+$', self.seq...
[ "0.75460523", "0.66509235", "0.63023216", "0.62009734", "0.6102887", "0.607652", "0.60707647", "0.6066537", "0.6057481", "0.600555", "0.5972855", "0.59287566", "0.59150547", "0.5870292", "0.5861222", "0.5849513", "0.5834805", "0.58038455", "0.57812077", "0.57812077", "0.57465...
0.8364336
0
Returns true, if `token` is contained in the blankspearated token sequence. If `token` itself is a blankseparated sequence of tokens, True is returned if all tokens are contained in
def has_token(token_sequence: str, tokens: str) -> bool: # assert validate_token_sequence(token_sequence) # assert validate_token_sequence(token) return not tokens or set(tokens.split(' ')) <= set(token_sequence.split(' '))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, token):\n return token in self._token_to_idx", "def _has_token( self ):\n t = self.tokens.get_token()\n return False if t==self.tokens.eof else self.tokens.push_token( t ) or True", "def is_token_allowed(token: Token) -> bool:\n # Avoid token: inmiscuyéndose lemma...
[ "0.6501618", "0.63345844", "0.6211768", "0.6198088", "0.6140086", "0.6139775", "0.6139775", "0.6133415", "0.605448", "0.5937694", "0.5890467", "0.58464277", "0.5786752", "0.573622", "0.57269585", "0.5714572", "0.5693267", "0.56349444", "0.5597937", "0.5584536", "0.5509629", ...
0.6691913
0
Returns True if bothe token sequences contain the same tokens,
def eq_tokens(token_sequence1: str, token_sequence2: str) -> bool: return set(token_sequence1.split(' ')) - {''} == set(token_sequence2.split(' ')) - {''}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_consistent(self):\n if len(self.ix2token) != len(self.token2ix):\n return False\n\n try:\n for token, ix in self.token2ix.items():\n if self.ix2token[ix] != token:\n return False\n except IndexError:\n return False\n\n ...
[ "0.7279222", "0.70653015", "0.690235", "0.6747001", "0.6645523", "0.6592311", "0.6494551", "0.6476441", "0.64759034", "0.6432271", "0.63852733", "0.6364431", "0.63641536", "0.6245687", "0.6161134", "0.6159428", "0.61582065", "0.6145436", "0.61429894", "0.6090225", "0.6080424"...
0.79331875
0
Returns the List of errors that occurred on the node or any child node at the position of the node that has already been removed from the tree, for example, because it was an anonymous empty child node.
def node_errors(self, node: Node) -> List[Error]: node_id = id(node) # type: int errors = [] # type: List[Error] start_pos = node.pos end_pos = node.pos + max(node.strlen(), 1) error_node_ids = set() for pos, ids in self.error_positions.items():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errors(self):\n\n return [item for item in self._content_parser.entries if item.kind == 'ERROR']", "def collect_errors(self) -> Iterator[Error]:\n if self._assert and not self._discard and not self.valid:\n yield from self.errors\n for child in self.children.values():\n ...
[ "0.6348888", "0.62610906", "0.6172863", "0.6166549", "0.606225", "0.6017381", "0.6006011", "0.59765637", "0.5937804", "0.5925516", "0.58970284", "0.5851871", "0.58181596", "0.58181596", "0.58181596", "0.57737803", "0.5697159", "0.567659", "0.567071", "0.565575", "0.56532884",...
0.7919486
0
Returns the list of errors, ordered bv their position.
def errors_sorted(self) -> List[Error]: errors = self.errors[:] errors.sort(key=lambda e: e.pos) return errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errors(self):\n return tuple(self._errors)", "def get_last_errors(self):\n errors = list(self.__last_errors)\n errors.reverse()\n return errors", "def errors(self):\n\n return [item for item in self._content_parser.entries if item.kind == 'ERROR']", "def errors(self) ->...
[ "0.7507947", "0.7431312", "0.7349339", "0.7222825", "0.72048604", "0.7145042", "0.7130312", "0.70136213", "0.6950376", "0.69450605", "0.69430995", "0.6937705", "0.69304246", "0.69304246", "0.69304246", "0.6926795", "0.6920339", "0.69157636", "0.68943995", "0.6892199", "0.6778...
0.8649353
0
Returns True, if the parser that has generated this tree did match, False otherwise. Depending on wether the Grammarobject that that generated the nodetree was called with `complete_match=True` or not this requires either the complete document to have been matched or only the beginning.
def did_match(self) -> bool: return self.name != '__not_yet_ready__' \ and not any(e.code == PARSER_STOPPED_BEFORE_END for e in self.errors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_complete(self) -> bool:\r\n if self.root is None:\r\n return True\r\n queue = Queue()\r\n flag = False # This is a check variable to make sure False is returned to the user if this flag is raise.\r\n # This flag will only raise if the tree is not complete\r\n ...
[ "0.62293625", "0.6210607", "0.5873039", "0.57806915", "0.5771932", "0.5675385", "0.5665847", "0.564172", "0.5622292", "0.5621534", "0.55760866", "0.55450153", "0.5522937", "0.5511523", "0.55005676", "0.5475831", "0.54579777", "0.54108334", "0.54098296", "0.5389158", "0.537441...
0.58598983
3
Parses a closing tag and returns the string segment, just after the closing tag.
def parse_closing_tag(s: StringView) -> Tuple[StringView, str]: match = s.match(RX_XML_CLOSING_TAG) assert match, 'XML-closing-tag expected, but found: ' + s[:20] tagname = match.groupdict()['tagname'] return s[s.index(match.end()):], tagname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_closing(tag):\n return '</' + tag + '>'", "def get_close_tag(self, tag, params):\n return '{%% end%s %%}' % tag", "def get_closing_tag(self):\n index = -1\n while True:\n try:\n element = self[index]\n if element.is_closing_tag():\n ...
[ "0.76954657", "0.72616535", "0.664807", "0.6566753", "0.6537162", "0.64680755", "0.62886167", "0.6281079", "0.62249935", "0.6106994", "0.5989816", "0.59862024", "0.58688724", "0.5850706", "0.58478165", "0.5768667", "0.5752739", "0.5707345", "0.5701091", "0.5692217", "0.567243...
0.7996944
0
Parses a JSONrepresentation of a nodetree. Other than and parse_xml, this function does not convert any jsondocument into a nodetree, but only jsondocuments that represents a nodetree, e.g. a jsondocument that has been produced by `Node.as_json()`!
def parse_json(json_str: str) -> RootNode: json_obj = json.loads(json_str, object_pairs_hook=lambda pairs: OrderedDict(pairs)) return RootNode(Node.from_json_obj(json_obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(json_data, root=None):\n data = json.loads(json_data)\n return NodeDecoder().decode(data, parent=root)", "def from_json_obj(json_obj: Union[Dict, Sequence]) -> Node:\n if isinstance(json_obj, Sequence): # list flavor\n assert 2 <= len(json_obj) <= 4, str(json_obj)\n ...
[ "0.6024159", "0.5784322", "0.5430638", "0.5260805", "0.5260805", "0.51423866", "0.50538135", "0.4997499", "0.49916458", "0.49747035", "0.49535474", "0.49324626", "0.4897654", "0.48159882", "0.48098588", "0.48036352", "0.48014235", "0.4791214", "0.4774543", "0.47214583", "0.47...
0.6288483
0
returns min sdk version of device. Gets ro.build.version.min_supported_target_sdk property.
def get_min_sdk_version(self): return int(self.props["ro.build.version.min_supported_target_sdk"]) if "ro.build.version.min_supported_target_sdk" in self.props else int(self.props["ro.build.version.sdk"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_sdk_version(self):\n return int(self.props[\"ro.build.version.sdk\"]) if \"ro.build.version.sdk\" in self.props else 19", "def get_sdk_version(self):\n return self.shell(\"getprop ro.build.version.sdk\").strip()", "def get_sdk_version():\n return studio_module.base.get_s...
[ "0.78517306", "0.73292464", "0.6911964", "0.66966957", "0.6487919", "0.6304983", "0.62784", "0.624722", "0.6158017", "0.61164093", "0.6098805", "0.599607", "0.5962554", "0.5950995", "0.5925765", "0.5925765", "0.5925765", "0.5925765", "0.5925765", "0.5924509", "0.59006387", ...
0.91396314
0
returns device sdk version. Gets ro.build.version.sdk.
def get_device_sdk_version(self): return int(self.props["ro.build.version.sdk"]) if "ro.build.version.sdk" in self.props else 19
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sdk_version(self):\n return self.shell(\"getprop ro.build.version.sdk\").strip()", "def sdk_version():\r\n return _base._rsf.sdk_version()", "def get_sdk_version():\n return studio_module.base.get_sdk_version()", "def get_min_sdk_version(self):\n return int(self.props[\"ro...
[ "0.85821885", "0.79359305", "0.79135114", "0.78055066", "0.6772429", "0.67503434", "0.6668751", "0.66190106", "0.6538582", "0.64298", "0.63888633", "0.63774365", "0.63659686", "0.6353288", "0.63510084", "0.6323158", "0.6301145", "0.62523246", "0.62523246", "0.62457955", "0.62...
0.910272
0
sets log size through persist.logd.size property.
def set_log_size(self, log_size_bytes=16384): super(Device, self).execute_root_command(f"shell setprop persist.logd.size {log_size_bytes}K", shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_size(self, arg):\n self.mod[\"size\"]= arg.size", "def set_journal_size(self, limit=682):\n self._config['journal-size'] = limit\n return self", "def set_size(self, size):\n pass", "def storage_size(self, storage_size):\n \n self._storage_size = storage_size"...
[ "0.6451949", "0.6371185", "0.6340975", "0.6225075", "0.62171036", "0.61678606", "0.6138838", "0.61379576", "0.6037161", "0.6037161", "0.6037161", "0.6037161", "0.6037161", "0.6037161", "0.6037161", "0.6037161", "0.5963481", "0.5957188", "0.5913233", "0.57894737", "0.5653607",...
0.8477629
0
Sets the operational_status of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def operational_status(self, operational_status): self._operational_status = operational_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_oper_status(self, status):\n if self.oper_status == status:\n return\n now = datetime.datetime.now()\n if self.oper_status != status and (\n not self.oper_status_change or self.oper_status_change < now\n ):\n self.update(oper_status=status, oper_...
[ "0.54956365", "0.5397773", "0.5397773", "0.5238934", "0.5238934", "0.5238934", "0.5238934", "0.5131093", "0.4958426", "0.48250604", "0.47626883", "0.47455484", "0.45790845", "0.45236018", "0.44897336", "0.44519848", "0.44519848", "0.4447309", "0.4447309", "0.443457", "0.44274...
0.67675036
0
Sets the output_queue_count of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def output_queue_count(self, output_queue_count): self._output_queue_count = output_queue_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_max_noutput_items(self, *args, **kwargs):\n return _mack_sdr_rossi_swig.BCH_decoder_ATSC_sptr_set_max_noutput_items(self, *args, **kwargs)", "def set_max_noutput_items(self, *args, **kwargs):\n return _mack_sdr_rossi_swig.BCH_encoder_ATSC_sptr_set_max_noutput_items(self, *args, **kwargs)", ...
[ "0.5652896", "0.5627767", "0.5584132", "0.55481744", "0.5545798", "0.5530381", "0.5527216", "0.5501107", "0.5497269", "0.5496852", "0.5487741", "0.5472312", "0.54670626", "0.54477894", "0.5433047", "0.54164743", "0.5412778", "0.5412176", "0.54085445", "0.5397308", "0.5382834"...
0.7425369
0
Sets the output_packets of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def output_packets(self, output_packets): self._output_packets = output_packets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputs(self, outputs):\n\n self._outputs = outputs", "def outputs(self, outputs):\n\n self._outputs = outputs", "def set_output_interface(self, output_interface=OUTPUT_INTERFACE_GPIB):\n return 'OUTX ' + str(output_interface)", "def set_output_tnsrs(self):\n raise NotImplemen...
[ "0.550997", "0.550997", "0.5433772", "0.5293261", "0.5251874", "0.523609", "0.5235172", "0.51977456", "0.519761", "0.51751894", "0.51739603", "0.51167804", "0.51153976", "0.5088235", "0.5068946", "0.506287", "0.50571114", "0.5049748", "0.5040321", "0.50391024", "0.5032841", ...
0.71674854
0
Sets the output_ratebps of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def output_ratebps(self, output_ratebps): self._output_ratebps = output_ratebps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_ratebps(self, input_ratebps):\n\n self._input_ratebps = input_ratebps", "def PacketOutRxRate(self):\n return self._get_attribute('packetOutRxRate')", "def set_max_output_buffer(self, *args):\n return _mack_sdr_rossi_swig.Demapper_ATSC_sptr_set_max_output_buffer(self, *args)", "...
[ "0.5625432", "0.5204894", "0.50962603", "0.5086813", "0.50398964", "0.5036115", "0.5026667", "0.5012096", "0.49949616", "0.49944156", "0.49828097", "0.49817425", "0.49799305", "0.49762845", "0.49613956", "0.4954208", "0.4944994", "0.49365988", "0.49348262", "0.49346688", "0.4...
0.7772835
0
Sets the input_packets of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def input_packets(self, input_packets): self._input_packets = input_packets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_packets(self, output_packets):\n\n self._output_packets = output_packets", "def add_interface_ip(self, interface, ip):\n self.interface[interface][\"IP\"] = ip", "def _set_interfaces(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGD...
[ "0.5778269", "0.5108916", "0.49640873", "0.4852994", "0.4764762", "0.47608963", "0.47587225", "0.47582573", "0.47494298", "0.47277513", "0.47268134", "0.47125", "0.47010565", "0.4684866", "0.4672357", "0.4666508", "0.46645918", "0.46637934", "0.46579182", "0.4631156", "0.4624...
0.6672485
0
Sets the input_ratebps of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def input_ratebps(self, input_ratebps): self._input_ratebps = input_ratebps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_ratebps(self, output_ratebps):\n\n self._output_ratebps = output_ratebps", "def SetRateInAir(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details('Method not implemented!')\n raise NotImplementedError('Method not implemented!')", ...
[ "0.6581747", "0.50433975", "0.49220258", "0.49115902", "0.48431394", "0.4779306", "0.4761532", "0.47218177", "0.47115904", "0.46903995", "0.46780694", "0.46528167", "0.46381533", "0.4630309", "0.4630309", "0.4630309", "0.46262282", "0.46173415", "0.45472288", "0.45247975", "0...
0.72583306
0
Sets the output_queue_depth of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def output_queue_depth(self, output_queue_depth): self._output_queue_depth = output_queue_depth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_queue_max_depth(self, input_queue_max_depth):\n\n self._input_queue_max_depth = input_queue_max_depth", "def output_queue_count(self, output_queue_count):\n\n self._output_queue_count = output_queue_count", "def set_max_output_buffer(self, *args):\n return _ncofdm_swig.ncofdm_car...
[ "0.5567727", "0.5402559", "0.5217047", "0.5167077", "0.5073188", "0.5060961", "0.5045273", "0.50379425", "0.50240695", "0.4954089", "0.49450353", "0.49328893", "0.49275982", "0.48996893", "0.48926398", "0.48875415", "0.48801854", "0.48709163", "0.48460487", "0.48411474", "0.4...
0.7177192
0
Sets the admin_status of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def admin_status(self, admin_status): self._admin_status = admin_status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_admin_status(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'oc-mplst:ADMIN_DOWN': {'@namespace': u'http://openconfig.net/yang/mpls-types', '@modul...
[ "0.65034", "0.65034", "0.65034", "0.65034", "0.6502887", "0.6502887", "0.6502887", "0.6502887", "0.6316053", "0.6316053", "0.6124212", "0.5917599", "0.58512825", "0.58512825", "0.58512825", "0.58512825", "0.58512825", "0.58512825", "0.58512825", "0.58512825", "0.58512825", ...
0.7203185
0
Sets the refreshed_at of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def refreshed_at(self, refreshed_at): self._refreshed_at = refreshed_at
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_refresh(cls, value):\n cls.set(\"refresh\", value, \"general\")", "def _set_interface_ref(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=yc_interface_ref_openconfig_mpls_igp__mpls_signaling_protocols_segment_routing_interfaces_...
[ "0.47783455", "0.46823496", "0.46799117", "0.46609285", "0.46410778", "0.45819888", "0.4568275", "0.45565873", "0.4546887", "0.45360234", "0.45220983", "0.45074657", "0.45044413", "0.45044413", "0.45044413", "0.45044413", "0.44919187", "0.44903994", "0.44880995", "0.44804803", ...
0.63085777
0
Sets the output_drop of this PathResponseResultResponseEgressVirtualInterfaceInterfaceStatistics.
def output_drop(self, output_drop): self._output_drop = output_drop
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self, output):\n if output is None:\n raise ValueError(\"Invalid value for `output`, must not be `None`\")\n\n self._output = output", "def set_output_interface(self, output_interface=OUTPUT_INTERFACE_GPIB):\n return 'OUTX ' + str(output_interface)", "def output_max(s...
[ "0.53545445", "0.51874304", "0.5177839", "0.4954498", "0.48776343", "0.48749068", "0.47955468", "0.4794211", "0.47894454", "0.47888693", "0.475625", "0.47184247", "0.47067714", "0.4701781", "0.47007594", "0.46989122", "0.46861088", "0.4679866", "0.46537134", "0.46203578", "0....
0.7359963
0
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_model_(self):\n return str(self)", "def __str__(self):\n\n return str(self.model)", "def get_model_string(self):\n raise NotImplementedError()", "def __str__(self):\n return self.model", "def serialize_model(self):\n return dill.dumps(self.model)", "def __str_...
[ "0.8602374", "0.85093755", "0.8237104", "0.8050309", "0.80128866", "0.79348034", "0.78766525", "0.77898884", "0.7786461", "0.7745792", "0.7627315", "0.76055235", "0.757999", "0.7514394", "0.75038797", "0.75035286", "0.74850684", "0.7440529", "0.74325883", "0.74239755", "0.740...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n return not self == other", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other):\n return self.__dict__ != other.__dict__", "def __eq__(self, other):\n return not self.__ne__(other)", ...
[ "0.8410411", "0.8391477", "0.8172175", "0.81410587", "0.80920255", "0.8088807", "0.80676955" ]
0.0
-1
Update success data accordingly based on succeeded flag
def save_test_success(baseline_root, src_root, test, succeeded, force_commit_test=None): if baseline_root is not None: try: with SharedArea(): success_path, prev_results = _read_success_data(baseline_root, test) the_dir = os.path.dirname(success_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_success(self):\n pass", "def success(self, focus=None):\n if self.result.status in [\n hd_fields.ActionResult.Failure,\n hd_fields.ActionResult.PartialSuccess\n ]:\n self.result.status = hd_fields.ActionResult.PartialSuccess\n els...
[ "0.73844886", "0.71621984", "0.7104922", "0.7081387", "0.7068278", "0.6898674", "0.682872", "0.6828058", "0.68273026", "0.68273026", "0.68273026", "0.6780146", "0.67753947", "0.67428535", "0.6723429", "0.6675488", "0.66381806", "0.6625868", "0.6612597", "0.65757406", "0.64738...
0.0
-1
Return the mdi icon of the entity.
def icon(self) -> str: return self._icon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon(self):\n return self._def[ATTR_ICON]", "def icon(self):\n icon = None\n if self.entity_description.key == \"status\":\n status = self.device.status\n if status == \"standby\":\n icon = \"mdi:power-plug-off\"\n elif status == \"plugged\...
[ "0.78540725", "0.7842752", "0.75995725", "0.7588675", "0.74880105", "0.74804544", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383", "0.7472383",...
0.7432262
25
Redirect the default route (/) to /index
def main(): return redirect('/index') # redirect /index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_redirect():\n redirect('/ardublockly/index.html')", "def root():\n return redirect('index.html')", "def redirect_catchall():\n return redirect(\"/\")", "def index():\n redirect('/list')", "def static_docs_index():\n redirect('/docs/Home/index.html')", "def index():\n return re...
[ "0.746519", "0.7419152", "0.7165796", "0.7154509", "0.69939315", "0.6964139", "0.6920024", "0.6815048", "0.676764", "0.6739082", "0.6708215", "0.6675313", "0.6668963", "0.665695", "0.66184205", "0.6614607", "0.660521", "0.6443252", "0.6438474", "0.6419448", "0.6409424", "0....
0.79594404
0
Render the correct html template, index.html for the /index route Html template shows a form for user input
def index(): return render_template('index.html') # index.html has the form
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_page():\n\n return render_template(\"application-form.html\")\n\n # Alternately, we could make this a Jinja template in `templates/`\n # and return that result of rendering this, like:\n #\n # return render_template(\"index.html\")", "def index():\n return render_template('submit.html...
[ "0.8077942", "0.7730369", "0.7652438", "0.7650472", "0.7576783", "0.7574747", "0.7566703", "0.75592697", "0.754761", "0.75307494", "0.75275373", "0.7518243", "0.75113344", "0.7509184", "0.7509184", "0.7509184", "0.7509184", "0.7509184", "0.7509184", "0.7509184", "0.7509184", ...
0.8462187
0
Returns tuple A tuple of the form (min_procs, max_procs), indicating the min and max processors usable by this `Driver`.
def get_req_procs(self): minprocs, maxprocs = self.root.get_req_procs() if MPI: minprocs *= self._num_par_doe if MPI and maxprocs is not None: maxprocs *= self._num_par_doe return (minprocs, maxprocs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_workers(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"min_workers\")", "def get_max_processes():\n return config.max_processes", "def estimate_nprocs(self,max_npn=16,limit_npn=None):\n nnodes = 1\n npn = 1\n npara = 1\n\n return nnodes, npn, npara", "d...
[ "0.6187627", "0.61766183", "0.6168727", "0.61662334", "0.6115369", "0.60955215", "0.5890597", "0.58511144", "0.57983065", "0.5788914", "0.5780663", "0.57730204", "0.57681096", "0.57535106", "0.57535106", "0.57521087", "0.57349545", "0.57195896", "0.56787753", "0.566674", "0.5...
0.76101726
0
Buy shares of stock
def buy(): symbol = request.form.get('symbol') price = request.form.get('price') if not request.form.get("shares"): return apology('You must provide a positive number', 403) # total cost of the transaction total = float(request.form.get("shares")) * float(price) # get the cash from the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _buy(self, stock, sig, day):\n\n idx = self.ncs.index(stock)\n # Calculate the maximum possible number of stock unit the current cash can buy\n available_unit = self.state[0] // self.stock_price.loc[day][stock]\n num_share = min(available_unit, int(sig))\n # Deduct the traded...
[ "0.76153445", "0.74124885", "0.7267408", "0.7223713", "0.718933", "0.71885616", "0.7062022", "0.70250934", "0.69889945", "0.6956662", "0.6875506", "0.6870458", "0.6861766", "0.68553936", "0.6828792", "0.6827072", "0.68264323", "0.68008643", "0.6792532", "0.67765707", "0.67682...
0.671312
27
Sell shares of stock
def sell(): symbol = request.form.get('symbol') price = request.form.get('price') shares = int(request.form.get('shares')) # get the number of shares associated with this symbol stock = db.session.query(Transaction.symbol_id, func.sum( Transaction.shares).label("sum")).join(Symbol, Symbol.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sell(self, stock, sig, day):\n\n # Get the index of the stock\n idx = self.ncs.index(stock)\n\n # Only need to sell the unit recommended by the trading agent, not necessarily all stock unit.\n num_share = min(abs(int(sig)), self.state[idx + 1])\n commission = dp.Trading.comm...
[ "0.7493962", "0.7363704", "0.72457373", "0.7232984", "0.7170457", "0.7157004", "0.7102979", "0.70986", "0.7088864", "0.7058037", "0.7032456", "0.7011614", "0.6995602", "0.6966525", "0.69662094", "0.6964375", "0.6914818", "0.68679184", "0.68611443", "0.6845491", "0.6813046", ...
0.69479614
16
Calculates second derivative of activation function
def da2(self, Z): raise NotImplemented("da2() not implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cost_derivative(self, output_activations, y):\n return (output_activations-y)", "def activation_function_derivative(self, v):\n # Derivative of sigmoid.\n return self.activation_function(v) * (1 - self.activation_function(v))", "def cost_derivative(self, output_activations, y):\n ...
[ "0.73532116", "0.70824385", "0.7080747", "0.7080747", "0.7080747", "0.7051007", "0.69930226", "0.69818646", "0.69789845", "0.69493705", "0.6883231", "0.6838566", "0.6831418", "0.6790671", "0.6722681", "0.67107135", "0.66919595", "0.66693175", "0.66552746", "0.6649135", "0.664...
0.0
-1
Tests that negative indexing works in slices
def test_slice_negative(self): slices = ( (-10,-5), (-20, 20), (3, -10) ) for (start, stop) in slices: self.assertEqual(self.normal_list[start:stop], self.paginated_list[start:stop])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_backward_indexing(self):\n self.assertEqual(self.normal_list[10:5], self.paginated_list[10:5])", "def test_slice_bad_negative_index(self):\n with self.assertRaises(IndexError):\n self.paginated_list[:-30]", "def test_slice_bad_index(self):\n self.assertEqual(self....
[ "0.7051475", "0.70240575", "0.69557667", "0.6864449", "0.6795601", "0.6610331", "0.65333635", "0.64792067", "0.64705914", "0.6426645", "0.6406912", "0.62865305", "0.6277904", "0.6187463", "0.60789204", "0.6060119", "0.60031265", "0.59920144", "0.5976076", "0.59589946", "0.594...
0.7803004
0
Tests that an IndexError is raised when a bad negative index is given
def test_slice_bad_negative_index(self): with self.assertRaises(IndexError): self.paginated_list[:-30]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_valid_index(index:int,message:str):\n if index<0:\n raise Exception(message)", "def test_out_of_range_raises(self):\n msg = r\"'index' must be between 0 and 7, inclusive\"\n with pytest.raises(ValueError, match=msg):\n get_bit(b'\\x00', -1)\n\n with pytest.rais...
[ "0.76062965", "0.7378523", "0.7262479", "0.6937953", "0.6731686", "0.6685534", "0.6682592", "0.6678778", "0.66304", "0.6586255", "0.6548666", "0.65298426", "0.6489706", "0.64833415", "0.6475716", "0.6458095", "0.6438587", "0.6435117", "0.6397958", "0.6393971", "0.6350573", ...
0.7318653
2
Tests that out of bounds indexes in slices work
def test_slice_bad_index(self): self.assertEqual(self.normal_list[30:], self.paginated_list[30:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wrong_slice(self, begin, end):\n with pytest.raises(IndexError) as err:\n utils.check_slice_options(self.universe, first_frame=begin, last_frame=end)\n assert \"Incorrect slice options\" in str(err.value)", "def test_slice_bad_negative_index(self):\n with self.assertRaise...
[ "0.7645355", "0.7543484", "0.7235173", "0.7131395", "0.70533407", "0.6901453", "0.68554664", "0.6833176", "0.6774488", "0.6766184", "0.658983", "0.6570296", "0.6548428", "0.6540797", "0.65143514", "0.6503097", "0.64542824", "0.64184713", "0.640083", "0.63862103", "0.63590044"...
0.76852447
0
Calculate the error rate.
def evaluate(self, output, input_y): with tf.name_scope('evaluate'): pred = tf.argmax(output, axis=1) error_num = tf.count_nonzero(pred - input_y, name='error_num') tf.summary.scalar('model_error_num', error_num) return error_num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_rate(error_total, tokens):\n if len(tokens) > 0:\n return(float(\"{0:.3f}\".format(error_total/len(tokens))))\n else:\n return(np.nan)", "def calculate_error_rate(self, records):\r\n diagnose_error = 0\r\n for record in records:\r\n if record.illness != self...
[ "0.73571485", "0.7332695", "0.72648126", "0.7206449", "0.7017305", "0.7014026", "0.68936104", "0.68507475", "0.67572117", "0.6718291", "0.6700418", "0.66925883", "0.66272974", "0.65770084", "0.6576471", "0.6470785", "0.64633745", "0.64328694", "0.64136887", "0.6406785", "0.63...
0.0
-1
Converts all wav files in the mashup diretory to a single array
def convert_mashup_to_array(file_path_in, file_path_out): # Get list of all .wav files in directory audio_clips = os.listdir(file_path_in) n_songs = len(audio_clips) - 1 # Initialize the magnitude and phase arrays initialized = False signal = None for i, song in enumerate(audio_clips): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(path): \n audiofiles = []\n transcripts = []\n offsets_durs = []\n \n for _, _, files in os.walk(path):\n for file in files:\n if file.endswith('.wav'):\n audiofiles.append(os.path.join(path, file)) \n path2txt = os.path.join(path, ...
[ "0.6674443", "0.6659052", "0.6516803", "0.6494851", "0.6459394", "0.63995624", "0.63878745", "0.6369907", "0.6327796", "0.6315741", "0.62871265", "0.62280774", "0.6199726", "0.6192042", "0.6189697", "0.61634517", "0.6143768", "0.61314255", "0.6112503", "0.6076127", "0.6068457...
0.68384296
0
Converts all wav files in the original song diretory to a single array
def convert_original_to_array(file_path_in, file_path_out): # Get list of all .wav files in directory audio_clips = os.listdir(file_path_in) n_songs = int((len(audio_clips) - 1)/2) # Initialize the magnitude and phase arrays initialized = False signal = None for i, song in enumerate(audio_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(path): \n audiofiles = []\n transcripts = []\n offsets_durs = []\n \n for _, _, files in os.walk(path):\n for file in files:\n if file.endswith('.wav'):\n audiofiles.append(os.path.join(path, file)) \n path2txt = os.path.join(path, ...
[ "0.6765031", "0.67638785", "0.67246896", "0.6615934", "0.65725887", "0.65251404", "0.651483", "0.6496914", "0.6395289", "0.6389333", "0.63776046", "0.63623744", "0.63584185", "0.6289082", "0.62766755", "0.6263423", "0.6223507", "0.6221394", "0.6219642", "0.6204531", "0.605826...
0.7298223
0
Returns Returns this object's simplified JSON representation. This is used for serialization to YAML, which is used in turn to allow object persistence.
def datafy(self): return {'name': self.name, 'filename': self.filename, 'input': self.input, 'output': self.output, 'requirements': [r.name for r in self.requirements], 'type': 'transform', 'dummy': self.dummy}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n\t\treturn json.dumps(self, default=lambda o: o.__dict__)", "def json(self):\n return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4)", "def serialize(self):\n return json.dumps(asdict(self))", "def toJSON(self):\n return json.dumps(self.__d...
[ "0.8322599", "0.8136118", "0.8072972", "0.8068398", "0.8012876", "0.8006828", "0.8006828", "0.8006828", "0.8006828", "0.8006828", "0.7968395", "0.7950977", "0.79483736", "0.79451513", "0.783857", "0.7836741", "0.7804644", "0.7784806", "0.7784806", "0.7784806", "0.7784806", ...
0.0
-1
Get the current UTC offset for the client
def s3_get_utc_offset(): offset = None if auth.is_logged_in(): # 1st choice is the personal preference (useful for GETs if user wishes to see times in their local timezone) offset = session.auth.user.utc_offset if offset: offset = offset.strip() if not offset: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone_offset(self):\n return int(round((datetime.now() - datetime.utcnow()).total_seconds()))", "def tz_utc_offset(self) -> int:\n import pytz\n import datetime\n\n if not hasattr(self, \"_utcoffset\"):\n dt = datetime.datetime.now(tz=pytz.utc)\n self._utc...
[ "0.76899385", "0.74225014", "0.739402", "0.70786667", "0.7068069", "0.6906051", "0.69008434", "0.6727321", "0.6684411", "0.6684411", "0.66713005", "0.6593342", "0.65147364", "0.65128624", "0.6505891", "0.64715767", "0.6469036", "0.64219147", "0.6403852", "0.63974273", "0.6397...
0.75231725
1
Convert model to a dictionary.
def to_dict(self): return { 'name': self.name, 'rmse': self.rmse, 'parameters': self.params, 'pressure_range': self.pressure_range, 'loading_range': self.loading_range, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modelDict(self):\n return self.__modelDict", "def to_dict(self) -> Dict[str, Any]:\n output = copy.deepcopy(self.__dict__)\n if hasattr(self.__class__, \"model_type\"):\n output[\"model_type\"] = self.__class__.model_type\n\n return output", "def get_model_diction...
[ "0.76273584", "0.75186914", "0.7382191", "0.7097884", "0.70187664", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", "0.70133495", ...
0.0
-1
Return initial guess for fitting.
def initial_guess(self, pressure: "list[float]", loading: "list[float]"): # ensure arrays of at least 1 dimension loading = numpy.atleast_1d(loading) pressure = numpy.atleast_1d(pressure) # remove invalid values in function zero_values = ~numpy.logical_and(pressure > 0, loading ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialGuess(self, positions, parameter, parameter_index):\n # We need a starting point for the fitter.\n # Use a constant value over the whole field as\n # a reasonable guess.\n n = self._orders[parameter_index]+1\n C = np.zeros((n,n))\n C[0,0] = parameter.mean()\n ...
[ "0.7203818", "0.70162433", "0.6643605", "0.64425087", "0.64422", "0.64174837", "0.6392732", "0.6390533", "0.6303189", "0.62666917", "0.6189084", "0.60303", "0.60092556", "0.59473735", "0.5874734", "0.5874144", "0.58740085", "0.5854018", "0.58530056", "0.5839583", "0.58226246"...
0.5817877
22
Trim initial guess to the bounds.
def initial_guess_bounds(self, guess): for param, val in guess.items(): bounds = self.param_bounds[param] if val < bounds[0]: guess[param] = bounds[0] if val > bounds[1]: guess[param] = bounds[1] return guess
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _trim_suggestions(self, suggestions, score_index, staff=\"upper\", last_digit=None):\n gold = self._score_gold(score_index=score_index, staff=staff, last_digit=last_digit)\n nugget_count = 0\n for i in range(len(suggestions)):\n if suggestions[i] in gold:\n nugget...
[ "0.6152846", "0.6026592", "0.6007829", "0.5889721", "0.5843987", "0.58105576", "0.5794565", "0.57918197", "0.57543385", "0.57083106", "0.56394786", "0.5595842", "0.55844957", "0.5583771", "0.5562825", "0.5530452", "0.5521756", "0.54377365", "0.54289377", "0.5424032", "0.54231...
0.5629967
11
Check that invalid beam angle dimensions are handled by xyzlut.
def test_xyz_lut_angles(stream_digest: digest.StreamDigest) -> None: meta = stream_digest.meta meta1 = copy(meta) client.XYZLut(meta1) meta1.beam_azimuth_angles = meta1.beam_azimuth_angles + [0.0] with pytest.raises(ValueError): client.XYZLut(meta1) meta1.beam_azimuth_angles = meta1.b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fail_dimension_requirement(self):\n msg = \"The cube does not contain the expected\"\n cube = self.cube[0, :, 0]\n with self.assertRaisesRegex(ValueError, msg):\n check_for_x_and_y_axes(cube, require_dim_coords=True)", "def test_incorrect_dimensions(self):\n lattic...
[ "0.68175125", "0.6674562", "0.6412111", "0.64055973", "0.63065135", "0.6262889", "0.61434406", "0.6114589", "0.6097759", "0.6019241", "0.60130656", "0.60123414", "0.5993912", "0.59912515", "0.59804344", "0.59373647", "0.59223664", "0.58855724", "0.58699584", "0.5863512", "0.5...
0.5877155
18
Return lxml node name without the namespace prefix.
def node_name(node): try: return node.tag.split('}')[-1] except AttributeError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodeName( self, stripNamespace=False ):\n name = self.name().rsplit('|', 1)[-1]\n if stripNamespace:\n name = name.rsplit(':', 1)[-1]\n return name", "def getNodeName(self) -> str:\n return self._el.nodeName", "def get_name(self):\r\n var = self.xmlnode.prop(\"...
[ "0.72428215", "0.7149782", "0.7146757", "0.71242577", "0.7110528", "0.70224875", "0.69534963", "0.6892776", "0.6888822", "0.6888822", "0.6888822", "0.6888822", "0.6888822", "0.6802159", "0.6749842", "0.6695026", "0.65980905", "0.6580903", "0.64670414", "0.64670414", "0.638827...
0.7123174
4
pads awkward array up to ``target`` index along axis ``axis`` with value ``value``, optionally converts to numpy array
def pad_val( arr: ak.Array, value: float, target: int = None, axis: int = 0, to_numpy: bool = False, clip: bool = True, ): if target: ret = ak.fill_none(ak.pad_none(arr, target, axis=axis, clip=clip), value, axis=None) else: ret = ak.fill_none(arr, value, axis=None) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_dim(arr, target, axis=0, fill_value=0.0):\n shape = list(arr.shape)\n original_size = shape[axis]\n assert original_size <= target\n if original_size == target:\n return arr\n shape[axis] = target\n to_fill = constant_value_array(fill_value, shape, arr.dtype)\n indices = [sli...
[ "0.67883766", "0.5655951", "0.54625744", "0.54364854", "0.53272974", "0.5227826", "0.5216632", "0.5141974", "0.50711465", "0.5049494", "0.50446415", "0.5039909", "0.50223976", "0.4994689", "0.4946098", "0.49445575", "0.49333435", "0.489637", "0.4861868", "0.4844597", "0.48201...
0.72820646
0
Get the ID of the currently loaded certificate. This is an opaque string uniquely identifying the loaded EC2 certificate.
def id_from_cert(): cert = X509.load_cert(env.ec2.cert) rsa = cert.get_pubkey().get_rsa() m = hashlib.md5() m.update(rsa.e) m.update(rsa.n) return m.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cert_id(self) -> Optional[str]:\n return pulumi.get(self, \"cert_id\")", "def certificate_id(self) -> Optional[str]:\n return pulumi.get(self, \"certificate_id\")", "def ssl_certificate_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"ssl_certificate_id\")", "def ...
[ "0.7276032", "0.7215654", "0.6422424", "0.6251282", "0.6217068", "0.62040067", "0.6145655", "0.61446047", "0.60500365", "0.60327315", "0.6017461", "0.6017461", "0.599231", "0.5976187", "0.59522104", "0.59200627", "0.5919421", "0.5902009", "0.58733314", "0.5854205", "0.5816439...
0.71747416
2
Construct a path to the keyfile named by the `directory' and `name'. `directory' is relative to the source root. Optionally specify an extension.
def keyfile_path(directory, name, ext='yaml'): return os.path.join( mixer_path(directory), '%s-%s.%s.smime' % (id_from_cert(), name, ext) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keyfile(directory, name, ext='yaml'):\n s = SMIME.SMIME()\n s.load_key(env.ec2.pk, env.ec2.cert)\n p7, data = SMIME.smime_load_pkcs7(keyfile_path(directory, name, ext))\n\n return s.decrypt(p7)", "def _key_to_filename(self, key):\n digest = md5hex(key)\n return os.path.join(self...
[ "0.6495573", "0.6214519", "0.61496186", "0.59804714", "0.57797027", "0.57565093", "0.5724209", "0.5632708", "0.5622333", "0.5590216", "0.5585331", "0.55824494", "0.55536467", "0.55393964", "0.5534657", "0.5533936", "0.55260295", "0.54939175", "0.54754573", "0.54517776", "0.54...
0.784639
0
If editor_mode is true, and user is an editor, return unfiltered queryset.
def queryset(self, request): editor_mode = getattr(settings, "MEZZANINE_EDITOR_ENABLED", True) if editor_mode: editor_name = getattr(settings, "MEZZANINE_EDITOR_GROUPNAME", "Editor") editor_super = getattr(settings, "MEZZANINE_EDITOR_SUPER", False) editor, created =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self, request):\n queryset = Article.objects\n if not (request.toolbar and toolbar_edit_mode_active(request)):\n queryset = queryset.published()\n return queryset", "def get_queryset(self, request):\n queryset = super(EditorAdmin, self).get_queryset(request...
[ "0.70078963", "0.69472533", "0.6904698", "0.6855203", "0.6781281", "0.66870624", "0.6684152", "0.66572714", "0.6628261", "0.65928733", "0.65578526", "0.65578526", "0.65112334", "0.65111667", "0.6505659", "0.64965856", "0.6481643", "0.646588", "0.6430609", "0.6412565", "0.6395...
0.64436793
18
If editor_mode is true, blogpost is created and user is not an Editor, set blogpost status to draft.
def save_model(self, request, obj, form, change): editor_mode = getattr(settings, "MEZZANINE_EDITOR_ENABLED", True) if editor_mode and obj.status == CONTENT_STATUS_PUBLISHED: editor_name = getattr(settings, "MEZZANINE_EDITOR_GROUPNAME", "Editor") editor_super = getattr(settings,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draft(title):\n blog = models.Blog(os.getcwd())\n try:\n blog.new_post(title, draft=True)\n except ValueError as ve:\n click.ClickException(str(ve))", "def draft(self, user=None):\r\n self.status = self.STATUS.draft\r\n self.save(force_update=True, user=user)", "def may...
[ "0.6423787", "0.63446325", "0.6324096", "0.59277487", "0.5898097", "0.58581865", "0.58539355", "0.58369505", "0.57594246", "0.57055837", "0.57024646", "0.5668745", "0.5620893", "0.55821", "0.55747384", "0.5500644", "0.5484214", "0.54663795", "0.5448884", "0.5437114", "0.53786...
0.5822666
8
Return the length of the collection.
def __len__(self): return len(self.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return self.list.length()", "def __len__(self):\n total_size = self.total_size\n if isinstance(total_size, int):\n # The size was a number present in the collection\n # representation.\n return total_size\n elif isinstance(total_siz...
[ "0.8218343", "0.81843424", "0.8152717", "0.8133669", "0.8070709", "0.806379", "0.8059703", "0.80567485", "0.80308956", "0.80229867", "0.7934847", "0.79256254", "0.7918641", "0.78668606", "0.78579116", "0.78578615", "0.78566533", "0.7835949", "0.78338796", "0.78271675", "0.781...
0.0
-1
Close the session, and, if necessary, set any required cookies
def closeSession(request): session = ISession(request, None) if session is not None: if session.accessed(): try: session.persist() except Exception: # Sometimes connection may be broken (e.g. with memcached or redis) # This allow to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.session is not None:\n self.session.cookies.clear()\n self.session.close()\n self.session = None", "def _close_session(self):\n if self._session:\n self._session.close()", "def _close_http_session(self):\n\n if self.ses...
[ "0.8012872", "0.74295986", "0.727825", "0.7056739", "0.70324415", "0.69522285", "0.6934545", "0.6897979", "0.6897979", "0.68411994", "0.6838598", "0.6742049", "0.6636878", "0.6636878", "0.6636878", "0.6636878", "0.66230863", "0.66189986", "0.6610202", "0.6589925", "0.6585194"...
0.7689495
1
Create a heatmap from a numpy array and two lists of labels.
def heatmap(data, row_labels, col_labels, ax=None, cbar_kw={}, cbarlabel="", **kwargs): if not ax: ax = plt.gca() # Plot the heatmap im = ax.imshow(data, **kwargs) # We want to show all ticks... ax.set_xticks(np.arange(data.shape[1])) ax.set_yticks(np.arange(dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heatmap(data, row_labels, col_labels, ax=None,\n cbar_kw={}, cbarlabel=\"\", **kwargs):\n\n if not ax:\n ax = plt.gca()\n\n # Plot the heatmap\n im = ax.imshow(data, **kwargs)\n\n # Create colorbar\n cbar = ax.figure.colorbar(im, ax=ax, **cbar_kw)\n cbar.ax.set_label(cbarlab...
[ "0.6713618", "0.66837937", "0.66761607", "0.66761607", "0.66082054", "0.65200794", "0.6483312", "0.64338195", "0.6395992", "0.63565475", "0.6190447", "0.6170368", "0.6020642", "0.5996789", "0.5981317", "0.5900491", "0.5864067", "0.5855121", "0.58276665", "0.581948", "0.580386...
0.68181986
0
Immutable. The globally unique, Firebaseassigned identifier for the `AndroidApp`. This identifier should be treated as an opaque token, as the data format is not specified.
def app_id(self) -> str: return pulumi.get(self, "app_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_id(self):\n return self.__pb.app_id()", "def app_id(self) -> Optional[str]:\n return pulumi.get(self, \"app_id\")", "def app_id(self) -> Optional[str]:\n return pulumi.get(self, \"app_id\")", "def steamAPPId(self):\n return \"\"", "def PUSHER_APP_ID(self):\n return fo...
[ "0.71976805", "0.660517", "0.660517", "0.6526108", "0.63958603", "0.63868004", "0.63868004", "0.63828605", "0.63416517", "0.63197684", "0.62709403", "0.6253278", "0.6222102", "0.6222102", "0.6146789", "0.60973555", "0.604239", "0.60339457", "0.60041827", "0.5935346", "0.59353...
0.69834405
29
Immutable. The canonical package name of the Android app as would appear in the Google Play Developer Console.
def package_name(self) -> str: return pulumi.get(self, "package_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_name(self):\n return self.bundle.replace('-', '_')", "def module_name(self):\n return self.app_name.replace('-', '_')", "def package(self) -> str:\n return self.__class__.__module__.rsplit('.', 1)[0]", "def name(self):\n if self._desktop:\n n = d_('app-insta...
[ "0.74784863", "0.6942169", "0.69254553", "0.69237685", "0.689972", "0.688076", "0.6836668", "0.6808469", "0.6791168", "0.6784676", "0.67506665", "0.6687725", "0.6644091", "0.6639794", "0.6626605", "0.65602463", "0.6534859", "0.6382956", "0.63423014", "0.63369936", "0.62238693...
0.6946415
1
Immutable. A userassigned unique identifier of the parent FirebaseProject for the `AndroidApp`.
def project(self) -> str: return pulumi.get(self, "project")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_id(self):\n return generate_project_id(name=self.name, creator=self.creator)", "def project_id(self):\n raise NotImplementedError()", "def _get_parent_project(self):\n if self.temp_table:\n return self.temp_table.projectId\n\n project = self.pipeline_options.view_as(GoogleC...
[ "0.72931415", "0.7144936", "0.69661176", "0.6925378", "0.69166964", "0.6907237", "0.6907237", "0.6907237", "0.6907237", "0.6907237", "0.6907237", "0.67514217", "0.6711141", "0.67006636", "0.67006636", "0.67006636", "0.669835", "0.66849434", "0.6630299", "0.6630299", "0.658793...
0.6290587
32
Test only GET requests are allowed for list view
def test_bug_list_GET_only(self): res = self.client.post(self.list_url) self.assertEqual(res.status_code, 405) res = self.client.patch(self.list_url) self.assertEqual(res.status_code, 405) res = self.client.put(self.list_url) self.assertEqual(res.status_code, 405) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_view_get(self):\n r = self.client.get(reverse('things_list'))\n self.assertEquals(200, r.status_code)\n rjson = json.loads(r.content)\n self.assertEquals(500, rjson['status'])\n self.assertEquals('Invalid request method', rjson['message'])", "def test_list_no_auth...
[ "0.7347284", "0.7228982", "0.7109131", "0.7098988", "0.6964533", "0.69437337", "0.6892785", "0.6880198", "0.687988", "0.6855344", "0.68487763", "0.6827895", "0.6827895", "0.6757551", "0.6735393", "0.67223656", "0.6662401", "0.66579604", "0.66524225", "0.664991", "0.66397536",...
0.7260329
1
Test only GET requests are allowed for the bug detail view
def test_bug_detail_only_GET(self): self.client.force_login(self.supervisor) res = self.client.post(self.detail_url) self.assertEqual(res.status_code, 405) res = self.client.patch(self.detail_url) self.assertEqual(res.status_code, 405) res = self.client.put(self.detail...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exercise_report_details_block_public(self):\n url = reverse(\"api:exercise-report-detail\", args=[\"some-uuid-1234\"])\n response = self.client.get(url)\n\n self.assertEqual(status.HTTP_403_FORBIDDEN, response.status_code)", "def test_view_invalid_bug():\n\n url = \"https://bugs...
[ "0.74479854", "0.7231606", "0.69771", "0.69771", "0.6935802", "0.69053704", "0.6899132", "0.6886437", "0.6854407", "0.6847954", "0.68300813", "0.67904115", "0.6776818", "0.6762576", "0.6760892", "0.6725465", "0.6702497", "0.66982234", "0.66441166", "0.660408", "0.6580945", ...
0.7139425
2
Test trying to access a non existing bug returns a 404
def test_bug_detail_404_on_nonexisting_bug(self): self.client.force_login(self.supervisor) nonexisting_url = reverse('bugs:detail', args=[9876]) res = self.client.get(nonexisting_url) self.assertEqual(res.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_view_invalid_bug():\n\n url = \"https://bugs.info:4000/api/v1/bug\"\n bug = {\n \"bug_id\": 100000000000000000000\n }\n bug_id = bug[\"bug_id\"]\n r = requests.get(url, bug_id)\n assert \"NOT FOUND\" in r.raise_for_status()", "def test_404():\n errorURL = \"gdfipjdfgspi\...
[ "0.81813806", "0.77057433", "0.7515738", "0.74436134", "0.7295283", "0.72901976", "0.72877485", "0.72695065", "0.7261635", "0.7245288", "0.7214359", "0.72115946", "0.71707135", "0.71307766", "0.7107213", "0.70834327", "0.70718414", "0.7050749", "0.7019569", "0.7010564", "0.69...
0.82412624
0
Test only GET, POST and PUT requests are allowed to create view
def test_bug_create_view_GET_POST_PUT_only(self): res = self.client.patch(self.create_url) self.assertEqual(res.status_code, 405) res = self.client.delete(self.create_url) self.assertEqual(res.status_code, 405)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_not_allowed(self):\n self.user.is_staff = True\n request = self.create_request('post', user=self.user)\n view = self.view_class.as_view()\n response = view(request)\n self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)", "def test_message_cr...
[ "0.7603996", "0.7350426", "0.71970856", "0.70598024", "0.70568264", "0.7051135", "0.69862974", "0.6961752", "0.6897962", "0.687316", "0.68708754", "0.6859559", "0.6839288", "0.6820844", "0.67856723", "0.6774263", "0.67611724", "0.67413414", "0.6729915", "0.672911", "0.6695728...
0.79586756
0
Test DELETE requests are not allowed to update view
def test_bug_update_view_no_DELETE(self): res = self.client.delete(self.update_url) self.assertEqual(res.status_code, 405)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bug_creator_update_view_no_DELETE(self):\n res = self.client.delete(self.update_url)\n self.assertEqual(res.status_code, 405)", "def test_delete_not_allowed(self):\n self.user.is_staff = True\n request = self.create_request('delete', user=self.user)\n view = self.view_...
[ "0.8242945", "0.7971603", "0.7400912", "0.72066736", "0.71202815", "0.7097214", "0.7001805", "0.6993363", "0.69807804", "0.69651705", "0.6958389", "0.6929606", "0.68891835", "0.6886904", "0.68808866", "0.685453", "0.6837219", "0.68310547", "0.68215793", "0.6807282", "0.678553...
0.8500273
0
Test DELETE requests are not allowed to update view
def test_bug_creator_update_view_no_DELETE(self): res = self.client.delete(self.update_url) self.assertEqual(res.status_code, 405)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bug_update_view_no_DELETE(self):\n res = self.client.delete(self.update_url)\n self.assertEqual(res.status_code, 405)", "def test_delete_not_allowed(self):\n self.user.is_staff = True\n request = self.create_request('delete', user=self.user)\n view = self.view_class.as...
[ "0.8500273", "0.7971603", "0.7400912", "0.72066736", "0.71202815", "0.7097214", "0.7001805", "0.6993363", "0.69807804", "0.69651705", "0.6958389", "0.6929606", "0.68891835", "0.6886904", "0.68808866", "0.685453", "0.6837219", "0.68310547", "0.68215793", "0.6807282", "0.678553...
0.8242945
1