id
stringlengths
20
20
title
stringclasses
1 value
text
stringlengths
8
768k
0077e91efc07877f78af
def perform(self, achall): if (achall.alg in [jose.HS256, jose.HS384, jose.HS512] or not isinstance(achall.hints.jwk, achall.alg.kty)): return None for cert, key, _ in self.installer.get_all_certs_keys(): with open(cert) as cert_file: cert_data = ...
00780390e58c24d3af4c
def _build_rnn_graph_cudnn(self, inputs, config, is_training): # here we want to pemute the dimensions # inputs = tf.transpose(inputs, [1, 0, 2]) self._cell = tf.contrib.cudnn_rnn.CudnnLSTM( num_layers= config.num_layers, num_units = config.hidden_size, input_...
007829cb66e8006f0199
def get_mnist(data_dir): download_mnist(data_dir) train_data = torch.load(os.path.join(data_dir, "train_data.pt")) test_data = torch.load(os.path.join(data_dir, "test_data.pt")) train_dataset, val_dataset = MemoryDataset(train_data), MemoryDataset(test_data) return train_dataset, val_dataset, MNIST...
00782ac02c9755dd15f7
def __init__(self, n_head, n_feat, dropout_rate, diesntangled=True, clusters=4, encoder_decoder_attention=False, causal=False, var_estimation=False, mu_grad=5): super(DisentangledMaskAttention, self).__init__() assert n_feat % n_head == 0 # We assume d_v always equals d_k ...
00783df845ef4b8be776
def state_index(self) -> int:
00784605693afee3244a
def with_diagnostics(self): self.create_model['debugLevel'] = 'Diagnostic' return self
00788119b8b55f336429
def test_restore_failed(m): with pytest.raises(NotFoundError): m.restore( f"{m.test_folder_dbx}/restored-file", "015982ea314dac40000000154e40990" )
00789c8aec1c17b1c016
def clean(*args, target='animations.bin'): # Cleanup the animation objdirs for name in args: print("Cleaning [" + name + "]") del_files = glob(os.path.join(name, '*.bin')) del_files += glob(os.path.join(name, '*.elf')) del_files += glob(os.path.join(name, '*.o')) for x i...
0078aac43ada9e41501d
def save_mat(self, obj, destination_file): io.savemat(destination_file, mdict={'arr': obj})
0078c8857d264d1ca7ff
def setup(): pass
0078cb023e6bed07f7b7
def pretty_duration(self): hour = self.duration / 3600 minute = (self.duration - hour*3600 ) / 60 second = self.duration - hour*3600 - minute*60 return "%02d hours %02d minutes %02d seconds" % (hour, minute, second)
0078f662b21a65e9fa20
def get_subreddit(self): reddit = self.Reddit subreddit = self.subreddit scope = self.scope limit = self.limit # The following returns a generator sub_generator = reddit.subreddit(subreddit).top(scope, limit = limit) titles = [] for submission in sub_generator: titles += [submission.title] self.d...
0078fbf8266f6aa1392c
def get_iterator(self): for i in range(0, len(self.duos)): yield self.duos[i]
00794ad036f4e10ff0ee
def working_dir(self, working_dir): self._working_dir = working_dir
007957841f13f289803b
def field(self) -> str: return pulumi.get(self, "field")
00795bd914946d7f02e4
def services(): _services = [] for v in restart_map().values(): _services = _services + v return list(set(_services))
00797d94c213083b9044
def setTabMode(self, tab_mode=None): # -- If no tab mode is given we should look at the ui for # -- that information if tab_mode is None: tab_mode = self.ui.tabModeCombo.currentIndex() if tab_mode == self.tabMode and not self.tabMode == self.TAB_AUTO: return ...
0079888da965a3931338
def game_is_paused(self): if self._state == STATE_PAUSED: if self._wave.check_game_status() == False: self._wave.setBolts([]) self._text = GLabel(x=GAME_WIDTH/2,y=GAME_HEIGHT/2,width=GAME_WIDTH, height=GAME_HEIGHT, font_name = 'Arcade') ...
00798a2a551199af040b
def get_num_components(self): return self.wavelengths.size
00798a40fd63fed5b26c
def wallet(self) -> DynamicWallet: self.__check_is_open() return self.__wallet
007992e125e3906fab91
def _tokenize(self, text): if self.do_lower_case: text = text.lower() return self.gpt2_tokenizer.tokenize(text)
0079afcea5158db2d09a
def add_key(self, position, key): # TODO: Error handling (if the position is already taken, ask for replacement confirmation) # Add a reverse reference to the key key.view = self # Add the key to the keys list self.keys.insert(position, key) # self.keys[position - 1].view...
0079bdc7a254e8976628
def query2url(self, query): raise NotImplementedError()
0079d1cfeb67773cb452
def test_can_run_nmap_and_return_mac_addresses(self): scanner = deviceScanner() results = scanner.scan() self.assertIsNotNone(results) self.assertTrue(len(results) > 0) self.assertIn('mac', results[0]) self.assertIn('ip', results[0]) self.assertIn('vendor', result...
0079d7e6521ad5c17781
def compress_fastq(self, sample_id: str) -> bool: LOG.info(f"Check if FASTQ compression is possible for {sample_id}") version: Version = self.hk_api.get_latest_bundle_version(bundle_name=sample_id) if not version: return False sample_fastq: Dict[str, dict] = files.get_fastq_...
0079e2f35d0fb57db0b2
def get_current_state(self): return self._response_from_request(DbestRequest.GET_CURRENT_STATE)
0079efa2cc11d81475d8
def __button_clicked(self, button): btn = button.get_name() if btn == 'Save': self.__button_update() self.__gramplet.on_save() elif btn == 'Test': self.__button_update() status = "" if not self.query_test(): status = se...
007a04acd8186661856b
def gen(camera): while True: frame = camera.get_frame() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + detectFace() + b'\r\n')
007a1c2e1b96a5b5f325
def sort_url_list(url_list): def sort_key(s): re_obj = re.search(r'([a-z]+)-([a-z]+)\.', s) if re_obj: # first_key = re_obj.group(1) key = re_obj.group(2) return key url_list = sorted(set(url_list), key=sort_key) return url_list
007a3800810f8e85b795
def draw(self,screen = None): if not screen: screen = self.game.get_display() screen.blit(self.background,(0,0)) if self.area: self.area.draw(screen) for label in self.labels: ...
007a4a901a3b93b1a2ac
def calculateFCost(node): calculateGCost(node) calculateHCost(node) node["f"] = node["g"] + node["h"]
007a6b880d21159ebacb
def CreationTime(self) -> _n_1_t_9:
007a7a1f4e189b9684f8
def displayVGaps(nb_n=200, epsilon=0.2): # Array of the iteration n_l = np.linspace(1, 5000, num=nb_n, dtype=int) # Computation of the Q_n Q_n_l = [qLearning(n=n, epsilon=epsilon)[0] for n in n_l] # Computation of the policies given Q policy_l = [computeGreedyPolicy(Q_...
007a90a1fc474a65e689
def optimizeSolverParams(): optimization = BO(runAll40ExperimentsAndGetCost, {'solref1': (0, 1), 'solref2': (0, 1), 'solimp1':(0, 1), 'solimp2':(0,1), 'solimp3':(0,1)}) # initialize optimization with so far best found parameters to improve the results optimization.initialize({ 'target': [-30668.7,...
007a96f7e1e62c516a1b
def is_transgenic(self): if self.mut_origin is None: log.warning('Allele {} has no cvterm info to make this determination.'.format(self.name)) conclusion = None elif self.fbtp_list is None: log.warning('Allele {} has no FBtp info to make this determination.'.format(se...
007a9e719ad31bd50c0e
def render(self, row, index=None): return self.represent(row)
007acbded4dd3277c7bd
async def on_connected(self):
007ae365e3552189e130
def __init__(self, iterable=None): # TODO: initialize instance variables pass if iterable: for item in iterable: self.enqueue(item)
007ae444a0d14961b788
def generate_data(self, features, info, noise, seed): data, y, coef = datasets.make_regression(n_samples=1000, n_features=features, n_informative=info, noise=noise, coef=True, random_state=seed) self.X = pd.DataFrame(data) self.y = pd.Series(y)
007b0311ff41a5db393d
def get_group_associations(self, market: 'Market') -> Array: return np.ones((market.groups.group_count, 1), options.dtype)
007b06ca8f9371c68537
def sample_paths(self, num_samples): return self._pg.sample_paths(num_samples=num_samples)
007b0dfa670a55a5f9c4
def create_demo_record() -> dict: with open(join(dirname(__file__), "data/pure_record_fake.json"), "rb") as fp: demo_record = json.load(fp) faker = Faker() demo_record["title"]["value"] = faker.text() for i in range(len(demo_record["abstract"]["text"])): demo_record["abstract"]["text"]...
007b18c8ed6c095faf3a
def main(): parser = ArgumentParser( formatter_class=ArgumentDefaultsHelpFormatter, description="The script reads versions from cmake and produce ENV variables", ) parser.add_argument( "--version-path", "-p", default=FILE_WITH_VERSION_PATH, help="relative path...
007b22c661ddbd7ea195
def reload(self): try: os.path.isfile(FileStorage.__file_path) except Exception as e: pass else: with open(FileStorage.__file_path, 'r') as buffer: FileStorage.__objects = json.loads(buffer)
007b627b95c0b3d07ecd
def are_queues_stopped(self,queue=None,queues=None): query = {'name':'stopped','stopped':True} queue_list = ['*'] if queue: queue_list.append(queue) elif queues: queue_list.extend(queues) if len(queue_list) > 1: query['queue'] = {'$in':queue_...
007b69b53666cd44b271
def add_participants(self, players): self.players_list = players self.nb_players = len(players) self.nb_rounds = int(math.log2(len(players)))
007b6c71a833081da692
def get_bit(number, index): return int((number & (1 << index)) != 0)
007b6c7b57094fcb63cf
def open(self): if self.connection: # Nothing to do if the connection is already open. return False connection_params = {} if self.timeout is not None: connection_params['timeout'] = self.timeout if self.use_ssl: connection_params.update({...
007b78ec07b8d9c0cdc4
def getTextureHeight(self): return _osg.TextureRef_getTextureHeight(self)
007b909a784d9545cb89
def deprecated(func): def new_func(*args, **kwargs): warnings.warn("Call to deprecated function %s." % func.__name__, category=DeprecationWarning, stacklevel=2) return func(*args, **kwargs) new_func.__name__ = func.__name__ new_func.__doc__ = func.__doc__ new_func...
007bb397aef22a27723d
def add_secret(self): credential = DefaultAzureCredential() # credential = ClientSecretCredential(tenant_id, client_id, client_secret) secret_client = SecretClient(vault_url="https://my-key-vault.vault.azure.net/", credential=credential) secret = secret_client.set_secret("secret-name", ...
007bc4e3ce3255367370
def plot(name, filepath): input_csv = filepath; with open(input_csv, 'r') as infile: # create pandas data frame from csv data in infile df = pd.read_csv(infile) infile.close() df = make_numeric(df) if name == 'annealing' or name == 'population': line(name, df, filepa...
007bcae72bfb6a5af56d
def upsert(self, db_cur, table, pk_fields, schema=None, **kwargs): assert len(pk_fields) > 0, "must be at least one field as a primary key" if schema: rel = '%s.%s' % (schema, table) else: rel = table # check to see if it already exists where = ' AND '.jo...
007bd3b5c37a2092d7d5
def setUp(self): self.browser = webdriver.Chrome(ChromeDriverManager().install())
007bdb7af21389c7bc88
def addIGMattenuation(self, redshift, rtau, wavelen=None, flambda=None): # Catch case of z=0, where should not apply any IGM extinction. if redshift == 0: warnings.warn("IGM attenuation is not applied for redshift=0. No action taken.") return # Updating self or using pas...
007c3985bb4e6f43f9d7
def SetMetadata(self, *args): return _gdal.MajorObject_SetMetadata(self, *args)
007c4bedbb3ff3896e74
def load_model(self, model_file_path): self.model = keras.models.load_model(model_file_path, custom_objects={'part_norm_dist_log_likelihood': self.part_norm_dist_log_likelihood}) return
007c5364d4f80fce6190
def get_xml_string(self): element = self.get_xml_element() return ET.tostring(element, encoding="unicode", method="xml")
007c5992623f32c44e48
def get_ctrl_modifier(): if sys.platform in ['linux', 'win32']: return 'Control' elif sys.platform == 'darwin': return 'Meta' else: raise ValueError(f'No control modifier defined for platform {sys.platform}')
007c7419aa3206493e9f
def main(): # load a pretrained model from HDF5 file model = load_model(shape_path, weights_path) # load dataset for iterating paths data_frame = pd.read_csv(CSV_PATH) # iterate over all image paths for i in range(len(data_frame['imgPath'])): img = load_image(IMAGE_BASE_PATH + data_fra...
007cb3d16e6d495c1b2e
def GetCharAt(self, pos):
007cc12a87a313abda42
def list_for_user(self, user_id): endpoint = "/user/{}/instances".format(user_id) return self._get(endpoint, _ServerSchema(many=True))
007cd2f99089f1b6f1e3
def backup_to_sheet(self, sheet_id, dataframe, sheet_name=None, set_range=(2, 1)): pyg = authorize(custom_credentials=self.credentials) spreadsheet = pyg.open_by_key(sheet_id) if sheet_name is None: wks = spreadsheet[0] else: wks = spreadsh...
007cd51c8291ed44c64c
def checkWinner(self): vert = 0 hori = 0 draw = True #Horizontal, Vertical, or Draw check for i in range(BOARD_ROWS): for j in range(BOARD_COLS): vert += self.board[j][i] hori += self.board[i][j] if self.board[i][j] == 0...
007cd6a1ad88991eaef3
def add_maximal_tuple(tup, s): for t in s.copy(): sim = tuple_intersection(tup, t) if sim == tup: # tup is a subtuple of t return s if sim == t: s.remove(t) # t is a subtuple of tup s.add(tup) return s
007cdd2e5dbffd67a954
def get_from_disk(self, s2e_output_dir): with open(os.path.join(s2e_output_dir, CustomAnalysisData.GUI_FILE_NAME), 'r') as destination: self.data = json.load(destination)
007cedd856fba9586fdc
async def set_label(self, status: ni_abc.Status) -> str: labels_url = await self.labels_url() if status == ni_abc.Status.signed: await self._gh.post(labels_url, data=[CLA_OK]) return CLA_OK else: await self._gh.post(labels_url, data=[NO_CLA]) return NO_CLA
007cf2778a097c41ce0c
def delay(ms): pass
007d1c90ceb0f0755a39
def transition_prob(self, transition): possible_next_states = self._get_neighboring_states(transition.prev_state) n_possible_next_states = len(possible_next_states) if transition.next_state not in possible_next_states: return 0.0 intended_state = self._apply_action(transition...
007d3c98baafa56dde42
def add_error(msg, errors): errors.append(msg)
007d50fd6b3bd5e3a392
def get_maps(self): return
007d900e04efcc8fc194
def _text_from_raw(self, raw_content): text = raw_content['trail'][0]['content_raw'] soup = bs4.BeautifulSoup(text) for link in soup.findAll('a'): link.replace_with(link.get('href')) return soup.text
007dc0ec6b71bd4eb51b
def unique_factorial(): import math return { len(str(math.factorial(x))) for x in range(20) }
007dc6dba3fa8114e936
def test_cylinder_update_accelerations(): start = np.random.rand(3) direction = 5 * np.random.rand(3) direction_norm = np.linalg.norm(direction) direction /= direction_norm normal = np.array((direction[1], -direction[0], 0)) base_length = 10 base_radius = np.random.uniform(1, 10) volume...
007dc86518be24e14eec
def fetchInventory(self, game): packetPipeline = game.getModInstance('ClientMod').packetPipeline packetPipeline.sendToServer(FetchInventoryPacket(game.player.name))
007dd7e428c01c807e10
def route_as_waksman_inner(left, right, lo, hi, pi, piinv): if left > right: return sz = (hi - lo + 1) assert (right - left + 1) >= width(sz) if right - left + 1 > width(sz): # If there is more space for the routing network than # required, then the ...
007deb7bdae2089e565c
def remove(self): original = self.original original.preceding = self.preceding for preceding in self.preceding: preceding.following.remove(self) preceding.following.append(original) # seppuku now
007dfdfc3e0ca657e668
def save( self, path ): if os.path.exists( os.path.dirname( path ) ): fh = file( path, 'w' ) self.img.save( fh ) fh.close()
007e748f8e552d4afbd0
def __wait(self): self.__result = self.__msgq.wait_cfgmgr()
007e895420d52c8bcf2a
def ReadModifyWriteRow(self, request, context): context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)
007e8c566f2c9b2432af
def get_width(cls): if cls.width < 0: return len(cls.field_map[0]) else: return cls.width
007ec0b7e37fa2587a13
def get_datatype(data): subtype = "project" if "entity" in data.keys(): subtype = "entity" if data.get("type"): subtype = "shot_type" if "cat" in data.keys(): subtype = "asset" if data.get("cat"): subtype = "asset_cat" if data.get("name"): ...
007ec685bc387909e6d7
def video_feed(): return Response(pre_main(), mimetype='multipart/x-mixed-replace; boundary=frame')
007ed854d16e37007c9f
def change_bib_file(aux_file_name, bib_file_name): with fileinput.FileInput(aux_file_name, inplace=True) as f: bibboost = False for line in f: p = _bibboost_bib_files_re.match(line) if p is not None: bibboost = True p = _bib_files_re.match(line) ...
007ee549c6aa29e38f35
def list_modules(self): cmd = f"""find {self.project.path.stack()} -type f -iname "*.tf" -exec awk ' BEGIN {{print "List of modules and required sources:"}} / *module +".*"/ {{ USEDBY = USEDBY ", " $$2; while ($$0!~/^[^#]*}}/) {{if ($$0~/^ *sou...
007ef50990ca3cbc1786
def toggle_outline(self): self.outline.visible = not self.outline.visible
007f028b61359598675b
def search_title(self, title): print('search!') with DBHandler.DBHandler(): num = DBHandler.search(title) return num
007f38d271c077df8fa2
def get(siret): return SireneInstitution.query.filter_by( siret=siret, ).first()
007f3ff70b6cd3d0692e
async def start(self, ctx, *, question): perms = ctx.channel.permissions_for(ctx.me) if not perms.add_reactions: return await ctx.send( "Ho bisogno del permesso Aggiungere reazioni." ) # a list of messages to delete when we're all done messages = ...
007f42121804a5d56c53
def test_rule_creation_dialog(text_monitor_workbench, dialog_sleep, exopy_qtbot, should_save, monkeypatch): p = text_monitor_workbench.get_plugin(PLUGIN_ID) d = CreateRuleDialog(plugin=p) d.show() wait_for_window_displayed(exopy_qtbot, d) exopy_qtbot.wait(dialog_sleep)...
007f44fe85cdfd2381bb
def get_sharing_profiles(self): s = select([self.profiles]).where(self.profiles.c.sharing) with self.get_connection() as connection: result = connection.execute(s) rows = result.fetchall() profiles = [self._parse_squeak_profile(row) for row in rows] return...
007f59d92853518997b2
def __init__(self): self.action_space = [(0, 0)] + list(permutations([0,1,2,3,4], 2)) self.state_space = list(product([0,1,2,3,4], np.arange(0,24), [0,1,2,3,4,5,6])) #(location, hour, day) self.state_init = random.choice(self.state_space) # Start the first round self.reset()
007f5adc4857314aaf6b
def register(self, filter, cb): filter = set([coord for coord in filter.upper().split("_")]) if not PREPOST.intersection(filter) and "ANY" not in filter: filter.add("PRE") self.callbacks.append((filter, cb))
007f5ff8fedb2bda39d1
def get_policy_rewards(self): logging.info( "Estimating reward confidence interval for random baseline feedback" ) for i, (policy, _) in enumerate(self.policies): logging.info( f"[{i + 1} of {len(self.policies)}] Estimating reward confindence interval for ...
007f908ba58673f88b99
def is_valid_queryparam(param): return param != '' and param != [] and param is not None
007fb3b0b1bd4fba7910
def ShowCopyrightNotice(filePath, fileName): print("-- Copyright Notice -- " + "\n") PrintFile(filePath, fileName) globals.ReturnPrompt()
007fbccb52604f7a6dc5
def draw_sensor(time, data: pd.DataFrame, graph_name: str=""): for name, series in data.iteritems(): plt.plot(time, series, label=name) show_plot(graph_name)
007fcb4b07f0944db884
def path_of_module(self, mod: nn.Module) -> str: # Prefer the O(1) algorithm if hasattr(self, "submodule_paths") and self.submodule_paths: path = self.submodule_paths.get(mod) if path is None: path = self._insert_module_as_submodule(mod) if path is Non...
007fd312758db41aa9b6
def get_colors(num_colors): for index in xrange(num_colors): # finds the 3 (rgb) values for the ith color: col = [int(x) for x in colorsys.hsv_to_rgb( 1. * index / num_colors, 1.0, 230)] # formats a string representing that color: yield "#{0:02x}{1:02x}{2:02x}".format(*co...
00800358ec3744e467f8
def list_checkpoints(self, path): return []