query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
send measurement to self.pubTemp | def sendTemperature(self):
if len(self.controller.myContainer.temperature) != 0:
temp = sum(self.controller.myContainer.temperature) / len(self.controller.myContainer.temperature)
else:
temp = 0
payload = ('{"ts": '+ str(int(time())) + ', "temp":' + str(temp) +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_temp(context):\n job = context.job\n t1 = __sauna.control.getPortValue(\"Temperature Sensor 2\")\n t2 = float(\"{:.1f}\".format(t1))\n context.bot.send_message(job.context, text=\"Current Temp \" + str(t2) + \" Grad\")",
"def sendMeasurement(self, metric, value, source, timestamp=None):\n ... | [
"0.62318873",
"0.61939365",
"0.6153396",
"0.6117912",
"0.6080702",
"0.6041283",
"0.6015182",
"0.5937347",
"0.587916",
"0.58472216",
"0.57501924",
"0.5739049",
"0.57359487",
"0.57344073",
"0.56908",
"0.56750673",
"0.56663686",
"0.5665518",
"0.56356996",
"0.56098765",
"0.560700... | 0.7455403 | 0 |
send the manual control updates to the server | def sendControls(self):
if self.controller.status:
mode = '"cool3"'
temp = self.controller.setpoint
else:
mode = '"off"'
temp = self.controller.setpoint
payload = '{"mode": ' + mode + ', "temp": ' + str(temp) + '}'
res, self.midControls =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_control(self):\n self._control_ctr += 0x01",
"def sendControls(self, status, tempset):\n outString = str(status) + '?' + str(tempset) + '?control'\n self.sendBytesToSTM(outString.encode(\"utf-8\"))",
"def updateControls(self, onoff=False, radio=True):\n self.myContainer.s... | [
"0.6650497",
"0.66212636",
"0.6336081",
"0.6305258",
"0.6170719",
"0.600657",
"0.59971505",
"0.59700865",
"0.59700865",
"0.5958515",
"0.594598",
"0.593457",
"0.5918884",
"0.587391",
"0.58698344",
"0.5818733",
"0.579478",
"0.57647264",
"0.5762704",
"0.5762704",
"0.5762704",
... | 0.705174 | 0 |
Set up the HTU21D sensor. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
name = config.get(CONF_NAME)
bus_number = config.get(CONF_I2C_BUS)
temp_unit = hass.config.units.temperature_unit
bus = smbus.SMBus(config.get(CONF_I2C_BUS))
sensor = await hass.async_add_executor_job(partial(HTU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupHw():\n\n pin.setupHw()\n pin.setupOutPins(traffic_lights)\n pin.setDebug(False)",
"def _initialize_hardware(self):\n # Import\n try:\n import board\n import busio\n import adafruit_vl6180x\n except Exception as ex:\n logging.erro... | [
"0.6785495",
"0.60709953",
"0.6040685",
"0.6019263",
"0.5967158",
"0.59412783",
"0.5906236",
"0.5894144",
"0.5891464",
"0.58776057",
"0.584603",
"0.58359516",
"0.58337975",
"0.58261347",
"0.5811149",
"0.58005816",
"0.5769889",
"0.5766768",
"0.5764947",
"0.5758379",
"0.5749928... | 0.65923154 | 1 |
Analyze and print the bond orders, and optionally use for the bonding in the structure. | def _bond_orders(self, control, bond_order_matrix, configuration):
text = ""
n_atoms = configuration.n_atoms
bond_i = []
bond_j = []
bond_order = []
bond_order_str = []
orders = []
ij = 0
for j in range(n_atoms):
for i in range(j + 1):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payment_info_and_status(report):\n\n order_data = open(report)\n for line in order_data:\n order = lines_into_list(line) # function will split each line by '|' and get a list of strings\n # each order has 4 strings\n order[0:1] = []\n name = order.pop(0)\n order_as_floa... | [
"0.5906417",
"0.58164936",
"0.57983583",
"0.572823",
"0.5678574",
"0.5646116",
"0.5638378",
"0.5605157",
"0.5403813",
"0.53988194",
"0.53677356",
"0.5344988",
"0.5310984",
"0.5300891",
"0.52989656",
"0.52847356",
"0.5280561",
"0.5248943",
"0.5236017",
"0.5175988",
"0.51714003... | 0.7156463 | 0 |
The non social agent should pump to where it wants to go to. However, if P1 pups above the agent's EV, it should ajust its EV accordingly in order to win. | def non_social_action(self):
if not self.agent.done:
if self.opponenet.cashed and self.opponenet.pumps >= self.agent.pumps:
self.EV = self.opponenet.pumps + np.random.randint(1,5)
self.action_gating() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hesitant_action(self):\n if not self.agent.done:\n if not self.opponenet.done:\n self.EV = self.opponenet.pumps - np.random.randint(1,5)\n else:\n if self.opponenet.cashed:\n self.EV = self.opponenet.pumps + 1\n elif s... | [
"0.58771443",
"0.57470256",
"0.5713751",
"0.5505406",
"0.5483104",
"0.5479817",
"0.5391838",
"0.53856057",
"0.5380091",
"0.5310722",
"0.5270674",
"0.52652335",
"0.5252042",
"0.5229873",
"0.52257144",
"0.5217264",
"0.52000123",
"0.51954573",
"0.5180291",
"0.51767766",
"0.51655... | 0.58396876 | 1 |
gera o ddl (create table e tipos das colunas) | def ddl_table(self, tabela):
sql = """SELECT COLUMN_NAME as coluna,
CASE DATA_TYPE
WHEN 'uniqueidentifier' THEN 'varchar'
WHEN 'datetime' THEN 'timestamp'
WHEN 'varbinary' THEN 'bytea'
WH... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(self):\n pass",
"def ddl_table(self, tabela):\r\n sql = \"\"\"SELECT col.column_name AS coluna,\r\n CASE\r\n WHEN col.data_type LIKE 'NUMBER%%' THEN 'NUMERIC'\r\n WHEN col.data_type LIKE 'NCHAR%%' THEN 'CHAR'\r\n ... | [
"0.70581096",
"0.69772404",
"0.6690184",
"0.6676371",
"0.65414095",
"0.6525927",
"0.65184194",
"0.6486767",
"0.6476043",
"0.64362794",
"0.6377072",
"0.63573045",
"0.6342024",
"0.63180053",
"0.63128495",
"0.6280136",
"0.6240983",
"0.6212543",
"0.6198705",
"0.61973125",
"0.6178... | 0.71857804 | 0 |
Return a background callable for this task specification. Returns collections.abc.Callable Callable accepting arguments ``send`` and ``cancelled``. The callable can use ``send`` to send messages and ``cancelled`` to check whether cancellation has been requested. | def background_task(self):
return CallBackgroundTask(
callable=self.callable,
args=self.args,
kwargs=self.kwargs.copy(),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_call(executor, callable, *args, **kwargs):\n task = BackgroundCall(callable=callable, args=args, kwargs=kwargs)\n return executor.submit(task)",
"def to_async(func: Callable, scheduler=None) -> Callable:\n from ..operators.observable.toasync import to_async\n return to_async(func, ... | [
"0.6046948",
"0.57481253",
"0.5699998",
"0.56213224",
"0.55187863",
"0.542474",
"0.539684",
"0.53696924",
"0.53572047",
"0.5343441",
"0.5229373",
"0.52166164",
"0.52069044",
"0.51850367",
"0.51710916",
"0.51294076",
"0.5113927",
"0.5096022",
"0.50803524",
"0.5024802",
"0.5010... | 0.680307 | 0 |
Convenience function to submit a background call to an executor. | def submit_call(executor, callable, *args, **kwargs):
task = BackgroundCall(callable=callable, args=args, kwargs=kwargs)
return executor.submit(task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _async_submit(self, callable, *args, **kwargs):\n if not self._async_executor:\n self._async_executor = ThreadPoolExecutor(max_workers=self._thread_pool_count)\n return self._async_executor.submit(callable, args, kwargs)",
"def submit(self, *args, **kwargs):\n return self.exec... | [
"0.6497439",
"0.64870363",
"0.62554556",
"0.6224032",
"0.6215283",
"0.6135851",
"0.6057905",
"0.60406923",
"0.59824437",
"0.58395463",
"0.58181906",
"0.5815557",
"0.5810637",
"0.57943904",
"0.57922715",
"0.5750794",
"0.5741174",
"0.5738223",
"0.56663096",
"0.55685973",
"0.547... | 0.8166681 | 0 |
Sets the total of this Metadata. | def total(self, total):
self._total = total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_total(self):\n\n self.total = 0\n for item in self.items.all():\n self.total += item.price\n self.save()",
"def set_total(self, valeurs):\r\n \r\n self._total = valeurs",
"def total_num(self, total_num):\n\n self._total_num = total_num",
"def total... | [
"0.7345318",
"0.73374975",
"0.72063965",
"0.71454555",
"0.7011428",
"0.69185275",
"0.69073534",
"0.6881462",
"0.68273604",
"0.67822355",
"0.6774405",
"0.6726431",
"0.6698601",
"0.6680655",
"0.667271",
"0.6666874",
"0.66498363",
"0.66184264",
"0.6577569",
"0.65486485",
"0.6507... | 0.8169622 | 1 |
Sets the index of this Metadata. | def index(self, index):
self._index = index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_index(self, index):\n self.index = index",
"def index(self, index):\n \"\"\"\n if index is None:\n raise ValueError(\"Invalid value for `index`, must not be `None`\")\n \"\"\"\n\n self.container['index'] = index",
"def setIndex(self, index):\n\n self... | [
"0.8639466",
"0.8079269",
"0.8046353",
"0.75118023",
"0.73526555",
"0.7189295",
"0.6799408",
"0.6671059",
"0.6655663",
"0.6651388",
"0.6651388",
"0.65320814",
"0.65255284",
"0.6455516",
"0.64315563",
"0.63905156",
"0.6384226",
"0.6369748",
"0.6339082",
"0.63354546",
"0.633312... | 0.8210771 | 1 |
export_courses get all courses from the database return all courses as a dictionary of course dictionaries | def export_courses():
courses = Course.query().fetch()
dictionary = {}
for course in courses:
dictionary[course.department + "" + course.number] = course.to_dict()
return dictionary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_courses(self):\n\n self.search([]).unlink()\n token = self.env['odoo.moodle'].search([('create_uid', '=', self.env.user.id)]).token\n domain = \"http://localhost:8888\"\n webservice_url = \"/webservice/rest/server.php?\"\n parameters = {\n \"wstoken\":token,\n ... | [
"0.7052836",
"0.7041838",
"0.70088214",
"0.700561",
"0.6939108",
"0.66422844",
"0.66270727",
"0.6546052",
"0.64977354",
"0.649505",
"0.6464057",
"0.64300716",
"0.64214396",
"0.6378788",
"0.6374261",
"0.6343026",
"0.63298833",
"0.6263807",
"0.61841094",
"0.61821026",
"0.613415... | 0.85508007 | 0 |
update_db Updates the database with all the courses for the current semester | def update_db():
with open("courses_2016.json") as data:
data = data.read()
courses = json.loads(data)
for course in courses:
try:
[dept, course] = course.split(" ")
text = get_course(dept, course)
insert_course(dept, course,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_course(self):\n # ensure that updating course is exists\n if self.is_course_exists():\n db = Course._file.read_db()\n for crs_i in range(len(db[\"courses\"])):\n if db[\"courses\"][crs_i][\"course_name\"] == self._course_name:\n\n # e... | [
"0.6768394",
"0.63613737",
"0.63062465",
"0.6221332",
"0.60496604",
"0.59358865",
"0.5929495",
"0.59224737",
"0.5922039",
"0.565147",
"0.5638097",
"0.5626825",
"0.56209064",
"0.55687594",
"0.55594355",
"0.55489606",
"0.5509718",
"0.54877836",
"0.5472728",
"0.5467652",
"0.5453... | 0.7535003 | 0 |
check_db Compares the database entries with the entire list of courses Returns a list of courses that failed to insert into the database | def check_db():
with open("courses_2016.json") as data:
data = data.read()
courses = json.loads(data)
course_keys_in_db = Course.query().fetch(keys_only=True)
db_list = []
failures = []
for course in course_keys_in_db:
db_list.append(course.id())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_new_curriculum_courses(self, curriculum_courses):\n\n for cur in curriculum_courses:\n # check to make sure its in the general courses table\n self.db_cursor.execute(\"\"\"SELECT COUNT(*) FROM Course WHERE name = %s\"\"\", (cur,))\n ct = self.db_cursor.fetchone(... | [
"0.6906886",
"0.6675097",
"0.6283814",
"0.61212605",
"0.60753566",
"0.597159",
"0.5901944",
"0.58181834",
"0.5798651",
"0.5767637",
"0.5721752",
"0.5678129",
"0.564499",
"0.5597766",
"0.55770147",
"0.55652153",
"0.5563142",
"0.54699236",
"0.5439198",
"0.5401672",
"0.5396904",... | 0.82807064 | 0 |
Uses eslsfetch to generate family specific fasta files out of seq_file which is provided as source (e.g. rfamseq11.fa). It will generate fasta files for all families by default | def generate_fasta(seq_file, out_dir):
LOGGER.info("Generating fasta file", seq_file)
sequence = ''
fp_out = None
seq_bits = None
# logging sequences not exported
# rename this to family log
log_file = os.path.join(out_dir, "missing_seqs.log")
logging.basicConfig(filename=log_file, fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_fasta_single(seq_file, rfam_acc, out_dir):\n\n sequence = ''\n fp_out = None\n seq_bits = None\n\n # logging sequences not exported\n # rename this to family log\n log_file = os.path.join(out_dir, rfam_acc + \".log\")\n logging.basicConfig(\n filename=log_file, filemode='w'... | [
"0.682649",
"0.5828559",
"0.5778012",
"0.5694929",
"0.5649731",
"0.56244236",
"0.5572279",
"0.5545438",
"0.55044687",
"0.5495895",
"0.53976244",
"0.53522515",
"0.52965266",
"0.52827317",
"0.5257475",
"0.5205217",
"0.5178159",
"0.5138306",
"0.51249355",
"0.51217663",
"0.510904... | 0.6929186 | 0 |
Uses eslsfetch to generate family specific fasta files out of seq_file which is provided as source. Works on single family based on rfam_acc. Files are generated in a compressed .fa.gz format | def generate_fasta_single(seq_file, rfam_acc, out_dir):
sequence = ''
fp_out = None
seq_bits = None
# logging sequences not exported
# rename this to family log
log_file = os.path.join(out_dir, rfam_acc + ".log")
logging.basicConfig(
filename=log_file, filemode='w', level=logging.I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_fasta(seq_file, out_dir):\n\n LOGGER.info(\"Generating fasta file\", seq_file)\n\n sequence = ''\n fp_out = None\n seq_bits = None\n\n # logging sequences not exported\n # rename this to family log\n log_file = os.path.join(out_dir, \"missing_seqs.log\")\n logging.basicConfig(f... | [
"0.75194967",
"0.58702254",
"0.58072424",
"0.57938075",
"0.577255",
"0.5770231",
"0.5736186",
"0.57126784",
"0.5697429",
"0.5694916",
"0.55857223",
"0.5553263",
"0.5482889",
"0.54565287",
"0.54469514",
"0.5441418",
"0.5434659",
"0.541446",
"0.536763",
"0.5361356",
"0.53465176... | 0.7629038 | 0 |
Checks if the sequence provided is valid fasta sequence. Returns True if the sequence is valid, otherwise returns False. | def seq_validator(sequence):
# checks for ascii characters that should not appear in a fasta sequence
seq_val = re.compile(r"[.-@|\s| -)|z-~|Z-`|EFIJLOPQX|efijlopqx+,]+")
if seq_val.search(sequence) is None:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSequenceValid(sequence):\n if not sequence:\n return False\n allowed_chars = set('GCAU')\n return set(sequence).issubset(allowed_chars)",
"def validate_fasta_seq(sequence):\n sequence = sequence.replace(\" \", \"\")\n sequence.upper()\n regex = re.compile('>\\S*\\n[ACTGNRYSWKMBDHVE... | [
"0.76752746",
"0.75949574",
"0.7480253",
"0.72784495",
"0.7131281",
"0.69375044",
"0.6605551",
"0.64831626",
"0.6424644",
"0.63862854",
"0.6311217",
"0.6299898",
"0.62989056",
"0.61712056",
"0.61065215",
"0.6092603",
"0.60289305",
"0.5995795",
"0.5978732",
"0.5963744",
"0.596... | 0.79304975 | 0 |
Display the top 10 retail traded stocks for last days | def display_top_retail(
limit: int = 3, export: str = "", sheet_name: Optional[str] = None
):
retails = nasdaq_model.get_retail_tickers()
if retails.empty:
return
for date, df in retails.head(limit * 10).groupby("Date"):
df = df.drop(columns=["Date"])
df = df.reset_index(drop=T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_performers(self, market, country, number_of_stocks=5, percent_change=1):\n # creating api-object\n # using defined function above to retrieve dataframe of all instruments\n instruments = self.instruments_with_meta_data()\n # filtering out the instruments with correct market and ... | [
"0.60119677",
"0.600845",
"0.59116054",
"0.5886201",
"0.5875277",
"0.5846949",
"0.5815054",
"0.5814599",
"0.5805478",
"0.5791384",
"0.57870483",
"0.5783525",
"0.5782132",
"0.5722076",
"0.57188046",
"0.570357",
"0.5679663",
"0.5674654",
"0.562725",
"0.5620135",
"0.56172734",
... | 0.68973005 | 0 |
Display NASDAQ dividend calendar | def display_dividend_calendar(
date: Optional[str] = None,
sortby: str = "Dividend",
ascend: bool = False,
limit: int = 10,
export: str = "",
sheet_name: Optional[str] = None,
):
if date is None:
date = datetime.today().strftime("%Y-%m-%d")
div_map = {
"symbol": "Symbol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cal():\n this_cal = Kalendar()\n to_display = \"\"\n\n for elements in this_cal.get_all_elements():\n to_display += elements[\"key\"] + \":<BR>\"\n for element in elements[\"value\"]:\n to_display += \" \" + str(element) + \"<BR>\"\n\n return to_displ... | [
"0.61509955",
"0.6010468",
"0.58811027",
"0.5843441",
"0.5834613",
"0.5769455",
"0.57268524",
"0.56952477",
"0.5682419",
"0.5652854",
"0.55936015",
"0.55887353",
"0.55171776",
"0.55142546",
"0.5458473",
"0.5439535",
"0.535989",
"0.53140265",
"0.5308999",
"0.5267314",
"0.52660... | 0.67086595 | 0 |
This function will write a sitemap index file that references individual sitemaps for all the batches, issues, pages and titles that have been loaded. | def write_sitemaps():
sitemap_index = open('static/sitemaps/sitemap.xml', 'w')
sitemap_index.write('<?xml version="1.0" encoding="UTF-8"?>\n<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n')
max_urls = 50000
page_count = 0
url_count = 0
sitemap_file = None
for loc, last... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_sitemap ( self ):\n try:\n self.output_fd = open ( file=dflt_cfg.DFLT_CFG[ OUTPUT_PATH ], mode='w' )\n self.print_url_links ( self.root )\n except (PermissionError, AttributeError) as err:\n self.logger.error ( \"Error {0} occurred. Output file {1} cannot be... | [
"0.73367053",
"0.65047354",
"0.62692606",
"0.6251964",
"0.6188501",
"0.6039944",
"0.5989667",
"0.5955969",
"0.589843",
"0.5862699",
"0.5834666",
"0.5832418",
"0.5780622",
"0.5770587",
"0.57512975",
"0.5719937",
"0.56961554",
"0.56895816",
"0.56689733",
"0.5664793",
"0.5609329... | 0.8053461 | 0 |
A generator that returns all the urls for batches, issues, pages and titles, and their respective modified time as a tuple. | def sitemap_urls():
for batch in m.Batch.objects.all():
yield batch.url, batch.released
yield rdf_uri(batch), batch.released
for issue in batch.issues.all():
yield issue.url, batch.released
yield rdf_uri(issue), batch.released
for page in issue.pages.all()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urls(self) -> list[str]:\r\n ...",
"def getURLs():",
"async def org_info_below_13(org_urls13):\n org_info_till13 = []\n project_urls_till13 = []\n for url in org_urls13:\n # General information about the org\n try:\n soup = await get_page(url)\n org_name ... | [
"0.5946937",
"0.5943982",
"0.58248746",
"0.58053154",
"0.5790465",
"0.57346326",
"0.57095873",
"0.5661363",
"0.56141263",
"0.5576062",
"0.5567747",
"0.5489056",
"0.54827327",
"0.54785705",
"0.54465747",
"0.54260623",
"0.54244757",
"0.54214203",
"0.5409607",
"0.5382013",
"0.53... | 0.6931409 | 0 |
Not exactly the same as the executor's definition of get_field_def, in this statically evaluated environment we do not always have an Object type, and need to handle Interface and Union types. | def get_field_def(schema, parent_type, field_ast):
name = field_ast.name.value
if name == SchemaMetaFieldDef.name and schema.get_query_type() == parent_type:
return SchemaMetaFieldDef
elif name == TypeMetaFieldDef.name and schema.get_query_type() == parent_type:
return TypeMetaFieldDef
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFieldDef(fielddef, fields=\"format_, addrdef, baseaddr, bits, bitshift, strindex, datadef, arraydef, validate, cmd, group, tasmotacmnd, converter, readconverter, writeconverter\"):\n format_ = addrdef = baseaddr = datadef = arraydef = validate = cmd = group = tasmotacmnd = converter = readconverter = wri... | [
"0.66650426",
"0.61259234",
"0.5725323",
"0.5587269",
"0.55751014",
"0.54820305",
"0.53778094",
"0.53522205",
"0.5343069",
"0.52950495",
"0.52775973",
"0.5277331",
"0.5243576",
"0.52401596",
"0.52392125",
"0.5216343",
"0.51968074",
"0.5188637",
"0.5114995",
"0.511223",
"0.508... | 0.6130992 | 1 |
Draws a texture on the internal image. If the texture is smaller than the image it loops. | def __draw_board_texture(self, texture):
textureWidth, textureHeight = texture.size
for x in range(0, self.width, textureWidth):
for y in range(0, self.height, textureHeight):
self.baseImage.paste(texture, (x, y)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self):\n\n glEnable(self.texture.target)\n glBindTexture(self.texture.target, self.texture.id)\n if self.mipmaps:\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)",
"def draw(self):\r\n self.screen.blit(self.image, self.image.get_rec... | [
"0.7347973",
"0.64104",
"0.6329882",
"0.6255792",
"0.62519455",
"0.62173605",
"0.6149818",
"0.6123493",
"0.6123493",
"0.6082988",
"0.6069757",
"0.6025694",
"0.59712917",
"0.59451574",
"0.59443766",
"0.59195346",
"0.58604574",
"0.58564085",
"0.58564085",
"0.58564085",
"0.58564... | 0.715414 | 1 |
Get the appropriate static method for exec'ing a QFileDialog. | def get_file_dialog_exec_func(mode):
if mode not in _STATIC_METHOD_NAMES:
raise ValueError("Unknown file dialog mode: '%s'" % mode)
return getattr(QFileDialog, _STATIC_METHOD_NAMES[mode]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runOpenFileDialog(\n self,\n c: Cmdr,\n title: str,\n filetypes: list[str],\n defaultextension: str='',\n multiple: bool=False,\n startpath: str=None,\n ) -> Union[list[str], str]: # Return type depends on the evil multiple keyword.\n if g.unitTesting... | [
"0.6026292",
"0.5952529",
"0.5807682",
"0.5787794",
"0.5634657",
"0.5631036",
"0.56236327",
"0.5597713",
"0.5584776",
"0.5563499",
"0.5553169",
"0.5518008",
"0.5509124",
"0.5458683",
"0.5433406",
"0.5431244",
"0.5426807",
"0.54229605",
"0.53799635",
"0.5375665",
"0.5331219",
... | 0.78081536 | 0 |
Load only the last saved tensor. | def load_last_tensor(path: str, params: Optional[Params]) -> Optional[th.Tensor]:
path = get_path_with_hash(path, params)
f = get_last_file(path)
return th.load(f) if f else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_latest_save(self, device=None):\n return torch.load(str(self.previous_saves()[-1].absolute()), map_location=device)",
"def load(self):\n try:\n if self.model.is_cuda:\n self.model.load_state_dict(torch.load(os.path.join(self.save_path, \"save_point.pth\")))\n ... | [
"0.6790029",
"0.643399",
"0.6366274",
"0.62869316",
"0.6262909",
"0.6245039",
"0.6235464",
"0.6201017",
"0.6193098",
"0.61869633",
"0.6171663",
"0.6100199",
"0.60631746",
"0.6054893",
"0.6017372",
"0.6001262",
"0.5974573",
"0.5973511",
"0.5964038",
"0.5951946",
"0.5906625",
... | 0.71581215 | 0 |
Same as the anchor target layer in original Fast/er RCNN | def anchor_target_layer(rpn_cls_score, gt_boxes, im_info, _feat_stride, all_anchors, num_anchors):
A = num_anchors
total_anchors = all_anchors.shape[0]
K = total_anchors / num_anchors
# allow boxes to sit over the edge by a small amount
_allowed_border = 0
# map of shape (..., H, W)
height... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, src, label):\r\n \"\"\"color distort\"\"\"\r\n # img = random_color_distort(src)\r\n\r\n # print(\"previous label shape = \", label.shape)\r\n target = np.zeros(shape=(label.shape[0],))\r\n\r\n \"\"\"Pyramid Anchor sampling\"\"\"\r\n img, boxes, label = ... | [
"0.6049695",
"0.59141093",
"0.59044313",
"0.5859675",
"0.5762134",
"0.56918836",
"0.5655732",
"0.5647954",
"0.5621027",
"0.55535257",
"0.5541016",
"0.55154335",
"0.5508736",
"0.55031645",
"0.5502034",
"0.5467258",
"0.5453469",
"0.5444473",
"0.53857285",
"0.53718",
"0.5365043"... | 0.61300606 | 0 |
adds the passed params to to the list of query params map | def __add_query_param(self, params_to_map, params, overwrite=True):
for key, value in params_to_map.items():
(is_query_param, tkey) = self.__get_solr_key_from_app_key(key)
if is_query_param:
if not overwrite:
# check if the param is already present, i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addParams(self, *params):\n for param in params:\n self.addParam(param)\n self.params = list(set(self.params))",
"def add_params(self, params):\n return self.set_param('params', params)",
"def add_params(self, params: t.Mapping[str, str]) -> 'Request':\n return replace(self, params... | [
"0.7209539",
"0.7026987",
"0.69236857",
"0.68808097",
"0.6757168",
"0.67167974",
"0.6687688",
"0.6580263",
"0.6561481",
"0.6480852",
"0.6480852",
"0.64774287",
"0.6393934",
"0.6393934",
"0.63533145",
"0.632442",
"0.6317008",
"0.6285332",
"0.62216014",
"0.6214522",
"0.6209007"... | 0.7101635 | 1 |
internal method that returns the name of the app parameter given the solr parameter name. Returns the mapped key if mapping is found else the default value Returned value is a tuple with first value | def __get_app_key_from_solr_key(self, key):
keys = self.__config.solr_response_map['map']
if key in keys:
return (True, keys[key])
return (False, key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"mapping_name\")",
"def __get_solr_key_from_app_key(self, key):\n keys = self.__config.get_inverse_map()\n if key in keys:\n return (True, keys[key])\n\n return (False, key)",
"def get_param... | [
"0.637135",
"0.6053645",
"0.60306513",
"0.60296565",
"0.59799975",
"0.5863355",
"0.5863355",
"0.58111364",
"0.5795304",
"0.57818747",
"0.573486",
"0.573421",
"0.5727314",
"0.5697753",
"0.5696839",
"0.56940734",
"0.5673148",
"0.566544",
"0.56475675",
"0.55933285",
"0.55770475"... | 0.6488492 | 0 |
Creates a box from a contour representation of the box. | def create(cls, boxCon):
array = boxCon.tolist()
startX = min(boxCon, key = lambda vertex : vertex[0][0])[0][0]
endX = max(boxCon, key = lambda vertex : vertex[0][0])[0][0]
startY = min(boxCon, key = lambda vertex : vertex[0][1])[0][1]
endY = max(boxCon, key = lambda vertex : vertex[0][1])[0][1]
box = cls(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_box(self, scale, color):\n box = Box()\n box.set_color(c=color)\n box.set_location(0, 0, 0)\n box.set_size(scale, scale, scale)\n return box",
"def make_box(self, scale, color):\n box = Box()\n box.set_color(c=color)\n box.set_location(0, 0, 0)\n ... | [
"0.6670145",
"0.6670145",
"0.65071213",
"0.63027024",
"0.62290746",
"0.617087",
"0.60887074",
"0.60454017",
"0.60419816",
"0.5995471",
"0.59096074",
"0.58819383",
"0.58666605",
"0.58454734",
"0.5770305",
"0.571959",
"0.5706984",
"0.5702862",
"0.56961715",
"0.568718",
"0.56661... | 0.68660736 | 0 |
Access the coordinates of this vector by index. | def __getitem__(self, index):
if index == 0:
return self.x
elif index == 1:
return self.y
raise IndexError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n return self.points[index]",
"def __getitem__(self, index: int) -> float:\n if index == 0:\n return self.x\n elif index == 1:\n return self.y\n else:\n raise IndexError",
"def __getitem__(self, j):\n\t\treturn self._coo... | [
"0.73434335",
"0.71966803",
"0.7094703",
"0.7090151",
"0.7011572",
"0.6990462",
"0.6972173",
"0.6955546",
"0.683827",
"0.6811535",
"0.6756246",
"0.6756099",
"0.66974694",
"0.6631126",
"0.66226995",
"0.66208637",
"0.6599712",
"0.6575773",
"0.6575773",
"0.6520088",
"0.64941",
... | 0.7436619 | 0 |
Verifies that the node returns a shifted pose according to the specified linear offset. | def test_pose_shifter(self):
self.dyn_client.update_configuration({"linear_offset_x":0.1, "linear_offset_y":0.0, "linear_offset_z":0.05})
pose_in = geometry_msgs.msg.PoseStamped()
expected = geometry_msgs.msg.PoseStamped()
pose_in.header.frame_id = "base_link"
expected.header.fra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_input_offset(self):\n final_config = self.dtm2.validate_input('01010101')\n nose.assert_equal(final_config[0], 'q4')\n nose.assert_equal(str(final_config[1]), 'TMTape(\\'yyx1010101\\')')",
"def is_ahead_of(self, pose, x, y):\n x1 = pose.position.x\n y1 = pose.... | [
"0.60130155",
"0.5325522",
"0.52897584",
"0.5204398",
"0.5195322",
"0.5172869",
"0.5134362",
"0.50898653",
"0.5074088",
"0.50511104",
"0.50483215",
"0.50256354",
"0.50066537",
"0.49883357",
"0.49804953",
"0.49800643",
"0.49333018",
"0.49173224",
"0.49115375",
"0.49074942",
"0... | 0.55197906 | 1 |
Return the x coordinate of the rectangle's left edge. | def _rect_left(self):
return min(self.x, self.x + self.w) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self):\n return self.points['topLeft'].x",
"def left(self):\n return self.points['topLeft'].x",
"def pos_left(self, x=1):\n\n self.x -= x\n return self.pos(self.x, self.y)",
"def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n ... | [
"0.7934868",
"0.7934868",
"0.75278914",
"0.75106096",
"0.74849534",
"0.7438955",
"0.73301005",
"0.72666276",
"0.7224344",
"0.7210953",
"0.7207516",
"0.716287",
"0.7159352",
"0.7111415",
"0.7107011",
"0.7096342",
"0.70923966",
"0.7085268",
"0.7046702",
"0.7046702",
"0.70441395... | 0.8043434 | 0 |
Return the xcoordinate of the rectangle's right edge. | def _rect_right(self):
return max(self.x, self.x + self.w) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right(self):\n return self.points['topRight'].x",
"def right(self):\n return self.points['topRight'].x",
"def right(self):\n return self.left + self.width",
"def get_rightmost_edge(self):\n return self.offset + sum(self.get_screen_widths())",
"def getupperleft(self):\n ... | [
"0.78304136",
"0.78304136",
"0.752309",
"0.71365297",
"0.71340376",
"0.7098199",
"0.6944949",
"0.6943818",
"0.6876187",
"0.6863866",
"0.6857044",
"0.6842752",
"0.68269175",
"0.68269175",
"0.6822077",
"0.67144597",
"0.6675918",
"0.66704386",
"0.6663189",
"0.6648827",
"0.664767... | 0.78578556 | 0 |
Return the ycoordinate of the rectangle's top edge. | def _rect_top(self):
return max(self.y, self.y + self.h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n return self.points['topRight'].y",
"def top(self):\n return self.points['topRight'].y",
"def y(self):\n return self.top",
"def top_y(self):\r\n return self.position.y + self.size.y + self.bulk",
"def get_y_position(self): \n return self.rect.y",
"d... | [
"0.8013071",
"0.8013071",
"0.7716812",
"0.7624312",
"0.7223911",
"0.7139694",
"0.7086764",
"0.70743144",
"0.68563634",
"0.6853508",
"0.68473446",
"0.68470025",
"0.6838489",
"0.68368363",
"0.68299663",
"0.6772753",
"0.67421156",
"0.67209494",
"0.6692827",
"0.6545961",
"0.65459... | 0.8257693 | 0 |
Return the ycoordinate of the rectangle's bottom edge. | def _rect_bottom(self):
return min(self.y, self.y + self.h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom(self):\n return self.points['bottomRight'].y",
"def bottom(self):\n return self.points['bottomRight'].y",
"def bottom_y(self):\r\n return self.position.y - self.size.y - self.bulk",
"def bottom(self):\n return self.top + self.height",
"def _rect_top(self):\n\treturn max... | [
"0.7935119",
"0.7935119",
"0.7601335",
"0.7535251",
"0.73022354",
"0.7227902",
"0.71988606",
"0.71584624",
"0.7158076",
"0.71382874",
"0.7126317",
"0.70913297",
"0.70295787",
"0.6968889",
"0.69069374",
"0.6902811",
"0.6878907",
"0.6869381",
"0.67873216",
"0.67635727",
"0.6749... | 0.8172904 | 0 |
Compute weights minimizing Maximum Mean Discrepancy. X Samples matrix. target_X Target samples matrix. method Method of weights computation. | def _compute_weights(self, X, target_X, method='l2'):
if method == 'proj_l2' or method == 'proj_l2_nonorm':
#
# At first calculate unrestricted weights: (X.T)^-1
# Then project answer onto Unit simplex
#
target_center = np.mean(target_X, axis=0) # * X... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_weights(self, xi, target):\n output = self.net_input(xi)\n error= (target - output)\n self.w_[1:] += self.eta * xi.dot(error)\n self.w_[0] += self.eta * error\n cost =0.5* error**2\n return cost",
"def _update_weights(self, xi, target):\n output = self... | [
"0.6762532",
"0.6708177",
"0.6708177",
"0.6503242",
"0.6470267",
"0.6403376",
"0.63818663",
"0.6355758",
"0.628095",
"0.6246446",
"0.6223636",
"0.62204105",
"0.6191204",
"0.61547375",
"0.6106272",
"0.6090991",
"0.6075102",
"0.60460854",
"0.6040239",
"0.603885",
"0.60202414",
... | 0.7669641 | 0 |
Returns the formula string, but with elements anonymized by atom type using a greater number of anonymizations than the normal fuzzy_formula method. e.g., Y2SiO5 becomes Tm2X1Y5 | def get_fuzzy_formula_strict(composition):
x = defaultdict(float)
for e in composition.elements:
if e.is_lanthanoid:
x["Ln"] += composition[e]
elif e.is_actinoid:
x["Ac"] += composition[e]
elif e.is_alkali:
x["A"] += composition[e]
elif e.is_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fuzzy_formula(composition):\n x = defaultdict(float)\n\n for e in composition.elements:\n if e.is_lanthanoid or e.is_actinoid:\n x[\"Re\"] += composition[e]\n elif e.is_alkali or e.is_alkaline:\n x[\"A\"] += composition[e]\n elif e.is_transition_metal:\n ... | [
"0.6042614",
"0.53327316",
"0.5252985",
"0.5109102",
"0.4933846",
"0.49012175",
"0.49012175",
"0.48788637",
"0.4818534",
"0.48048475",
"0.4786649",
"0.47793177",
"0.4746812",
"0.47359288",
"0.4733897",
"0.47329667",
"0.47292286",
"0.47193587",
"0.46981952",
"0.4692537",
"0.46... | 0.61645776 | 0 |
Function that takes a player's history data and returns an altair chart showing their winning percentage based on their hand totals and the dealer's up card | def result_heatmap(data, result="win", title=None,
width=500, height=500):
possible_results = ["win", "loss", "push", "surrender"]
assert result in possible_results, (
"'result' must be 'win', 'loss', or 'push'"
)
if not title:
title = f"{result.title()} Percentage"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outcome_bars(data, name=None, width=100):\n # if it's a dataframe already, just add the name for the legend\n if isinstance(data, pd.DataFrame):\n data_list = [data]\n elif isinstance(data, list):\n # check if it's a list of dicionaries, like player history, or a list\n # of lists... | [
"0.634474",
"0.6184851",
"0.586159",
"0.57326776",
"0.5692181",
"0.5665392",
"0.5642855",
"0.5554835",
"0.55420274",
"0.553956",
"0.5507848",
"0.5477072",
"0.5455402",
"0.5449548",
"0.5444684",
"0.5435415",
"0.53835887",
"0.5383032",
"0.5378751",
"0.5371841",
"0.53710645",
... | 0.62488574 | 1 |
Calculate the probability of busting in a given dataset | def pct_bust(data):
return round((data["new_total"] > 21).sum() / len(data), 3) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability(self, samples):\n pass",
"def calculate_probability(self):\n return 0",
"def test_bp_example():\n signal = np.array([4, 7, 9, 10, 6, 11, 3])\n\n pe = permutation_entropy(signal, 2)\n\n assert 0.91 < pe < 0.92 # Should be approx 0.918.\n\n pe = permutation_entropy(sign... | [
"0.6277068",
"0.59250945",
"0.5895558",
"0.58948094",
"0.58774555",
"0.58189124",
"0.577898",
"0.57713586",
"0.57664675",
"0.57664675",
"0.5738593",
"0.573379",
"0.5720934",
"0.5656361",
"0.56534046",
"0.5645686",
"0.5632636",
"0.56128347",
"0.5610137",
"0.560257",
"0.5592999... | 0.6100775 | 1 |
Function for calculating house edge. | def house_edge(player, params):
data = pd.DataFrame(player.history)
results = np.where(
np.logical_and(data["result"] == "win", data["blackjack"]),
"blackjack", data['result']
)
results = pd.Series(np.where(
np.logical_and(data["double_down"], data["result"] == "win"),
"d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def house_oriented_TLE(self, grid):\n # write your code here\n # write your code here\n n, m = len(grid), len(grid[0])\n dist = [[0 for _ in range(m)] for _ in range(n)]\n reachable_count = [[0 for _ in range(m)] for _ in range(n)]\n \n house_count = 0\n for... | [
"0.6256715",
"0.62175244",
"0.6126858",
"0.6026825",
"0.6026479",
"0.59540725",
"0.58980346",
"0.5889512",
"0.58494496",
"0.58221847",
"0.5807132",
"0.57258004",
"0.57251084",
"0.5721338",
"0.5703475",
"0.57021576",
"0.5696279",
"0.5675031",
"0.5668957",
"0.5659139",
"0.56333... | 0.6363273 | 0 |
Create the producer, check for provided serializable message and publish it to the topic | def publish_message(self, topic, message):
def delivery_report(err, msg):
""" Called once for each message produced to indicate delivery result.
Triggered by poll() or flush(). """
if err is not None:
print('Message delivery failed: {}'.format(err))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish_message(producer_instance, topic_name, key, value):\n key_serializer = repr(key).encode()\n value_serializer = repr(value).encode()\n\n producer_instance.send(topic_name, key=key_serializer, value=value_serializer)\n producer_instance.flush()\n print('Message published successfully.')",
... | [
"0.7313503",
"0.6905501",
"0.6878873",
"0.68761635",
"0.68431354",
"0.6827728",
"0.68188864",
"0.66390926",
"0.65988934",
"0.6591432",
"0.65635467",
"0.653336",
"0.65256566",
"0.6479786",
"0.64766586",
"0.64306474",
"0.64306474",
"0.6413492",
"0.6377593",
"0.63338226",
"0.627... | 0.6998185 | 1 |
Like `str.format`, but takes tuples with a thread id and text instead. Return a `Message` object, with the formatted string and relevant mentions. >>> Message.format_mentions("Hey {!r}! My name is {}", ("1234", "Peter"), ("4321", "Michael")) | def format_mentions(cls, text, *args, **kwargs):
result = ""
mentions = list()
offset = 0
f = Formatter()
field_names = [field_name[1] for field_name in f.parse(text)]
automatic = "" in field_names
i = 0
for (literal_text, field_name, format_spec, convers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_msg(self, format_str, *args):\n if not args:\n format_str = six.moves.urllib.parse.unquote(format_str)\n return \"{} - - [{}] {}\\n\".format(\n self.client_address[0],\n self.log_date_time_string(),\n format_str % args\n )",
"def _forma... | [
"0.5809069",
"0.57020247",
"0.5651881",
"0.56004184",
"0.5461424",
"0.5386012",
"0.5381233",
"0.5335397",
"0.5301617",
"0.52856266",
"0.52818877",
"0.52577573",
"0.5242129",
"0.5230628",
"0.5182866",
"0.5172696",
"0.5172185",
"0.5059956",
"0.50580597",
"0.5057411",
"0.5011646... | 0.75185233 | 0 |
Response when someone shout out to Bob | def shouting(self):
return 'Whoa, chill out!' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendShout(self, user, message):\n pass",
"def whoelse(sock, request):\n users = set()\n for s in connections.values():\n users.add(s['user'])\n response = { \"echo\": \"\\n\".join(users) }\n sock['conn'].sendall(json.dumps(response))",
"def say_hello_to_boy(friend_name):\r\n ca... | [
"0.68223554",
"0.62321746",
"0.613027",
"0.61272854",
"0.6083503",
"0.6044151",
"0.60427237",
"0.60396767",
"0.6015404",
"0.5978478",
"0.5938269",
"0.59224814",
"0.58828086",
"0.5871032",
"0.5866333",
"0.58441913",
"0.58326113",
"0.5827812",
"0.5786388",
"0.5778596",
"0.57460... | 0.6643294 | 1 |
Wait for the start of a MV build, ensuring that it has saved some progress | def _wait_for_view_build_start(self, session, ks, view, wait_minutes=2):
start = time.time()
while True:
try:
query = "SELECT COUNT(*) FROM %s WHERE keyspace_name='%s' AND view_name='%s'" %\
(self._build_progress_table(), ks, view)
resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waitUntilFinished():",
"def waitUntilFinished():",
"def waitUntilFinished():",
"def waitUntilFinished():",
"def wait(self):\n self.mainloop().wait()",
"def wait_progress(self):\n pass",
"def wait_progress(self):\n pass",
"def wait(self):\n self.event.wait()",
"def wa... | [
"0.6729482",
"0.6729482",
"0.6729482",
"0.6729482",
"0.65039194",
"0.64148176",
"0.64148176",
"0.641136",
"0.63505125",
"0.63505125",
"0.6345326",
"0.6255207",
"0.6221448",
"0.6187781",
"0.61466134",
"0.6146286",
"0.6141253",
"0.6140755",
"0.6135329",
"0.60878426",
"0.6061043... | 0.7093879 | 0 |
Test the materialized view creation | def test_create(self):
session = self.prepare(user_table=True)
result = list(session.execute(("SELECT * FROM system_schema.views "
"WHERE keyspace_name='ks' AND base_table_name='users' ALLOW FILTERING")))
assert len(result) == 1, "Expecting 1 materialized ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_migrate_view_fields(self):\n self.test_view = RecordView.create(\n self.testcoll, test_view_id, test_view_create_values\n )\n migrate_coll_data(self.testcoll)\n # Read field definition and check for inline field list\n view_data = self.check_entity_values(... | [
"0.7338154",
"0.6931388",
"0.66762626",
"0.647838",
"0.64327127",
"0.63275766",
"0.6172521",
"0.61617875",
"0.61125934",
"0.61102265",
"0.60945475",
"0.60887665",
"0.60561234",
"0.6020806",
"0.59891534",
"0.5975811",
"0.5974465",
"0.591563",
"0.5910595",
"0.58976763",
"0.5882... | 0.7793154 | 0 |
Verify that it's not possible to create or set a too low gc_grace_seconds on MVs | def test_gcgs_validation(self):
session = self.prepare(user_table=True)
# Shouldn't be able to alter the gc_grace_seconds of the base table to 0
assert_invalid(session,
"ALTER TABLE users WITH gc_grace_seconds = 0",
"Cannot alter gc_grace_seconds of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_gc_min_max(self):\n if not self.allow_open_amount:\n return\n\n if self.gc_min < 0 or self.gc_max < 0:\n self.raise_user_error(\"negative_amount_not_allowed\")\n\n if self.gc_min > self.gc_max:\n self.raise_user_error(\"invalid_amount\")",
"def test... | [
"0.5917992",
"0.5739292",
"0.5642895",
"0.56359136",
"0.5613127",
"0.55982673",
"0.55579895",
"0.5507703",
"0.546689",
"0.5466805",
"0.54514426",
"0.5366381",
"0.53661144",
"0.52998894",
"0.52954394",
"0.5257324",
"0.52490336",
"0.523056",
"0.5204648",
"0.51972055",
"0.518032... | 0.6689494 | 0 |
Test that a view is OK when created with existing data with wide rows | def test_populate_mv_after_insert_wide_rows(self):
session = self.prepare(consistency_level=ConsistencyLevel.QUORUM)
session.execute("CREATE TABLE t (id int, v int, PRIMARY KEY (id, v))")
session.cluster.control_connection.wait_for_schema_agreement()
for i in range(5):
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_migrate_view_fields(self):\n self.test_view = RecordView.create(\n self.testcoll, test_view_id, test_view_create_values\n )\n migrate_coll_data(self.testcoll)\n # Read field definition and check for inline field list\n view_data = self.check_entity_values(... | [
"0.62218446",
"0.6083495",
"0.60534817",
"0.58710885",
"0.5809294",
"0.5730357",
"0.5714876",
"0.56728816",
"0.5636616",
"0.5632922",
"0.5626984",
"0.5605452",
"0.5581437",
"0.5578789",
"0.54950875",
"0.54854596",
"0.5480552",
"0.5479986",
"0.5469593",
"0.54688376",
"0.545246... | 0.65026 | 0 |
Test that crc_check_chance parameter is properly populated after mv creation and update | def test_crc_check_chance(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int)")
session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t WHERE v IS NOT NULL "
"AND id IS NOT NULL PRIMARY KEY (v, id) WITH crc_check_chan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_crc():\n status_update = bytes.fromhex('7E1DFFAF13000064082D00000100000400000000000000000064000000067E')\n status_update_crc = 0x06\n\n conf_req = bytes.fromhex('7E050ABF04777E')\n conf_req_crc = 0x77\n\n spa = balboa.BalboaSpaWifi('gnet-37efed')\n\n result = spa.balboa_calc_cs(conf_req[... | [
"0.65232795",
"0.59417105",
"0.5777849",
"0.56471217",
"0.5601775",
"0.55940324",
"0.5572456",
"0.5551666",
"0.5518868",
"0.5510873",
"0.54753995",
"0.5463696",
"0.5428021",
"0.5407845",
"0.5405547",
"0.54040843",
"0.53722864",
"0.53687423",
"0.53552634",
"0.5338046",
"0.5320... | 0.7335866 | 0 |
Test that a materialized view is immutable | def test_immutable(self):
session = self.prepare(user_table=True)
# cannot insert
assert_invalid(session, "INSERT INTO users_by_state (state, username) VALUES ('TX', 'user1');",
"Cannot directly modify a materialized view")
# cannot update
assert_invalid(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_tombstone(self):\n\n self.prepare(rf=3, options={'hinted_handoff_enabled': False})\n node1, node2, node3 = self.cluster.nodelist()\n\n session = self.patient_exclusive_cql_connection(node1)\n session.max_trace_wait = 120\n session.execute('USE ks')\n\n sessio... | [
"0.6292278",
"0.6224354",
"0.62184346",
"0.6176855",
"0.61021394",
"0.60555184",
"0.5991923",
"0.58763736",
"0.580347",
"0.5795407",
"0.5791623",
"0.57561356",
"0.57543343",
"0.5753366",
"0.57337886",
"0.57281095",
"0.5682763",
"0.567763",
"0.5645807",
"0.5579052",
"0.5550505... | 0.74655896 | 0 |
Test that we can drop a view properly | def test_drop_mv(self):
session = self.prepare(user_table=True)
# create another materialized view
session.execute(("CREATE MATERIALIZED VIEW users_by_birth_year AS "
"SELECT * FROM users WHERE birth_year IS NOT NULL AND "
"username IS NOT NULL ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_drop_while_building(self):\n\n session = self.prepare(options={'concurrent_materialized_view_builders': 4}, install_byteman=True)\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)\")\n\n logger.debug(\"Inserting initial data\")\n for i in range... | [
"0.67889017",
"0.6657126",
"0.6492653",
"0.6312419",
"0.6294251",
"0.6155534",
"0.61430365",
"0.61430365",
"0.61031616",
"0.5975371",
"0.57409096",
"0.5730362",
"0.5695469",
"0.56953293",
"0.5690902",
"0.5669387",
"0.56591684",
"0.56381315",
"0.563404",
"0.56134856",
"0.55903... | 0.6910934 | 0 |
Test that we cannot drop a column if it is used by a MV | def test_drop_column(self):
session = self.prepare(user_table=True)
result = list(session.execute(("SELECT * FROM system_schema.views "
"WHERE keyspace_name='ks' AND base_table_name='users' ALLOW FILTERING")))
assert len(result) == 1, "Expecting {} materia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_drop_column(self):\n name_column = Varchar()\n name_column._meta.name = \"name\"\n\n genre_column = Varchar()\n genre_column._meta.name = \"genre\"\n\n schema: t.List[DiffableTable] = [\n DiffableTable(\n class_name=\"Band\",\n ta... | [
"0.6937958",
"0.675997",
"0.6724233",
"0.6671695",
"0.63737416",
"0.63224864",
"0.6310467",
"0.6293324",
"0.62916225",
"0.6285022",
"0.62181425",
"0.6184214",
"0.61387783",
"0.6126988",
"0.610433",
"0.60856223",
"0.6075637",
"0.6050881",
"0.60451186",
"0.60119206",
"0.6000019... | 0.75503546 | 0 |
Test that we can use clustering columns as primary key for a materialized view | def test_clustering_column(self):
session = self.prepare(consistency_level=ConsistencyLevel.QUORUM)
session.execute(("CREATE TABLE users (username varchar, password varchar, gender varchar, "
"session_token varchar, state varchar, birth_year bigint, "
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_complex_mv_select_statements(self):\n cluster = self.cluster\n cluster.set_configuration_options({'enable_materialized_views': 'true'})\n cluster.populate(3).start()\n node1 = cluster.nodelist()[0]\n session = self.patient_cql_connection(node1, consistency_level=Consiste... | [
"0.70326984",
"0.63601124",
"0.6233337",
"0.6105476",
"0.6045581",
"0.6044368",
"0.6027007",
"0.6023061",
"0.6000726",
"0.5922775",
"0.5874505",
"0.576385",
"0.5734012",
"0.57260954",
"0.5708586",
"0.56991565",
"0.56796235",
"0.5655274",
"0.5647864",
"0.56471586",
"0.5637265"... | 0.68584615 | 1 |
CASSANDRA10978 Test that materialized views work as expected when adding a node. | def test_add_node_after_mv(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int)")
session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t "
"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id)"))
for i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_node_after_very_wide_mv(self):\n\n session = self.prepare()\n\n session.execute(\"CREATE TABLE t (id int, v int, PRIMARY KEY (id, v))\")\n session.execute((\"CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t \"\n \"WHERE v IS NOT NULL AND id IS NOT NULL PR... | [
"0.7012901",
"0.7006532",
"0.64824516",
"0.6481415",
"0.6395929",
"0.6262773",
"0.62038887",
"0.6178619",
"0.6132794",
"0.6126011",
"0.6086672",
"0.6069375",
"0.60276246",
"0.5952837",
"0.58752394",
"0.5852436",
"0.58396053",
"0.58316773",
"0.5810097",
"0.57016176",
"0.568697... | 0.73405486 | 0 |
CASSANDRA11670 Test that materialized views work with very wide materialized views as expected when adding a node. | def test_add_node_after_very_wide_mv(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int, v int, PRIMARY KEY (id, v))")
session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t "
"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_node_after_mv(self):\n\n session = self.prepare()\n\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int)\")\n session.execute((\"CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t \"\n \"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id)\"... | [
"0.71924317",
"0.68652076",
"0.6806992",
"0.65596986",
"0.6539991",
"0.6482074",
"0.64745986",
"0.6339147",
"0.6170395",
"0.61196786",
"0.61022896",
"0.60363084",
"0.60322237",
"0.6024784",
"0.5951842",
"0.59104854",
"0.5875463",
"0.58679336",
"0.585328",
"0.57316285",
"0.569... | 0.7392547 | 0 |
CASSANDRA10621 CASSANDRA10978 Test that materialized views work as expected when adding a node in write survey mode. | def test_add_write_survey_node_after_mv(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int)")
session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t "
"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id)"))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_node_after_mv(self):\n\n session = self.prepare()\n\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int)\")\n session.execute((\"CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t \"\n \"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id)\"... | [
"0.65297717",
"0.6427251",
"0.60055476",
"0.5885476",
"0.5847958",
"0.5842925",
"0.58080024",
"0.5760694",
"0.57584924",
"0.5724205",
"0.5716714",
"0.5659941",
"0.55928737",
"0.55318415",
"0.54757285",
"0.5458959",
"0.5454351",
"0.54295045",
"0.54149824",
"0.5407767",
"0.5404... | 0.7997364 | 0 |
Test that allow filtering works as usual for a materialized view | def test_allow_filtering(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)")
session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t "
"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filtered_view_hydrated(empty_viewset):\n viewset = empty_viewset\n system1 = viewset.model.add_software_system(name=\"sys1\")\n container_view = viewset.create_container_view(\n key=\"container1\", description=\"container\", software_system=system1\n )\n viewset.create_filtered_view(... | [
"0.6839462",
"0.64977413",
"0.6263299",
"0.62301564",
"0.6035926",
"0.60172105",
"0.6004824",
"0.5993022",
"0.59713763",
"0.59470123",
"0.5942615",
"0.5900009",
"0.5886084",
"0.5870187",
"0.5866022",
"0.58232516",
"0.5784983",
"0.5762714",
"0.5761528",
"0.5744335",
"0.5738575... | 0.7628281 | 0 |
Test that secondary indexes cannot be created on a materialized view | def test_secondary_index(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)")
session.execute(("CREATE MATERIALIZED VIEW t_by_v AS SELECT * FROM t "
"WHERE v IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v, id)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_local_index_no_range_key(engine):\n with pytest.raises(ValueError):\n class Model(engine.model):\n id = Column(UUID, hash_key=True)\n another = Column(UUID)\n by_another = LocalSecondaryIndex(range_key=\"another\")",
"def test_missing_foreign_key_indices(db_ses... | [
"0.69561404",
"0.66222596",
"0.64954585",
"0.6400075",
"0.6302062",
"0.6185816",
"0.6120662",
"0.6085855",
"0.60465896",
"0.60010475",
"0.5999763",
"0.59957534",
"0.59345144",
"0.58763325",
"0.5832284",
"0.58175516",
"0.5813598",
"0.5802429",
"0.5792589",
"0.5788268",
"0.5758... | 0.80215204 | 0 |
Test that TTL works as expected for a materialized view The TTL is propagated properly between tables. | def test_ttl(self):
session = self.prepare()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 int, v3 int)")
session.execute(("CREATE MATERIALIZED VIEW t_by_v2 AS SELECT * FROM t "
"WHERE v2 IS NOT NULL AND id IS NOT NULL PRIMARY KEY (v2, id)"))
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_mv_with_default_ttl(self, flush):\n session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)\n node1, node2, node3 = self.cluster.nodelist()\n session.execute('USE ks')\n\n logger.debug(\"MV with same key and u... | [
"0.7233449",
"0.6468026",
"0.64311516",
"0.6386992",
"0.62730235",
"0.6260327",
"0.6132396",
"0.6131993",
"0.6101104",
"0.6042274",
"0.593731",
"0.584508",
"0.581179",
"0.5782146",
"0.57157606",
"0.5675802",
"0.5638631",
"0.55612683",
"0.55408764",
"0.5497256",
"0.5477924",
... | 0.80929774 | 0 |
Test that a materialized view created with 'SELECT ' works as expected when adding a new column The new column is not present in the view. | def test_query_new_column(self):
session = self.prepare(user_table=True)
session.execute(("CREATE MATERIALIZED VIEW users_by_state2 AS SELECT state, username FROM users "
"WHERE STATE IS NOT NULL AND USERNAME IS NOT NULL PRIMARY KEY (state, username)"))
self._insert_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_no_base_column_in_view_pk_complex_timestamp(self, flush):\n session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)\n node1, node2, node3 = self.cluster.nodelist()\n\n session.execute('USE ks')\n session.execu... | [
"0.6892171",
"0.6611816",
"0.65615696",
"0.6400288",
"0.6197115",
"0.61784774",
"0.6161736",
"0.5996451",
"0.5949513",
"0.59209174",
"0.59142745",
"0.59110093",
"0.58645874",
"0.5767183",
"0.57138884",
"0.5691429",
"0.5675922",
"0.56391716",
"0.55949956",
"0.55837137",
"0.557... | 0.74716026 | 0 |
Test that column renaming is atomically done between a table and its materialized views CASSANDRA12952 | def test_rename_column_atomicity(self):
session = self.prepare(nodes=1, user_table=True, install_byteman=True)
node = self.cluster.nodelist()[0]
self._insert_data(session)
assert_one(
session,
"SELECT * FROM users_by_state WHERE state = 'TX' AND username = 'user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rename_column(self):\n name_column = Varchar()\n name_column._meta.name = \"name\"\n\n title_column = Varchar()\n title_column._meta.name = \"title\"\n\n schema: t.List[DiffableTable] = [\n DiffableTable(\n class_name=\"Band\",\n ... | [
"0.70623285",
"0.63104355",
"0.61005694",
"0.60737306",
"0.5995365",
"0.5948483",
"0.58400935",
"0.5781707",
"0.57810545",
"0.5773753",
"0.57513714",
"0.5725413",
"0.56517184",
"0.5640607",
"0.56149244",
"0.5593741",
"0.5567643",
"0.5563331",
"0.5556346",
"0.555506",
"0.55446... | 0.73969036 | 0 |
Test that MV whose build has been stopped with `nodetool stop` can be dropped | def test_drop_with_stopped_build(self):
session = self.prepare(options={'concurrent_materialized_view_builders': 4}, install_byteman=True)
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)")
nodes = self.cluster.nodelist()
logger.debug("Inserting initial ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resume_stopped_build(self):\n\n session = self.prepare(options={'concurrent_materialized_view_builders': 4}, install_byteman=True)\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)\")\n nodes = self.cluster.nodelist()\n self.fixture_dtest_setup... | [
"0.68905497",
"0.66020924",
"0.638977",
"0.6324155",
"0.6261753",
"0.6236924",
"0.6183464",
"0.6149862",
"0.61090034",
"0.595898",
"0.5956245",
"0.5946295",
"0.593066",
"0.59184647",
"0.5911645",
"0.5901314",
"0.58555895",
"0.5782444",
"0.57531476",
"0.5745357",
"0.5744198",
... | 0.7115608 | 0 |
Able to shadow old view row if all columns in base are removed including unselected Able to recreate view row if at least one selected column alive CASSANDRA11500 | def _test_no_base_column_in_view_pk_complex_timestamp(self, flush):
session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)
node1, node2, node3 = self.cluster.nodelist()
session.execute('USE ks')
session.execute("CREATE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propagate_view_creation_over_non_existing_table(self):\n\n cluster = self.cluster\n cluster.populate(3)\n cluster.start()\n node1, node2, node3 = self.cluster.nodelist()\n session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.QUORUM)\n create_... | [
"0.5627029",
"0.54265463",
"0.54173553",
"0.5336454",
"0.5321225",
"0.5315297",
"0.5305727",
"0.5303478",
"0.52973366",
"0.51968604",
"0.51912946",
"0.51831746",
"0.5162054",
"0.5120009",
"0.51169086",
"0.5116364",
"0.5103139",
"0.50465274",
"0.5032975",
"0.50322765",
"0.5030... | 0.592299 | 0 |
Able to shadow old view row with column ts greater than pk's ts and reinsert the view row Able to shadow old view row with column ts smaller than pk's ts and reinsert the view row CASSANDRA11500 | def _test_base_column_in_view_pk_complex_timestamp(self, flush):
session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)
node1, node2, node3 = self.cluster.nodelist()
session.execute('USE ks')
session.execute("CREATE TA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_no_base_column_in_view_pk_complex_timestamp(self, flush):\n session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)\n node1, node2, node3 = self.cluster.nodelist()\n\n session.execute('USE ks')\n session.execu... | [
"0.7177231",
"0.61059767",
"0.57408565",
"0.550788",
"0.5367041",
"0.5361094",
"0.53473574",
"0.5249827",
"0.5230615",
"0.5230615",
"0.520213",
"0.5197923",
"0.51811713",
"0.51491165",
"0.51447564",
"0.5142157",
"0.5130651",
"0.5109452",
"0.502001",
"0.50022817",
"0.50022817"... | 0.7051648 | 1 |
Test MV with expired liveness limit is properly handled CASSANDRA13883 | def _test_expired_liveness_with_limit(self, rf, nodes):
session = self.prepare(rf=rf, nodes=nodes, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)
node1 = self.cluster.nodelist()[0]
session.execute('USE ks')
session.execute("CREATE TABLE t (k int PR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_hyperflex_feature_limit_external(self):\n pass",
"def test_update_offline_status(self):\n pass",
"def test_update_hyperflex_feature_limit_internal(self):\n pass",
"def test_environmental_impact_compliance():\n emissions = 12000\n legal_limit = 300\n assert emissi... | [
"0.61492723",
"0.6087286",
"0.6037791",
"0.6019407",
"0.6004978",
"0.5970144",
"0.5930014",
"0.5906103",
"0.59024256",
"0.5864831",
"0.58527917",
"0.57939404",
"0.57530594",
"0.57497495",
"0.57018834",
"0.566865",
"0.5648454",
"0.56078196",
"0.55687165",
"0.55558985",
"0.5547... | 0.7073038 | 0 |
Test that a materialized view are consistent after a simple repair. | def _simple_repair_test(self, repair_base=False, repair_view=False):
session = self.prepare(rf=3, options={'hinted_handoff_enabled': False})
node1, node2, node3 = self.cluster.nodelist()
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)")
session.execute(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_really_complex_repair(self):\n session = self.prepare(rf=5, options={'hinted_handoff_enabled': False}, nodes=5)\n node1, node2, node3, node4, node5 = self.cluster.nodelist()\n\n # we create the base table with gc_grace_seconds=5 so batchlog will expire after 5 seconds\n session... | [
"0.71252847",
"0.7041749",
"0.6935138",
"0.6930578",
"0.68625474",
"0.6740868",
"0.6521269",
"0.65040326",
"0.6496666",
"0.64616734",
"0.6252084",
"0.61252517",
"0.60395676",
"0.6006589",
"0.60032815",
"0.5981635",
"0.59799033",
"0.59473616",
"0.5926516",
"0.5917056",
"0.5915... | 0.75850284 | 0 |
Test repair does not fail when there is MV lock contention CASSANDRA12905 | def test_base_replica_repair_with_contention(self):
self._base_replica_repair_test(fail_mv_lock=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _base_replica_repair_test(self, fail_mv_lock=False):\n\n self.prepare(rf=3)\n node1, node2, node3 = self.cluster.nodelist()\n session = self.patient_exclusive_cql_connection(node1)\n session.execute('USE ks')\n\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int, v2... | [
"0.748205",
"0.69555116",
"0.6787574",
"0.6608144",
"0.6607815",
"0.65436244",
"0.6180294",
"0.61780506",
"0.61641556",
"0.613567",
"0.611566",
"0.6115433",
"0.61123097",
"0.6047326",
"0.6025254",
"0.5991636",
"0.595571",
"0.5936672",
"0.59278905",
"0.5926791",
"0.592278",
... | 0.78057253 | 0 |
Test that a materialized view are consistent after the repair of the base replica. | def _base_replica_repair_test(self, fail_mv_lock=False):
self.prepare(rf=3)
node1, node2, node3 = self.cluster.nodelist()
session = self.patient_exclusive_cql_connection(node1)
session.execute('USE ks')
session.execute("CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 dec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _simple_repair_test(self, repair_base=False, repair_view=False):\n\n session = self.prepare(rf=3, options={'hinted_handoff_enabled': False})\n node1, node2, node3 = self.cluster.nodelist()\n\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)\")\n ses... | [
"0.74890757",
"0.71741855",
"0.6980225",
"0.6973491",
"0.6903745",
"0.6803438",
"0.6549949",
"0.6438437",
"0.642581",
"0.62041116",
"0.616515",
"0.6136762",
"0.6135697",
"0.6135309",
"0.61278754",
"0.60847795",
"0.59118557",
"0.5904218",
"0.5855572",
"0.5855482",
"0.58467007"... | 0.71913344 | 1 |
Test that a materialized view are consistent after a more complex repair. | def test_really_complex_repair(self):
session = self.prepare(rf=5, options={'hinted_handoff_enabled': False}, nodes=5)
node1, node2, node3, node4, node5 = self.cluster.nodelist()
# we create the base table with gc_grace_seconds=5 so batchlog will expire after 5 seconds
session.execute("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _simple_repair_test(self, repair_base=False, repair_view=False):\n\n session = self.prepare(rf=3, options={'hinted_handoff_enabled': False})\n node1, node2, node3 = self.cluster.nodelist()\n\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)\")\n ses... | [
"0.7456203",
"0.70387155",
"0.6999308",
"0.69620454",
"0.68222475",
"0.679167",
"0.6605587",
"0.6563779",
"0.6553053",
"0.64597106",
"0.6333627",
"0.6204435",
"0.6145481",
"0.60931844",
"0.6082192",
"0.60116386",
"0.6002193",
"0.60000944",
"0.59826684",
"0.5974092",
"0.596942... | 0.7250699 | 1 |
Test complex MV select statements CASSANDRA9664 | def test_complex_mv_select_statements(self):
cluster = self.cluster
cluster.set_configuration_options({'enable_materialized_views': 'true'})
cluster.populate(3).start()
node1 = cluster.nodelist()[0]
session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.Q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_select(self):\n self.assertEqual(['SELECT',\n ['MAX(*)', 'AS', 'a'], ['(SELECT 1 FROM Q)', 'AS', 'b'], ['c', 'AS', 'c.a'],\n 'FROM', 'T', ''],\n grammar._SELECT_EXPR.parseString(\"SELECT MAX(*) AS a, (SELECT 1 FROM Q) AS b,\"\n... | [
"0.65079945",
"0.63243395",
"0.62658215",
"0.62626994",
"0.62251323",
"0.61912185",
"0.5928468",
"0.5857377",
"0.5831925",
"0.58248574",
"0.58164155",
"0.5789836",
"0.57417756",
"0.5724001",
"0.57180935",
"0.5706569",
"0.5698504",
"0.565796",
"0.56467897",
"0.56436086",
"0.56... | 0.7580564 | 0 |
The internal addition of a view over a non existing table should be ignored CASSANDRA13737 | def propagate_view_creation_over_non_existing_table(self):
cluster = self.cluster
cluster.populate(3)
cluster.start()
node1, node2, node3 = self.cluster.nodelist()
session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.QUORUM)
create_ks(session, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _test_no_base_column_in_view_pk_complex_timestamp(self, flush):\n session = self.prepare(rf=3, nodes=3, options={'hinted_handoff_enabled': False}, consistency_level=ConsistencyLevel.QUORUM)\n node1, node2, node3 = self.cluster.nodelist()\n\n session.execute('USE ks')\n session.execu... | [
"0.643317",
"0.5908668",
"0.58885986",
"0.5843251",
"0.5790858",
"0.5722778",
"0.5717566",
"0.5585914",
"0.55839574",
"0.55772454",
"0.55742663",
"0.554627",
"0.55317867",
"0.5525174",
"0.55066884",
"0.54840314",
"0.5459816",
"0.5369781",
"0.5342012",
"0.5285785",
"0.5284631"... | 0.6953988 | 0 |
Fails base table write before or after applying views Restart node and replay commit and batchlog Check that base and views are present CASSANDRA13069 | def _test_base_view_consistency_on_crash(self, fail_phase):
self.cluster.set_batch_commitlog(enabled=True, use_batch_window = self.cluster.version() < '5.0')
self.fixture_dtest_setup.ignore_log_patterns = [r'Dummy failure', r"Failed to force-recycle all segments"]
self.prepare(rf=1, install_byt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propagate_view_creation_over_non_existing_table(self):\n\n cluster = self.cluster\n cluster.populate(3)\n cluster.start()\n node1, node2, node3 = self.cluster.nodelist()\n session = self.patient_cql_connection(node1, consistency_level=ConsistencyLevel.QUORUM)\n create_... | [
"0.6456797",
"0.5971283",
"0.5955767",
"0.5870181",
"0.58392113",
"0.57749593",
"0.57468843",
"0.5569703",
"0.5568404",
"0.553152",
"0.55259246",
"0.5524626",
"0.5524061",
"0.5493021",
"0.54891425",
"0.5397019",
"0.5376122",
"0.533465",
"0.53338456",
"0.5315216",
"0.5313221",... | 0.6547234 | 0 |
Tests consistency of multiple writes to a single partition CASSANDRA10981 | def test_single_partition_consistent_reads_after_write(self):
self._consistent_reads_after_write_test(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_multi_partition_consistent_reads_after_write(self):\n self._consistent_reads_after_write_test(5)",
"def _check_write_consistency(self):\n self.logger.warning('Not checking write consistency')",
"def testConsistency(self):",
"def check_consistency(self, es):",
"def test_redis_increase... | [
"0.81448984",
"0.6523661",
"0.61439437",
"0.6118131",
"0.60696036",
"0.5982776",
"0.5967827",
"0.59595704",
"0.59334314",
"0.5880416",
"0.58677423",
"0.5786828",
"0.5780153",
"0.5724465",
"0.5712325",
"0.568453",
"0.5681303",
"0.56687766",
"0.5657813",
"0.5655897",
"0.5626915... | 0.79836094 | 1 |
Tests consistency of multiple writes to a multiple partitions CASSANDRA10981 | def test_multi_partition_consistent_reads_after_write(self):
self._consistent_reads_after_write_test(5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_single_partition_consistent_reads_after_write(self):\n self._consistent_reads_after_write_test(1)",
"def test_very_many_partitions_in_fsic(self):\n fsics = {\"super\": {}, \"sub\": {\"\": {self.data[\"group1_id\"].id: 1, self.data[\"group2_id\"].id: 1}}}\n for i in range(10000):\n ... | [
"0.75174904",
"0.6304416",
"0.6260457",
"0.6260355",
"0.60834306",
"0.6013536",
"0.5997093",
"0.59896755",
"0.5972248",
"0.595207",
"0.59135675",
"0.5900774",
"0.58920884",
"0.58596706",
"0.5805482",
"0.5766768",
"0.573955",
"0.5716366",
"0.5706905",
"0.5689456",
"0.5642045",... | 0.7950631 | 0 |
Validate (User | Group) payload from NEXT being added to AD. | def validate_create_entry(payload, data_type):
new_entry_required_fields = ["distinguishedName"]
new_entry_prohibited_fields = ["objectGUID", "whenChanged"]
if data_type == "user":
new_entry_required_fields.append("cn")
new_entry_required_fields.append("userPrincipalName")
elif data_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, data):\n user_type = 3\n return validate_register_user(self, data, user_type)",
"def fusion_api_validate_group_and_roles(self, body, api=None, headers=None):\n return self.LoginDomainsGroupToRoleMapping.validate(body, api, headers)",
"def validate(self, data):\n ... | [
"0.60938716",
"0.56177956",
"0.5573164",
"0.5544951",
"0.5542647",
"0.551167",
"0.55002177",
"0.54839563",
"0.5442849",
"0.5365981",
"0.5358088",
"0.5331456",
"0.5325358",
"0.53190184",
"0.5303998",
"0.52889675",
"0.5275196",
"0.5269549",
"0.52496207",
"0.52422386",
"0.523178... | 0.5935128 | 1 |
Validate (User | Group) payload from NEXT being updated on AD. | def validate_update_entry(payload, data_type):
updated_required_fields = ["distinguishedName"]
prohibited_updated_group_fields = ["objectGUID", "whenCreated"]
if data_type == "user":
prohibited_updated_group_fields.append("cn")
elif data_type == "group":
prohibited_updated_group_fields.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, data):\n groups = data['groups']\n if all(self.context['request'].user.has_perm(\"change_group\", group) for group in groups) or set(groups) <= set(\n self.context['request'].user.groups.all()):\n return data\n else:\n raise PermissionDen... | [
"0.6097056",
"0.5806911",
"0.5760532",
"0.56909925",
"0.56166065",
"0.5543161",
"0.55097544",
"0.54937786",
"0.5447769",
"0.5442769",
"0.54362345",
"0.5408871",
"0.5381777",
"0.5366057",
"0.5358948",
"0.5351018",
"0.5333003",
"0.531848",
"0.526143",
"0.52607524",
"0.5235242",... | 0.67155135 | 0 |
Returns the dimensions as a list, ordered according to the schema | def dims_list(self):
return [n for n in self.schema.names if n in self.dims] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_dimensions(md: Metadata) -> list:\n dimensions = []\n\n for dim in md.dimensions.all():\n dimension = OrderedDict()\n\n dimension[\"type\"] = dim.type\n dimension[\"custom_name\"] = dim.custom_name\n dimension[\"units\"] = dim.units\n dimension[\"extent\"] = d... | [
"0.75346553",
"0.746462",
"0.69651073",
"0.68094385",
"0.645766",
"0.6450359",
"0.64345264",
"0.63140184",
"0.6211617",
"0.61613286",
"0.61577505",
"0.6104858",
"0.6082072",
"0.60458875",
"0.60123855",
"0.59878355",
"0.597456",
"0.59037936",
"0.5862507",
"0.5858748",
"0.58487... | 0.7960348 | 0 |
Converts a DataFrame to a Flat by indicating the dimensions and value column | def from_dataframe(cls, df: pd.DataFrame, schema: Schema, dims: List[str], value_column: str) -> "Flat":
index = schema.encode_many(df[dims])
vals = df[value_column].values
dim_mask = schema.dims_to_mask(dims)
vec = grblas.Vector.from_values(index, vals, size=dim_mask + 1)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_df(df):\n flat_array = df.values.flatten()\n flat_df = pd.DataFrame(flat_array)\n flat_df.columns = [\"loan\"]\n flat_df[\"row_no\"] = flat_df.reset_index().index\n flat_df = flat_df[[\"row_no\", \"loan\"]]\n flat_df.row_no = flat_df.row_no // 100\n return flat_df",
"def flatten_... | [
"0.6000981",
"0.5966032",
"0.5887755",
"0.56872046",
"0.5651386",
"0.5570109",
"0.55378705",
"0.55341214",
"0.5467069",
"0.54654133",
"0.53458506",
"0.5280397",
"0.52247965",
"0.52107245",
"0.5186249",
"0.51823395",
"0.51717144",
"0.51630336",
"0.51435846",
"0.5136841",
"0.51... | 0.65643346 | 0 |
Return a list of all feature classes in current_workplace, including those that exist within feature datasets. Paramteters | def find_all_feature_classes(current_workspace):
paths_to_export = arcpy.ListFeatureClasses()
# search for additional feature classes in feature datasets
for fds in arcpy.ListDatasets():
env.workspace = os.path.join(env.workspace, fds)
for fc in arcpy.ListFeatureClasses():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFeatureClassNames(self):\n return self.featureClasses.keys()",
"def find_class_names(self) -> [str]:\n if not self.faithful:\n raise AttributeError('The workspace is not faithful')\n\n result = list()\n\n list_possible_class = list_folders_into_directory(join(self.direct... | [
"0.6694056",
"0.639444",
"0.6393714",
"0.63899076",
"0.6104128",
"0.59974563",
"0.59970427",
"0.5965981",
"0.59317553",
"0.5907754",
"0.59022886",
"0.58818835",
"0.58594966",
"0.58223754",
"0.58205307",
"0.5818834",
"0.5802727",
"0.5772846",
"0.5761205",
"0.5761205",
"0.57612... | 0.7001144 | 0 |
Ensures that path points to a file that (1) exists and (2) appears to be a filegeodatabase (i.e. a file that has the extension .gdb). Paramteters | def ensure_valid_gdb(path):
if not os.path.isfile(path):
raise IOError("geodatabase path does not appear to point to a file.\n")
elif path[-4:] != '.gdb':
raise IOError("path exists, but does not point to a geodatabase.\n")
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_db_path_correct(self, path):\n\t\tif path is None:\n\t\t\treturn self.file_loc() is None\n\t\telse:\n\t\t\treturn self.file_loc() == os.path.abspath(path)",
"def check_path(f):\n if not os.path.exists(f):\n raise Path('%s does not exist' % f)",
"def check_path(path, diagnostic):\n if not os... | [
"0.6616764",
"0.64977694",
"0.6336023",
"0.6326243",
"0.6283675",
"0.6255006",
"0.62168324",
"0.6167874",
"0.6159731",
"0.61583686",
"0.614238",
"0.61239034",
"0.61029625",
"0.6100908",
"0.608942",
"0.6063484",
"0.6059719",
"0.60456586",
"0.60453606",
"0.60333216",
"0.6032077... | 0.7969565 | 0 |
Convert a feature class infc from its current projection to a new projection, and place the new output in folder. If infc does not have a valid spatial reference, then it cannot be projected. Paramteters | def project_feature_class(infc, folder, projection = 4326):
dsc = arcpy.Describe(infc)
shortname = infc.split('\\')[1] if len(infc.split('\\')) == 2 else infc
if dsc.spatialReference.Name == "Unknown":
print 'Skipped {} - undefined coordinate system.'.format(shortname)
else:
print ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reprojectAndSaveNewShapefile(inFilepath,outFilepath,to_EPSG):\r\n import geopandas as gpd\r\n from fiona.crs import from_epsg\r\n\r\n inFile = gpd.read_file(inFilepath)\r\n inFile_proj = inFile.copy()\r\n inFile_proj['geometry'] = inFile_proj['geometry'].to_crs(epsg=to_EPSG)\r\n inFile_proj.c... | [
"0.69849026",
"0.6524256",
"0.624949",
"0.61722314",
"0.61330724",
"0.5708693",
"0.5525221",
"0.5507964",
"0.54671025",
"0.5429234",
"0.5400744",
"0.5377069",
"0.53676003",
"0.5363078",
"0.5346215",
"0.52861166",
"0.5228367",
"0.52146995",
"0.52057016",
"0.5200616",
"0.519003... | 0.80769724 | 0 |
Project all feature classes in the geodatabase and save them as shapefiles in a folder | def dump_geodatabase_to_folder(path, folder='Worldmap Files'):
# make sure that path exists and is a geodatabase
ensure_valid_gdb(path):
# set workspace and output folder
env.workspace = path
if os.path.isdir(folder):
os.removedirs(folder)
os.mkdir(folder)
# get complete ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_geojson(self, topology_map, filename):",
"def save_features_to_file(self):\n if not os.path.exists(self.features_save_path):\n os.makedirs(self.features_save_path)\n for s in self.sets:\n self.save_features_to_file_by_set(s)",
"def export_geojson(self):\n ... | [
"0.6630598",
"0.6579513",
"0.6309255",
"0.6297646",
"0.6271668",
"0.6196219",
"0.6082502",
"0.6075532",
"0.59326464",
"0.5927675",
"0.59165806",
"0.5888081",
"0.5879382",
"0.5877576",
"0.5852843",
"0.58418584",
"0.58341116",
"0.5779261",
"0.57326174",
"0.571467",
"0.5709001",... | 0.73370665 | 0 |
Parse label string from commandline. | def parse_cmdline(label_string):
if not label_string.startswith('//'):
label_string = '//' + label_string
return Label.parse(label_string, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_buildfile(label_string):\n if not isinstance(label_string, str):\n raise iga.fargparse.ParseError()\n return Label.parse(label_string, iga.context.current()['package'])",
"def parse(cls, label) -> Any:\n return label",
"def parse(label_string, current_package):\n ... | [
"0.7009553",
"0.67117226",
"0.6306262",
"0.60545367",
"0.6012107",
"0.5779139",
"0.5755251",
"0.56505704",
"0.56484544",
"0.5567437",
"0.5561202",
"0.5474867",
"0.54550755",
"0.5448368",
"0.5440687",
"0.5430991",
"0.5427897",
"0.5417681",
"0.53850394",
"0.53717554",
"0.53521"... | 0.80780363 | 0 |
Parse label string within BUILD file evaluation environment. | def parse_buildfile(label_string):
if not isinstance(label_string, str):
raise iga.fargparse.ParseError()
return Label.parse(label_string, iga.context.current()['package']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(label_string, current_package):\n if label_string.startswith('//'):\n package_start = 2\n package_end = (_find_or_none(label_string, ':', package_start) or\n len(label_string))\n package = label_string[package_start:package_end]\n ... | [
"0.65368384",
"0.6447805",
"0.63940996",
"0.63230217",
"0.56715554",
"0.55192065",
"0.5495118",
"0.54187506",
"0.54036874",
"0.53981274",
"0.5353999",
"0.53069943",
"0.5247078",
"0.517073",
"0.51227736",
"0.51175773",
"0.50712484",
"0.50627446",
"0.50543314",
"0.50518024",
"0... | 0.78581035 | 0 |
Find the start of the substring or return None. | def _find_or_none(string, substring, start):
index = string.find(substring, start)
return index if index != -1 else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_start(self): # -> str | None:\n ...",
"def hgvs_start(self):\n try:\n return self.hp.parse(self.term).posedit.pos.start\n except hgvs.exceptions.HGVSParseError:\n # Log me\n # print(self.term)\n return None",
"def startswith(self, s):\n ... | [
"0.8028616",
"0.67470604",
"0.6622218",
"0.6622218",
"0.66153365",
"0.65290195",
"0.64821583",
"0.64821583",
"0.64821583",
"0.6412685",
"0.61959994",
"0.61613446",
"0.6096288",
"0.6087059",
"0.6080864",
"0.6071819",
"0.60441285",
"0.6015387",
"0.60138243",
"0.6008052",
"0.599... | 0.7821502 | 1 |
Return the default target from a package string. | def _default_target(package):
return package[package.rfind('/')+1:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_import(import_str, default=None):\r\n try:\r\n return import_module(import_str)\r\n except ImportError:\r\n return default",
"def get_module_from_package(package, module, default=None):\n full_module_path = str('{0}.{1}'.format(package.__name__, module))\n\n try:\n return... | [
"0.5908625",
"0.5827704",
"0.56605",
"0.564478",
"0.5603874",
"0.55811745",
"0.5539311",
"0.5500699",
"0.545742",
"0.54094994",
"0.53598744",
"0.531693",
"0.5301025",
"0.5278612",
"0.52658737",
"0.52570933",
"0.5249404",
"0.52488565",
"0.52444404",
"0.5243546",
"0.5239999",
... | 0.8449904 | 0 |
Pad `data` in 'edge' mode, and get n nearest elements in the padded array and their indexes in the original array | def get_neighbor(x, n, data):
pad_width = np.ceil(n / 2).astype(np.int32)
padded = np.pad(data, pad_width, mode='edge')
x += pad_width
idxes = get_neighbor_idxes(x, n, len(padded))
ret = padded[idxes]
return idxes - pad_width, ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def broadcast_offset_param(data):\n return np.array([[data[int(i / 16)][(j + i * 32) % 128]\n for j in range(32)] \n for i in range(32)])",
"def pad_edges(self, pad):\n weights=[]\n for dim, xy in zip([0, 1], [self.x, self.y]):\n xy0 = np.mean(xy)\n ... | [
"0.60615134",
"0.590217",
"0.5884431",
"0.56500673",
"0.55898046",
"0.5451748",
"0.5354865",
"0.5353324",
"0.53041357",
"0.526425",
"0.5255124",
"0.5213514",
"0.51954556",
"0.51946807",
"0.5189732",
"0.5172915",
"0.51662403",
"0.515853",
"0.5158071",
"0.51450956",
"0.513981",... | 0.68009865 | 0 |
Return value in array even if they are null. | def _func_null_leaf(self, arr: list, search: str) -> list:
return [a.get(search) for a in arr] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self, value):\n if self.array is not None:\n len_array = self._len()\n if len_array == 0:\n return False\n elif value < len_array and value >= 0:\n return int(self.array[value])\n print(\">>> List is None\")\n return None"... | [
"0.592894",
"0.5727499",
"0.5704296",
"0.5620495",
"0.5620495",
"0.5583163",
"0.5563568",
"0.5524162",
"0.5510691",
"0.54853797",
"0.5483888",
"0.5475",
"0.54746735",
"0.5448026",
"0.54332584",
"0.5428005",
"0.54278314",
"0.5414081",
"0.5383123",
"0.538096",
"0.537916",
"0.... | 0.6111107 | 0 |
Ensure value is always an array. | def _always_array(value: str | list | None) -> list:
if value is None:
value = []
elif not isinstance(value, list):
value = [value]
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_array(value):\n\tif not isinstance(value, list):\n\t\treturn [value]\n\treturn value",
"def is_array(val):\n return (\n isinstance(val, tuple) or \\\n isinstance(val, dict) or \\\n isinstance(val, list)\n )",
"def check_array(arr: Arrayable) -> np.ndarray:\n if isinstance(arr, np.ndarray):... | [
"0.7712342",
"0.74892855",
"0.708963",
"0.7066387",
"0.7044346",
"0.70055664",
"0.69729424",
"0.66974515",
"0.66935796",
"0.66363895",
"0.6573458",
"0.6485523",
"0.6449914",
"0.64304817",
"0.6423054",
"0.64192736",
"0.6382778",
"0.63701683",
"0.6363354",
"0.634957",
"0.631916... | 0.7897924 | 0 |
Process fields that can be static values or a MetadataTransformModel. If value is not a MetadataTransformModel (i.e., it's a static value), and expected_length is given, "spread" the static value into an array of expected_length length. | def _process_metadata_transform_model(
self, value: bool | MetadataTransformModel | str | None, expected_length: int | None = None
) -> list:
if value is None:
if expected_length:
return [value] * expected_length
return []
if isinstance(value, Metadat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_value(self, value, strict: bool = True):\n value = super().init_value(value)\n if isinstance(self.data_type, MetaModel):\n t = self.data_type.get_class()\n elif issubclass(self.data_type, SimpleField):\n t = self.data_type.static_field_type\n else:\n ... | [
"0.5317404",
"0.5179199",
"0.5044",
"0.5017944",
"0.4996385",
"0.4966759",
"0.4951833",
"0.48719847",
"0.4859972",
"0.47839037",
"0.4748695",
"0.47472686",
"0.47458175",
"0.4743307",
"0.46897227",
"0.46752998",
"0.46727523",
"0.46621963",
"0.45767164",
"0.4572485",
"0.4543836... | 0.6757192 | 0 |
Process File Occurrences data. File Occurrences are a bit weird, in that none of the fields are required. Because of this, There may be results where all of the fields are None, in which case we'll skip that result and not call add_file_occurrence. | def _process_file_occurrences(self, file_occurrences: list[FileOccurrenceTransformModel]):
for file_occurrence in file_occurrences or []:
expected_length = max(
map(
lambda f: len(self._process_metadata_transform_model(f)),
[
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tests_ti_file_get_occurrences(self):\n file = cast(File, self.ti_helper.create_indicator())\n occurrence_names = ['pytest_occurrence_1', 'pytest_occurrence_2']\n file.add_occurrence(\n occurrence_names[0], (datetime.now() - timedelta(days=2)).isoformat(), '.'\n )\n ... | [
"0.6059152",
"0.5905004",
"0.5778753",
"0.5699282",
"0.5683771",
"0.5519713",
"0.5514828",
"0.5480031",
"0.54740256",
"0.54733485",
"0.5458618",
"0.5427449",
"0.5393411",
"0.5329494",
"0.530595",
"0.52048373",
"0.51568794",
"0.51409423",
"0.5137317",
"0.51298285",
"0.50797176... | 0.7470923 | 0 |
Process Group Specific data. | def _process_group(self):
if not isinstance(self.transform, GroupTransformModel):
return
self._process_name()
if self.transformed_item['type'] == 'Campaign':
self._process_metadata_datetime('firstSeen', self.transform.first_seen)
if self.transformed_item['type'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_data_callback(self, action: EventType, group_id: str) -> None:\n self.process_item(group_id, {})",
"def data_group():\n ...",
"def _parse_groupped_data(self):\n for i, val in enumerate(self.values.keys()):\n xy = self.values[val]\n self._set_and_get(\"x_\", val,... | [
"0.7243357",
"0.6760643",
"0.6536721",
"0.62792784",
"0.6244008",
"0.6113101",
"0.60894483",
"0.6086338",
"0.60303324",
"0.5993764",
"0.59914124",
"0.59914124",
"0.5969717",
"0.59248054",
"0.59004796",
"0.58814335",
"0.5875647",
"0.57523483",
"0.57357395",
"0.5716076",
"0.569... | 0.73376715 | 0 |
Process Indicator Specific data. | def _process_indicator(self):
if not isinstance(self.transform, IndicatorTransformModel):
return
# handle the 3 possible indicator fields
self._process_indicator_values()
if self.transform.active:
self._process_metadata('active', self.transform.active)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _data_process(self, v):\n pass",
"def process_indicators(actapi: act.api.Act, args: Config, falcon: Intel) -> None:\n\n indicator_marker = None\n\n for indicator in crowdstrike_intel.get_latest_indicators(\n falcon, get_last_indicator()\n ):\n handle_indicator(actapi, indicator,... | [
"0.66653603",
"0.63825715",
"0.63084006",
"0.62935305",
"0.61722577",
"0.6003158",
"0.6003158",
"0.6001415",
"0.5996518",
"0.5973672",
"0.5973634",
"0.5907465",
"0.59034735",
"0.59011394",
"0.58908945",
"0.58360183",
"0.5789101",
"0.5783111",
"0.57760155",
"0.5755044",
"0.575... | 0.7404228 | 0 |
Process Group Name data. | def _process_name(self):
if not isinstance(self.transform, GroupTransformModel):
return
name = self._transform_value(self.transform.name)
if name is None:
self.log.error(
'feature=ti-transform, event=process-group-name, message=no-name-found, '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_add_name(org_id, data):\n if data.has_key('groupname'):\n groupname = data['groupname']\n add_group(org_id, groupname, False)",
"def _set_group_name(self):\n self._scene_gen.group_name = self._group_name_le.text()\n self._refresh_view()",
"def set_group_name(self, name):\n ... | [
"0.6870541",
"0.647826",
"0.6424762",
"0.6213746",
"0.61461794",
"0.61408144",
"0.61103433",
"0.6044551",
"0.60382485",
"0.59623533",
"0.5926703",
"0.5880001",
"0.585873",
"0.58447593",
"0.57991725",
"0.5753259",
"0.5715129",
"0.5704183",
"0.56917757",
"0.56917757",
"0.568460... | 0.7495443 | 0 |
Process metadata fields that should be a TC datetime. | def _process_metadata_datetime(self, key: str, metadata: DatetimeTransformModel | None):
if metadata is not None and metadata.path is not None:
value = self._path_search(metadata.path)
if value is not None:
self.add_metadata(
key, self.util.any_to_date... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_t(data):\n if 't_utc' not in data['properties']:\n return None\n data['properties']['DateTime'] = util.datestring(data['properties']['t_utc'], tz=config['local_tz']) \n return data",
"def prepare_data(self, data):\n for i, v in data.items():\n field_type = self.get... | [
"0.6487719",
"0.6416545",
"0.62630284",
"0.60930234",
"0.607387",
"0.59573936",
"0.5950122",
"0.5936687",
"0.5919602",
"0.5879977",
"0.58798766",
"0.5831652",
"0.5831652",
"0.5831652",
"0.5783733",
"0.57555133",
"0.5716862",
"0.5673746",
"0.56561273",
"0.564494",
"0.563797",
... | 0.7287922 | 0 |
Select the correct transform based on the "applies" field. | def _select_transform(self):
for transform in self.transforms:
if transform.applies is None or transform.applies(self.ti_dict) is True:
self.transform = transform
break
else:
raise RuntimeError('No transform found for TI data') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_transform(self):\n pass",
"def _apply_transform(self, w2w_transform):\n raise NotImplementedError",
"def get_transform_fn():",
"def getCurrentTransformSelection():\n node = cmds.ls(sl=True)\n if node:\n node = node[0]\n if cmds.nodeType(node) == 'transform':\n ... | [
"0.599259",
"0.5802514",
"0.5593477",
"0.55098355",
"0.5502565",
"0.5366491",
"0.5366491",
"0.52897954",
"0.52482057",
"0.52445346",
"0.52439463",
"0.5236918",
"0.5220782",
"0.5141374",
"0.5130341",
"0.51176065",
"0.50397825",
"0.5034048",
"0.49685302",
"0.49674764",
"0.49308... | 0.6984942 | 0 |
Transform a value using a static map. | def _transform_value_map(self, value: str, map_: dict, passthrough: bool = False) -> str:
_default = value if passthrough is True else None
if isinstance(value, str):
# a static map is a dict of key/value pairs
value = map_.get(value.lower(), _default)
else:
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_value(self) -> global___Expression.MapValue:",
"def constant_transform(input_dict, constant):\n return {\n \"data\": constant,\n }",
"def transform(self, name, value):\n raise NotImplementedError()",
"def remap_single_value(value, remapping):\n return remapping[value] if va... | [
"0.6872702",
"0.6598292",
"0.6037038",
"0.5979952",
"0.57496524",
"0.55890745",
"0.5582468",
"0.5575885",
"0.55652285",
"0.5521447",
"0.54932886",
"0.54850787",
"0.53919625",
"0.53560996",
"0.5353477",
"0.53521",
"0.534856",
"0.532428",
"0.5300235",
"0.52695125",
"0.5253864",... | 0.7314087 | 0 |
Passed the raw JSON data about a User from Twitter's API, it returns an HTMLified version of the User's description. Replaces t.co URLs with clickable, full links. Makes hashtags into clickable links. Makes into clickable links. | def htmlify_description(json_data):
# I don't think users in the Twitter archive JSON have description
# elements:
try:
desc = json_data["description"]
except KeyError:
return ""
# Make t.co URLs into their original URLs, clickable.
if "entities" in json_data and "description" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_user_desc(self):\n desc = self.data['user']['description']\n if desc is not None:\n desc = ' '.join(re.sub(\"(RT : )|(@[\\S]+)|(&\\S+)|(http\\S+)\", \" \", desc).split())\n desc = \" \".join(re.sub(\"(#\\S+)\", ' ', desc).split())\n desc = ''.join(list(filte... | [
"0.626007",
"0.61623025",
"0.5927306",
"0.5736171",
"0.56661755",
"0.56513816",
"0.5638651",
"0.56263965",
"0.56249464",
"0.55535585",
"0.54890394",
"0.5486235",
"0.543844",
"0.53785974",
"0.53651506",
"0.5362454",
"0.53605413",
"0.53557855",
"0.53542066",
"0.5318884",
"0.531... | 0.73408073 | 0 |
Returns a list of banned IPs | def getBanIps(self):
banned = []
q = """SELECT clients.ip as target_ip FROM penalties INNER JOIN clients ON penalties.client_id = clients.id
WHERE penalties.type = 'Ban' AND penalties.inactive = 0 AND penalties.time_expire = -1
GROUP BY clients.ip"""
cursor = self.q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blacklist_ips(self):\r\n if self.blacklist == '':\r\n return []\r\n return self.IPFilterList([addr.strip() for addr in self.blacklist.split(',')]) # pylint: disable=no-member\r",
"def getTempBanIps(self):\n banned = []\n q = \"\"\"SELECT clients.ip AS target_ip FROM pe... | [
"0.76528513",
"0.7535373",
"0.71156114",
"0.6923343",
"0.68603015",
"0.66740763",
"0.6577855",
"0.65607035",
"0.6518757",
"0.63871664",
"0.63259524",
"0.6294472",
"0.62581086",
"0.62581086",
"0.6232289",
"0.6191144",
"0.6184423",
"0.60499585",
"0.60441494",
"0.60439366",
"0.6... | 0.8300037 | 0 |
Returns a list of TempBanned IPs | def getTempBanIps(self):
banned = []
q = """SELECT clients.ip AS target_ip FROM penalties INNER JOIN clients ON penalties.client_id = clients.id
WHERE penalties.type = 'TempBan' AND penalties.inactive = 0 AND penalties.time_expire > %s
GROUP BY clients.ip""" % int(time())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBanIps(self):\n banned = []\n q = \"\"\"SELECT clients.ip as target_ip FROM penalties INNER JOIN clients ON penalties.client_id = clients.id\n WHERE penalties.type = 'Ban' AND penalties.inactive = 0 AND penalties.time_expire = -1\n GROUP BY clients.ip\"\"\"\n ... | [
"0.7872632",
"0.69478935",
"0.6512142",
"0.62523556",
"0.613556",
"0.61001235",
"0.6085994",
"0.60793865",
"0.6066895",
"0.602393",
"0.6016197",
"0.598317",
"0.59719723",
"0.59685814",
"0.5909207",
"0.5827688",
"0.57749563",
"0.5765984",
"0.57615256",
"0.5756254",
"0.57404757... | 0.86281383 | 0 |
Will extract information for the "ip_address", "user_agent" and "locale" properties from the given HTTP header dictionary. | def from_headers(self, headers):
try:
# First IP address is the one of the client
ip = headers['X_FORWARDED_FOR'].split(',')[0].strip()
except KeyError:
ip = headers.get('REMOTE_ADDR')
if ip:
# Double-check if the address has a valid format
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_headers(request: Dict[str, str]) -> Tuple[str, Dict[str, str]]:\n host = None\n headers = {}\n for name, value in request['META'].items():\n if name == \"HTTP_HOST\":\n host = value\n continue # comment to preserve host header, but eventual output contains host twice.... | [
"0.6395573",
"0.6370883",
"0.6120538",
"0.6111331",
"0.6002312",
"0.58925486",
"0.5866152",
"0.58608603",
"0.5837583",
"0.5790471",
"0.57902354",
"0.5771844",
"0.5757349",
"0.5755024",
"0.5725017",
"0.57227486",
"0.5641827",
"0.55207497",
"0.5515972",
"0.55122787",
"0.5508224... | 0.6731328 | 0 |
Equality operator for Curcio1990Map. Compares two Curcio1990Map's based attribute equality | def __eq__(self, other):
if not isinstance(other, Curcio1990Map):
return False
if id(self) == id(other):
return True
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, Watson2014Map):\n return False\n if id(self) == id(other):\n return True\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n eq = True\n for attr in ['geocode',\n 'g... | [
"0.7665283",
"0.69506687",
"0.686751",
"0.6837607",
"0.6741164",
"0.6676089",
"0.66535497",
"0.66449416",
"0.6511533",
"0.64939123",
"0.64839643",
"0.6445785",
"0.6424692",
"0.6396489",
"0.63746417",
"0.6373116",
"0.63492835",
"0.63492835",
"0.63492835",
"0.63492835",
"0.6349... | 0.8193522 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.