query stringlengths 9 9.05k | document stringlengths 10 222k | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Creates rented_temp.csv file with changed book status | def change_books_status(main_page, book_code, rented_book_data):
new_rented_data = rented_book_new_data(main_page, book_code)
with open('rented.csv', 'r') as rented_base_r:
rented_reader = csv.reader(rented_base_r)
with open('rented_temp.csv','w', newline = '') as rented_base_w:
r... | [
"def change_books_status(login, book_code,rented_book_data):\n\n # modifying book_data:\n rental_date = datetime.date.today()\n return_date = rental_date + timedelta(days= 40)\n\n rental_date = date.strftime(rental_date,'%d.%m.%Y')\n return_date = date.strftime(return_date,'%d.%m.%Y')\n\n new_rent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delegates change_name() to change_data() with 'name' | def change_name(change_account):
change_data(change_account, changed_data='name') | [
"def _changed_name(self, *obj):\n self.update_title(self.get_menu_title())\n self.preview_name.set_text(self.get_preview_name())\n self.name_list.update_defname()",
"def updateName(self,name):\n self.name = name",
"def change_name(self, who, new_name):\n if who == NameReferenc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delegates change_name() to change_data() with 'surname' | def change_surname(change_account):
change_data(change_account, changed_data='surname') | [
"def change_name(change_account):\n change_data(change_account, changed_data='name')",
"def change_surname(db, login, new_name):\n db.change_surname(login, new_name)",
"def update_names(self, data, **kwargs):\n if data[\"type\"] == \"personal\":\n names = [data.get(\"family_name\"), data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delegates change_name() to change_data() with 'password' | def change_password(change_account):
change_data(change_account, changed_data='password') | [
"def change_name(change_account):\n change_data(change_account, changed_data='name')",
"def change_password(self,employee,new_password):\n pass",
"def change_username(self, name):\n self.username = name",
"def edit_user_name():\n raise NotImplementedError",
"def user_change_password(self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tells if transaction is in context mode | def is_context_active(self):
return self.is_active and bool(self.__inside_context) | [
"def InTransaction(self) -> bool:",
"def _has_active_context(self):\n return self._get_current_context() is not None",
"def is_transaction(self) -> bool:\n return self._is_txn",
"def in_transaction(self) -> bool:\n return self._transaction is not None and self._transaction.is_active",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tells if transaction is active (is opened somehow) | def is_active(self):
active = bool(
self.__is_connected and
self._db_connection and
self._db_transaction and
self._db_connection.in_transaction() and
self._db_transaction.is_active
)
if not active and self.__is_connected:
... | [
"def in_transaction(self) -> bool:\n return self._transaction is not None and self._transaction.is_active",
"def InTransaction(self) -> bool:",
"def is_in_transaction(self) -> bool:\n return self._protocol.is_in_transaction()",
"def is_session_active(session):\n if getattr(session, 'autocommi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The current ORM session associated with transaction and connection | def session(self):
if not self.is_active:
raise errors.InactiveTransaction()
return self._orm_session_proxy | [
"def get_sql_session(self):\n session_maker_obj = sessionmaker(bind=self._engine,\n expire_on_commit=False)\n session = session_maker_obj()\n return session",
"def get_session(self):\n return object_session(self)",
"def session(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flushes data from ORM Session into DB, but does not commit transaction | def flush(self):
if not self.is_active:
return
# XXX: investigate if there is db transaction flush
self._orm_session.flush() | [
"def dbflush(self):\n # see http://stackoverflow.com/questions/4201455/sqlalchemy-whats-the-difference-between-flush-and-commit\n if (self.session!=None):\n self.session.flush()",
"def model_sessionflush(self, modelobj):\n session = modelobj.dbsession()\n session.flush()",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a savepoint under current transaction | def savepoint(self):
if not self.is_active:
raise errors.InactiveTransaction()
return Savepoint(self) | [
"def savepoint_create_sql(self, sid):\n return \"SAVE TRANSACTION %s\" % sid",
"def savepoint(self, id):\n self.execute(\"SAVEPOINT {}\".format(id))",
"def savepoint_create_sql(self, sid):\n raise NotImplementedError",
"def savepoint(self):\n if self.transaction is None:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts db connection, transaction, SqlAlchemy ORM session | def _connect(self):
assert not self.__is_connected
self._db_engine = create_engine(self._database.url)
from sqlalchemy import event
if self._database.driver == 'sqlite':
@event.listens_for(self._db_engine, "connect")
def do_connect(dbapi_connection, *args, **k... | [
"def start(self):\n \n self.db.session.add(self.sql_model_instance)\n self.db.session.commit()",
"def setup_session():\n print(\"Setting up session\")\n engine = setup_engine()\n Base.metadata.bin = engine\n\n DBSession = sessionmaker(bind=engine)\n session = DBSession()\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes deferred queries within separate transaction | def _execute_deferred_queries(self):
assert not self.__is_connected
if not self._deferred_queries:
return
with Transaction(self.__database_name) as txn:
while True:
try:
query = self._deferred_queries.popleft()
tx... | [
"def test_query_is_deferred(self):\n s = yield self.getReadyDB()\n a = s.dQuery('select 1 as foo;')\n self.assertTrue(isinstance(a, Deferred), a)\n a.addErrback(lambda x: None)",
"async def test_transaction_commit_low_level(database_url):\n\n async with Database(database_url) as dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Time the execution of the statement `number` of times and repeat it number of `repetitions`. The returned timing is the all recorded `repetitions` with discarded potential outliers with the highest and lowest times, then averaged. The statement is executed number of times for each repetition and for each repetition we ... | def timeitrep(statement, number=1, repetition=1):
timings = []
results = []
for _ in range(repetition):
t0 = time.time()
statement_result = None
for _ in range(number):
statement_result = statement()
t1 = time.time()
timings.append(t1 - t0)
if len(... | [
"def timeitrep(statement, number=1, repetition=1):\n timings = []\n for _ in range(repetition):\n t0 = time.time()\n statement_result = None\n for _ in range(number):\n statement_result = statement()\n t1 = time.time()\n timings.append(t1 - t0)\n if len(tim... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of the properties under the specified key name. | def list_property(
self, key: str) -> Collection[Tuple[str, PropertyAttribute]]:
return self._env.list_property(key) | [
"def getProperties(self):\n return self.metadataByProperty.keys()",
"def properties(cls):\n _validate(cls)\n result = []\n for key, value in cls.__dict__.items():\n if isinstance(value, property):\n result.append(key)\n return list(sorted(result))",
"def get_all_properties(cls):... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Randomly sample a batch of experiences from memory. | def sample(self):
sample_ind = np.random.choice(len(self.memory), self.batch_size)
# get the selected experiences: avoid using mid list indexing
es, ea, er, en, ed = [], [], [], [], []
i = 0
while i < len(sample_ind):
self.memory.rotate(-sample_ind[i]) # rotate the m... | [
"def experience_replay(batch_size):\n memory = []\n while True:\n experience = yield rsample(memory, batch_size) if batch_size <= len(memory) else None\n memory.append(experience)",
"def sample(self):\n # get a set of random indices, weighted by the sampling weights\n current_siz... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a LaTeX table for the strategy results. | def result_table(fmt='latex_booktabs'):
names = [
"ETF EW.",
"Antonacci ETF",
"Antonacci ETF Inv. Vol.",
"Futures EW.",
"Antonacci Futures",
"Antonacci Futures Inv. Vol.",
"TSMOM Futures Low Vol.",
"TSMOM Futures High Vol."
]
# Get stats ... | [
"def latex() -> None:\n TABLE_START = '\\\\begin{table}\\\\begin{tabular}{ccc}Model&T&STD\\\\\\\\\\\\hline'\n RESULTS = 'results'\n ROW = '{model} & {t} & {t_std}\\\\\\\\'\n headers = get_headers([m for m in EVALUATION_METRICS if m != 'T-hat'])\n data = OrderedDict([(k, []) for k in DATA])\n for r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the configuration file name according to the command line parameters | def get_config_file_name(self):
argv = sys.argv
config_type = "dev" # default configuration type
if None != argv and len(argv) > 1 :
config_type = argv[1]
config_file = config_type + ".cfg"
logger.info("get_config_file_name() return : " + config_file)
return c... | [
"def configFilename(self):\n return self.name()+'.py'",
"def config_file_name(self):\n return self._config_file_name",
"def get_config_path():\n parser = argparse.ArgumentParser(description='Log Analyzer')\n parser.add_argument('-c', '--config', help='Path to config file')\n args = parser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update review data based on last performance. | def review(self, performance_rating):
self.correct = performance_rating >= 0.6
now = datetime.datetime.now()
if self.date_last_reviewed is None:
self.date_last_reviewed = now
percent_overdue = self.percent_overdue
self.difficulty += percent_overdue / 17 * (8 - 9 * per... | [
"def update_review_details(self):\n\n movie_reviews = Review.objects.filter(movie=self)\n if movie_reviews.count() == 0:\n self.avg_rating = None\n self.num_reviews = None\n else:\n self.num_reviews = movie_reviews.count()\n # get average of all revie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns cards that require reviewing. This defaults to at most 20 items, for cards that have not been reviewed in the last 8 hours. | def fetch_review(self):
c = self.db.cursor()
c.execute("""SELECT * FROM cards
WHERE date_last_reviewed < (DATETIME('now', 'localtime', '-8 hours'))
OR correct = 0""")
rows = c.fetchall()
cards = [
Card(
id=id,
card_type=card_typ... | [
"def has_enough_cards(self):\n enough = len(self.deck.full_deck) > 6\n\n return enough",
"def test_consumed_cards_longer(self):\n game = TestGames.replay(9, [3, 1, 0, 0, 1, 2, 2, 0, 6, 3,\n 0, 0, 1, 2, 6, 0, 0, 0, 0, 0])\n consumed_cards = game.consum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize a new linked list containing the given items. The first node in the linked list contains the first item in . | def __init__(self, items):
if len(items) == 0:
self._first = None
self._rest = None
else:
self._first = items[0]
self._rest = LinkedListRec(items[1:]) | [
"def __init__(self, items):\r\n if len(items) == 0: # No items, and an empty list!\r\n self._first = None\r\n else:\r\n self._first = _Node(items[0])\r\n curr = self._first\r\n for item in items[1:]:\r\n curr.next = _Node(item)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store item at position in this list. Raise IndexError if index is >= the length of . | def __setitem__(self, index, item):
# TODO: complete this function!
if index >= self.__len__():
raise IndexError
else:
if index == 0:
self._first = item
else:
self._rest.__setitem__(index-1, item) | [
"def __setitem__(self, index, item):\n if index < -self.length or index > self.length - 1: # Checks if index within the valid range,\n raise IndexError('Index out of range') # otherwise raise exception\n if index < 0:\n index = self.length + index ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the number of times occurs in this list. Use == to compare items. | def count(self, item):
# TODO: complete this function!
if item not in self:
return 0
else:
num_occur = 0
if self._first == item:
num_occur += 1
num_occur += self._rest.count(item)
return num_occur | [
"def count(self, val):\n count = 0\n if self._size > 0:\n for i in range(0, self._size):\n if val == self._list[i]:\n count += 1\n i += 1\n return count",
"def count(self, value):\n self.__validate_value(value)\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert item in to the list at position . Raise an IndexError if index is > the length of the list. Note that it is possible to add to the end of the list (when index == len(self)). | def insert(self, index, item):
if index > len(self):
raise IndexError
elif index == 0:
self.insert_first(item)
else:
self._rest.insert(index-1, item) | [
"def insert(self, index, item):\n if index < -self.length or index > self.length: # Checks if index is within valid range,\n raise IndexError(\"Index out of range\") # Otherwise raise exception\n if self.is_full():\n raise Exception(\" List is Full \") ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a new LinkedList whose nodes store items that are obtained by applying f to each item in this linked list. Does not change this linked list. | def map(self, f):
if self.is_empty():
pass
else:
items = []
items.append(f(self._first))
map(f._rest)
new_lst = LinkedListRec(items) | [
"def map(self, f: Callable[[object], object]) -> 'LinkedList':\n new_ll = LinkedList()\n curr = self.front\n while curr is not None:\n val = f(curr.value)\n new_ll.append(val)\n curr = curr.next_\n return new_ll",
"def filter(self, f: Callable[[object],... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function randomly creates a stock price series bases on gaussian probabilities. | def GaussianRandomStockPrice(mu, sigma, n, end, freq, S0=100):
RStock = np.random.normal(mu, sigma, n).astype("float")
RStock = pd.DataFrame(RStock)
RStock.rename(inplace=True, columns={RStock.columns[0]: "Return"})
RStock["Price"] = ((1 + RStock["Return"]).cumprod()) * S0
times = pd.date_range(end... | [
"def generate_prices(reference_price, sigma, total):\n return [random.normalvariate(reference_price, sigma) for i in range(total)]",
"def testGaussian(self):\r\n random.seed(42)\r\n\r\n sample = ExponentiallyDecayingReservoir()\r\n for _ in range(300):\r\n sample.update(random.gauss(42.0, 13.0))\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. calculates max length of feat/gep tensors 2. padds feat/geo tensors with zeros till the max length 3. writes resulting tensor to the file | def write_filtered_pad_feat_geo(self):
length_max = self._get_length_max()
data_list = range(self.idx_write, len(self.files_refined))
# length_max = 150
progress = tqdm(data_list)
for id in progress:
progress.set_postfix({'pdb': self.files_refined[id]})
fe... | [
"def ggml_tensor_overhead() -> int:\n ...",
"def ggml_nbytes_pad(tensor: ffi.CData) -> int:\n ...",
"def ggml_get_max_tensor_size(ctx: ffi.CData) -> int:\n ...",
"def ggml_nbytes(tensor: ffi.CData) -> int:\n ...",
"def pack_features(args):\n workspace = args.workspace\n data_type = args.da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the max length of feature array among all pdbids | def _get_length_max(self):
# data_list = list(range(len(self.files_refined)))
data_list = range(self.idx_max_length, len(self.files_refined))
progress = tqdm(data_list)
for pdb_id in progress:
features_filt, geo_filt = self._get_features_geo_filtered(pdb_id)
lengt... | [
"def get_max_rois(self):\n \n maxsize = 0\n for index in self.SampleID:\n rois = self.__getrois__(index);\n maxsize = max(maxsize, rois.shape[0])\n \n return maxsize",
"def max_length(self) -> int:\r\n return max([len(str(i)) for i in self.matrix.fla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates a hot vector of an atom type | def atom_to_hot_vector(self, elem: str):
hot_vector = np.zeros(22)
idx = self.dict_atoms_simple[elem]
hot_vector[idx] = 1
return hot_vector | [
"def get_one_hot_vector(i, size=3):\n vec = np.zeros(size)\n vec[i] = 1\n return vec",
"def to_one_hot(v):\n n = len(v)\n m = max(v) + 1\n out = np.zeros((n, m))\n out[np.arange(n), v] = 1\n return out",
"def one_hot_encoding(raw_feats, ohe_dict_broadcast, num_ohe_feats):\n return Spa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
selects atoms of "id_pdb" protein within the distance "precision" around "center_lig" | def _get_mask_selected_atoms_pocket(
self, pdb_id: int,
):
path_protein, path_ligand = self._get_path(pdb_id)
center_ligand = self._get_ligand_center(path_ligand)
if self.type_filtering == "all" and self.h_filterig == 'h':
sel="protein and noh and sqr(x-'{0}')+sqr(y-'{1}... | [
"def query_points(self, point, precision=5):\n # Generate the geohash.\n (latitude, longitude) = point\n\n hashcode = geohash.encode(latitude, longitude, precision)\n log.debug('Point \"%s\" geohash is: \"%s\"' % (point, hashcode))\n\n results = self.regex_query(self.spatial_index... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the geometrical center of a ligand | def _get_ligand_center(self, path_ligand):
mol_ligand = Molecule(path_ligand)
coor_lig = mol_ligand.coords
center = np.mean(coor_lig, axis=0)
center = center.reshape(1, -1)
return center | [
"def get_center(self):\n lon, lat = self.coordinates\n\n dimx = lon.shape[0]\n dimy = lon.shape[1]\n \n return (lon[dimx/2][dimy/2],lat[dimx/2][dimy/2])",
"def _get_centre(self, gdf):\n bounds = gdf[\"geometry\"].bounds\n centre_x = (bounds[\"maxx\"].max() + bounds[\"minx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes all elems in protein | def _get_all_elems(self, protein_id: int):
path_protein, _ = self._get_path(protein_id)
try:
# mol_pocket = Molecule(path_protein)
mol_protein = Molecule(path_protein)
mol_protein.filter('protein')
if (self.type_feature == "bio_properties" or self.type_fea... | [
"def get_protein_sequence(self, list_of_proteins):\n return torch.cat([self.seq_dict[p].reshape(1, -1) for p in list_of_proteins], dim=0)",
"def translate_protein(protein):\n proteinsequence = []\n for index in range(len(protein)):\n proteinsequence.append(AminoAcid(protein[index], index))\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get a full path to protein/ligand | def _get_path(self, protein_id: int):
protein_name = self.files_refined[protein_id]
path_protein = os.path.join(
self.init_refined, protein_name, protein_name + "_protein.pdb"
)
path_ligand = os.path.join(
self.init_refined, protein_name, protein_name + "_ligand.m... | [
"def _get_fullpath(self, address):\n address = os.path.abspath(address)\n if len(address) < 4 or address[-4:] != \".dta\":\n address = address + \".dta\"\n return address",
"def lpath(file0, file1):\n return os.path.abspath(os.path.join(os.path.dirname(file0), file1))",
"def p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders and returns a string of the rendered menu. | def render(self, menu):
# Get the menu title.
try:
menu_title = menu["meta"]["title"]
except KeyError:
# If menu title not found, set to a default title.
menu_title = "??????????"
render = "\n" + menu_title
render += "\n" + "=" * len(menu_titl... | [
"def render(self):\n menu = etree.Element('openbox_pipe_menu')\n \n walk(self.menuItems, menu)\n \n print etree.tostring(menu)",
"def render(self) -> str:\n return self.current_level.render()",
"def get_menu() -> str:\n date = datetime.date.today()\n urls = generate_urls(date)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
count number of fillin edges after removing nid number of combinations of nhd existing edges (nodes in the subgraph of nhd) | def fill_count(nid):
n_edges = G.subgraph(G.neighbors(nid)).number_of_edges()
deg = G.degree[nid]
n_fill = deg*(deg-1)//2 - n_edges
return n_fill | [
"def num_edges(g):\n total_edges_with_duplicates = sum(len(v) for v in g.values())\n return total_edges_with_duplicates // 2",
"def countnt_good_duntngeons(game: Game) -> int:\n\n def dfs(unt, wnt):\n \"\"\"\n untpdates the goodness of a single duntngeon\n :param unt: inpuntt room\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the QListWisgetItem initialized with txt informations to the User Interface logger_list and to the save_parameters.logger array. =============== =========== ====================== Parameters Type Description txt string the log info to add. =============== =========== ====================== | def add_log(self,txt):
try:
now=datetime.datetime.now()
new_item=QtWidgets.QListWidgetItem(now.strftime('%Y/%m/%d %H:%M:%S')+": "+txt)
self.ui.logger_list.addItem(new_item)
if self.h5saver.h5_file.isopen:
self.h5saver.append(self.h5saver.logger_arr... | [
"def _append_log(self, message):\n index = self._log_listbox.Append(message)\n self._log_listbox.SetSelection(index)",
"def log(self, item: Dict[str, Any]) -> None:\n raise NotImplementedError",
"def updateLog(self):\n self.teLogs.clear()\n selItems = self.twJobs.selectedItems... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all docks containing Moves or Viewers. See Also quit_fun, update_status | def clear_move_det_controllers(self):
try:
#remove all docks containing Moves or Viewers
if hasattr(self,'move_modules'):
if self.move_modules is not None:
for module in self.move_modules:
module.quit_fun()
self.move... | [
"def delete_players() -> None:\n remove_all_players()",
"def delete_games() -> None:\n remove_all_games()",
"def RemoveAll(self):",
"def clear_moves(self):\n [x.set_board() for x in self.pieces if x.get_state() == MOVE]",
"def cleanup():\n for s in [missiles, explosions, bonus]:\n\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load and restore a layout state from the select_file obtained pathname file. See Also utils.select_file | def load_layout_state(self, file=None):
try:
if file is None:
file=utils.select_file(save=False, ext='dock')
if file is not None:
with open(str(file), 'rb') as f:
dockstate = pickle.load(f)
self.dockarea.restoreState... | [
"def loadWindowState(self):\n self.stopUpdate()\n fileName = self.s.config.currentFileName\n if fileName is None:\n self.logger.warning(\"No window state to load. Please specify a \"\n \"configuration file first.\")\n else:\n fileName ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Quit the current instance of DAQ_scan and close on cascade move and detector modules. See Also quit_fun | def quit_fun(self):
try:
try:
self.h5saver.close_file()
except:
pass
for module in self.move_modules:
try:
module.quit_fun()
QtWidgets.QApplication.processEvents()
QTh... | [
"def stop(self):\n print 'closing'\n self.comm.close_all_serial() # Close all serial connections opened with SNAPconnect\n print 'closed'\n sys.exit(0) # Exit the program",
"def quit(self):\n self.stream.close()\n if SHOW_GRAPH:\n plt.close('all')\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the current layout state in the select_file obtained pathname file. Once done dump the pickle. See Also utils.select_file | def save_layout_state(self, file = None):
try:
dockstate = self.dockarea.saveState()
if file is None:
file=utils.select_file(start_path=None, save=True, ext='dock')
if file is not None:
with open(str(file), 'wb') as f:
pickl... | [
"def saveWindowState(self):\n fileName = self.s.config.currentFileName\n if fileName is None:\n self.logger.warning(\"No window state to save. Need to run an \"\n \"experiment first.\")\n else:\n fileName = \"%s.layout\" % fileName\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check for changes in the given (parameter,change,information) tuple list. In case of value changed, update the DAQscan_settings tree consequently. =============== ============================================ ============================== Parameters Type Description param instance of pyqtgraph parameter the parameter t... | def parameter_tree_changed(self, param, changes):
for param, change, data in changes:
path = self.settings.childPath(param)
if path is not None:
childName = '.'.join(path)
else:
childName = param.name()
if change == 'childAdded':pas... | [
"def updateParameterNodeFromGUI(self, caller=None, event=None):\r\n\r\n if self._parameterNode is None or self.logic is None or self._updatingGUIFromParameterNode:\r\n return\r\n\r\n wasModified = self._parameterNode.StartModify() # Modify all properties in a single batch\r\n\r\n self.logic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a file preset from the converted xml file given by the filename parameter. =============== =========== =================================================== Parameters Type Description filename string the name of the xml file to be converted/treated =============== =========== ========================================... | def set_file_preset(self,filename):
if os.path.splitext(filename)[1] == '.xml':
self.preset_file = filename
self.preset_manager.set_file_preset(filename, show=False)
self.move_docks = []
self.det_docks_settings = []
self.det_docks_viewer = []
... | [
"def set_source_file(self, source_file):\n # intiate xml info\n xml_file = 'test/temp.xml'\n # print '%s begin' %source_file\n commands.getoutput('srcml --position ' + source_file + ' -o ' + xml_file + ' > null')\n # print '%s end' %source_file\n self.parse_xml(xml_file)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send the command_DAQ signal with "set_ini_positions" list item as an attribute. | def set_ini_positions(self):
self.command_DAQ_signal.emit(["set_ini_positions"]) | [
"def set_ini_positions(self):\n try:\n positions=self.scan_moves[0]\n for ind_move,pos in enumerate(positions): #move all activated modules to specified positions\n # if pos[0]!=self.move_modules[ind_move].title: # check the module correspond to the name assigned in pos\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the date/time and author values of the scan_info child of the scan_attributes tree. Show the 'scan' file attributes. See Also show_file_attributes | def set_metadata_about_current_scan(self):
date=QDateTime(QDate.currentDate(),QTime.currentTime())
self.scan_attributes.child('scan_info','date_time').setValue(date)
self.scan_attributes.child('scan_info','author').setValue(self.dataset_attributes.child('dataset_info','author').value())
... | [
"def snapshot_info(self) -> MetaFile:\n raise NotImplementedError",
"def set_metadata_about_dataset(self):\n date=QDateTime(QDate.currentDate(),QTime.currentTime())\n self.dataset_attributes.child('dataset_info','date_time').setValue(date)\n res = self.show_file_attributes('dataset')\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the date value of the data_set_infodate_time child of the data_set_attributes tree. Show the 'dataset' file attributes. See Also show_file_attributes | def set_metadata_about_dataset(self):
date=QDateTime(QDate.currentDate(),QTime.currentTime())
self.dataset_attributes.child('dataset_info','date_time').setValue(date)
res = self.show_file_attributes('dataset')
return res | [
"def test_set_get_dt():\n data = io.create_sample_dataset()\n assert data.attrs[\"dt\"] == 1.0\n assert data.piv.dt == 1.0\n data.piv.set_dt(2.0)\n assert data.attrs[\"dt\"] == 2.0",
"def setNodeDatum(self, node, value):\n\n if not cmds.attributeQuery('datum', node=node, exists=True):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
| Set the preset mode from the given filename. | | In case of "mock" or "canon" move, set the corresponding preset calling set_()_preset procedure. | | Else set the preset file using set_file_preset function. | Once done connect the move and detector modules to logger to recipe/transmit informations. | def set_preset_mode(self,filename):
try:
self.mainwindow.setVisible(False)
for area in self.dockarea.tempAreas:
area.window().setVisible(False)
self.splash_sc.show()
QtWidgets.QApplication.processEvents()
self.splash_sc.raise_()
... | [
"def set_file_preset(self,filename):\n if os.path.splitext(filename)[1] == '.xml':\n self.preset_file = filename\n self.preset_manager.set_file_preset(filename, show=False)\n self.move_docks = []\n self.det_docks_settings = []\n self.det_docks_viewer = [... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the current scan given the selected settings. Makes some checks, increments the h5 file scans. In case the dialog is cancelled, return False and aborts the scan | def set_scan(self):
try:
# set the filename and path
res = self.create_new_file(False)
if not res:
return
#reinit these objects
self.scan_data_1D = []
self.scan_data_1D_average = []
self.scan_data_2D = []
... | [
"def startScan(self):\n self.statusbar.showMessage(\"Scan Start\")\n msg = \"Started scanning the cube!\"\n self.addLogEntry(msg)\n self.progBar_Status.setValue(0)\n\n cam = cv.VideoCapture(-1); # open the default cam\n if (~cam.isOpened()): # check if we succeeded\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Foreach module of the move module object list, stop motion. See Also stop_scan, DAQ_Move_main.daq_move.stop_Motion | def stop_moves(self,overshoot):
self.overshoot = overshoot
self.stop_scan()
for mod in self.move_modules:
mod.stop_Motion() | [
"def _stop_all_motors(self):\n self.arm_left.stop()\n self.arm_right.stop()\n self.bucket_left.stop()\n self.bucket_right.stop()\n self.pinion_left.stop()\n self.pinion_right.stop()",
"def stop_moving(self):\n self.logger.info('stop moving')\n self.anc350_in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emit the command_DAQ signal "stop_acquisiion". See Also set_ini_positions | def stop_scan(self):
self.ui.log_message.setText('Stoping acquisition')
self.command_DAQ_signal.emit(["stop_acquisition"])
if not self.overshoot:
self.set_ini_positions() #do not set ini position again in case overshoot fired
status = 'Data Acquisition has been stopped b... | [
"def on_stop(self):",
"def stop(self):\n self.scion_sh('stop')",
"def on_stop(self):\n pass",
"def stop(self, *args):\n return _yarp.IPositionControl_stop(self, *args)",
"def _stop_sequence(self):\n self.logger.info(\"Received stop command, executing stop sequence\")\n try... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add the scan_optionsplot_form child to the DAQscan_settings tree from the selected value of the given parameter. =============== ================================= ======================== Parameters Type Description param instance of pyqtgraph parameter the parameter to treat =============== ===========================... | def update_plot_det_items(self,param):
items=param.value()['selected']
self.settings.child('scan_options', 'plot_from').setOpts(limits=items) | [
"def update_scan2D_type(self, param):\n try:\n self.settings.child('scan2D_settings', 'step_2d_axis1').show()\n self.settings.child('scan2D_settings', 'step_2d_axis2').show()\n scan_subtype = self.settings.child('scan2D_settings', 'scan2D_type').value()\n self.sett... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the txt message in the status bar with a delay of wait_time ms. =============== =========== ======================= Parameters Type Description txt string The message to show wait_time int the delay of showing log_type string the type of the log =============== =========== ======================= | def update_status(self,txt,wait_time=0,log_type=None):
try:
self.ui.statusbar.showMessage(txt,wait_time)
if log_type is not None:
self.log_signal.emit(txt)
logging.info(txt)
except Exception as e:
pass | [
"def StatusbarTimer(self):\r\n\t\ttime.sleep(self.statusmsgTimeout)\r\n\t\tself.statusbar.SetStatusText(self.statusmsg)",
"def flash_status_message(self, message):\r\n try:\r\n self.statusbar.SetStatusText(message, 1)\r\n self.timeroff = wx.Timer(self)\r\n self.Bind(wx.EVT_TIMER, lambda event: s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
| Set the positions from the scan_move attribute. | | Move all activated modules to specified positions. | Check the module corresponding to the name assigned in pos. See Also DAQ_Move_main.daq_move.move_Abs | def set_ini_positions(self):
try:
positions=self.scan_moves[0]
for ind_move,pos in enumerate(positions): #move all activated modules to specified positions
# if pos[0]!=self.move_modules[ind_move].title: # check the module correspond to the name assigned in pos
... | [
"def move_stages(self,positions):\n for ind_move,pos in enumerate(positions): #move all activated modules to specified positions\n #self.move_modules[ind_move].move_Abs(pos)\n self.move_modules_commands[ind_move].emit(utils.ThreadCommand(command=\"move_Abs\", attributes=[pos]))",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
| Update the move_done_positions attribute if needed. | If position attribute is setted, for all move modules launched, update scan_read_positions with a [modulename, position] list. ============== ============ ================= Parameters Type Description name string the module name position float ??? ============== =... | def move_done(self,name,position):
try:
if name not in list(self.move_done_positions.keys()):
self.move_done_positions[name]=position
if len(self.move_done_positions.items())==len(self.move_modules_names):
list_tmp=[]
for name_tmp in sel... | [
"def set_ini_positions(self):\n try:\n positions=self.scan_moves[0]\n for ind_move,pos in enumerate(positions): #move all activated modules to specified positions\n # if pos[0]!=self.move_modules[ind_move].title: # check the module correspond to the name assigned in pos\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send the status signal 'Time out during acquisition' and stop the timer. | def timeout(self):
self.timeout_scan_flag=True
self.timer.stop()
self.status_sig.emit(["Update_Status","Timeout during acquisition",'log'])
self.status_sig.emit(["Timeout"]) | [
"def stop_timer(self):\r\n self.countdownTimer.stop()",
"def stop_timer(self):\n self.end_time = datetime.now()",
"def stop_scan(self):\n self.ui.log_message.setText('Stoping acquisition')\n self.command_DAQ_signal.emit([\"stop_acquisition\"])\n\n if not self.overshoot:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move all the activated modules to the specified positions. =============== ============ ============================================= Parameters Type Description positions tuple list The list of the positions related to indices =============== ============ ============================================= See Also DAQ_Move... | def move_stages(self,positions):
for ind_move,pos in enumerate(positions): #move all activated modules to specified positions
#self.move_modules[ind_move].move_Abs(pos)
self.move_modules_commands[ind_move].emit(utils.ThreadCommand(command="move_Abs", attributes=[pos])) | [
"def set_ini_positions(self):\n try:\n positions=self.scan_moves[0]\n for ind_move,pos in enumerate(positions): #move all activated modules to specified positions\n # if pos[0]!=self.move_modules[ind_move].title: # check the module correspond to the name assigned in pos\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find peak in filtered image | def peak_finder(filt_im, dist, threshold):
from skimage.feature import peak_local_max
coordinates = peak_local_max(filt_im, min_distance=dist, threshold_abs=threshold)
return coordinates | [
"def find_peaks(param, img):\n\n peaks_binary = (maximum_filter(img, footprint=generate_binary_structure(\n 2, 1)) == img) * (img > param['thre1'])\n # Note reverse ([::-1]): we return [[x y], [x y]...] instead of [[y x], [y\n # x]...]\n return np.array(np.nonzero(peaks_binary)[::-1]).T",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates vocabulary that is used to map BPEs to ids and viceversa. It iterates over data, performs tokenization with the BPE tokenizer and true caser and creates a vocabulary of unique symbols that is saved. | def create_bpe_vocabulary(bpe_vocab_fp, bpe_int_fp, data_path, truecaser_fp):
bpe = BPE(glossaries=SPECIAL_TOKENS)
bpe.load(bpcodes_fp=bpe_int_fp, merges=-1)
tcaser = MosesTruecaser(load_from=truecaser_fp, is_asr=True)
tcase_func = partial(tcaser.truecase, return_str=True, use_known=True)
unsup_tok... | [
"def build_vocab_dict(data, name):\n print('Building vocab dict...')\n word_counter = collections.Counter()\n for token in data:\n word_counter.update(token.text)\n vocabulary = set([word for word in word_counter])\n vocabulary = list(vocabulary) + [PADDING, UNKNOWN, LBR, RBR]\n vocab_dict ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Converter class instance with the CommonAPIHandler class instance. | def __init__(self, common_api_handler):
self.common_api_handler = common_api_handler | [
"def _initialize_converters(self):\n for module_info in au.get_local_module_infos_of_type('converter').values():\n # path based import from https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly\n spec = importlib.util.spec_from_file_location(module_info.name,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the ACE of the model based on data (X,Y). | def ace(model, X, Y, n_bins=10, backend="google"):
if backend is None:
raise NotImplementedError
elif backend == "prototype":
raise NotImplementedError
elif backend == "google":
probabilities, labels = google_metric_formulation(model=model, X=X, Y=Y)
metric_value = um.ace(... | [
"def get_ace(self):\n d = Point(self.pt2.x + 4 * (self.pt2.x - self.pt1.x), self.pt2.y)\n self.a = Point(d.x, d.y - self.shape[1])\n self.c = Point(d.x + self.shape[0], d.y)\n self.e = Point(d.x, self.pt1.y)",
"def azizen(self):\n # x0,y0 array pixel coordinates relative to cx,c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plugin main page. With list of all categories and search menu. | def index(request):
main_menu = [
(
buildUrl(request.basePath(), {"path": "/search"}),
xbmcgui.ListItem(
label=xbmcaddon.Addon().getLocalizedString(30009),
iconImage=getMediaResource("search.png"),
path=buildUrl(request.basePath(), {"p... | [
"def index():\n litems = []\n allitems = []\n viewmode = int(plugin.get_setting('viewmode'))\n if viewmode is None: viewmode = 500\n plugin.set_view_mode(viewmode)\n DOSTR8 = plugin.get_setting(key='dostr8')\n if not (DOSTR8 == True or DOSTR8 == 'true'): DOSTR8 = False\n else: DOSTR8 = True\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print a recipe with the name `name` and return the instance | def get_recipe_by_name(self, name):
for key, val in self.recipes_list.items():
for a, b in val.items():
if name == a:
print(str(b)) | [
"def get_recipe_by_name(self, name):\n a = [y for x in self.recipes_list.values() for y in x if y.name == name]\n for xx in a:\n print(xx)",
"def name(self):\n return self.recipe_name",
"def recipe_printer():\n\n path = os.curdir\n recipe = raw_input(\"What is the name of t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a message when the command /reloadplayers is issued. | def reload_command(update: Update, context: CallbackContext) -> None:
player.saveChatID(players)
logger.info(f'Player chat ids have been saved in {config.CHAT_ID_JSON}')
player.loadPlayers(players)
logger.info(f'Players reloaded')
update.message.reply_text(f'Players reloaded') | [
"def update_player_list():\n Group(\"lobby\").send({\n \"text\": json.dumps({\n \"players\": LOBBY_PLAYERS\n })\n })",
"def reload_player(id):\n global database\n table = database.Tables.players\n return get_query(table.select().where(table.c.id == id))"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the countryLetterCode | def country_letter_code(self):
if "countryLetterCode" in self._prop_dict:
return self._prop_dict["countryLetterCode"]
else:
return None | [
"def country_code(self):\n return self.__country_code",
"def country_code(self) -> str:\n return pulumi.get(self, \"country_code\")",
"def country(alpha_2_code: str) -> None:",
"def _set_country_code(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the marketingNotificationEmails | def marketing_notification_emails(self):
if "marketingNotificationEmails" in self._prop_dict:
return self._prop_dict["marketingNotificationEmails"]
else:
return None | [
"def sender_email_notifications(self):\n return self._sender_email_notifications",
"def signer_email_notifications(self):\n return self._signer_email_notifications",
"def emails(self):\n return self._emails",
"def Emails(self, default=[None]):\n return self.data.get('emails', d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the onPremisesLastSyncDateTime | def on_premises_last_sync_date_time(self):
if "onPremisesLastSyncDateTime" in self._prop_dict:
return datetime.strptime(self._prop_dict["onPremisesLastSyncDateTime"].replace("Z", ""), "%Y-%m-%dT%H:%M:%S.%f")
else:
return None | [
"def last_sync_date(self, last_sync_date):\n\n self._last_sync_date = last_sync_date",
"def last_sync_time(self):\n return self._status[StatusInfo.LAST_SYNC_TIME]",
"def last_sync(self, last_sync):\n\n self._last_sync = last_sync",
"def get_last_sync(self):\n return self.app.sync_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the onPremisesSyncEnabled | def on_premises_sync_enabled(self):
if "onPremisesSyncEnabled" in self._prop_dict:
return self._prop_dict["onPremisesSyncEnabled"]
else:
return None | [
"def is_sync_enabled(self) -> bool:\n return self.is_enabled",
"def _get_ldp_sync_enabled(self):\n return self.__ldp_sync_enabled",
"def enable_sync(self) -> None:\n self.is_enabled = True",
"def _enable_sync(self, enable_sync: bool = True):\n self.__enable_sync = enable_sync",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the postalCode | def postal_code(self):
if "postalCode" in self._prop_dict:
return self._prop_dict["postalCode"]
else:
return None | [
"def postal_code(self):\n return self._postal_code",
"def postal_code(self) -> str:\n return self.__postal_code",
"def postal_code(self, postal_code):\n\n self._postal_code = postal_code",
"def postal_code(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"postal_co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the privacyProfile | def privacy_profile(self):
if "privacyProfile" in self._prop_dict:
if isinstance(self._prop_dict["privacyProfile"], OneDriveObjectBase):
return self._prop_dict["privacyProfile"]
else :
self._prop_dict["privacyProfile"] = PrivacyProfile(self._prop_dict["pri... | [
"def get_profile(self):\n endpoint = '/profile'\n return self.get_request(endpoint)",
"def get_user_profile(self):\n return self.user.profile",
"def profile_privacy() -> object:\n privacy = request.form.get(\"privacy\")\n with sqlite3.connect(\"database.db\") as conn:\n cur = c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the securityComplianceNotificationMails | def security_compliance_notification_mails(self):
if "securityComplianceNotificationMails" in self._prop_dict:
return self._prop_dict["securityComplianceNotificationMails"]
else:
return None | [
"def technical_notification_mails(self):\n if \"technicalNotificationMails\" in self._prop_dict:\n return self._prop_dict[\"technicalNotificationMails\"]\n else:\n return None",
"def marketing_notification_emails(self):\n if \"marketingNotificationEmails\" in self._prop_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the securityComplianceNotificationPhones | def security_compliance_notification_phones(self):
if "securityComplianceNotificationPhones" in self._prop_dict:
return self._prop_dict["securityComplianceNotificationPhones"]
else:
return None | [
"def security_compliance_notification_mails(self):\n if \"securityComplianceNotificationMails\" in self._prop_dict:\n return self._prop_dict[\"securityComplianceNotificationMails\"]\n else:\n return None",
"def phone_configs(self) -> Optional[Sequence['outputs.QuickConnectQuick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the street | def street(self):
if "street" in self._prop_dict:
return self._prop_dict["street"]
else:
return None | [
"def street(self, street):\n\n self._street = street",
"def street(self):\n return self._street",
"def street(self, street):\n if self.local_vars_configuration.client_side_validation and street is None: # noqa: E501\n raise ValueError(\"Invalid value for `street`, must not be `N... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the technicalNotificationMails | def technical_notification_mails(self):
if "technicalNotificationMails" in self._prop_dict:
return self._prop_dict["technicalNotificationMails"]
else:
return None | [
"def security_compliance_notification_mails(self):\n if \"securityComplianceNotificationMails\" in self._prop_dict:\n return self._prop_dict[\"securityComplianceNotificationMails\"]\n else:\n return None",
"def marketing_notification_emails(self):\n if \"marketingNotific... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the verifiedDomains | def verified_domains(self):
if "verifiedDomains" in self._prop_dict:
return VerifiedDomainsCollectionPage(self._prop_dict["verifiedDomains"])
else:
return None | [
"def domains(self, domains):\n\n self._domains = domains",
"def domains(self):\n return self._domains",
"def sl_domains(self):\n return self._sl_domains",
"def sl_domains(self, sl_domains):\n self._sl_domains = sl_domains",
"def actual_domains():\n domains = set([item.stri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets and sets the mobileDeviceManagementAuthority | def mobile_device_management_authority(self):
if "mobileDeviceManagementAuthority" in self._prop_dict:
if isinstance(self._prop_dict["mobileDeviceManagementAuthority"], OneDriveObjectBase):
return self._prop_dict["mobileDeviceManagementAuthority"]
else :
s... | [
"def automobile_platform(self):\n return self._automobile_platform",
"def mobile(self, mobile):\n\n self._mobile = mobile",
"def issuing_authority(self, issuing_authority):\n self._issuing_authority = issuing_authority",
"def issuing_authority(self):\n return self._issuing_authorit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion que devuelve la fecha actual mas los dias especificados en el parametro ``days_to_add´´. Devuelve el dia en formato "DDMMAAAA" | def today_plus_days(days_to_add, US=False):
if US:
return (datetime.now() + timedelta(days=int(days_to_add))).strftime('%m-%d-%Y')
else:
return (datetime.now() + timedelta(days=int(days_to_add))).strftime('%d-%m-%Y') | [
"def add_days(self, no_of_days):\n new_dt = self.date_string + no_of_days\n return new_dt",
"def sumar_dias(dias=0):\n fecha = datetime.datetime.now() + datetime.timedelta(days=dias)\n nueva_fecha = fecha.strftime(\"%d-%m-%Y\")\n return nueva_fecha",
"def add_days(str_date, days=1, date_f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_add_user_groups_for_user_post | def test_resource_user_resource_add_user_groups_for_user_post(self):
pass | [
"def test_users_groups_post(self):\n pass",
"def test_resource_user_resource_set_user_groups_for_user_put(self):\n pass",
"def test_resource_user_resource_add_users_post(self):\n pass",
"def test_resource_user_resource_add_user_post(self):\n pass",
"def test_user_group_controller... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_add_user_post | def test_resource_user_resource_add_user_post(self):
pass | [
"def test_resource_user_resource_add_users_post(self):\n pass",
"def test_add_user(self):\n pass",
"def test_user_post(self):\n pass",
"def test_post_user_post(self):\n pass",
"def test_api_user_post(self):\n pass",
"def test_resource_user_resource_add_user_groups_for_us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_add_users_post | def test_resource_user_resource_add_users_post(self):
pass | [
"def test_resource_user_resource_add_user_post(self):\n pass",
"def test_add_user(self):\n pass",
"def test_resource_user_resource_add_user_groups_for_user_post(self):\n pass",
"def test_post_users_post(self):\n pass",
"def test_add_user_to_collection(self):\n pass",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_change_user_avatar_patch | def test_resource_user_resource_change_user_avatar_patch(self):
pass | [
"def test_resource_user_resource_get_avatar_file_get(self):\n pass",
"def test_userprofile_avatar_update(self):\n self.assert_create(User, username=TEST_USERNAME,\n password=TEST_PASSWORD, email=TEST_EMAIL)\n user = User.objects.get(id=1)\n userprofile_model = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_change_user_patch | def test_resource_user_resource_change_user_patch(self):
pass | [
"def test_patch_user(self):\n pass",
"def test_resource_user_resource_change_user_avatar_patch(self):\n pass",
"def test_update_user(self):\n pass",
"def test_update_system_user(self):\n pass",
"def test_modify_user(self):\n print('('+self.test_modify_user.__name__+')', \\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_find_users_get | def test_resource_user_resource_find_users_get(self):
pass | [
"def test_resource_user_resource_get_user_get(self):\n pass",
"def test_resource_user_resource_get_user_by_email_address_get(self):\n pass",
"def test_resource_user_resource_get_current_user_get(self):\n pass",
"def test_users_get(self):\n pass",
"def test_get_user(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_get_avatar_file_get | def test_resource_user_resource_get_avatar_file_get(self):
pass | [
"def test_resource_user_resource_change_user_avatar_patch(self):\n pass",
"def getUserProfilePic(user):",
"def get_user_avatar(user_id):\n\n raise RuntimeError('get_user_avatar function not implemented in Artella Abstract API!')",
"def test_userprofile_avatar_read(self):\n self.assert_create(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_get_current_user_get | def test_resource_user_resource_get_current_user_get(self):
pass | [
"def test_resource_user_resource_get_user_get(self):\n pass",
"def test_get_user(self):\n pass",
"def test_get_current(self):\n self.assertEqual(api.user.get_current().getUserName(), TEST_USER_NAME)",
"def test_resource_user_resource_find_users_get(self):\n pass",
"def test_retri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_get_user_by_email_address_get | def test_resource_user_resource_get_user_by_email_address_get(self):
pass | [
"def test_get_user_by_emailuser_email_get(self):\n pass",
"def test_get_user_by_email(self):\n query_string = [('client_gravatar', False),\n ('include_custom_profile_fields', False)]\n response = self.client.open(\n '/api/v1/users/{email}'.format(email='iago@... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_get_user_get | def test_resource_user_resource_get_user_get(self):
pass | [
"def test_resource_user_resource_get_current_user_get(self):\n pass",
"def test_resource_user_resource_find_users_get(self):\n pass",
"def test_get_user(self):\n pass",
"def test_resource_user_resource_get_user_by_email_address_get(self):\n pass",
"def test_api_user_get(self):\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_remove_user_from_user_groups_delete | def test_resource_user_resource_remove_user_from_user_groups_delete(self):
pass | [
"def test_groups_group_users_user_delete(self):\n pass",
"def test_remove_user_group(self):\n response = self.client.open(\n '/api/v1/user_groups/{user_group_id}'.format(user_group_id=1),\n method='DELETE')\n self.assert200(response,\n 'Response bod... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test case for resource_user_resource_set_user_groups_for_user_put | def test_resource_user_resource_set_user_groups_for_user_put(self):
pass | [
"def test_resource_user_resource_add_user_groups_for_user_post(self):\n pass",
"def test_groups_group_users_put(self):\n pass",
"def test_resource_user_resource_remove_user_from_user_groups_delete(self):\n pass",
"def test_users_groups_post(self):\n pass",
"def test_admin_can_upd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
BuildAndRefine est la fonction à appeler pour mettre à jour un histogramme avec un ensemble de requête. | def BuildAndRefine(self, workload):
cpt_nb_req = 0
for requete in workload:
if self.verbeux:
print('Traitement de la requête ', cpt_nb_req, '/', len(workload))
cpt_nb_req += 1
self.expand_root(requete)
tab = self.nb_tuple_intervalles(re... | [
"def Fill(self, *args, **kwargs):\n self._varexp = kwargs.get(\"varexp\")\n self._cuts = kwargs.get(\"cuts\", [])\n self._weight = kwargs.get(\"weight\", \"1\")\n if len(args) == 1 and isinstance(args[0], (str, unicode)):\n IOManager.FillHistogram(self, args[0], **kwargs)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renvoie une estimation du nombre d'éléments dans la zone délimitée par bound. Les dimensions de l'intervalle à estimer doivent être décris dans le paramètre dim_a_estimer. | def estimer(self, dim_a_estimer, bound):
# Calcul du volume de l'intersection entre l'intervalle et du volume totale de l'intervalle dans ces dimensions
def volume_inter(bound1, bound2, dim_a_estimer, dim_name):
"""
Fonction intermédiaire pour calculer le volume de l'intersection... | [
"def get_ensemble_size_per_run(exp_name):\n\tN = {'ERPALL' : 80,\n\t'NODA' : 80,\n\t'RST' : 80,\n\t'ERPRST' : 80,\n\t'SR' : 64,\n\t'STINFL' : 64,\n\t'OBSINFL' : 64,\n\t'PMO27' : 38,\n\t'PMO28' : 38,\n\t'PMO32' : 40,\n\t'NCAR_FULL' : 40,\n\t'NCAR_LAONLY' : 40, \n\t'NCAR_PMO_CONTROL' : 40, \n\t'NCAR_PMO_LA' : 40, \n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fonction intermédiaire pour calculer le volume de l'intersection entre l'intervalle et la requête. Renvoit aussi le volume total de l'intervalle de manière à faire le calcul du nombre d'élément. | def volume_inter(bound1, bound2, dim_a_estimer, dim_name):
volume = 1
vol_tot = 1
for i in range(len(dim_a_estimer)):
id_dim = dim_name.index(dim_a_estimer[i])
vol_tot *= (bound1[id_dim][1] - bound1[id_dim][0])
if bound2[i][0] <= bound1... | [
"def calcVolume(self):\n\t\tu = self.s1[0] - self.s2[3]\n\t\tv = self.s1[0] - self.s1[1]\n\t\tw = self.s1[0] - self.s1[3]\n\t\tself.volume = get_norme(u)*get_norme(v)*get_norme(w)",
"def computeVolume(self):\n return (1 if self.clockwise else -1)*np.sum(np.linalg.det(np.dstack((self.vertices[self.faces[:,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renvoit si l'intervalle définit par la frontière intersectionne la requête. | def intersect(self, bound_requete):
for dim in range(len(self.intervalles)):
if self.intervalles[dim][0] < bound_requete[dim][0]:
if self.intervalles[dim][1] <= bound_requete[dim][0]:
return False # La requête et l'intervalle ne s'intersectionne pas !
... | [
"def intersection(self,x1,y1,x2,y2,x3,y3,x4,y4): \n int1 = self.side(x1,y1,x2,y2,x3,y3,x4,y4)\n int2 = self.side(x3,y3,x4,y4,x1,y1,x2,y2)\n \n return (int1<0) & (int2<0)",
"def _intersect_continuous(self, interval):\n first = self.intervals.bisect_left(interval)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that batch Reads will allow read_all_bins with no ops | def test_batch_read_all_bins_pos(self):
b = br.Read(("test", "demo", 1), ops=None, read_all_bins=True)
assert b.read_all_bins | [
"def test_block_missing_batch(self):\n pass",
"def test_block_bad_batch(self):\n pass",
"def test_no_val_data():\n data_handlers = []\n for input_file in input_files:\n data_handler = DataHandler(input_file, features, val_split=0,\n **dh_kwargs)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test that batch Reads will always use a new batch_records list. | def test_batch_default_arg_pos(self):
b = br.Read(("test", "demo", 1), ops=None)
bwr = br.BatchRecords()
bwr.batch_records.append(b)
assert len(bwr.batch_records) == 1
bwr = br.BatchRecords()
assert len(bwr.batch_records) == 0 | [
"def test_get_batch_by_id(self):\n pass",
"def test_batch(self):\n pass",
"def test_record_batches_rec_too_large(self, failure_mock):\n records = [\n {'key': 'test' * 1000 * 1000}\n ]\n\n result = list(FirehoseClient._record_batches(records, 'test_function_name'))\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the factors, resulting in change in the dimensions | def onUpdateFactors(self, evt):
if self.blockFactorUpdate:
print "Blocking factor update"
return
x, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()
fx = 1
fy = 1
fz = 1
try:
fx = float(self.factorX.GetValue())
fy = float(self.factorY.GetValue())
fz = float(self.factorZ.GetValue())... | [
"def set_factor_array(self, v):\n if not self._factor.shape == v.shape:\n k = np.arange(self.N)\n self._factor = self.broadcast_to_ndims((k+1)/(k+3))",
"def rebalance(self):\n\n # Compute norms along columns for each factor matrix\n norms = [np.linalg.norm(f, axis=0) for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the GUI for setting the resampled size | def createResample(self):
box = wx.StaticBox(self, -1, "Resample now to")
self.currDimText = u"Current dataset original dimensions: %d x %d x %d"
self.dimsLbl = wx.StaticText(self, -1, self.currDimText % (0, 0, 0))
boxsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
panel = wx.Panel(self, -1)
boxsizer.Add(pan... | [
"def r_rep_widget(self):\n figure = plt.figure()\n canvas = FigureCanvas(figure)\n canvas.mpl_connect('button_press_event', self.click_handling)\n FigureCanvas.setSizePolicy(canvas, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)\n FigureCanvas.updateGeometry(canvas)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select a half size to be used for resampling | def onSetToHalfSize(self, evt):
self.halfResampleZ.Enable(1)
if self.dataUnits:
x, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()
zf = 1
if self.halfResampleZ.GetValue():
zf = 0.5
self.currSize = int(0.5 * x), int(0.5 * y), int(zf * z)
self.fourthResampleZ.Enable(0)
for obj in [... | [
"def test_subsampling(self):",
"def subsample(y, limit=256, factor=2):\n if len(y) > limit:\n return y[::factor].reset_index(drop=True)\n return y",
"def __rejection_sampling(self,sample_size, kind='cubic'):\n sampling = np.ones((sample_size, 2))\n n_points = 0\n x_min, x_max =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select a fourth size to be used for resampling | def onSetToFourthSize(self, evt):
self.halfResampleZ.Enable(0)
self.fourthResampleZ.Enable(1)
if self.dataUnits:
zf = 1
x, y, z = self.dataUnits[0].dataSource.getOriginalDimensions()
if self.fourthResampleZ.GetValue():
zf = 0.25
self.currSize = int(0.25 * x), int(0.25 * y), int(zf * z)
fo... | [
"def test_subsampling(self):",
"def next_sample_size(self, *args, **kwargs):\n\n pass",
"def _choose_sample(self):\n\n \t #periodically generate a new reconstruction for the purposes of sampling",
"def _set_number_of_subsamples(self, number_of_subsamples):\n self._number_of_subsamples = number_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return True if the image i2 can be to the right of i1. | def right(i1, i2):
return "".join([i1[row][-1] for row in range(len(i1))]) == "".join(
[i2[row][0] for row in range(len(i2))]
) | [
"def imright(h1, h2):\n return h1 - h2 == 1",
"def is_to_the_right(self, other_rect):\n distance = other_rect.distance_x(self.rect)\n return distance != inf and distance > 0",
"def is_right_of(self, other):\n return other.is_left_of(self)",
"def right(self):\n if (self.right_fla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts w_global to the same dtype as w_client. PFNM procedure changes the dtype causing discrepancies between data dtype and model dtype. | def change_global_dtypes(w_global, w_client):
result = []
for i in range(len(w_client)):
dtype = w_client[i].dtype
result.append(w_global[i].astype(dtype))
return result | [
"def coerced(self, force_integer=False, force_unsigned=False, force_float=False, force_gl=True):\n\n if force_integer and not self.is_integer():\n raise TypeError(\"no matching datatype\")\n if force_float and not self.is_float():\n raise TypeError(\"no matching datatype\")\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts the dict formatted class counts into a list with the array index being the class label and the corresponding value being the number of examples of this class | def prepare_class_freqs(cls_counts, n_classes):
if None in cls_counts:
return None
lst_cls_counts = []
for party_cls_counts in cls_counts:
temp = [0] * n_classes
for label, count in party_cls_counts.items():
temp[int(label)] = int(count)
lst_cls_counts.append(... | [
"def classFreqCounter(data, classes):\n classCounts = [0] * 16\n for key in data.keys():\n for i, classy in enumerate(classes):\n if classy == data[key][0]:\n classCounts[i] += 1\n for i, n in enumerate(classCounts):\n if n == 0:\n classCounts[i] = 1\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the network dimensions from the its weights | def compute_net_dimensions(weights):
new_dims = []
for i in range(1, len(weights), 2):
new_dims.append(weights[i].shape[0])
return new_dims | [
"def get_weight_dimensions(weight_shape: np.array) -> np.array:\n dims = len(weight_shape)\n if dims == 4:\n return weight_shape\n return np.append(weight_shape, [1 for _ in range(4 - dims)]).astype(int)",
"def __find_net_dims(self):\n\n input_params = INPUT_CHANNELS * INPUT_SIZE ** 2\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute GMM models for each digit | def eachDigitGMM(data, cfg):
models = {}
for j in range(len(data)):
train_set = data[j][0]
for i in range(1, len(data[j])):
train_set = np.concatenate((train_set, data[j][i]), axis=0)
estimator = GaussianMixture(n_components=cfg['components'], max_iter=cfg['max_iter... | [
"def gmm(X, k):\n mix = sklearn.mixture.GaussianMixture(n_components=k).fit(X)\n pi = mix.weights_\n m = mix.means_\n S = mix.covariances_\n clss = mix.predict(X)\n bic = mix.bic(X)\n\n return pi, m, S, clss, bic",
"def my_GMM(X,K):\n\tmain_data = X[:,:-1].astype(float)\n\tground_truth = X[:,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |