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 |
|---|---|---|---|---|---|---|
If both orders have been filled to the same qty then killing the cross is trivial, just cancel the orders if they've been partially filled. HOWEVER, trouble starts when they get filled with unequal quantities to avoid holding a position we need cancel the larger order and replace the smaller at a price which is likely ... | def kill_cross():
logging.info("kill_cross()")
assert cross.sent, "Can't kill a cross before you send it"
bid = order_manager.get_order(cross.bid_order_id)
ask = order_manager.get_order(cross.offer_order_id)
bid_qty = bid.filled_qty
ask_qty = ask.filled_qty
logger.info('Kill cross with bid filled qty = %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_cross():\n\n global cross\n assert cross.sent, \"Can't kill a cross before you send it\"\n bid = order_manager.get_order(cross.bid_order_id)\n ask = order_manager.get_order(cross.offer_order_id)\n logger.info('kill_cross evaluating: \\nbid=<%s>\\nask=<%s>', bid, ask)\n bid_qty = bid.cum_... | [
"0.6736424",
"0.6668893",
"0.6345054",
"0.62269306",
"0.60974157",
"0.6073251",
"0.5916385",
"0.5842358",
"0.58184767",
"0.58053577",
"0.5795568",
"0.57717836",
"0.56962395",
"0.5691401",
"0.5633731",
"0.5604525",
"0.55975944",
"0.5591008",
"0.5586871",
"0.5548664",
"0.552750... | 0.6938118 | 0 |
Takes two dead orders and optionally places a hedge order if they are unevenly filled | def both_dead(bid, offer):
global cross
logging.info("both_dead(", bid, offer, ")")
if bid.filled_qty > offer.filled_qty:
close_unbalanced_cross(bid, offer)
elif bid.filled_qty < offer.filled_qty:
close_unbalanced_cross(offer, bid)
elif bid.filled_qty == 0:
assert offer.filled_qty == 0
log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ensure_order_consistent(self):\r\n if self.order_sum() != self.order_triangle() or \\\r\n self.force_reset_order is True:\r\n self._reset_order()\r\n self._have_reset_order = True\r\n else:\r\n self._have_reset_order = False\r\n return self.... | [
"0.5728129",
"0.5423449",
"0.54223293",
"0.53632784",
"0.5334285",
"0.5309591",
"0.5303919",
"0.524891",
"0.5207954",
"0.5173803",
"0.5152647",
"0.5145825",
"0.51373315",
"0.5129122",
"0.5122443",
"0.511957",
"0.5108854",
"0.5097575",
"0.5063077",
"0.5062477",
"0.5059257",
... | 0.5760139 | 0 |
Detect vehicles in an image | def detect_vehicles_image(input_img,
scaler=None,
classifier=None,
decision=DECISION_THRESHOLD,
tracker=None,
method='heatmap',
save_path=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect(self, img):\n # 1. color filter\n lane_img = self.color_filter(img.copy())\n # 2. gaussian blur\n lane_img = self.gaussian_blur(lane_img)\n # 3.canny edge detection\n lane_img = self.canny(lane_img)\n # 4. region of interest crop\n lane_img = self.... | [
"0.7463099",
"0.69356066",
"0.6705482",
"0.67020255",
"0.6691043",
"0.66829145",
"0.66630316",
"0.66599035",
"0.66434467",
"0.662603",
"0.65860486",
"0.65338045",
"0.64767104",
"0.64680755",
"0.64597774",
"0.64392614",
"0.6438811",
"0.64282924",
"0.6388481",
"0.6353332",
"0.6... | 0.7054148 | 1 |
Detect and track vehicles in video | def detect_vehicles_video(video_name,
classifier=None,
scaler=None,
tracker=None,
decision=DECISION_THRESHOLD,
mining=False,
view=False,
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect(self):\n # process the input video and get the attributes:\n self.process_video()\n\n # build a rcnn/ yolov5 predictor:\n self.build_predictor()\n\n \n # assert not os.path.isfile(args.output_file), \"File with the name %s already exists\"%args.output_file\n ... | [
"0.68234026",
"0.68118405",
"0.6680285",
"0.6629191",
"0.6568646",
"0.65558994",
"0.6509291",
"0.6463038",
"0.64350194",
"0.6340384",
"0.6329694",
"0.6325468",
"0.6262434",
"0.6227318",
"0.6217634",
"0.62076473",
"0.62012535",
"0.6187199",
"0.6162087",
"0.6119457",
"0.6101264... | 0.7594735 | 0 |
Accepts one character as an argument Returns True if it belongs to the DNA alphabet "ACGT" and False otherwise | def filter_DNA(c):
if c in "ACGTacgt":
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_letter(c):\n return 'A' <= c <= 'Z' or 'a' <= c <= 'z'",
"def validate_dna(s):\n import re\n return re.match(\"^[ctga]*$\", s.lower()) is not None",
"def character(x):\n if (x==\"a\"or x==\"A\"or x==\"e\"or x==\"E\"or x==\"i\"or x==\"I\"or x==\"o\"or x==\"O\"or x==\"u\"or x==\"U\"):\n ... | [
"0.7993517",
"0.7697351",
"0.7612758",
"0.7529799",
"0.750335",
"0.7334284",
"0.7305269",
"0.72839844",
"0.71316",
"0.70816296",
"0.7075064",
"0.70565623",
"0.7028162",
"0.7025595",
"0.69465196",
"0.6934375",
"0.68896127",
"0.6753821",
"0.6733003",
"0.6717631",
"0.67077184",
... | 0.7875878 | 1 |
Return an array of zeros with the same shape and type as a given array. | def zeros_like(a, dtype=None, order='K', subok=True, shape=None):
res = np.full(a.shape, 0, dtype=a.dtype)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros_numpy_array(self,\n type_name,\n as_matrix = True):\n if as_matrix:\n return np.zeros((1, self.get_max_id(type_name)), dtype='float32')\n else:\n return np.zeros((self.get_max_id(type_name),), dtype='float32')",
"def __array__(self):\n re... | [
"0.71901995",
"0.7102643",
"0.70028716",
"0.6906397",
"0.690314",
"0.69028187",
"0.67210937",
"0.670826",
"0.6682537",
"0.6682537",
"0.66433126",
"0.66100216",
"0.6585698",
"0.65632486",
"0.65425885",
"0.65417486",
"0.65417486",
"0.6528437",
"0.64924175",
"0.645705",
"0.63689... | 0.7236643 | 0 |
If the msg is NULL, return True | def is_str_null(msg):
if None == msg or "" == msg:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_message(self, msg):\n pass",
"def is_msg_inited(self):\n pass",
"def has_msg(self):\n return self.bufsize >= 4 and self.bufsize - 4 >= struct.unpack('!I', str(self.buf.peek(0, 4)))[0]",
"def msg(self, msg):\r\n if self.__isInit != True:\r\n return",
"def is_... | [
"0.761693",
"0.6795791",
"0.6755917",
"0.6688675",
"0.66656345",
"0.6583419",
"0.6490694",
"0.6490694",
"0.64844847",
"0.63425833",
"0.624207",
"0.6234231",
"0.6226441",
"0.6195576",
"0.6140589",
"0.605953",
"0.604777",
"0.604777",
"0.604777",
"0.604777",
"0.604777",
"0.603... | 0.7400227 | 1 |
Write a message to a file | def write_msg(file_path, msg):
try:
fd = open(file_path, 'a+')
fd.write(msg)
fd.close()
except Exception, e:
debug(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(message):\n\n with open(str(path), 'a') as fp:\n fp.write(message)",
"def write(self, message):\r\n os.write(self.wfid, message.encode('utf-8'))",
"def create_procesed_file(msg, filename, path):\n write_path_txt = os.path.join(path, filename)\n with open(write_path_txt,... | [
"0.8627511",
"0.7826734",
"0.7780094",
"0.77533007",
"0.76725864",
"0.7476233",
"0.73752046",
"0.7364743",
"0.72658825",
"0.7234093",
"0.7085841",
"0.7055347",
"0.69615",
"0.6851825",
"0.6851825",
"0.6832394",
"0.6807166",
"0.67879146",
"0.6675312",
"0.6672585",
"0.6665839",
... | 0.8355526 | 1 |
Creates the html output for env_spec_entry input, which is the current dictionary. | def render_input(env_spec_entry):
default_value = env_spec_entry["default_value"]
default_value_state = f'value="{default_value}"' if default_value else ""
env_spec_entry_input = (
f'<input id="env_spec_{env_spec_entry["name"].lower()}" '
f'name="{env_spec_entry["name"].lower()}" type="{env... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_env_spec(spec_str):\n env_spec_list = parse(spec_str)\n html_output = render_to_html(env_spec_list)\n return html_output",
"def render_to_html(env_spec_list):\n if not env_spec_list:\n return []\n html_output = \"\"\n\n for env_spec_entry in env_spec_list:\n if env_spec... | [
"0.7261028",
"0.67479104",
"0.6198787",
"0.61730343",
"0.58135664",
"0.5587349",
"0.5468661",
"0.53528565",
"0.5285854",
"0.5233406",
"0.51907825",
"0.5176583",
"0.5159405",
"0.5159174",
"0.5126405",
"0.51133424",
"0.51084286",
"0.5069613",
"0.50665456",
"0.50639826",
"0.5031... | 0.6901125 | 1 |
Creates the html output for key "choice". | def render_choice(choice, selected=False):
selected_state = "selected" if selected else ""
return f'\t<option value="{choice}"{selected_state}>{choice}</option>\n' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quiz_selection():\n\n verbs = crud.get_verbs()\n tenses = crud.get_tenses()\n\n return render_template(\"verb-conjugation.html\", verbs=verbs, tenses=tenses)",
"def __str__(self):\n return \"choice_text: \" + self.choice_text",
"def button_choice(value):\r\n return 'You have selected \"{... | [
"0.67064846",
"0.6681025",
"0.6633636",
"0.6526178",
"0.65037805",
"0.6408098",
"0.6369888",
"0.6304685",
"0.6207041",
"0.6157141",
"0.61380893",
"0.60496235",
"0.6048041",
"0.6033166",
"0.6010804",
"0.59988534",
"0.5958508",
"0.5938636",
"0.5925661",
"0.59090185",
"0.5897863... | 0.6837719 | 0 |
Creates the html output from the env_spec list, by checking whether the value is None or not.(comments, choices, default_value) Returns the html output of the whole list. | def render_to_html(env_spec_list):
if not env_spec_list:
return []
html_output = ""
for env_spec_entry in env_spec_list:
if env_spec_entry["choices"] is None:
ret_str = render_label(env_spec_entry)
ret_str += render_input(env_spec_entry)
else:
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_env_spec(spec_str):\n env_spec_list = parse(spec_str)\n html_output = render_to_html(env_spec_list)\n return html_output",
"def render_input(env_spec_entry):\n default_value = env_spec_entry[\"default_value\"]\n default_value_state = f'value=\"{default_value}\"' if default_value else \"... | [
"0.6108407",
"0.5383599",
"0.53536624",
"0.516855",
"0.5121368",
"0.5045059",
"0.5015247",
"0.4924866",
"0.4907484",
"0.48915365",
"0.47923467",
"0.4784033",
"0.47056007",
"0.46399152",
"0.4636127",
"0.4557118",
"0.45432517",
"0.45174992",
"0.45044142",
"0.44969708",
"0.44961... | 0.7674002 | 0 |
Parse function creates a list of dictionaries by splitting env_spec_text by | def parse(env_spec_text):
env_spec_list = []
alphanumeric_that_does_not_start_with_digit = r"^[A-Z_][0-9A-Z_]*$"
name_regex = r"^(.+)\:(.+)$"
choices_regex = r"^(.+)\]"
default_values_regex = r"^(.+)\=(.+)$"
line_comment_regex = r"^#"
comment_regex = r"^(.+)\#(.+)$"
lines = env_spec_te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse(self, inval):\n regex = re.compile(r'^os\\.environ\\[(.*)\\]$')\n for val in inval:\n if val is None:\n continue\n # split on \\n\n cmd = val.split('\\n')\n for v2 in cmd:\n if not v2:\n continue\n... | [
"0.6494117",
"0.6396899",
"0.6154961",
"0.6085255",
"0.6055717",
"0.60156995",
"0.5978126",
"0.5877958",
"0.58728516",
"0.58479744",
"0.5742934",
"0.5684829",
"0.56658345",
"0.5589795",
"0.55644625",
"0.5511448",
"0.5511448",
"0.54664266",
"0.5458185",
"0.53426546",
"0.533402... | 0.8215798 | 0 |
Render_emv_spec function takes the given spec_str and returns the html output. | def render_env_spec(spec_str):
env_spec_list = parse(spec_str)
html_output = render_to_html(env_spec_list)
return html_output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_to_html(env_spec_list):\n if not env_spec_list:\n return []\n html_output = \"\"\n\n for env_spec_entry in env_spec_list:\n if env_spec_entry[\"choices\"] is None:\n ret_str = render_label(env_spec_entry)\n ret_str += render_input(env_spec_entry)\n els... | [
"0.55909",
"0.5047621",
"0.50237036",
"0.4876869",
"0.48238346",
"0.48105097",
"0.47940475",
"0.47791538",
"0.47570574",
"0.47466692",
"0.46885926",
"0.46878535",
"0.46856266",
"0.46787462",
"0.46523425",
"0.4630138",
"0.46278706",
"0.4623053",
"0.46179366",
"0.46146548",
"0.... | 0.7654973 | 0 |
Copy the defaults, get the host specific values and merge them overriding any matching defaults, then create an options object to handle the command line merging in any command line overrides. Finally post process the command line. | def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = True):
global host_windows
global host_posix
#
# The path to this command.
#
command_path = path.dirname(path.abspath(args[0]))
if len(command_path) == 0:
command_path = '.'
#
# The command line c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _options_commandline_overrides(options):\n cmdline_values = {\n 'run_storage_base': options.run_storage_base,\n 'watch': options.watch,\n 'verbose': options.verbose,\n 'uploader_config': options.uploader_config,\n 'logging_config': options.logging_config,\n }\n\n # C... | [
"0.6891529",
"0.64468396",
"0.64255697",
"0.6246926",
"0.62139875",
"0.6148332",
"0.6103537",
"0.6056638",
"0.6024813",
"0.60133547",
"0.5942717",
"0.5911384",
"0.59090465",
"0.5876665",
"0.58584774",
"0.58426994",
"0.57928723",
"0.57799214",
"0.577969",
"0.5774557",
"0.57596... | 0.6765438 | 1 |
Appends to clist for a given wsize | def next(self,item):
if not self.clist or len(self.clist)<self.maxsize:
self.clist.append(item)
self.wsize = len(self.clist)
else:
self.clist.popleft()
if len(self.clist) > self.maxsize:
print('Something fishy with size')
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resize_list(self, new_size: int):\n for _ in range((new_size + 1) - len(self)):\n self.append(0)",
"def appendsize(self, numents):\n pass",
"def update_size(self,\r\n entrylist=None,\r\n newsize=60):\r\n if entrylist is None:\r\n ... | [
"0.59452087",
"0.5724344",
"0.5469425",
"0.5381657",
"0.5275255",
"0.52205974",
"0.52100295",
"0.50974923",
"0.5064413",
"0.5026587",
"0.49966073",
"0.49931526",
"0.49918443",
"0.496411",
"0.4959401",
"0.49548578",
"0.49469963",
"0.4852457",
"0.48513347",
"0.48510632",
"0.485... | 0.6262214 | 0 |
List available midi devices or log input messages to pippi.log | def do_midi(self, cmd):
if cmd == 'log' or cmd == 'log on':
midi.input_log(self.io.ns, True)
elif cmd == 'log off':
midi.input_log(self.io.ns, False)
else:
midi.print_devices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_audio_devices():\n\n devs = get_audio_devices()\n\n print(\"\\nOutput Devices\")\n print('{:>5}: {:<40} {:<6} {}'.format('idx', 'name', 'chans', 'latency'))\n for d in devs['output']:\n print('{index:>5}: {name:<40} {channels:<6} {latency[0]:.3f} - {latency[1]:.3f}'.format(**d))\n\n ... | [
"0.6347147",
"0.58937216",
"0.58301723",
"0.57920176",
"0.5714648",
"0.56964964",
"0.5640166",
"0.5558911",
"0.5520629",
"0.55167437",
"0.5513707",
"0.54877794",
"0.5409831",
"0.5391065",
"0.53887534",
"0.5376044",
"0.533934",
"0.53264284",
"0.530405",
"0.5302531",
"0.5302159... | 0.615967 | 1 |
Set tuning of A4 | def do_tune(self, cmd):
self.params.set('tune', float(cmd) / 16.0, 'global') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tune(acc_rate, proposed, step):\n if step.tune_scaling:\n # a and b after Muto & Beck 2008.\n a = 1 / 9\n b = 8 / 9\n step.scaling = (a + b * acc_rate) ** 2\n if step.tune_steps:\n acc_rate = max(1.0 / proposed, acc_rate)\n step.n_steps = min(step.max_steps, 1 +... | [
"0.6383188",
"0.6092623",
"0.59553427",
"0.5817448",
"0.5814875",
"0.5799531",
"0.5621054",
"0.5591782",
"0.5557341",
"0.5509695",
"0.5503524",
"0.54959947",
"0.54816645",
"0.5478003",
"0.54423743",
"0.541846",
"0.5393589",
"0.5385482",
"0.538398",
"0.5363345",
"0.5361191",
... | 0.62833846 | 1 |
Add a simple field to the form data. | def add_field(self, name, value):
self.form_fields.append((name, value))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_field(self, name, value):\n if not isinstance(value, str):\n value = json.dumps(value, ensure_ascii=False)\n self.form_fields.append((name, value))\n return",
"def add_field(self, field, field_data):\n self.extra_fields[field] = field_data",
"def add_field(self, *... | [
"0.74151355",
"0.7208831",
"0.69235045",
"0.6700662",
"0.6700662",
"0.6679923",
"0.66495657",
"0.6378988",
"0.6376649",
"0.6359253",
"0.6335677",
"0.62295204",
"0.6200369",
"0.6173918",
"0.6133554",
"0.5962955",
"0.5863354",
"0.56744784",
"0.56402624",
"0.56112504",
"0.561071... | 0.7443055 | 1 |
Changes the log level of existing log handlers | def setLevel(self, level):
handlers = self.logger.handlers
for handler in handlers:
handler.setLevel(level) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_level(log_or_name, level):\n if isinstance(log_or_name, str):\n log = get_logger(log_or_name)\n else:\n log = log_or_name\n log.setLevel(level)\n for handler in log.handlers:\n handler.setLevel(level)",
"def adjust_log_level(level='ERROR'):\n _logger = logger()\n ol... | [
"0.7290717",
"0.70485944",
"0.6943617",
"0.6905589",
"0.6900469",
"0.68942964",
"0.6889501",
"0.68823797",
"0.6866855",
"0.6765658",
"0.6734045",
"0.6733529",
"0.6714622",
"0.6709143",
"0.6705101",
"0.66910774",
"0.66720605",
"0.6664049",
"0.665063",
"0.6620443",
"0.65997595"... | 0.7424739 | 0 |
Returns a list of active fileHandlers | def fileHandlers(self):
fileHandlers = list()
handlers = self.logger.handlers
for handler in handlers:
try:
if handler._name.startswith("LogFile-"):
fileHandlers.append(handler)
except:
pass
return fileHandlers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_handlers(self):\n return []",
"def get_registered_handlers(self):\n return list(self._registry.values())",
"def get_handlers(self):\n return self._handlers",
"def get_handlers(self):\n\n # Get handlers \n logger.debug(\"%s: Returned %d handlers.\" % \\\n ... | [
"0.8486658",
"0.7035221",
"0.6896432",
"0.68689203",
"0.66847473",
"0.66794074",
"0.6582473",
"0.6442148",
"0.6417444",
"0.6410967",
"0.6342239",
"0.628562",
"0.61796874",
"0.6176613",
"0.6151553",
"0.6129311",
"0.6104369",
"0.60489553",
"0.60451555",
"0.5993025",
"0.5992524"... | 0.7769305 | 1 |
Appends additional fileHandlers to the log object | def fileHandlers(self, handlers):
for handler in handlers:
self.logger.addHandler(handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_handler(self, app):\n # Check if directory exists.\n basedir = dirname(app.config[\"LOGGING_FS_LOGFILE\"])\n if not exists(basedir):\n raise ValueError(\"Log directory {0} does not exist.\".format(basedir))\n\n handler = RotatingFileHandler(\n app.confi... | [
"0.6914407",
"0.69063836",
"0.68310547",
"0.67813516",
"0.6640141",
"0.66169846",
"0.661104",
"0.65808535",
"0.64918107",
"0.6485708",
"0.64221716",
"0.61785734",
"0.60697335",
"0.603634",
"0.60355294",
"0.6007974",
"0.5931759",
"0.59082806",
"0.5888139",
"0.5866379",
"0.5841... | 0.7874667 | 0 |
Check the expiration time of the order and expires as needed. | def _close_order_if_past_expiration_time(self, order, order_update_creator,
curr_time):
log.debug('Checking %s to see if it has passed its expiration time'
% order)
if curr_time > order.expiration_time:
with instrumentation_conte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checked_expired(self, order):\n exp_time = order.get_expiration_time()\n curr_time = self.table.current_time\n # self.debug(\"Check %i expiration: exp(%f) vs. curr(%f)\" % (order.m_orderId, exp_time, curr_time))\n if curr_time >= exp_time:\n self.debug(\"Order %i has expi... | [
"0.7791965",
"0.6935269",
"0.6700758",
"0.66924286",
"0.6598127",
"0.6552106",
"0.650587",
"0.6505778",
"0.63915366",
"0.6385122",
"0.63123053",
"0.6290626",
"0.62889904",
"0.6283209",
"0.6258611",
"0.6253302",
"0.6232671",
"0.6216502",
"0.6157735",
"0.613258",
"0.61314684",
... | 0.7124736 | 1 |
Remove from querysets the given item. | def _pop_item_from_all_querysets(self, items_querysets, item):
for nickname in items_querysets:
item_queryset = items_querysets[nickname]
# This is safe if the Item does not exist within the queryset
items_querysets[nickname] = self._pop_item_from_queryset(
it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self, item):\n try:\n self._data.remove(item)\n except ValueError as exc:\n raise KeyError from exc\n else:\n self.__log__.append(SetRemove(value=item))",
"def delete(self, item):\r\n self.fetch()\r\n t = self.make_item_tuple(item)\r\... | [
"0.72295785",
"0.7172147",
"0.7128515",
"0.70647466",
"0.70647466",
"0.69042647",
"0.67816764",
"0.67503947",
"0.67181885",
"0.6714726",
"0.67105085",
"0.6701625",
"0.66870147",
"0.66509855",
"0.6581971",
"0.65409505",
"0.6501526",
"0.6480652",
"0.647745",
"0.6453084",
"0.644... | 0.7178403 | 1 |
Return an item from the given queryset. We will first attempt to find an item with a held_by of None since the queryset contains a mix of Items which are held by None and items which are held by a creator_task. | def _get_item_from_queryset(self, item_queryset):
held_by_none_qs = item_queryset.filter(held_by_object_id=None)
if held_by_none_qs:
return random.choice(list(held_by_none_qs))
return random.choice(list(item_queryset)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item(self, name: str) -> Optional[Item]:\n item = self.filter_items(name, limit=1)\n return item[0] if item else None",
"def get_item(self, id: str, user: User) -> Optional[T]:",
"def get_object(self):\n if not self._item:\n self._item = get_object_or_404(Item, pk=self.k... | [
"0.6374839",
"0.6245404",
"0.611717",
"0.5785819",
"0.5615396",
"0.5602468",
"0.55595344",
"0.551572",
"0.55039126",
"0.5484496",
"0.5476774",
"0.5458361",
"0.54530853",
"0.54526657",
"0.5447521",
"0.5444338",
"0.5425015",
"0.5422178",
"0.5418804",
"0.5405689",
"0.53927535",
... | 0.7372274 | 0 |
Assign an eligible item to each nickname in an Order. Return None if any nickname is unassignable. Otherwise, return a dictionary of selected items. ignore_rare can be set to True to only select from nonrare items. If the order is inherently looking for rare items, selection will fail. | def _select_items(self, order_items, assigned_items_ids,
held_by_any=False,
requires_maintenance_items=False,
ignore_rare=False):
log.debug('Selecting for order items: %s', json.dumps(order_items,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_item(items, weights, k):\n x = random.choices(items, weights=weights, k=k)\n return x",
"def set_ignore_flag(self, reag_item_id: int, do_ignore: bool) -> dict:\n raise NotImplementedError('not implemented')",
"def rank_potential_items(self, target_user_id, top_k_users):\n items_r... | [
"0.47286037",
"0.47222415",
"0.4672227",
"0.46527725",
"0.46180725",
"0.4610449",
"0.4523621",
"0.44626144",
"0.43504247",
"0.43231848",
"0.4291707",
"0.4285643",
"0.42685294",
"0.42229778",
"0.42227703",
"0.42100358",
"0.41949123",
"0.418418",
"0.4177426",
"0.41560102",
"0.4... | 0.69764084 | 0 |
Try to create an Item from a recipe. Returns a set of tasks that creates the item based on the given recipe. If a recipe is defined, we will either return a task to create the item or recursively check its required ingredients for tasks to create those as well if needed. | def _get_creator_tasks_for_item(self,
item_requirements,
item_type,
assigned_items_ids,
recursion_depth=0):
if recursion_depth > MAX_RECURSION_LIMIT:
# If w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n self._finish_creation_settings()\n return self.project.create_recipe(self.recipe_proto, self.creation_settings)",
"def create_recipe(current_user):\n data = request.get_json()\n\n try:\n for item in data:\n new_recipe = Recipe(\n name=item[... | [
"0.6231743",
"0.58083355",
"0.5618072",
"0.5536619",
"0.5461407",
"0.5366937",
"0.5303408",
"0.5229377",
"0.5228868",
"0.51893526",
"0.5158577",
"0.5128561",
"0.5118839",
"0.51109815",
"0.50826126",
"0.50712633",
"0.5056629",
"0.5027513",
"0.49965465",
"0.4988464",
"0.4966910... | 0.6630937 | 0 |
Compute a dictionary mapping order SIDs to processing priority. For now, an order's priority is just the time_created with a slight addition to pretend orders from the same user are throttled. This is a cheap way to effectively throttle orders mainly so that the release pipeline doesn't aggressively hog all available i... | def _compute_order_priorities(self, orders):
order_priorities = {}
times_last_created = {}
if len(orders) == 0:
return order_priorities
time_last_order_created = orders[-1].time_created
# We'll analyze all orders created in the
# bodega_all.serializers.DEFAU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_order_priorities_stats(self, orders):\n order_prices = {}\n tab_limits = {}\n tab_demands = {}\n total_fulfilled_prices = Counter()\n valid_statuses = set([Order.STATUS_OPEN, Order.STATUS_FULFILLED])\n\n for order in orders:\n if order.status not in... | [
"0.6928912",
"0.6299566",
"0.5871416",
"0.5846619",
"0.56935185",
"0.56491286",
"0.56021535",
"0.5562296",
"0.55017084",
"0.5461793",
"0.5396191",
"0.5385343",
"0.5385343",
"0.5384413",
"0.5245209",
"0.5226358",
"0.51977336",
"0.51956356",
"0.5191404",
"0.51736885",
"0.516267... | 0.76245046 | 0 |
Get the list of open orders sorted by pricebased priority. | def _get_open_orders_by_price(self):
log.debug("Getting open orders sorted by price-based priority")
# time_created ordering will be preserved as the secondary sort key.
unprioritized_open_orders = list(Order.objects.filter(
status=Order.STATUS_OPEN).order_by('time_created'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_open_orders(self):\n # When using ORDER_PRICE_PRIORITY, the get_priority function has a\n # side-effect of doing a database write for the tab_based_priority\n # field of each open order. More details documented on the function\n if settings.ENABLE_ORDER_PRICE_PRIORITY:\n ... | [
"0.8122122",
"0.7449787",
"0.738588",
"0.6954568",
"0.68871236",
"0.6769588",
"0.6758001",
"0.67508096",
"0.6726667",
"0.67122585",
"0.6685512",
"0.6683707",
"0.664624",
"0.6634862",
"0.65878135",
"0.6567664",
"0.6509634",
"0.649378",
"0.6487633",
"0.6478969",
"0.64556736",
... | 0.8930003 | 0 |
Compute each open order's pricebased priority. | def _sort_open_orders_by_price(self,
open_orders,
fulfilled_orders):
priorities_stats = self._compute_order_priorities_stats(
open_orders + fulfilled_orders)
median_demand, order_prices, tab_limits, total_fulfilled_prices ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_priority(open_order):\n priority = 0.0\n if not open_order.maintenance:\n order_price = order_prices[open_order.sid]\n tab = open_order.tab\n owner_total_fulfilled_price = \\\n total_fulfilled_prices.get(tab.id, 0.0)\n ... | [
"0.7422625",
"0.69262826",
"0.68071866",
"0.61527026",
"0.61096567",
"0.6056146",
"0.60235584",
"0.5899413",
"0.58803433",
"0.58233005",
"0.57301986",
"0.57205254",
"0.56839997",
"0.5679024",
"0.5643783",
"0.5642073",
"0.55993915",
"0.55762595",
"0.5554343",
"0.5519948",
"0.5... | 0.71463144 | 1 |
Compute an open order's pricebased priority. The floor and 20% fudge keep FIFO as a small component of priority instead of severely penalizing people who ordered early but want just a bit more than average demand. Maintenance orders are a special case and always priced at 0.0 to be processed early. | def get_priority(open_order):
priority = 0.0
if not open_order.maintenance:
order_price = order_prices[open_order.sid]
tab = open_order.tab
owner_total_fulfilled_price = \
total_fulfilled_prices.get(tab.id, 0.0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sort_open_orders_by_price(self,\n open_orders,\n fulfilled_orders):\n priorities_stats = self._compute_order_priorities_stats(\n open_orders + fulfilled_orders)\n median_demand, order_prices, tab_limits, total_fulfill... | [
"0.704593",
"0.6488155",
"0.6295288",
"0.6160808",
"0.6082626",
"0.602238",
"0.6016289",
"0.58993936",
"0.5851355",
"0.58454853",
"0.5840931",
"0.5826296",
"0.58225465",
"0.57819754",
"0.5778246",
"0.57767415",
"0.57418007",
"0.57363963",
"0.5725386",
"0.57253605",
"0.5713836... | 0.79288495 | 0 |
Compute the statistics required to calculate order priorities. | def _compute_order_priorities_stats(self, orders):
order_prices = {}
tab_limits = {}
tab_demands = {}
total_fulfilled_prices = Counter()
valid_statuses = set([Order.STATUS_OPEN, Order.STATUS_FULFILLED])
for order in orders:
if order.status not in valid_status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyse_per_priority(self):\n dm1_total = 0\n dm2_total = 0\n none_total = 0\n dm1_size = []\n dm2_size = []\n none_size = []\n users = []\n pdd = self.chipdata.get_var_strict('$_per_prio_data')\n num_entries = len(pdd.members)\n\n for curre... | [
"0.68234336",
"0.64972305",
"0.6443613",
"0.63312316",
"0.6254689",
"0.5945108",
"0.5911284",
"0.5883312",
"0.5813391",
"0.58116776",
"0.58110833",
"0.5744193",
"0.573082",
"0.5719208",
"0.56675434",
"0.56445605",
"0.5623097",
"0.56221884",
"0.5601727",
"0.55823493",
"0.55689... | 0.7679977 | 0 |
Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. | def max_ones_length(self, array, m):
n = len(array)
i, j = 0, 0 # sliding window indices
curr_ones = 0
max_ones = 0
while j < n:
if array[j]: # current element is 1, increase 1s count
curr_ones += 1
j += 1
max_ones = m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_ones_seq(self, array, m):\n n = len(array)\n i, j = 0, 0 # start, end of current consecutive 1s sequence\n x, y = 0, 0 # start, end of longest consecutive 1s sequence\n while j < n:\n if array[j]: # current element is 1\n if j - i > y - x: # update ... | [
"0.6893887",
"0.65101814",
"0.6407813",
"0.631066",
"0.6254758",
"0.62352514",
"0.6232273",
"0.6207942",
"0.61769855",
"0.61196387",
"0.61055666",
"0.60988253",
"0.60544664",
"0.6033804",
"0.60193837",
"0.5965587",
"0.5893189",
"0.58626795",
"0.5847767",
"0.5819652",
"0.58049... | 0.7667801 | 0 |
Returns indices of longest sequence of consecutive 1s that can be achieved by flipping m 0s. | def max_ones_seq(self, array, m):
n = len(array)
i, j = 0, 0 # start, end of current consecutive 1s sequence
x, y = 0, 0 # start, end of longest consecutive 1s sequence
while j < n:
if array[j]: # current element is 1
if j - i > y - x: # update start, end ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_seq_of_1s(n, index_to_ignore):\n max_ = 0\n counter = 0\n for i in range(SEQ_LENGTH):\n if i == index_to_ignore or get_bit(n, i):\n counter += 1\n max_ = max(counter, max_)\n else:\n counter = 0\n return max_",
"def max_ones_length(self, arra... | [
"0.6979165",
"0.6648837",
"0.6146359",
"0.60105515",
"0.59314334",
"0.5880684",
"0.584108",
"0.58386207",
"0.57824165",
"0.5766266",
"0.5740819",
"0.56680346",
"0.56573284",
"0.562722",
"0.56147873",
"0.561053",
"0.5606155",
"0.560538",
"0.5593764",
"0.5568098",
"0.556361",
... | 0.7318321 | 0 |
Compute cchalf of a function over resolution bins | def cchalf(dataframe, function, bins):
dist = dataframe.set_index(['H', 'K', 'L'])['D'].drop_duplicates()
dmin = dist.min()
dmax = dist.max()
binedges = np.linspace(dmin**-2, dmax**-2, bins+1)**-0.5
binedges = list(zip(binedges[:-1], binedges[1:]))
a,b = split(dataframe)
xval_a, xval_b = fu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cdfFunction(f, x, N):\r\n return ssstats.binom.cdf(x, N, f)",
"def correlation_bins(shred):\n return 0",
"def colfct(self, x):\n for i in xrange(self.anz_seg):\n # find interval which contains x\n if self.xmin[i]<=x<=self.xmax[i]:\n # normalize to [0, 1]\n ... | [
"0.6387757",
"0.6288094",
"0.60831857",
"0.6082385",
"0.604365",
"0.6014291",
"0.59704983",
"0.5904199",
"0.5893589",
"0.587315",
"0.58455086",
"0.58343196",
"0.5834009",
"0.57700086",
"0.57615536",
"0.5759984",
"0.575848",
"0.57362837",
"0.57346606",
"0.57000774",
"0.568298"... | 0.6857753 | 0 |
Aggregate the image metadata from an integration run into a separate dataframe | def image_metadata(dataframe, keys = None):
if keys is None:
keys = [k for k in dataframe.keys() if 'ipm' in k.lower()]
specifically_check = ['Io', 'BEAMX', 'BEAMY', 'Icryst', 'SERIES', 'RUN']
for k in specifically_check:
if k in dataframe:
keys.append(k)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_metadata(self) -> None:\n self.log(\"Extracting metadata.\")\n image_paths: list[Path] = []\n for ext in (\"jpg\", \"jpeg\", \"png\"):\n image_paths.extend(self._base_dir.glob(f\"**/*.{ext}\"))\n image_paths_str = [str(image.relative_to(self._base_dir)) for image... | [
"0.6656725",
"0.6102529",
"0.5949194",
"0.5859919",
"0.58583206",
"0.57422954",
"0.57326746",
"0.5682449",
"0.5663314",
"0.56612027",
"0.564676",
"0.5577625",
"0.5571192",
"0.5527884",
"0.5519806",
"0.5519758",
"0.5479037",
"0.54765713",
"0.54756606",
"0.5443117",
"0.5440707"... | 0.62086684 | 1 |
Write a .jpeg image for each character in the font character set. | def create_images(self):
font = ImageFont.truetype(str(self.font_file), 45, encoding="utf-8")
for letter in self.hebrew.letter_li:
(self.training_folder / letter).mkdir(parents=True, exist_ok=True)
for i in range(len(self.hebrew.font_li)):
letter_path = self.training_fol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, chars, output, format='png'):\n im = self.generate_image(chars)\n return im.save(output, format=format)",
"def img_to_ascii(**kwargs):\n ascii_chars = [ 'b', 'd', 'f', 'r', 'K', 'R', 'A', 'F', 'D', 'L', 'B']\n\n \n \n path = kwargs.get('path')\n font=kwargs.get('font')\n... | [
"0.6859765",
"0.6464529",
"0.6385584",
"0.62492186",
"0.6241094",
"0.6206566",
"0.61844194",
"0.6091356",
"0.6027785",
"0.60202336",
"0.5911846",
"0.5901859",
"0.5869405",
"0.5845161",
"0.58256745",
"0.5822927",
"0.58191985",
"0.5803564",
"0.57912236",
"0.5762809",
"0.5709356... | 0.678149 | 1 |
Repeatedly apply morphing to character images of a font. | def augment_data(self):
for char in self.hebrew.letter_li:
char_path = self.training_folder / char
img = cv.imread(
str((self.training_folder / char / f"{char}_original.jpeg").resolve())
) # read font character
h, w, _ = img.shape # image height ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def applyMorphologicalCleaning(self, image):",
"def startmorph(self):\n cursor_pos = 0\n clrR = QColor(255, 0, 0, 255)\n clrB = QColor(0, 0, 0, 255)\n cursor = self.textEdit_morph.textCursor()\n\n if self.radioButton_image.isChecked():\n self.morph_state[0][0] = self... | [
"0.60066146",
"0.5983302",
"0.5785943",
"0.5766293",
"0.56237286",
"0.56163055",
"0.5562952",
"0.552708",
"0.5524501",
"0.5497708",
"0.5492038",
"0.5345803",
"0.53314066",
"0.53304166",
"0.5306901",
"0.5306537",
"0.528748",
"0.5265406",
"0.52535367",
"0.5235807",
"0.52245575"... | 0.7099706 | 0 |
Plots an explantion of a single prediction as a waterfall plot. The SHAP value of a feature represents the impact of the evidence provided by that feature on the model's output. The waterfall plot is designed to visually display how the SHAP values (evidence) of each feature move the model output from our prior expecta... | def wfall(shap_values, max_display=10, show=True):
dark_o= mpl.colors.to_rgb('dimgray')
dim_g= mpl.colors.to_rgb('darkorange')
base_values = shap_values.base_values
features = shap_values.data
feature_names = shap_values.feature_names
lower_bounds = getattr(shap_values, "lower_bounds", Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waterfall(shap_values, max_display=10, show=True, y_reverse=False, rank_absolute=True, raw_ascending=True):\n # Turn off interactive plot\n if show is False:\n plt.ioff()\n\n base_values = shap_values.base_values\n features = shap_values.display_data if shap_values.display_data is not None e... | [
"0.75429845",
"0.6488294",
"0.594002",
"0.5885582",
"0.5786359",
"0.57558745",
"0.57261145",
"0.54675704",
"0.5397909",
"0.5311824",
"0.5300442",
"0.5288463",
"0.5284333",
"0.52532196",
"0.524341",
"0.5239114",
"0.52311605",
"0.5230331",
"0.52274936",
"0.5216817",
"0.51673377... | 0.7552447 | 0 |
coming_up() returns false for event whose event_date is more than 2 days ago. | def test_coming_up_two_days_past(self):
time = timezone.now() + datetime.timedelta(days=-2)
tomorrow_event = Event(event_date=time)
self.assertIs(tomorrow_event.coming_up(), False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_coming_up_one_day_past(self):\n time = timezone.now() + datetime.timedelta(days=-1, hours=-1)\n tomorrow_event = Event(event_date=time)\n self.assertIs(tomorrow_event.coming_up(), False)",
"def test_coming_up_seven_days_until(self):\n time = timezone.now() + datetime.timedelt... | [
"0.762766",
"0.7625201",
"0.75764257",
"0.74357736",
"0.728246",
"0.7177838",
"0.6640359",
"0.65865034",
"0.65504026",
"0.65462446",
"0.65177923",
"0.6206658",
"0.6151112",
"0.607829",
"0.6053867",
"0.60537565",
"0.60498893",
"0.6033766",
"0.6014222",
"0.59207",
"0.590429",
... | 0.8068123 | 0 |
coming_up() returns false for event whose event_date is more than 7 days in the future. | def test_coming_up_seven_days_until(self):
time = timezone.now() + datetime.timedelta(days=10)
event = Event(event_date=time)
self.assertIs(event.coming_up(), False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_coming_up_seven_days_past(self):\n time = timezone.now() + datetime.timedelta(days=-7)\n tomorrow_event = Event(event_date=time)\n self.assertIs(tomorrow_event.coming_up(), False)",
"def test_coming_up_one_day_past(self):\n time = timezone.now() + datetime.timedelta(days=-1, ... | [
"0.8148623",
"0.7653311",
"0.7554201",
"0.7468266",
"0.74681044",
"0.7382703",
"0.66987747",
"0.6370789",
"0.6319554",
"0.63135624",
"0.6278618",
"0.6153979",
"0.6141238",
"0.6093789",
"0.606227",
"0.60470486",
"0.60265756",
"0.60035163",
"0.5997401",
"0.59239984",
"0.5902729... | 0.8249643 | 0 |
coming_up() returns false for event whose event_date is more than 1 day ago. | def test_coming_up_one_day_past(self):
time = timezone.now() + datetime.timedelta(days=-1, hours=-1)
tomorrow_event = Event(event_date=time)
self.assertIs(tomorrow_event.coming_up(), False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_coming_up_seven_days_until(self):\n time = timezone.now() + datetime.timedelta(days=10)\n event = Event(event_date=time)\n self.assertIs(event.coming_up(), False)",
"def test_coming_up_lt_one_dat_past(self):\n time = timezone.now() + datetime.timedelta(days=-1, hours=1)\n ... | [
"0.7846603",
"0.7821566",
"0.7812403",
"0.78072834",
"0.7714356",
"0.76410115",
"0.7024043",
"0.6957371",
"0.6620368",
"0.65947145",
"0.657569",
"0.64715207",
"0.6382975",
"0.6311791",
"0.6269978",
"0.6213732",
"0.6213166",
"0.618987",
"0.6187144",
"0.6139289",
"0.6123987",
... | 0.80431724 | 0 |
coming_up() returns false for event whose event_date is more than 7 days ago. | def test_coming_up_seven_days_past(self):
time = timezone.now() + datetime.timedelta(days=-7)
tomorrow_event = Event(event_date=time)
self.assertIs(tomorrow_event.coming_up(), False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_coming_up_seven_days_until(self):\n time = timezone.now() + datetime.timedelta(days=10)\n event = Event(event_date=time)\n self.assertIs(event.coming_up(), False)",
"def test_coming_up_one_day_past(self):\n time = timezone.now() + datetime.timedelta(days=-1, hours=-1)\n ... | [
"0.82002",
"0.76431745",
"0.75249463",
"0.7492997",
"0.74103093",
"0.7277739",
"0.66175056",
"0.6509838",
"0.64736384",
"0.6336823",
"0.62860835",
"0.6249254",
"0.6131607",
"0.6104379",
"0.61001396",
"0.6087395",
"0.59814036",
"0.5964934",
"0.5945831",
"0.5944156",
"0.5917056... | 0.81731856 | 1 |
when a user is added to another user's friends it choudl be symmetrical | def test_friends_symmetrical(self):
u = AppUser(id = 1)
u.django_user = User.objects.create(username='Testuser')
u.save()
f = AppUser(id = 2)
f.django_user = User.objects.create(username='Testuser2')
f.save()
u.friends.add(f)
self.assertIs(u in f.friends.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_requested_friends_asymmetrical(self):\n u = AppUser(id = 1)\n u.django_user = User.objects.create(username='Testuser')\n u.save()\n f = AppUser(id = 2)\n f.django_user = User.objects.create(username='Testuser2')\n f.save()\n \n f.requested_friends.ad... | [
"0.76149416",
"0.7285686",
"0.7139211",
"0.6939368",
"0.6939368",
"0.6939368",
"0.68677807",
"0.68303233",
"0.6826258",
"0.67173105",
"0.6652495",
"0.65613484",
"0.65613484",
"0.65308964",
"0.64700794",
"0.64370733",
"0.63776004",
"0.63748425",
"0.63141555",
"0.6207134",
"0.6... | 0.76746625 | 0 |
when a user is added to another user's requested friends, it should not be symmetrical | def test_requested_friends_asymmetrical(self):
u = AppUser(id = 1)
u.django_user = User.objects.create(username='Testuser')
u.save()
f = AppUser(id = 2)
f.django_user = User.objects.create(username='Testuser2')
f.save()
f.requested_friends.add(u)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_friends_symmetrical(self):\n u = AppUser(id = 1)\n u.django_user = User.objects.create(username='Testuser')\n u.save()\n f = AppUser(id = 2)\n f.django_user = User.objects.create(username='Testuser2')\n f.save()\n\n u.friends.add(f)\n self.assertIs(u... | [
"0.7518013",
"0.72528183",
"0.72003794",
"0.71052116",
"0.71052116",
"0.71052116",
"0.6914747",
"0.68687415",
"0.6846159",
"0.6767714",
"0.6767714",
"0.675642",
"0.6689466",
"0.6665915",
"0.66377425",
"0.66270375",
"0.6615423",
"0.649321",
"0.6407449",
"0.64051676",
"0.636605... | 0.7956926 | 0 |
Find all Android.mk under dirpath | def find_android_mk(dirpath):
result = []
for (root, dirnames, filenames) in os.walk(dirpath):
for file_name in filenames:
if file_name.upper() == "ANDROID.MK":
result.append(os.path.join(root, file_name))
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_archs(kdir):\n archs = []\n arch_dir = '{0}/arch'.format(kdir)\n for arch in os.listdir(arch_dir):\n full_path = '{0}/{1}'.format(arch_dir, arch)\n if os.path.isdir(full_path):\n archs.append(arch)\n return archs",
"def find_build_dir(hw, r):\n os.chdir(hw)\n find_... | [
"0.5763226",
"0.54093915",
"0.5371048",
"0.5363172",
"0.53142184",
"0.5247495",
"0.5167386",
"0.5134581",
"0.5062873",
"0.50331354",
"0.4998593",
"0.49700207",
"0.49476817",
"0.4943611",
"0.4939321",
"0.49350196",
"0.49345618",
"0.49305654",
"0.48867127",
"0.48849607",
"0.487... | 0.7916674 | 0 |
Add a module that current module depends on A dependent module is defined by a LOCAL_STATIC_LIBRARIES or LOCAL_SHARED_LIBRARIES | def add_depend_module(self, module):
self.depends.append(module) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addExternalDependency(self, mods):\n for modname in mods:\n # if one adds a dependency that is found in optional modules\n # change it from optional to external\n if( modname in self.optmodules ):\n self.buildWithout([modname])\n\n # if one adds... | [
"0.68014795",
"0.65886223",
"0.6574054",
"0.644146",
"0.6044032",
"0.5976168",
"0.58847",
"0.5723679",
"0.5591653",
"0.5546661",
"0.5501792",
"0.54732645",
"0.54397476",
"0.54304147",
"0.5411216",
"0.5386366",
"0.5354493",
"0.5315326",
"0.529837",
"0.5298174",
"0.52964526",
... | 0.69594836 | 0 |
Add a module to the pool | def add_module(self, module):
if module.name not in self.pool:
self.pool[module.name] = module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_pool ( self, pool ):\n self._pool_id += 1\n try:\n self._poolstack.append ( pool )\n except:\n self._pool_id -= 1\n raise\n\n self._update_resolver()",
"def register_pooling(key, module):\n register(key, module, pooling_dict)",
"def addModule(self, name):... | [
"0.70122206",
"0.70063007",
"0.69624376",
"0.6786196",
"0.67693245",
"0.67139685",
"0.6634249",
"0.65702987",
"0.6261229",
"0.6245648",
"0.6133845",
"0.61204356",
"0.6086922",
"0.6065079",
"0.60145545",
"0.59754914",
"0.5956861",
"0.59457874",
"0.5940898",
"0.5935046",
"0.583... | 0.8778162 | 0 |
Helper routine for 'find_bad_zeros'. This operates upon a single dataframe produced by 'groupby'. We expect an additional column 'meter_id' which is a duplicate of 'meter' because groupby eliminates the original one. | def make_is_bad_zero(Xy_subset, min_interval=48,summer_month_start = 5,summer_month_end = 8):
meter = Xy_subset.meter_id.iloc[0]
is_zero = Xy_subset.meter_reading == 0
if meter == 0:
# Electrical meters should never be zero. Keep all zero-readings in this table so that
# they will all be dro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_bad_zeros(df : pd.DataFrame, y):\n Xy = df.assign(meter_reading=y, meter_id=df.meter)\n is_bad_zero = Xy.groupby([\"building_id\", \"meter\"]).apply(make_is_bad_zero)\n return is_bad_zero[is_bad_zero].index.droplevel([0, 1])",
"def find_bad_building1099(df : pd.DataFrame, y):\n return df[(df... | [
"0.7847698",
"0.5478215",
"0.51488006",
"0.5016223",
"0.50017387",
"0.49610132",
"0.49375772",
"0.49336025",
"0.48981208",
"0.48355094",
"0.47869137",
"0.4758842",
"0.4715291",
"0.4688432",
"0.46801785",
"0.4630348",
"0.4628824",
"0.46280947",
"0.46110505",
"0.46032372",
"0.4... | 0.58906925 | 1 |
Returns indices of bad rows (with absurdly high readings) from building 1099. | def find_bad_building1099(df : pd.DataFrame, y):
return df[(df.building_id == 1099) & (df.meter == 2) & (y > 3e4)].index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_invalid_rows(rows):\n\n invalid_row_indices = []\n for i, row in enumerate(rows):\n is_valid, col_id = is_row_well_formatted(row)\n if not is_valid:\n invalid_row_indices.append((i, col_id))\n\n return invalid_row_indices",
"def find_bad_zeros(df : pd.DataFrame, y):\n ... | [
"0.6372683",
"0.5847993",
"0.58163613",
"0.5712987",
"0.57086277",
"0.5675514",
"0.5631074",
"0.55058837",
"0.5444953",
"0.5429496",
"0.54250795",
"0.5417753",
"0.54119563",
"0.53947705",
"0.5358459",
"0.5345951",
"0.53214365",
"0.5304924",
"0.5300727",
"0.5296954",
"0.528590... | 0.67571837 | 0 |
Trim some outliers readings from specified sites | def trim_site(df : pd.DataFrame) -> pd.DataFrame:
df.loc[df.site_id == 6,'meter_reading'] = np.clip(df.loc[df.site_id == 6,'meter_reading'],a_min=0,a_max=1.9e5)
df.loc[(df.primary_use == 'Education') &(df.site_id == 13),'meter_reading'] = np.clip(df.loc[(df.primary_use == 'Education') &(df.site_id == 13),'mete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_outliers(data):\n upper_boundary = np.quantile(data, 0.992)\n lower_boundary = np.quantile(data, 0.008)\n selection = data[(data > lower_boundary) & (data < upper_boundary)]\n standard_dev = np.std(selection)\n median = np.median(selection)\n data[(median + 4.5 * standard_dev < data) |... | [
"0.67543423",
"0.6571936",
"0.64495254",
"0.6443208",
"0.64402384",
"0.6416144",
"0.6389424",
"0.6328406",
"0.6282972",
"0.6278256",
"0.6230398",
"0.62217075",
"0.619615",
"0.61903083",
"0.6177258",
"0.61731714",
"0.6173103",
"0.61611265",
"0.6158626",
"0.6132621",
"0.6129153... | 0.68785924 | 0 |
Fill NaN values with respect to mean of its own column | def filling_nan_values(df: pd.DataFrame) -> pd.DataFrame:
ratio = df.count()/len(df)
cols = ratio[ratio < 1].index
for col in cols:
print(f"Filling Column:{col}")
df[col] = df[col].fillna(df[col].mean())
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_mean(df):\n df = df.fillna(df.mean().fillna(0).to_dict())\n return df",
"def mean_impute(self, column_val):\n mean = np.mean(column_val)\n column_val = column_val.fillna(mean)\n return column_val",
"def fill_with_group_average(df, group, column):\r\n #df=None\r\n df[co... | [
"0.8125276",
"0.7587665",
"0.75541764",
"0.74173355",
"0.73173165",
"0.72306746",
"0.70660305",
"0.6994226",
"0.6994226",
"0.69728667",
"0.69485354",
"0.67343813",
"0.6701985",
"0.66185844",
"0.65464234",
"0.6533651",
"0.6525364",
"0.6509862",
"0.64980525",
"0.64164865",
"0.6... | 0.79082817 | 1 |
plot the results of budget analysis | def plot_budget_analyais_results(df, fs=8, fs_title=14, lw=3, fontsize=20, colors=['#AA3377', '#009988', '#EE7733', '#0077BB', '#BBBBBB', '#EE3377', '#DDCC77']):
df_decomposed = df.loc[df['block'] == 'decomposed']
df_joint = df.loc[df['block'] == 'joint']
ticklabels = []
num_sweeps = df_decomposed['num_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_results(self):\n #get data\n new_df = self.solution.groupby('supplier').sum()\n new_df['count'] = self.solution.groupby('supplier').supplier.count()\n new_df = new_df.sort_values(by=['count'], ascending = False)\n \n #plotting \n ax = new_df.plot.bar(second... | [
"0.6441302",
"0.643619",
"0.6412584",
"0.63093454",
"0.6301961",
"0.62443256",
"0.623567",
"0.6186577",
"0.6175985",
"0.61526716",
"0.6135732",
"0.61080295",
"0.610679",
"0.6103491",
"0.6087276",
"0.6073608",
"0.60567075",
"0.60313046",
"0.6018025",
"0.5990412",
"0.59825087",... | 0.6609281 | 0 |
visualize the samples along the sweeps | def viz_samples(data, trace, num_sweeps, K, viz_interval=3, figure_size=3, title_fontsize=20, marker_size=1.0, opacity=0.3, bound=20, colors=['#AA3377','#0077BB', '#EE7733', '#009988', '#BBBBBB', '#EE3377', '#DDCC77'], save_name=None):
E_tau, E_mu, E_z = trace['E_tau'].cpu(), trace['E_mu'].cpu(), trace['E_z'].cpu()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_and_plot(self):\n fig = plt.figure()\n ax = plt.axes(projection = '3d')\n ax.plot_surface(self.X, self.Y, self.sample(), cmap = plt.cm.jet, rstride = 2, cstride = 2, linewidth = 1)\n plt.show()",
"def show_data(self, samples=5):\n self._samples = samples\n ... | [
"0.68361515",
"0.6737333",
"0.6675007",
"0.66607934",
"0.6647686",
"0.63957226",
"0.63925797",
"0.63518846",
"0.6333047",
"0.6294461",
"0.62597936",
"0.6259562",
"0.6245345",
"0.62292916",
"0.619693",
"0.6185343",
"0.61714333",
"0.61702764",
"0.6152748",
"0.61445093",
"0.6139... | 0.7096492 | 0 |
Return all lanes from origin > destination | def get_lanes(self, origin: str, destination: str) -> List[AbstractLane]:
return list(self.graph[origin][destination].values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_floors(self):\r\n return self.destinations",
"def get_destination_bool_list(self):\r\n destinations = []\r\n\r\n for floor in range(self.min_floor, self.max_floor + 1):\r\n if floor in self.destinations:\r\n destinations.append(True)\r\n e... | [
"0.6837783",
"0.6416192",
"0.608846",
"0.6061502",
"0.6038717",
"0.602981",
"0.6024143",
"0.6007663",
"0.59894925",
"0.597376",
"0.59308785",
"0.5902937",
"0.586856",
"0.5848742",
"0.58485955",
"0.58456373",
"0.5837731",
"0.5805117",
"0.5796703",
"0.57656074",
"0.5761677",
... | 0.73163944 | 0 |
Get the lane geometry corresponding to a given index in the road_network network. | def get_lane(self, index: LaneIndex) -> Optional[AbstractLane]:
o, d, i = index
try:
return self.graph[o][d][i]
except KeyError:
if i is None and len(self.graph[o][d]) == 1:
return list(self.graph[o][d].values())[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start(network, road_id):\n return network[0][road_id][0]",
"def get_speed(network, road_id):\n return network[0][road_id][3]",
"def get_lane(self):\n return self.lane",
"def get_length(network, road_id):\n return network[0][road_id][2]",
"def from_road(\n cls,\n road_id: str... | [
"0.5562059",
"0.5291774",
"0.5234415",
"0.5215976",
"0.5121749",
"0.5067551",
"0.4942661",
"0.49056548",
"0.48472506",
"0.48393336",
"0.483635",
"0.47798848",
"0.47721452",
"0.47636837",
"0.4763161",
"0.4762479",
"0.47502688",
"0.47472808",
"0.47154695",
"0.4694995",
"0.46944... | 0.64556396 | 0 |
Returns the lane that is closest to the given cars current position | def get_closest_lane(self, car: Car) -> AbstractLane:
pos = car.position
lanes = self.upstream_lane_list if car.lane.upstream else self.downstream_lane_list
return min(lanes, key=lambda l: l.distance(pos)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_closest_waypoint_idx(self):\n\n # Position\n x = self.car_pose.pose.position.x\n y = self.car_pose.pose.position.y\n closest_idx = self.waypoint_tree.query([x, y], 1)[1]\n\n # Coordinates\n closest_coord = self.waypoints_2d[closest_idx]\n prev_coord = self.w... | [
"0.7061694",
"0.69426876",
"0.6906088",
"0.67814636",
"0.65129054",
"0.64891684",
"0.6473377",
"0.6447523",
"0.6422363",
"0.6403858",
"0.6336842",
"0.63275343",
"0.6274098",
"0.6223115",
"0.62109077",
"0.61967826",
"0.6183382",
"0.61756",
"0.6172152",
"0.6168604",
"0.6167646"... | 0.82646704 | 0 |
Returns lanes to left and right of given lane | def side_lanes(self, lane: "AbstractLane", x_pos=None) -> List[AbstractLane]:
if lane.is_offramp:
return []
lanes = []
o, d, i = lane.index
right_o, right_d, right_i = o, d, i + 1
left_o, left_d, left_i = o, d, i - 1
upstream = lane.upstream
if i =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_right_and_left_lanelet(self): \n if self.scenario is not None:\n possible_lanelet_ids = self.scenario.lanelet_network.find_lanelet_by_position([np.array(list(self.current_pos))])[0]\n self.current_lanelet = None\n self.right_lanelet = None\n self.left_l... | [
"0.7278354",
"0.666985",
"0.61193",
"0.60302114",
"0.6029851",
"0.6000256",
"0.5946578",
"0.5798555",
"0.5761168",
"0.5751177",
"0.56764525",
"0.56606615",
"0.56147474",
"0.5590975",
"0.55684423",
"0.5549523",
"0.55449927",
"0.5530483",
"0.5521365",
"0.5511419",
"0.54823583",... | 0.70721513 | 1 |
Get the absolute position and heading along a route composed of several lanes at some local coordinates. | def position_heading_along_route(self, route: Route, longitudinal: float, lateral: float) \
-> Tuple[np.ndarray, float]:
while len(route) > 1 and longitudinal > self.get_lane(route[0]).length:
longitudinal -= self.get_lane(route[0]).length
route = route[1:]
lane = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_info(self, route):\r\n total_distance = 0\r\n cost_mult = 0.35\r\n cost = 0\r\n time = 0\r\n if route[0] in self.edges:\r\n for i in range(len(route) - 1):\r\n for edge in self.edges[route[i]]:\r\n if edge.destination == rout... | [
"0.56592906",
"0.5552669",
"0.54638463",
"0.53784215",
"0.53739697",
"0.53518784",
"0.5349987",
"0.5331288",
"0.5316443",
"0.5305487",
"0.52977824",
"0.52928746",
"0.52802086",
"0.52736473",
"0.52617115",
"0.5227609",
"0.52105176",
"0.5205379",
"0.51914",
"0.5172299",
"0.5161... | 0.71304905 | 0 |
Iterate through every lane in the graph | def __iter__(self) -> Iterable["AbstractLane"]:
for origin in self.graph:
for destination in self.graph[origin]:
for index, lane in self.graph[origin][destination].items():
yield lane | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iteredges(self):\n for source, targets in self.successors.items():\n for target in targets:\n yield source, target",
"def iter_node(self,i):\n nd = self.nodes[i]\n for kn in nd.get_close():\n # for kn in nd.get_known():\n # for kn in nd.neighbours:... | [
"0.6316119",
"0.6182507",
"0.6003868",
"0.5988994",
"0.5785477",
"0.57659775",
"0.57628006",
"0.57533664",
"0.57533664",
"0.57533664",
"0.56844",
"0.56843925",
"0.56597424",
"0.5656894",
"0.56275016",
"0.5622235",
"0.55965596",
"0.55960184",
"0.55773723",
"0.5564902",
"0.5548... | 0.7644985 | 0 |
Return MySensors devices for a platform. | def get_mysensors_devices(hass, domain):
if MYSENSORS_PLATFORM_DEVICES.format(domain) not in hass.data:
hass.data[MYSENSORS_PLATFORM_DEVICES.format(domain)] = {}
return hass.data[MYSENSORS_PLATFORM_DEVICES.format(domain)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_devices(self):\n return self.api_request('GET', self.url + '/device', {})",
"def get_devices(self):\n devices = self.get(\"event/device\")",
"def get_devices(self):\n return get_devices(self.api_key)",
"def get_devices():\n devices = []\n for device_id in range(pm.lib.Pm_Co... | [
"0.68569696",
"0.6679099",
"0.66768116",
"0.66325873",
"0.66100585",
"0.64867175",
"0.64808327",
"0.64228743",
"0.64004874",
"0.63938224",
"0.63351697",
"0.62933505",
"0.6269824",
"0.62601966",
"0.6258197",
"0.62559813",
"0.61981905",
"0.61654925",
"0.6144452",
"0.6132",
"0.6... | 0.72125417 | 0 |
Search for similar posts for given post and add assigns them to dataset. | def add_similar_posts(post):
t = 0
# infinite while loop provides a possibility to retry search for more times in case of error
while True:
t += 1
try:
similar_posts_search = Post.search().filter("term", post_type=1).filter("term", page=post.page).exclude("term", is_in_ds=True).q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_similar_posts(slice_idx):\n global part\n main_posts_in_ds_search = Post.search().filter(\"term\", post_type=1).filter(\"term\", ds_item_role=0).filter(\"term\", is_in_ds=True).params(scroll=\"1440m\")\n main_posts_in_ds_search = main_posts_in_ds_search.extra(slice={\"id\": part * PARALLEL_SLI... | [
"0.66122675",
"0.614841",
"0.5544174",
"0.54480326",
"0.53945965",
"0.5385072",
"0.53645724",
"0.52937025",
"0.5278152",
"0.5148001",
"0.5097731",
"0.50940573",
"0.5057342",
"0.50529534",
"0.5039504",
"0.5038117",
"0.50194675",
"0.50169235",
"0.50152695",
"0.50127894",
"0.497... | 0.77006567 | 0 |
Add all given duplicate posts to the dataset into given DS group number | def add_duplicates_into_ds(duplicates, group_nr):
for duplicate in duplicates:
add_post_into_ds(duplicate, group_nr, DS_DUPLICATE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_main_post_into_ds(post):\n global ds_size\n if post is not None and not post.is_in_ds:\n duplicates = find_all_duplicates_for_post(post)\n if (len(duplicates)) > 0:\n add_post_into_ds(post, ds_size, DS_MAIN_POST)\n add_duplicates_into_ds(duplicates, ds_size)\n ... | [
"0.6759946",
"0.6186227",
"0.6092438",
"0.563832",
"0.5423488",
"0.5396405",
"0.5298581",
"0.5280868",
"0.5276795",
"0.52658087",
"0.52515924",
"0.51031435",
"0.5095523",
"0.50684834",
"0.499911",
"0.49759316",
"0.49666578",
"0.4944382",
"0.4942442",
"0.49409768",
"0.49399912... | 0.7790309 | 0 |
Searches for all duplicates of given post in the whole dataset. Since the function searches for transitive relations as well, it is necessary to define the maximum recursion depth (MAX_DUPLICATE_RECURSION_DEPTH) where duplicates are going to be searched for. | def find_all_duplicates_for_post(post, recursion_depth=0):
if recursion_depth > MAX_DUPLICATE_RECURSION_DEPTH:
return []
duplicates_result = []
duplicates_search = PostLink.search().filter("term", link_type=3).filter("term", post_ID=post.post_ID).filter("term", page=post.page)
duplicate_links ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_similar_posts(post):\n t = 0\n # infinite while loop provides a possibility to retry search for more times in case of error\n while True:\n t += 1\n try:\n similar_posts_search = Post.search().filter(\"term\", post_type=1).filter(\"term\", page=post.page).exclude(\"term\",... | [
"0.6140078",
"0.5686703",
"0.52428836",
"0.52421385",
"0.51868016",
"0.5130797",
"0.51256514",
"0.5106996",
"0.5095837",
"0.50573856",
"0.5054639",
"0.504398",
"0.50285757",
"0.5003089",
"0.4975157",
"0.49411562",
"0.49254417",
"0.49214733",
"0.49057597",
"0.49054658",
"0.490... | 0.8165918 | 0 |
Add the given post and it's duplicates into dataset | def add_main_post_into_ds(post):
global ds_size
if post is not None and not post.is_in_ds:
duplicates = find_all_duplicates_for_post(post)
if (len(duplicates)) > 0:
add_post_into_ds(post, ds_size, DS_MAIN_POST)
add_duplicates_into_ds(duplicates, ds_size)
ds_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_similar_posts(post):\n t = 0\n # infinite while loop provides a possibility to retry search for more times in case of error\n while True:\n t += 1\n try:\n similar_posts_search = Post.search().filter(\"term\", post_type=1).filter(\"term\", page=post.page).exclude(\"term\",... | [
"0.65634674",
"0.61040473",
"0.58139896",
"0.55208975",
"0.55101025",
"0.54462475",
"0.541581",
"0.541004",
"0.5366051",
"0.53590244",
"0.5358564",
"0.53563",
"0.5354371",
"0.5306628",
"0.53019595",
"0.52814966",
"0.52765554",
"0.5250513",
"0.5246981",
"0.52373797",
"0.522058... | 0.7050733 | 0 |
Add given post into dataset and assigns it to given dataset group with given ds item role (main/duplicate/similar/different). | def add_post_into_ds(post, ds_group, ds_item_role):
post.ds_group = ds_group
post.ds_item_role = ds_item_role
post.is_in_ds = True
post.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_postre(self, post_course):\n self.postre[post_course.get_course_id()] = post_course",
"def add_post(self, post: Post) -> None:\n self.post_process.append(post)",
"def add_main_post_into_ds(post):\n global ds_size\n if post is not None and not post.is_in_ds:\n duplicates = ... | [
"0.61856025",
"0.6074312",
"0.60511315",
"0.5796579",
"0.57553005",
"0.55577093",
"0.55200565",
"0.5481873",
"0.5444735",
"0.54320204",
"0.53213024",
"0.5312544",
"0.5312544",
"0.53064585",
"0.52849835",
"0.52665675",
"0.52627647",
"0.5262167",
"0.52265656",
"0.52171093",
"0.... | 0.8479265 | 0 |
Process given slice of similar posts in the dataset search for similarities and assign the into ds. | def process_similar_posts(slice_idx):
global part
main_posts_in_ds_search = Post.search().filter("term", post_type=1).filter("term", ds_item_role=0).filter("term", is_in_ds=True).params(scroll="1440m")
main_posts_in_ds_search = main_posts_in_ds_search.extra(slice={"id": part * PARALLEL_SLICES + slice_idx, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_similar_posts(post):\n t = 0\n # infinite while loop provides a possibility to retry search for more times in case of error\n while True:\n t += 1\n try:\n similar_posts_search = Post.search().filter(\"term\", post_type=1).filter(\"term\", page=post.page).exclude(\"term\",... | [
"0.5966078",
"0.5394834",
"0.5264691",
"0.511117",
"0.51077896",
"0.5074714",
"0.496906",
"0.49686676",
"0.49365717",
"0.4916166",
"0.48817647",
"0.48807493",
"0.4877699",
"0.48617667",
"0.48364544",
"0.48295683",
"0.48181862",
"0.4817176",
"0.48113933",
"0.48093402",
"0.4808... | 0.72559017 | 0 |
Inserts and gets exposure and night if necessary. | def insert_exposure(
self, expid, night, telra=None, teldec=None,
tile=None, dateobs=None, flavor=None, exptime=None
):
# Check if expid is already registered
if not Exposure.objects.filter(exposure_id=expid):
exposure = Exposure(
exposure_id=expi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_exposure(self, expstart, number):\n\n index_number = number - 1 # for zero indexing\n\n filename = '{:04d}_raw.fits'.format(number)\n\n exp_gen = ExposureGenerator(self.detector, self.grism, self.NSAMP,\n self.SAMPSEQ, self.SUBARRAY,\n ... | [
"0.5672643",
"0.5491056",
"0.5472256",
"0.5437883",
"0.53866726",
"0.530296",
"0.5192331",
"0.51650876",
"0.515939",
"0.5042749",
"0.5035688",
"0.5029678",
"0.50065887",
"0.49907067",
"0.49876213",
"0.49672928",
"0.49617288",
"0.49491733",
"0.49381182",
"0.4929297",
"0.491999... | 0.7123694 | 0 |
Insert job and camera if necessary. | def insert_job(self, process_id, camera, start, logname, version='1.0'):
camera = self.insert_camera(camera)
job = Job(
process_id=process_id,
camera_id=camera,
start=start,
logname=logname,
version=version
)
job.save()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill(self):\n\n self.db.batch_insert_camera_from_api()",
"def register_job(self, job):\n self.job = job",
"def insert_job(sess, filetype, status, type_id, submission, job_id=None, filename=None,\n file_size=None, num_rows=None):\n job = Job(\n file_type_id=... | [
"0.62880826",
"0.57561755",
"0.5561151",
"0.555651",
"0.5531252",
"0.54754514",
"0.5469053",
"0.5403571",
"0.53810406",
"0.53725356",
"0.53377956",
"0.5320554",
"0.52909607",
"0.52840847",
"0.52804136",
"0.52668285",
"0.52586067",
"0.52491367",
"0.5237247",
"0.5223192",
"0.51... | 0.68304765 | 0 |
Gets Process using process_id | def get_process_by_process_id(self, process_id):
try:
process = Process.objects.get(pk=process_id)
except Process.DoesNotExist:
process = None
return process | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_process(self, pid):\n return self.processes.get(pid, None)",
"def get_process_object(pid, die=True):\n try:\n return psutil.Process(pid)\n except psutil.NoSuchProcess as e:\n if die:\n raise e\n else:\n return None",
"def get_my_process():\n re... | [
"0.8290559",
"0.72341645",
"0.7107103",
"0.70217097",
"0.6914625",
"0.68333167",
"0.68333167",
"0.67466384",
"0.6700509",
"0.6613847",
"0.66125506",
"0.6609235",
"0.6601116",
"0.65918016",
"0.6483107",
"0.64814293",
"0.6465647",
"0.64625174",
"0.6328448",
"0.6324513",
"0.6301... | 0.85268074 | 0 |
Gets process object by expid | def get_expid_in_process(self, expid):
return Process.objects.filter(exposure_id=expid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_process(self, pid):\n return self.processes.get(pid, None)",
"def get_process_object(pid, die=True):\n try:\n return psutil.Process(pid)\n except psutil.NoSuchProcess as e:\n if die:\n raise e\n else:\n return None",
"def get_process_by_process_id... | [
"0.7075181",
"0.69125867",
"0.67851424",
"0.67524797",
"0.5991037",
"0.5978255",
"0.59189427",
"0.5846065",
"0.5754799",
"0.57009786",
"0.5678404",
"0.5678404",
"0.5655324",
"0.56435716",
"0.5642641",
"0.5636066",
"0.5625719",
"0.56222534",
"0.56222534",
"0.561779",
"0.560962... | 0.79926956 | 0 |
Delete by exposure id | def delete_exposure(self, expid):
Exposure.objects.filter(exposure_id=expid).delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, _id):",
"def delete(self, req, id):\n context = None\n try:\n db_api.image_destroy(context, id)\n except exception.NotFound:\n return exc.HTTPNotFound()",
"def delete(self, id):\n raise NotImplementedError",
"def delete(self, expense_id):\n ... | [
"0.72957754",
"0.6862971",
"0.6778349",
"0.6644676",
"0.662393",
"0.66158587",
"0.65863407",
"0.6567307",
"0.6510809",
"0.65033597",
"0.64867663",
"0.6434894",
"0.64288247",
"0.64288247",
"0.64288247",
"0.64288247",
"0.64288247",
"0.64238656",
"0.6399355",
"0.6317964",
"0.630... | 0.811407 | 0 |
Definine sigma levels. For more information, please visit the website of ECMWF. Since there are 60 model levels, there are 61 half levels, so it is for A and B values. | def defineSigmaLevels():
# A and B values for the definition of sigma levelist
# Since there are 72 model levels, there are 73 half levels, so it is for A and B values
# the unit of A is hPa!!!!!!!!!!!!
# from surface to TOA
A = np.array([
0.000000e+00, 4.804826... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nice_sigma_levels(im, sigs=[1, 2, 3]):\n V = 1.0 - np.exp(-0.5 * np.array(sigs) ** 2)\n Hflat = im.flatten()\n inds = np.argsort(Hflat)[::-1]\n Hflat = Hflat[inds]\n sm = np.cumsum(Hflat)\n sm /= sm[-1]\n\n for i, v0 in enumerate(V):\n try:\n ... | [
"0.6472334",
"0.6344654",
"0.61129016",
"0.608467",
"0.6055449",
"0.59758246",
"0.59516245",
"0.59214205",
"0.5884365",
"0.5867825",
"0.5852346",
"0.5819451",
"0.58126694",
"0.5810049",
"0.5797689",
"0.5767603",
"0.57548386",
"0.5673804",
"0.5673203",
"0.566542",
"0.56601393"... | 0.82711655 | 0 |
Calculate geopotential on sigma levels. The method is given in ECMWF IFS 9220, from section 2.20 2.23. | def calc_gz(self, var_key):
logging.info("Start the computation of geopotential on model level.")
# call the function to generate contants
constant = self.setConstants()
# define sigma level
A, B = self.defineSigmaLevels()
# extract variables
T = var_key.va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defineSigmaLevels():\r\n # A and B values for the definition of sigma levelist\r\n # Since there are 72 model levels, there are 73 half levels, so it is for A and B values\r\n # the unit of A is hPa!!!!!!!!!!!!\r\n # from surface to TOA\r\n A = np.array([\r\n 0.000... | [
"0.5999392",
"0.5809234",
"0.57480246",
"0.56042504",
"0.5603348",
"0.5599668",
"0.5571877",
"0.55435854",
"0.55012757",
"0.5479915",
"0.54791987",
"0.5461513",
"0.5451372",
"0.5447715",
"0.54377466",
"0.5419909",
"0.5409579",
"0.5372026",
"0.53661907",
"0.5358142",
"0.534008... | 0.6471554 | 0 |
Creates validatable test set from given XML path. Validates contents from XML file against valitest XSD schema. | def __init__(self, xml_path):
# Load XSD schema for document validation
self.__schema = xmlschema.XMLSchema('valitest.xsd')
try:
self.__schema.validate(xml_path)
self.__xmldoc = xml.etree.ElementTree.parse(xml_path)
self.__xml_path = basename(xml_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_does_validate_valid_xml_file(self):\n xml_file = join(\n getcwd(), 'testdata', 'newstest2019-defr-src-ts.de.FIXED.xml'\n )\n doc = valitest.ValidatableTestSet(xml_file)\n self.assertEqual(doc.setid, \"newstest2019\")\n self.assertEqual(doc.srclang, \"any\")",
... | [
"0.6964036",
"0.59044886",
"0.585947",
"0.58230215",
"0.5658123",
"0.56389606",
"0.5631872",
"0.5598888",
"0.55694276",
"0.5560271",
"0.55295485",
"0.55163157",
"0.5504027",
"0.5462044",
"0.5459229",
"0.5455946",
"0.5455779",
"0.54491115",
"0.54145783",
"0.5410175",
"0.538751... | 0.65811896 | 1 |
Gets XML path for this test set. | def xml_path(self):
return self.__xml_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_file_path(self):\n xml_file_path_prefix = \"./tests/\"\n return xml_file_path_prefix + self.test_name + \"_data/\"",
"def path(self):\n ret = libxml2mod.xmlURIGetPath(self._o)\n return ret",
"def getPath(self):\n return _libsbml.SBMLUri_getPath(self)",
"def pat... | [
"0.72125906",
"0.6890599",
"0.6353252",
"0.6320129",
"0.6319706",
"0.6318261",
"0.62749434",
"0.62696236",
"0.62675756",
"0.6255836",
"0.6254572",
"0.6216396",
"0.62156737",
"0.6171451",
"0.6171451",
"0.6171451",
"0.6171451",
"0.6171451",
"0.6171451",
"0.6171451",
"0.6171451"... | 0.81717086 | 0 |
Gets set id for this test set. | def setid(self):
return self.__setid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_set_id(self) -> str:\n return self.__data_set_id",
"def set_ident(self) -> int:\n return self._set_id",
"def target_set_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"target_set_id\")",
"def get_id(self):\n\n\t\treturn self.__id",
"def get_id(self):\n return... | [
"0.7612788",
"0.7225671",
"0.70273244",
"0.6457544",
"0.64520437",
"0.64520437",
"0.64520437",
"0.64520437",
"0.64520437",
"0.64520437",
"0.64496386",
"0.643195",
"0.64304936",
"0.64304936",
"0.6424694",
"0.6402841",
"0.6402841",
"0.6402841",
"0.6402841",
"0.6402841",
"0.6402... | 0.7679466 | 0 |
Gets srclang for this test set. | def srclang(self):
return self.__srclang | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lang(self):\n return self.langs.lang",
"def get_lang(self):\n\n path = self.get_lang_path()\n for language in self.languages:\n if language in path:\n return language",
"def lang(self):\n return self._lang",
"def get_language(self):\n retur... | [
"0.657984",
"0.64497256",
"0.626398",
"0.62187135",
"0.6023418",
"0.5945498",
"0.58959574",
"0.5867391",
"0.5825524",
"0.57900405",
"0.57401115",
"0.5734547",
"0.56895125",
"0.5689471",
"0.56826746",
"0.56624717",
"0.5644646",
"0.56427604",
"0.5623684",
"0.56085175",
"0.55688... | 0.81992567 | 0 |
Create runner for current plugin (configured using for_plugin()) | def create_runner(self) -> PluginsRunner:
return PluginsRunner(
self.workflow,
self.workflow.plugins_conf,
plugins_results=self.workflow.data.plugins_results,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runner_setup():\n runner = ClassicRunner()\n yield runner",
"def runner():\n return CliRunner()",
"def runner() -> CliRunner:\n return CliRunner()",
"def runner() -> CliRunner:\n return CliRunner()",
"def with_runner(self, runner: RunnerPlugin) -> \"Nornir\":\n return Nornir(**{**... | [
"0.6866504",
"0.68554384",
"0.6599028",
"0.6599028",
"0.65962666",
"0.6537111",
"0.6392773",
"0.6361446",
"0.61659765",
"0.6073541",
"0.6058075",
"0.60097",
"0.5966024",
"0.594582",
"0.594582",
"0.594582",
"0.59167594",
"0.5853902",
"0.5853091",
"0.5838199",
"0.58074355",
"... | 0.7544901 | 0 |
Set "scratch" user param to specified value | def set_scratch(self, scratch):
return self.set_user_params(scratch=scratch) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLocal(name, value):",
"def set(self, param, value):\r\n # continuous testing of inputs\r\n if self.testing_unit.testing_level > 1 and not self.testing_unit.c_test_set_inp(param, value):\r\n raise ValueError(\"set won't run, input's aren't valid.\")\r\n\r\n # continuous test... | [
"0.54380286",
"0.5388172",
"0.5256381",
"0.52541",
"0.5233565",
"0.520882",
"0.51804376",
"0.512866",
"0.51105255",
"0.51102644",
"0.5088432",
"0.5070453",
"0.506889",
"0.5051964",
"0.504263",
"0.49984756",
"0.49974656",
"0.49936995",
"0.49809253",
"0.4974157",
"0.49724293",
... | 0.7948603 | 0 |
Set "isolated" user param to specified value | def set_isolated(self, isolated):
return self.set_user_params(isolated=isolated) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_param(self, name, value):\n self._frozenjson._data[name] = value",
"def setLocal(name, value):",
"def _set_value(o, d):\n if isinstance(o, Param) and not o._mutable:\n return # ignore requests to set immutable params\n else:\n try:\n o.value = d\n except A... | [
"0.6170815",
"0.615861",
"0.5966737",
"0.5943898",
"0.59173894",
"0.58535784",
"0.5851193",
"0.57528216",
"0.5684014",
"0.56808037",
"0.55515176",
"0.55412376",
"0.55389595",
"0.55376667",
"0.55083",
"0.5441295",
"0.5429271",
"0.5417539",
"0.5412213",
"0.53750086",
"0.5359692... | 0.74468386 | 0 |
Set result of the check_and_set_platforms plugin. | def set_check_platforms_result(self, result):
return self.set_plugin_result(PLUGIN_CHECK_AND_SET_PLATFORMS_KEY, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_matched_platforms(self, platform):\n raise NotImplemented",
"def get_platforms(self):\n _log.debug(\"Passing platforms back: {}\".format(\n self._registered_platforms.keys()))\n return self._registered_platforms.values()",
"def add_platforms(project, env_spec_name, platf... | [
"0.5848311",
"0.57884127",
"0.5783506",
"0.57761276",
"0.57096714",
"0.56946737",
"0.5678969",
"0.5589927",
"0.5579518",
"0.5556038",
"0.5533406",
"0.546268",
"0.54300576",
"0.5416443",
"0.5285097",
"0.5256257",
"0.51613456",
"0.5151262",
"0.5109948",
"0.5102886",
"0.51000375... | 0.8730079 | 0 |
Set result of the specified plugin (stored in workflow) | def set_plugin_result(self, plugin_key: str, result: Any):
self.workflow.data.plugins_results[plugin_key] = result
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_result(self, value):\n value_rpc = utils.get_rpc_value(type(value), value)\n self._call('set_result', value=value_rpc)",
"def set_result(self, result):\n self._result = result\n self._set_done()",
"def result(self, result):\n self._result = result",
"def result(self... | [
"0.66603214",
"0.6367439",
"0.6362497",
"0.6362497",
"0.6359219",
"0.62176156",
"0.62176156",
"0.61453456",
"0.6018869",
"0.6016762",
"0.5982818",
"0.5969014",
"0.59450924",
"0.59320945",
"0.5912415",
"0.5878978",
"0.58733106",
"0.58701086",
"0.58672035",
"0.5866218",
"0.5702... | 0.7638874 | 0 |
Set plugin arguments (stored in plugins configuration in workflow). By default, sets args for the current plugin (configured using for_plugin()). Phase and plugin key can be specified to set args for a different plugin. If overriding phase and plugin key, the specified plugin must already be present in the plugins conf... | def set_plugin_args(self, args: Dict[str, Any], plugin_key: Optional[str] = None):
plugin_key = plugin_key or self._plugin_key
plugin = self._get_plugin_conf(plugin_key)
plugin['args'] = args
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_plugin(self, plugin_key, args=None):\n self._plugin_key = plugin_key\n plugins_conf = self.workflow.plugins_conf\n\n for conf in plugins_conf:\n if conf[\"name\"] == plugin_key:\n raise ValueError(f\"This environment already has plugin: {plugin_key}\")\n\n ... | [
"0.6513374",
"0.61226624",
"0.5574608",
"0.5473614",
"0.54702693",
"0.54359835",
"0.54171944",
"0.5409807",
"0.5287567",
"0.52268344",
"0.5218227",
"0.52091795",
"0.5185592",
"0.51742077",
"0.5114523",
"0.5108311",
"0.50985545",
"0.50842005",
"0.5058278",
"0.505524",
"0.50459... | 0.7975675 | 0 |
Set reactor config map in the workflow | def set_reactor_config(self, config: Union[Configuration, Dict[str, Any]]):
if isinstance(config, dict):
if ReactorConfigKeys.VERSION_KEY not in config:
config[ReactorConfigKeys.VERSION_KEY] = 1
config = Configuration(raw_config=config)
elif isinstance(config, Con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reactor_config(self):\n if not self._reactor_config_map:\n config = Configuration(raw_config={'version': 1})\n self._reactor_config_map = config\n self.workflow.conf = config\n\n return self._reactor_config_map",
"def init_config(self, conf_map):\n pass",... | [
"0.74665",
"0.6243018",
"0.58144563",
"0.5796829",
"0.5634255",
"0.5528479",
"0.5518935",
"0.55061996",
"0.5493769",
"0.54686093",
"0.54425114",
"0.54340535",
"0.54340535",
"0.54340535",
"0.54340535",
"0.5416368",
"0.54137444",
"0.5401429",
"0.53786635",
"0.53777194",
"0.5377... | 0.6885855 | 1 |
Get reactor config map (from the ReactorConfigPlugin's workspace) | def reactor_config(self):
if not self._reactor_config_map:
config = Configuration(raw_config={'version': 1})
self._reactor_config_map = config
self.workflow.conf = config
return self._reactor_config_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_config_map():\n path = os.path.join(os.path.dirname(__file__), \"nadamw_configs.json\")\n configs = json.loads(open(path).read())\n return configs",
"def _get_config_dict():\r\n return CONFIGS",
"def config(self) -> dict:\n return self._configs",
"def config():\n return _config",
"... | [
"0.6830962",
"0.6784852",
"0.62548757",
"0.6240544",
"0.6170802",
"0.61214566",
"0.60933065",
"0.60656995",
"0.6044908",
"0.6043268",
"0.60306436",
"0.60101277",
"0.60093963",
"0.5989619",
"0.5988969",
"0.59417576",
"0.5933837",
"0.59208107",
"0.5910441",
"0.59071994",
"0.590... | 0.7547591 | 0 |
Set dockerfile images in the workflow. | def set_dockerfile_images(self, images: Union[DockerfileImages, List[str]]):
if not isinstance(images, DockerfileImages):
images = DockerfileImages(images)
self.workflow.data.dockerfile_images = images
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_dockerfile_images(self, path: str) -> None:\n df_images = self.data.dockerfile_images\n\n # Consider dockerfile_images data was saved when previous task ended,\n # e.g. prebuild, now subsequent task starts to run and the saved data\n # is loaded into the dockerfile_images obje... | [
"0.6999326",
"0.6069255",
"0.60510445",
"0.60258573",
"0.5884081",
"0.57834285",
"0.5751879",
"0.5709651",
"0.5709379",
"0.56507194",
"0.5635004",
"0.563302",
"0.563302",
"0.563302",
"0.563302",
"0.5591328",
"0.5578667",
"0.5560351",
"0.55517054",
"0.55517054",
"0.55517054",
... | 0.7603983 | 0 |
Make the check_build_outcome method return the specified values. | def mock_build_outcome(self, *, failed: bool, cancelled: bool = False):
if cancelled and not failed:
raise ValueError(
"Cannot set build outcome (failed=False, cancelled=True), "
"cancelled=True implies failed=True"
)
outcome = (failed, cancelled)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_build_outcome(self) -> Tuple[bool, bool]:\n cancelled = (\n self.osbs.build_has_any_cancelled_tasks(self.pipeline_run_name) # prev. task cancelled\n or self.data.task_canceled # this task cancelled\n )\n failed = (\n cancelled # cancelled counts as... | [
"0.65783787",
"0.56206334",
"0.54711205",
"0.5419938",
"0.5388649",
"0.5377874",
"0.5351865",
"0.53423566",
"0.5331572",
"0.52913177",
"0.52704",
"0.5268928",
"0.526637",
"0.5238966",
"0.52228534",
"0.52097917",
"0.5198528",
"0.5184792",
"0.51632065",
"0.51352155",
"0.512853"... | 0.6163853 | 1 |
Conducts a trial of the permutation test. Builds subgraph, shuffles network, then recalculates H. | def permutation_test_trial(adj_matrix, ass_matrix, size, graph, n_cell_types):
if size == adj_matrix.shape[0]:
shuffled_graph = shuffle_labels(ass_matrix, n_cell_types)
H = calculate_neighborhood_distribution_sparse(adj_matrix, shuffled_graph)
else:
subgraph_nodes = create_subgraph(gra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutation_test_trial_wrapper(args):\n # print(\"starting \" + str(mp.current_process()))\n adj_matrix = args[0]\n ass_matrix = args[1]\n size = args[2]\n graph = args[3]\n n_cell_types = args[4]\n # H = permumation_test_trial\n H = permutation_test_trial(adj_matrix, ass_matrix, size, ... | [
"0.6631888",
"0.5971771",
"0.58807373",
"0.5743018",
"0.5654957",
"0.55904275",
"0.558983",
"0.55839705",
"0.55392504",
"0.5523688",
"0.5421038",
"0.5404024",
"0.53940094",
"0.53793323",
"0.53648597",
"0.53432286",
"0.5339285",
"0.5329799",
"0.53277785",
"0.53277296",
"0.5325... | 0.6297735 | 1 |
Parallelization wrapper for the permutation test trial. | def permutation_test_trial_wrapper(args):
# print("starting " + str(mp.current_process()))
adj_matrix = args[0]
ass_matrix = args[1]
size = args[2]
graph = args[3]
n_cell_types = args[4]
# H = permumation_test_trial
H = permutation_test_trial(adj_matrix, ass_matrix, size, graph, n_cell_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distribute_individual_permutation_tests(\r\n matrix: csr_matrix,\r\n seeds: List[types.BioEntity],\r\n uids: Dict[types.BioEntity, int],\r\n output: str,\r\n permutations: int = 250,\r\n alpha: np.double = 0.15,\r\n procs: int = os.cpu_count(),\r\n single: bool = False,\r\n fdr: bool... | [
"0.67676497",
"0.6616038",
"0.6531123",
"0.63069123",
"0.62605315",
"0.6084127",
"0.60566527",
"0.6006791",
"0.5996716",
"0.5952139",
"0.5840212",
"0.5836318",
"0.5825213",
"0.5800342",
"0.5778902",
"0.57562375",
"0.57141477",
"0.5713211",
"0.5708124",
"0.5700589",
"0.5661800... | 0.6876492 | 0 |
Returns the directory string from self.query. Raises ValueError if no dataset or item is set. | def directory(self):
if not self.query["dataset"]:
raise ValueError("At least a dataset must be selected")
if not self.query["filter"]:
if self.query["item"]:
return "{}/{}".format(self.query["dataset"], self.query["item"])
else:
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directory(self) -> str:\n return self._values.get(\"directory\")",
"def folder(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"folder\")",
"def folder(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"folder\")",
"def dataset_dir(self):\n retu... | [
"0.5974601",
"0.58581316",
"0.58581316",
"0.57819396",
"0.577771",
"0.57607937",
"0.57607937",
"0.57607937",
"0.57321185",
"0.5712645",
"0.56639737",
"0.5539212",
"0.55385935",
"0.5533829",
"0.54940766",
"0.54602796",
"0.545167",
"0.54432976",
"0.54289764",
"0.54031324",
"0.5... | 0.8309908 | 0 |
Write clusters to a MATLAB mat file | def __write_matlab_clusters(tel, filename):
# type: (TelescopeAnalysis, str) -> None
centre_x = np.array([])
centre_y = np.array([])
points_x = np.array([])
points_y = np.array([])
for name in tel.layouts:
if name == 'ska1_v5':
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matlab_export(self, filename):\n\n import scipy.io as sio\n matdata = {}\n for nn in range(self.num_networks):\n for ll in range(len(self.networks[nn].layers)):\n wstring = 'ws' + str(nn) + str(ll)\n matdata[wstring] = self.networks[nn].layers[ll].w... | [
"0.6547306",
"0.6492633",
"0.63744015",
"0.63683176",
"0.6368144",
"0.6319745",
"0.6222778",
"0.6165265",
"0.6157875",
"0.61203426",
"0.60532",
"0.6051007",
"0.60090786",
"0.596469",
"0.59446454",
"0.59358704",
"0.5926595",
"0.59191155",
"0.58925784",
"0.58876187",
"0.5867734... | 0.7741933 | 0 |
Compare histograms for several models found in the same results folder. | def compare_hist(results_dir, log_axis=False):
plot_style = [
{'color': 'k', 'marker': 'none', 'lw': 1.5},
{'color': 'r', 'marker': 'none', 'lw': 1.5}
]
if log_axis:
axis_type = 'log'
else:
axis_type = 'lin'
unwrap_levels = ['r08']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_hist_2(results_dir_root):\n plot_style = [\n {'color': 'k', 'marker': 'none', 'lw': 1.5},\n {'color': 'r', 'marker': 'none', 'lw': 1.5}\n ]\n unwrap_levels = ['r08']\n\n fig, axes = plt.subplots(figsize=(8, 10), nrows=5, ncols=2, sharex=True,\n ... | [
"0.74447167",
"0.6722412",
"0.619602",
"0.6189617",
"0.605641",
"0.6045303",
"0.5934117",
"0.5863671",
"0.58600086",
"0.5839747",
"0.5823994",
"0.58201504",
"0.5746103",
"0.57217723",
"0.56947136",
"0.56901574",
"0.56547004",
"0.5616909",
"0.5600826",
"0.55986506",
"0.5598327... | 0.7558292 | 0 |
Load labels and associate label with normalized patient ID. Splits into training and validation sets, stratified by label. | def load_label_data(config):
label_data = pd.read_csv(config.LabelDataConfig.data_path)
ids = list(label_data['Training cases final'])
labels = config.build_labels(label_data)
train_ids, val_ids, train_labels, val_labels = train_test_split(
ids,
labels,
stratify=labels,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare(self):\n\n # step 0: load only when not loaded yet\n if TRAINING in self.data \\\n and VALIDATION in self.data:\n return\n\n # step 1: load the file names\n file_list = sorted(glob.glob(self.location+\"*.mhd\"))\n # count the number of data point... | [
"0.6899584",
"0.67678577",
"0.6700436",
"0.6546509",
"0.6544759",
"0.6543949",
"0.6521865",
"0.64535046",
"0.64433956",
"0.6432448",
"0.64194286",
"0.6379336",
"0.63601017",
"0.6348987",
"0.6348516",
"0.6347279",
"0.63445735",
"0.6322222",
"0.63080835",
"0.6262983",
"0.626127... | 0.7183424 | 0 |
Read and preprocess all images, record metadata for new image locations, labels, and IDs. | def preprocess_images_and_labels(config,
image_file_data,
train_image_id_labels,
val_image_id_labels):
# Commenting out the line below in keeping with the comment block above the function. We don't
# actually need... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self):\n meta_file_path = os.path.join(database_directory, 'data.txt')\n meta = pd.read_csv(meta_file_path, delimiter=' ', header=None)\n meta = meta[meta[0] != '45567.jpg'] # Corrupt image.\n meta.to_pickle(os.path.join(database_directory, 'meta.pkl'))\n for file... | [
"0.7054344",
"0.6931772",
"0.6927908",
"0.68990767",
"0.6851807",
"0.683386",
"0.67895216",
"0.66671056",
"0.6544011",
"0.65223366",
"0.64893246",
"0.63646966",
"0.634209",
"0.63263416",
"0.62912625",
"0.628086",
"0.6280859",
"0.62441504",
"0.62260914",
"0.6221261",
"0.616618... | 0.694946 | 1 |
Write the preprocessed image metadata to disk. | def write_metadata(config, train_image_metadata, val_image_metadata):
with open(config.ImageDataConfig.preprocessed_image_metadata_filename, 'wb') as f:
pickle.dump({'train': train_image_metadata, 'val': val_image_metadata}, f, pickle.HIGHEST_PROTOCOL) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveMetadata(self):\n pickle.dump(self.metadata, open(self.metadataFile, 'w+b'))",
"def save_metadata(self):\n # Load file\n retouch_file = pd.read_csv(self.file)\n \n # Loop over rows\n for index, row in retouch_file.iterrows():\n # Check if image exists\... | [
"0.6646797",
"0.64469486",
"0.6340336",
"0.62708116",
"0.6234069",
"0.6172521",
"0.6158808",
"0.6143974",
"0.6068073",
"0.6042658",
"0.6035192",
"0.59775",
"0.59581953",
"0.5945225",
"0.59321845",
"0.5892916",
"0.5888533",
"0.5865226",
"0.58597296",
"0.58055806",
"0.5796792",... | 0.7266918 | 0 |
Return the number of samples that have step < 0 for each dictionary | def _number_of_negative_steps(samples, logger_level="debug"):
_samples = copy.deepcopy(samples)
try:
parameters = set.intersection(
*[set(_params) for _params in _samples.parameters.values()]
)
except AttributeError:
parameters = list(_samples.parameters)
step_param =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_count(self):\n assert len(self.decay_x) == len(self.decay_y)\n return len(self.decay_x)",
"def _number_of_samples(self):\n return len(self._raw_data.samples)",
"def runcount(test_keys, sigma, sigma_max, sigma_step,\n npoints_min, npoints_max, npoints_step):\n run = 1... | [
"0.65192235",
"0.6369329",
"0.6240577",
"0.6150838",
"0.61246765",
"0.6046083",
"0.6024768",
"0.6012521",
"0.6003307",
"0.6003307",
"0.6000365",
"0.5998044",
"0.59880537",
"0.5946021",
"0.5903021",
"0.589376",
"0.58761144",
"0.58592093",
"0.5845746",
"0.58443034",
"0.58256704... | 0.63758653 | 1 |
Discard all samples with step number < 0 as burnin | def burnin_by_step_number(samples, logger_level="debug"):
_samples = copy.deepcopy(samples)
n_samples = _number_of_negative_steps(_samples, logger_level=logger_level)
getattr(logger, logger_level)(
"Removing the first {} as burnin".format(
", ".join(
["{} samples from {}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_samples(chain_length):\n return min(chain_length / 10, MAX_GEN_DISCARD)",
"def burnin_by_first_n(samples, N, step_number=False, logger_level=\"debug\"):\n _samples = copy.deepcopy(samples)\n n_samples = {key: N for key in _samples.keys()}\n if step_number:\n n_samples = {\n ... | [
"0.6511191",
"0.60692304",
"0.6036446",
"0.59330326",
"0.5847102",
"0.5819293",
"0.56267685",
"0.56258935",
"0.560285",
"0.55841905",
"0.5548382",
"0.55329823",
"0.5516958",
"0.55083865",
"0.5500549",
"0.54715633",
"0.54564315",
"0.5424539",
"0.54142076",
"0.54111594",
"0.538... | 0.66109174 | 0 |
Discard the first N samples as burnin | def burnin_by_first_n(samples, N, step_number=False, logger_level="debug"):
_samples = copy.deepcopy(samples)
n_samples = {key: N for key in _samples.keys()}
if step_number:
n_samples = {
key: item + N if item is not None else N for key, item in
_number_of_negative_steps(_sam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_samples(chain_length):\n return min(chain_length / 10, MAX_GEN_DISCARD)",
"def samples_keep(self,index):\n\n\t\tif isinstance(index, (int, long)): index = range(self.samples)[-index:]\n\n\t\tself.sampled_topics = np.take(self.sampled_topics,index,axis=0)\n\t\tself.tt = np.take(self.tt,index,axis=2... | [
"0.714055",
"0.65731627",
"0.6482909",
"0.637573",
"0.6302957",
"0.6292066",
"0.6248904",
"0.6155302",
"0.6131084",
"0.6086562",
"0.60662824",
"0.606339",
"0.6047471",
"0.6047471",
"0.603582",
"0.6016872",
"0.5947752",
"0.59053403",
"0.58987445",
"0.5855587",
"0.5852401",
"... | 0.72290444 | 0 |
return the date string list from fday to tday | def _list_day(self, fday=None, tday=None):
date_fday = fday or date.today()
date_tday = tday or date.today()
days = (date_tday - date_fday).days+1
dayList = [date_fday+timedelta(v) for v in range(days)]
return dayList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_1day_renu(self,fday,tday):\n dayList = self._list_day(fday, tday)\n return zip(dayList,[self._get_ndays_renu(d,1) for d in dayList])",
"def generate_dates(self):\r\n\r\n numdays = 20\r\n\r\n base = datetime.datetime.today()\r\n\r\n date_list = [base + datetime.timedelt... | [
"0.6943631",
"0.6857004",
"0.6671235",
"0.6600396",
"0.6598585",
"0.65296274",
"0.65248376",
"0.6488082",
"0.6396104",
"0.6356926",
"0.6335761",
"0.6304127",
"0.62983024",
"0.6257908",
"0.62569726",
"0.6236505",
"0.61465985",
"0.61411643",
"0.6122724",
"0.6119013",
"0.6102337... | 0.7516559 | 0 |
return the daily count of new user number | def get_dnu(self, day=None):
if not day:
return self.newUserBitmap.count()
return self.get_newuser_bitmap(day).count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_messages_daily(self, date):\n cursor = self.get_cursor()\n end_date = date + relativedelta(days=1)\n query = 'SELECT count(*) AS num FROM messages WHERE created_on > %s AND created_on < %s'\n cursor.execute(query, (date, end_date))\n count = cursor.fetchall()\n ... | [
"0.6539084",
"0.6330094",
"0.6329037",
"0.6316601",
"0.62761694",
"0.62403864",
"0.6229926",
"0.62269276",
"0.62062",
"0.61447453",
"0.6054294",
"0.6008175",
"0.59777904",
"0.5973353",
"0.59608513",
"0.5783945",
"0.5781988",
"0.57601184",
"0.57527024",
"0.5746283",
"0.5734634... | 0.65648293 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.