query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
r""" Convert a Pico detection to a menpo.shape.PointDirectedGraph. This enforces a particular point ordering. The Pico detections are circles with a given diameter. Here we convert them to the tighest possible bounding box around the circle. No orientaton is currently provided.
def pointgraph_from_circle(fitting): diameter = fitting.diameter radius = diameter / 2.0 y, x = fitting.center y -= radius x -= radius return bounding_box((y, x), (y + diameter, x + diameter))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_puncturefinder_graph(self):\n try:\n return self._puncturefinder_graph\n except AttributeError:\n pass\n\n # g = Graph(multiedges=True, loops=True)\n g = nx.MultiGraph()\n for i in self.switches():\n for sw in {-i, i}:\n b1...
[ "0.50767064", "0.49477744", "0.48864093", "0.48731953", "0.48656204", "0.48196903", "0.48136315", "0.48119062", "0.47768894", "0.4766206", "0.47514772", "0.47462827", "0.47427285", "0.47004747", "0.4687095", "0.46782252", "0.46657154", "0.4664539", "0.46427816", "0.46333265", ...
0.6494857
0
Finds the XZ points and connection types (straight and circle) that describe the 2D profile of the center column shield shape.
def find_points(self): points = [ (self.inner_radius, 0, "straight"), (self.inner_radius, self.height / 2, "straight"), (self.outer_radius, self.height / 2, "straight"), (self.outer_radius, self.arc_height / 2, "circle"), (self.mid_radius, 0, "circle"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_profile(data, z_col=0, z_start=50, p_col=None, P_atm=101325.):\n # Initialize counters for the start and end of the profile\n start = 0\n end = data.shape[0] - 1\n \n # Search for the start of the profile over the range z < z_start\n i = 1\n while data[i,z_col] < z_start and i <= e...
[ "0.55275995", "0.5274106", "0.5253383", "0.5144906", "0.51422834", "0.5093382", "0.50928247", "0.50314474", "0.50155497", "0.5006986", "0.49980095", "0.499089", "0.49905553", "0.4984461", "0.49840587", "0.49530435", "0.49454218", "0.49327758", "0.49292994", "0.49226856", "0.4...
0.5079558
7
Makes the horizontal box with buttons
def makeButtons(self): self.but_run = QtWidgets.QPushButton('Run') self.but_status = QtWidgets.QPushButton('Status') self.but_brow = QtWidgets.QPushButton('View') self.but_remove = QtWidgets.QPushButton('Remove files') self.hboxB = QtWidgets.QHBoxLayout() self.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_box(self):\r\n\r\n below_hz_frame = tkinter.Frame(self)\r\n ok_button = ttk.Button(below_hz_frame, text=\"OK\",\r\n width=10, command=self.ok,\r\n default=tkinter.ACTIVE)\r\n ok_button.grid(row=0, column=0, padx=30, pady=10...
[ "0.7095853", "0.6955391", "0.6926687", "0.68542206", "0.6837923", "0.67752045", "0.6765243", "0.671351", "0.6640223", "0.66398984", "0.6555973", "0.65282583", "0.6519112", "0.64659417", "0.64081466", "0.6394941", "0.63714725", "0.63361865", "0.62948644", "0.6293922", "0.62938...
0.71940935
0
Makes the table for the list of output and log files
def makeTable(self): self.table = QtWidgets.QTableWidget(3, 4, self) self.table.setHorizontalHeaderLabels(['File', 'Exists?', 'Creation time', 'Size(Byte)']) #self.table.setVerticalHeaderLabels(['']) self.table.verticalHeader().hide() self.table.horizontalHeader().setDefaultSec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_table(list_observations, indir, informat, outfile):\n print('Creating file summary table ...')\n\n # We gather all infos in a list of dicts and write this\n # as a FITS table at the end.\n # for documentation see http://gamma-astro-data-formats.readthedocs.org/en/latest/data_storage/hdu_index/...
[ "0.6630462", "0.66232985", "0.6505971", "0.645463", "0.6385245", "0.6288634", "0.6260098", "0.6237579", "0.6060306", "0.60600644", "0.6051961", "0.6037083", "0.60020095", "0.60003614", "0.59844756", "0.5984135", "0.5911837", "0.5903965", "0.58844244", "0.58825964", "0.5865558...
0.5784569
28
Instanciando la clase para pruebas
def setUp(self): self.employee = Employee('Lucas', 'Guerra', 45000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__():", "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def initialize(cls):", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplementedError", "def __init__(self):\n raise NotImplemented...
[ "0.7184988", "0.7074115", "0.7020825", "0.70042557", "0.70042557", "0.70042557", "0.70042557", "0.6994752", "0.6878596", "0.68609256", "0.6829584", "0.6829584", "0.6829584", "0.68059283", "0.6767492", "0.6765351", "0.6753933", "0.6753933", "0.67461365", "0.67400193", "0.66506...
0.0
-1
Generates image return data.
def gen_return_signals(s, ny, nx): r = np.tile(s.reshape((len(s),1,1)),(1,ny,nx)) base_noise = np.random.normal(loc=0.0, scale=1./(ny*nx), size=len(s)) noise_multi = np.arange(0, ny*nx, 1).reshape(ny,nx) noise_cube = base_noise[:,None,None]*noise_multi return r+noise_cube
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_image(self):\n pass", "def getimage(self):", "def generate():\n global output_frame, lock\n while True:\n with lock:\n if output_frame is None:\n continue\n (flag, encoded_image) = cv2.imencode(\".jpg\", output_frame)\n if not fla...
[ "0.753836", "0.6633045", "0.62766266", "0.6243967", "0.6184419", "0.6184419", "0.61753774", "0.61736894", "0.6158213", "0.6148624", "0.60932684", "0.6071237", "0.60606295", "0.6033717", "0.601991", "0.59980625", "0.5986919", "0.5981488", "0.59718686", "0.5969249", "0.59540033...
0.0
-1
Integration test that logger will raise an exception if account does not exists.
def test_configure_no_account(self): config = self._getConfiguration() account = u'no-such-account' logger = manufacture.makeLogger() with self.assertRaises(UtilsError) as context: logger.configure(configuration=config, account=account) self.assertEqual(u'1026', con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lookup_account(self):\n pass", "def test_account_already_exists(mocker, api: API):\n mocker.patch.object(Account, \"does_exist\", return_value=True)\n login = mocker.patch.object(Account, \"login\")\n create = mocker.patch.object(Account, \"create\")\n\n Account(api, \"USERNAME\", \"P...
[ "0.63863415", "0.6266122", "0.6089439", "0.6070338", "0.60358477", "0.59792036", "0.5952488", "0.5939118", "0.58980507", "0.5886915", "0.5841414", "0.5836312", "0.58110714", "0.57805747", "0.5735064", "0.5731167", "0.5697972", "0.56951076", "0.5693734", "0.5681385", "0.567892...
0.76106346
0
Integration test that the logger will initialize the log file using the account name.
def test_configure_logger_file_permissions_unix(self): path, segments = manufacture.fs.makePathInTemp() content = ( '[log]\n' 'log_file: %s\n' ) % (path) config = self._getConfiguration(content=content) if self._drop_user != '-': account = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_passing_log_fname(self):\n\n log_env_file = \"test.log\"\n log_file = \"test_2.log\"\n whole_env_log_file = os.path.join(LOG_FOLDER, log_env_file)\n whole_log_file = os.path.join(LOG_FOLDER, log_file)\n\n # remove both files if they exist\n for file in (whole_env_...
[ "0.6918608", "0.68335176", "0.66860163", "0.66610545", "0.66252", "0.6604844", "0.65274453", "0.6512236", "0.6473192", "0.6441965", "0.6436975", "0.6424023", "0.6419334", "0.63910013", "0.6374889", "0.6364612", "0.63481355", "0.63403594", "0.63371605", "0.63304365", "0.629130...
0.0
-1
Updates the progress bar.
def update(self, current, values=None): values = values or [] for k, v in values: if k not in self._values_order: self._values_order.append(k) if k not in self.stateful_metrics: if k not in self._values: self._values[k] = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_progressbar(self, count, value):\n self.status(\"Progress %s/%s\" % (value, count))", "def update_progress(self):\n report = self.build_progress_report()\n self.conduit.set_progress(report)", "def update_progress(self):\n report = self.build_progress_report()\n sel...
[ "0.8306248", "0.8249628", "0.8249628", "0.7703863", "0.75903213", "0.75694656", "0.7530859", "0.7482685", "0.74016", "0.74002707", "0.73856735", "0.7214641", "0.7203101", "0.7175258", "0.7172009", "0.71585083", "0.712334", "0.71129024", "0.70976585", "0.70785344", "0.7078421"...
0.0
-1
Replacement for `urlretrieve` for Python 2. Under Python 2, `urlretrieve` relies on `FancyURLopener` from legacy `urllib` module, known to have issues with proxy management.
def urlretrieve(url, filename, reporthook=None, data=None): def chunk_read(response, chunk_size=8192, reporthook=None): content_type = response.info().get("Content-Length") total_size = -1 if content_type is not None: total_size = int(content_type.strip()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlretrieve(url, ofile, *args, **kwargs):\n\n try:\n return urlretrieve(url, ofile, *args, **kwargs)\n except:\n if os.path.exists(ofile):\n os.remove(ofile)\n # try to make the thing more robust with a second shot\n try:\n return urlretrieve(url, ofile,...
[ "0.7382234", "0.68795955", "0.6858659", "0.68408483", "0.67872936", "0.6567124", "0.6545157", "0.64911443", "0.6465187", "0.6449113", "0.64198625", "0.6387063", "0.63373065", "0.6321156", "0.6253815", "0.6221016", "0.61790234", "0.61689067", "0.61582744", "0.61553967", "0.615...
0.68577385
3
Extracts an archive if it matches tar, tar.gz, tar.bz, or zip formats.
def _extract_archive(file_path, path=".", archive_format="auto"): if archive_format is None: return False if archive_format == "auto": archive_format = ["tar", "zip"] if isinstance(archive_format, six.string_types): archive_format = [archive_format] for archive_type in archive_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_archive(file_path, path='.', archive_format='auto'):\n if archive_format is None:\n return False\n if archive_format == 'auto':\n archive_format = ['tar', 'zip']\n if isinstance(archive_format, six.string_types):\n archive_format = [archive_format]\n\n for archive_type...
[ "0.77330834", "0.76566243", "0.7581955", "0.6881372", "0.6814677", "0.66347516", "0.64978355", "0.6380294", "0.6378682", "0.6291018", "0.62800467", "0.6221986", "0.6217149", "0.619506", "0.6140137", "0.61342347", "0.6103157", "0.61027014", "0.6078421", "0.6045398", "0.5988209...
0.77244127
1
Downloads a file from a URL if it not already in the cache. By default the file at the url `origin` is downloaded to the cache_dir `~/.keras`, placed in the cache_subdir `datasets`, and given the filename `fname`. The final location of a file `example.txt` would therefore be `~/.keras/datasets/example.txt`. Files in ta...
def get_file( fname, origin, untar=False, cache_subdir="datasets", extract=False, archive_format="auto", cache_dir=None, ): if cache_dir is None: cache_dir = os.path.join(os.path.expanduser("~"), ".keras") datadir_base = os.path.expanduser(cache_dir) if not os.access(data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(fname,\n origin,\n untar=False,\n md5_hash=None,\n file_hash=None,\n cache_subdir='datasets',\n hash_algorithm='auto',\n extract=False,\n archive_format='auto',\n cache_dir=None):\n if cache_...
[ "0.7850162", "0.77377146", "0.7314647", "0.6568045", "0.63742006", "0.63489455", "0.6254098", "0.6233374", "0.6074457", "0.60202646", "0.6016756", "0.60057044", "0.5962556", "0.5943933", "0.5888024", "0.5843652", "0.58388096", "0.5832503", "0.5784033", "0.5770607", "0.5770086...
0.71622556
3
Minimization of a scalar function of one or more variables using parallel CMAES retry.
def minimize(fun, bounds = None, value_limit = math.inf, num_retries = 1000, logger = None, workers = mp.cpu_count(), popsize = 31, max_evaluations = 50000, capacity = 500, stop_fittness = None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_scalar(objective, **kwargs):\n result = minimize_scalar(objective, **kwargs)\n return result.fun", "def auxminf1(x):\n \n# Sum over data points\n f = 0.0\n for m_ind in range(cfg.ntrain):\n f += auxmin_f1_part_i(x,m_ind) \n \n return f", "def fmin(func, x0, sigma0=None, arg...
[ "0.58401585", "0.5788632", "0.57425696", "0.57303965", "0.56360745", "0.56013083", "0.55810285", "0.556376", "0.55437535", "0.5528637", "0.55246705", "0.5506914", "0.550672", "0.550141", "0.54960895", "0.54928195", "0.54925305", "0.5491091", "0.5490144", "0.548972", "0.548911...
0.6479807
0
sorts all store entries, keep only the 90% best to make room for new ones.
def sort(self): # sort all entries to make room for new ones, determine best and worst ns = self.num_stored.value ys = np.asarray(self.ys[:ns]) yi = ys.argsort() sortRuns = [] for i in range(len(yi)): y = ys[yi[i]] xs = self.get_x(yi[i]) sortRu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_and_reduce(self):\n self.data = sorted(self.data, key=lambda item: item.pubDate)\n if len(self.data) > MAX_SIZE:\n self.data = self.data[-MAX_SIZE:]", "def volume_sort(self):\n self.jobs_sorted = sorted(\n self.jobs,\n key=lambda job: (job['height'],...
[ "0.65042984", "0.6291601", "0.5924032", "0.58100486", "0.56878287", "0.56756747", "0.5670386", "0.5621025", "0.55958736", "0.55391216", "0.5532553", "0.54889405", "0.5487602", "0.5483785", "0.5481501", "0.5474903", "0.54568", "0.54499155", "0.5449535", "0.5449535", "0.5441329...
0.690427
0
registers an optimization result at the score.
def add_result(self, y, xs, evals, limit=math.inf): with self.add_mutex: self.incr_count_evals(evals) if y < limit: self.count_stat_runs.value += 1 if y < self.best_y.value: self.best_y.value = y self.best_x[:] = x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_results(self, regressor, results):\n\n self.prediction_results[regressor] = results", "def update_score(self, concept: _Concept, result: _Result) -> None:\n\n score = self.make_score(concept, result)\n if score is None:\n pass\n else:\n self._vector....
[ "0.65395415", "0.6363197", "0.63301075", "0.63301075", "0.6103318", "0.60974675", "0.60485524", "0.5984385", "0.597561", "0.59645236", "0.5940409", "0.5850446", "0.5835131", "0.583454", "0.58208734", "0.57811385", "0.5778663", "0.5759728", "0.5757237", "0.5756544", "0.5756544...
0.55490243
31
logs the current status of the store if logger defined.
def dump(self): if self.logger is None: return Ys = self.get_ys() vals = [] for i in range(min(20, len(Ys))): vals.append(round(Ys[i],2)) dt = dtime(self.t0) message = '{0} {1} {2} {3} {4:.6f} {5:.2f} {6:.2f} {7!s} {8!s}'....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_logging(self):\n if datetime.datetime.utcnow().strftime('%Y%m%d') != self.logger_utc_date:\n # reset\n self.shut_down_logger()\n self.logger, self.logger_utc_date = self.set_up_logging(_name='archive', _mode='a')", "def logging(self):\r\n return None", "...
[ "0.62252045", "0.61887705", "0.6182616", "0.6051266", "0.6047264", "0.6011129", "0.6009875", "0.5946013", "0.5912739", "0.58753335", "0.5850058", "0.58334607", "0.5829842", "0.5821613", "0.57938844", "0.5789257", "0.57748824", "0.5748575", "0.574404", "0.57351345", "0.5730309...
0.0
-1
Adds child to the state.
def add_child(self, child, label): self.children[label] = child child.parents.append(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_child(self, child):\r\n self.children.append(child)", "def add_child(self, child):\r\n self.children.append(child)", "def add_child(self, child):\n self.children.append(child)", "def add_child(self, child):\n self.children.append(child)", "def add_child(self, child):\n ...
[ "0.81043047", "0.80499", "0.79667467", "0.79667467", "0.78721863", "0.7831041", "0.7818361", "0.7648586", "0.7625544", "0.75271404", "0.7494666", "0.742069", "0.7402691", "0.73870945", "0.72280127", "0.71841025", "0.71829116", "0.7137132", "0.70867896", "0.70867896", "0.70867...
0.7255127
14
Calculates hash value of the state and its children.
def hash(self, hashed_states=None): if hashed_states is None: hashed_states = [] hashed_states.append(self) result = '1' if self.final else '0' result += str(len(self.children)) for symbol in self.children: child = self.children[symbol] if chi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hash(self, value, get_val, get_child):\n hasher = getattr(hashlib, self.hash_func)\n children = get_child(value)\n\n # If leaf node\n if len(children) < 1:\n return hasher(get_val(value)).hexdigest()\n\n h = hasher()\n for child in children:\n # ...
[ "0.7342968", "0.72909665", "0.7124429", "0.70509243", "0.6966833", "0.6820188", "0.6742874", "0.67155385", "0.67155385", "0.6707483", "0.66744095", "0.6658651", "0.65652084", "0.6561096", "0.65602064", "0.65579015", "0.6549498", "0.65474933", "0.65199417", "0.65194243", "0.65...
0.7933615
0
Copies state and its children. Ignores parents.
def copy(self): new_state = State(self.final) for symbol in self.children: child = self.children[symbol] new_state.add_child(child.copy(), symbol) return new_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n copy = Node(self.node_data, self.tree_type, self.parent)\n if self.children:\n copy.children = [c.copy() for c in self.children]\n for c in copy.children:\n c.parent = copy\n return copy", "def clone_state(self):\n return self.str...
[ "0.66461754", "0.66092765", "0.64861435", "0.64813745", "0.64767754", "0.64714724", "0.6470946", "0.6437448", "0.64342207", "0.6415057", "0.64008224", "0.6400438", "0.6381998", "0.63714826", "0.6197291", "0.61630076", "0.61239284", "0.61002094", "0.61002094", "0.61002094", "0...
0.7628509
0
Login to APICEM northbound APIs in shell.
def login(): try: client = NbClientManager( server=APIC, username=APIC_USER, password=APIC_PASSWORD, connect=True) return client except requests.exceptions.HTTPError as exc_info: if exc_info.response.status_code == 401: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n return self.client.login(username='Georgie', password='12345678')", "def _login(self):\n data = self._send(self.nc_request(action=\"login\", parameters={\"apipassword\": self._api_password}))\n\n self._session_id = data[\"apisessionid\"]\n\n logging.info(f\"logged in su...
[ "0.6875937", "0.6725718", "0.67193294", "0.6714746", "0.657623", "0.6535312", "0.65296215", "0.64994276", "0.6449236", "0.64444697", "0.642967", "0.6409585", "0.6409585", "0.63871634", "0.63714683", "0.6365348", "0.6360069", "0.63199073", "0.6291092", "0.62905693", "0.6288457...
0.6854403
1
Return tasks performed by the user.
def user_tasks(request, user_id): if request.method == 'GET': records = HmmerQueryRecord.objects.filter(user__id=user_id, result_date__gt=(localtime(now())+ timedelta(days=-7))) serializer = UserHmmerQueryRecordSerializer(records, many=True) return JSONResponse(serializer.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n response = {\"tasks\": []}\n user_roles = [role[\"name\"] for role in g._user[\"roles\"]]\n if \"administrator\" in user_roles or \"tasks_all\" in user_roles:\n for k, v in available_tasks_by_path.items():\n response[\"tasks\"].append(v)\n else...
[ "0.69700736", "0.6934072", "0.6929113", "0.6916527", "0.68759656", "0.67436564", "0.67088544", "0.6646358", "0.6645172", "0.65048426", "0.64583445", "0.6424227", "0.642221", "0.6413776", "0.6383586", "0.63764113", "0.6356284", "0.63544863", "0.63216263", "0.63204014", "0.6317...
0.6144191
29
According to this function We Fetch data from the data base ordering by reverse Id here (N_post = Normal profile posts) (my_post_lists > refer fetching all post from the data base
def get(self, request, *args, **kwargs): my_normal_post_lists = NormalPosts.objects.filter(uploded_by=request.user.normalprofile).order_by("-id") return render(request, self.template_name, { 'my_normal_post_lists': my_normal_post_lists, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_posts():\n get_chain_address = F\"{CONNECTED_NODE_ADDRESS}/chain\"\n response = requests.get(get_chain_address)\n if response.status_code == 200:\n content = []\n chain = json.loads(response.content)\n for block in chain[\"chain\"]:\n for tx in block[\"transaction...
[ "0.6402055", "0.63352996", "0.62798464", "0.62748545", "0.6224536", "0.6171342", "0.6130636", "0.6092321", "0.60728544", "0.59778965", "0.5957494", "0.5913101", "0.58570284", "0.58428276", "0.579514", "0.57481414", "0.5719974", "0.5713792", "0.5709445", "0.5702672", "0.568024...
0.66532075
0
For rqt compatibility we are using `linear.x` and `angular.z` from a Twist message. However it should be `angular.x` and `angular.y`
def _process_msg(self, data): # print(data) tilt = data.linear.x pan = data.angular.z #self.controller.pantilt_magnitude(pan, tilt) self.controller.pantilt_increase_angle(pan * self.scale_pan, tilt * self.scale_tilt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __callback(self, msg) -> Dict:\n self.__linear = Dict(\n {\n \"x\": msg.linear.x,\n \"y\": msg.linear.y,\n \"z\": msg.linear.z,\n }\n )\n self.__angular = Dict(\n {\n \"x\": msg.angular.x,\n ...
[ "0.5537455", "0.5401958", "0.53630567", "0.52156", "0.5203077", "0.51795006", "0.5143717", "0.51053476", "0.5084922", "0.5059623", "0.50466514", "0.5036253", "0.503613", "0.5029052", "0.49994868", "0.49704492", "0.4955925", "0.49507394", "0.49380156", "0.49047706", "0.4900437...
0.0
-1
Check a given line to see if a move is valid. Return the squares that will change, if the move is valid, otherwise an empty list.
def valid_line(board, x, y, dx, dy): if not 0 <= x + dx + dx < 8: return [] if not 0 <= y + dy + dy < 8: return [] coords_1 = board.columns[x+dx] + board.rows[y+dy] coords_2 = board.columns[x+dx+dx] + board.rows[y+dy+dy] if board[coords_1] != -self.color: # If the neighbour square...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legal_moves(player, board):\n return [sq for sq in Othello.squares() if Othello.is_legal(sq, player, board)]", "def is_valid(move):\n return isinstance(move, int) and move in Othello.squares()", "def is_valid_move(state, move):\n row, col = move\n if row not in [1, 2, 3] or col not in [...
[ "0.6370445", "0.62957835", "0.6113358", "0.61125934", "0.59849495", "0.5977295", "0.5965192", "0.5934297", "0.59330297", "0.59321463", "0.5929608", "0.5929004", "0.5915414", "0.5898067", "0.58975315", "0.5873103", "0.5867404", "0.586026", "0.5846924", "0.58331126", "0.5830166...
0.7884284
0
Evaluation function of the board. A piece of the player's color in a corner is 4 points, one along an edge is 2 points, and elsewhere is 1 point. A piece of the opponent's color is worth 0.
def eval_board(self, board): s = 0 for i in board.columns: for j in board.rows: if board[i+j] == self.color: if i in ['A', 'H'] or j in ['1', '8']: if i + j in ['A1', 'A8', 'H1', 'H8']: s += 4 else: s += 2 else: s += 1 return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n # if player has no move, then player lost, -inf or inf depend on who the player is\n # if player has moves, use heuristics.\n \n #checkColorMoves = self.getAvailableMoves(self.colorIndex)\n #otherColorMoves = self.getAvailableMoves(1-self.colorIndex)\n ...
[ "0.69344604", "0.68018126", "0.6800121", "0.6774733", "0.6551623", "0.65121746", "0.6468724", "0.64252824", "0.6397569", "0.6394515", "0.63608354", "0.6336115", "0.6334367", "0.6328842", "0.6319716", "0.62664115", "0.62501293", "0.62361", "0.6218228", "0.6217244", "0.6211332"...
0.67024314
4
Use MiniMax algorithm to determine the move to play, with alphabeta pruning.
def play(self, board, opponent): start_time = time.time() def simulate(board, is_opponent_turn, depth, opponent, start_time, a, b): """ Recursion function computing the score of a given move. The opponent boolean argument determines if the following turn is played by the opponent or not. ""...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimax(board):\n #This function will return the best move. \n #If Ai is playing as X, I can reduce the processing time by creating a random first move. \n if (board == initial_state()):\n coord1 = randint(0,2)\n coord2 = randint(0,2)\n return ((coord1,coord2))\n #first I deter...
[ "0.70229936", "0.6792192", "0.67826146", "0.67568797", "0.67559093", "0.6684708", "0.6654769", "0.66272855", "0.65883726", "0.6581193", "0.6574713", "0.6554755", "0.6548766", "0.6543756", "0.64998734", "0.6488344", "0.6479946", "0.64436334", "0.6422739", "0.6380333", "0.63784...
0.0
-1
Recursion function computing the score of a given move. The opponent boolean argument determines if the following turn is played by the opponent or not.
def simulate(board, is_opponent_turn, depth, opponent, start_time, a, b): if is_opponent_turn: player = opponent else: player = self possible_moves = player._possible_moves(board) move_scores = {} if not possible_moves: # The score is infinite, with the sign corresponding to the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(self, board, opponent):\n\t\t\n\t\tstart_time = time.time()\n\t\t\n\t\tdef simulate(board, is_opponent_turn, depth, opponent, start_time, a, b):\n\t\t\t\"\"\"\n\t\t\tRecursion function computing the score of a given move.\n\t\t\t\n\t\t\tThe opponent boolean argument determines if the following turn is\n\t...
[ "0.69787616", "0.6318311", "0.63142854", "0.6293641", "0.623148", "0.62209374", "0.61859447", "0.61115557", "0.61001784", "0.60605156", "0.6045047", "0.6041457", "0.60403275", "0.603791", "0.6027123", "0.60146695", "0.60074717", "0.5991258", "0.5983312", "0.5974562", "0.59606...
0.618126
7
Initialize the board with the standard Othello position
def init_position(self): # Starting position, 1 is for WHITE, -1 is for BLACK self['D4'] = self['E5'] = 1 self['D5'] = self['E4'] = -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_board(self):\n self.board = np.zeros(shape=(BOARD_SIZE, BOARD_SIZE), dtype=np.int) # another way of defining board: [[for x in range(cm.BOARD_SIZE)] for x in range(cm.BOARD_SIZE)]\n center = int(BOARD_SIZE / 2)\n self.board[center-1][center-1] = self.board[center][center] = WH...
[ "0.8083504", "0.77488697", "0.7438994", "0.73643464", "0.72463167", "0.7220114", "0.7191008", "0.71880144", "0.7174799", "0.7166685", "0.71415997", "0.7066792", "0.706121", "0.7045774", "0.70409983", "0.7039879", "0.6993662", "0.6991095", "0.69650966", "0.694338", "0.6939766"...
0.6865075
28
Check if the given key is valid, with the format XY. X is the column, between A and H, and Y is the row, between 1 and 8.
def _is_valid_key(self, key): # If the key is not a string if not isinstance(key, str): return False else: key = str.upper(key) # If the given key does not match the standard notation XY if len(key) != 2: return False # If the key is out of the board if key[0] not in self.columns or key[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_key_validity(self, key):\n if not isinstance(key, tuple):\n raise TypeError(\"key must be a tuple\")\n if len(key) != 2:\n raise ValueError(\"key must be of length two\")\n if not (isinstance(key[0], int) and isinstance(key[1], int)):\n raise TypeEr...
[ "0.7048035", "0.69368386", "0.692533", "0.6781486", "0.64831704", "0.6406309", "0.6364915", "0.6322703", "0.63189375", "0.63171273", "0.6212421", "0.61821645", "0.6121905", "0.6106289", "0.60453564", "0.60074675", "0.6005349", "0.5961546", "0.5960941", "0.5926862", "0.5837048...
0.79342586
0
Return the board coordinates i, j corresponding to the key XY
def _index_from_key(self, key): return self.columns.index(str.upper(key[0])), self.rows.index(key[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPosition(board):\n\tfor i in range(len(board.matrix)):\n\t\tfor j in range(len(board.matrix[i])):\n\t\t\tif board.matrix[i][j]==\"X\":\n\t\t\t\treturn i,j", "def __key__(self) -> Tuple[int, int]:\n return self.col, self.row", "def coord (i, j):\r\n return j, i", "def findCellXY(self , x,...
[ "0.7299645", "0.7122287", "0.69937205", "0.6871313", "0.6715392", "0.66681343", "0.6656185", "0.66532195", "0.6636303", "0.6629158", "0.6601875", "0.65480083", "0.6534002", "0.6524047", "0.65096056", "0.6506239", "0.65015393", "0.64298564", "0.6406467", "0.6394576", "0.639374...
0.5994994
53
Overload the [] operator to accept XY keys
def __setitem__(self, key, value): if not self._is_valid_key(key): raise KeyError('The key is not valid') if not value in [-1, 0, 1]: raise ValueError('The value must be -1, 0 or 1') x, y = self._index_from_key(key) self._board[x][y] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, key):\n if key in ('x','y','z'):\n return self.asDict()[key]\n else:\n return self.coords.__getitem__(key)", "def __getitem__(self,key):\n return self.x[key]", "def __getitem__(self, key):\n return self.points.__getitem__(key)", "def __getit...
[ "0.75461715", "0.7427655", "0.7405729", "0.71605366", "0.7073889", "0.7072541", "0.70467174", "0.70363206", "0.7029189", "0.6951831", "0.6848382", "0.67433494", "0.66678095", "0.6666291", "0.66608286", "0.6622905", "0.6614218", "0.6575028", "0.6550919", "0.65494376", "0.65457...
0.0
-1
Overload the [] operator to accept XY keys
def __getitem__(self, key): if not self._is_valid_key(key): raise KeyError x, y = self._index_from_key(key) return self._board[x][y]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, key):\n if key in ('x','y','z'):\n return self.asDict()[key]\n else:\n return self.coords.__getitem__(key)", "def __getitem__(self,key):\n return self.x[key]", "def __getitem__(self, key):\n return self.points.__getitem__(key)", "def __getit...
[ "0.75460315", "0.742674", "0.7404729", "0.7157618", "0.70730907", "0.70716316", "0.70434946", "0.7034367", "0.702775", "0.6947922", "0.6845464", "0.6739764", "0.66686404", "0.6663108", "0.665847", "0.66203", "0.66111004", "0.6572633", "0.6548615", "0.6546767", "0.65427226", ...
0.6313919
51
Convert the table into a readable board, with coordinates
def __str__(self): def mapping(x): if x == 1: # WHITE return 'O' elif x == -1: # BLACK return 'X' else: # Empty return '-' s = 'BLACK - X\n' s += 'WHITE - O\n\n' for j in self.rows: s += j s += ' ' s += ''.join(mapping(self[i+j]) for i in self.columns) s += '\n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertBoard(self):\n \n board = \"\"\n \n for m in self.squares:\n board += str(convertMarker(m)) + \" \"\n \n return board", "def get_board_coordinates(self):\n\n temp_board = copy.deepcopy(self.get_board())\n board_columns = self.get_board_columns()\n bo...
[ "0.6576129", "0.6575407", "0.6201789", "0.6135939", "0.61056095", "0.60675895", "0.59742355", "0.5955102", "0.5953307", "0.59366435", "0.5936343", "0.59124774", "0.5893347", "0.58907324", "0.5878285", "0.58739036", "0.58660585", "0.5853971", "0.58257514", "0.5805743", "0.5787...
0.0
-1
Change pieces color according to the given squares
def update_board(self, symbol, modified_squares): for coord in modified_squares: self.board[coord] = symbol
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_square_colors(self):\n\n for flea in self.fleas.sprites():\n flea.square.change_color()", "def draw_multicolor_square(t,sz):\r\n for i in [\"red\", \"purple\", \"hotpink\", \"blue\"]:\r\n t.color(i)\r\n t.forward(sz)\r\n t.left(90)", "def squareColour(square...
[ "0.74945563", "0.70106286", "0.66607684", "0.65294814", "0.64497787", "0.6353148", "0.6281977", "0.62021154", "0.61708444", "0.60909253", "0.6083564", "0.60631675", "0.60601044", "0.602275", "0.59414184", "0.5882508", "0.5834815", "0.5812058", "0.57959276", "0.57789", "0.5765...
0.62668204
7
takes parent curses window or screen to pop up over
def __init__(self,scr): (max_y,max_x) = scr.getmaxyx() dialog.Dialog.__init__(self, scr, "ReplaceDialog", 5, max_x-4, [ dialog.Frame("Search and Replace"), dialog.Prompt("pattern",1,2,1,"Pattern: ",-1), dialog.Prompt("re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __liveActually(self, stdscr):\n global screenH, screenW\n self.__stdscr = stdscr\n (screenH, screenW) = self.__stdscr.getmaxyx()\n self.__stdscr.addstr(0, 0, \"Custom Burner \" + common.version)\n self.__stdscr.addstr(screenH - 1, 0, \"a: add ISO q: Quit\")\n self.__s...
[ "0.6756631", "0.66955143", "0.65564334", "0.6341394", "0.6274769", "0.626661", "0.62321126", "0.6225449", "0.6205126", "0.61767125", "0.61512554", "0.6143071", "0.61400974", "0.6133195", "0.60910547", "0.60887235", "0.6079294", "0.6074284", "0.6048056", "0.6029311", "0.602538...
0.0
-1
takes parent curses window or screen to pop up over
def __init__(self,scr): dialog.Dialog.__init__(self, scr, "ConfirmReplaceDialog", 5, 40, [ dialog.Frame("Do replace?"), dialog.Button("yes",1,2,3,"YES",dialog.Component.CMP_KEY_OK), dialog.Button("no",2,10,3,"NO",dialog.Componen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __liveActually(self, stdscr):\n global screenH, screenW\n self.__stdscr = stdscr\n (screenH, screenW) = self.__stdscr.getmaxyx()\n self.__stdscr.addstr(0, 0, \"Custom Burner \" + common.version)\n self.__stdscr.addstr(screenH - 1, 0, \"a: add ISO q: Quit\")\n self.__s...
[ "0.6757171", "0.6696189", "0.6557804", "0.6340912", "0.6275182", "0.6266778", "0.6231722", "0.6225813", "0.6205134", "0.61776346", "0.61500937", "0.614316", "0.6139939", "0.61341995", "0.60915905", "0.6089772", "0.6079524", "0.60742605", "0.6048554", "0.6029321", "0.6026564",...
0.0
-1
wrapper function for replace dialog, launches dialog over the passed curses window and returns a tuple of (pattern, replace) or (None,None) if canceled
def replace( scr ): d = ReplaceDialog(scr) value = d.main() if not "pattern" in value: return (None,None) else: return (value["pattern"],value["replace"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,scr):\n (max_y,max_x) = scr.getmaxyx()\n dialog.Dialog.__init__(self, scr, \"ReplaceDialog\", 5, max_x-4, [ dialog.Frame(\"Search and Replace\"),\n dialog.Prompt(\"pattern\",1,2,1,\"Pattern: \",-1),\n ...
[ "0.66686773", "0.66447234", "0.62689984", "0.6130497", "0.60572594", "0.6004771", "0.5970039", "0.5969815", "0.55415326", "0.55407614", "0.5508379", "0.5372172", "0.53694844", "0.53567016", "0.52937233", "0.5293361", "0.5287301", "0.5183273", "0.5166747", "0.5142576", "0.5140...
0.69241583
0
wrapper function for the confirm replace dialog, returns 1 == yes, 2 == no, 3 == all, 4 == cancel returns 4 == cancel if canceled
def confirm_replace( scr ): d = ConfirmReplaceDialog(scr) value = d.main() if "yes" in value: if value["yes"]: return 1 elif value["no"]: return 2 elif value["all"]: return 3 elif value["cancel"]: return 4 else: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm(text, window=None):\n return message(text, u'Confirma', M_QUESTION, B_YES_NO, window) == R_YES", "def confirm(force):\n if not force:\n ans = input(que(bold(\"Are you sure? [y/N]: \")))\n else:\n ans = 'y'\n\n return ans.lower()", "def ask_ok_cancel(message=\"\", title=Non...
[ "0.6553291", "0.6408498", "0.63460416", "0.633145", "0.6314579", "0.63029253", "0.6250293", "0.6190345", "0.6184483", "0.6169528", "0.6107208", "0.60912764", "0.6072582", "0.607161", "0.60662067", "0.6043061", "0.6029693", "0.6001996", "0.5931839", "0.59036756", "0.59018284",...
0.85182613
0
Show portfolio of stocks
def index(): user_stocks_list = db.execute("SELECT stock FROM transactions WHERE id = :current_id", current_id=session["user_id"]) user_stocks = [] for stock in user_stocks_list: if stock['stock'] not in user_stocks: user_stocks.append(stock['stock']) stock_portfolio = [] for p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n stocks = []\n username = session.get(\"username\")\n symbol_list = db.execute(\"SELECT stock_symbol FROM history WHERE username=:username GROUP BY stock_symbol\", username=username)\n cash_balance = db.execute(\"SELECT cash FROM users WHERE username=:username\", username=username)[0][\"c...
[ "0.7349525", "0.7257509", "0.7092902", "0.70700926", "0.70322937", "0.70166755", "0.6955458", "0.69515324", "0.6818638", "0.67683095", "0.67541313", "0.6739686", "0.66745", "0.66665316", "0.6584005", "0.65794265", "0.6577333", "0.6556571", "0.65012944", "0.64815927", "0.64735...
0.70840114
3
Buy shares of stock
def buy(): if request.method == "POST": if not request.form.get("shares"): return apology("gimme share", 400) if not lookup(request.form.get("symbol")): return apology("not correct stock", 400) if not request.form.get("shares").isdigit(): return apology("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def buy(self, ctx, name, shares: int):\n\t\tplural = 's' if shares != 1 else ''\n\t\tcurrency = await bank.get_currency_name(ctx.guild)\n\t\tif shares < 1:\n\t\t\tawait ctx.send('You cannot buy less than one share.')\n\t\t\treturn\n\t\tname = name.upper()\n\t\ttry:\n\t\t\tstock_data = await self._get_stock_d...
[ "0.75090504", "0.73669976", "0.719782", "0.7076133", "0.702035", "0.70142156", "0.69631433", "0.6943623", "0.6915625", "0.691014", "0.6897359", "0.68731195", "0.6865242", "0.68647367", "0.6850216", "0.6848369", "0.6818854", "0.67891747", "0.6722476", "0.6719868", "0.67112154"...
0.67188966
20
Show history of transactions
def history(): transactions_list = db.execute("SELECT stock, units, price, time, type FROM transactions WHERE id = :current_id", current_id=session["user_id"]) return render_template("history.html", transactions=transactions_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history():\n transactions = db.execute(\"SELECT Symbol, Shares, Transacted FROM cash WHERE id=:id\", id=session[\"user_id\"])\n return render_template(\"history.html\", transactions=transactions)", "def history():\n\n #Query transactions by user id\n trans = Transactions.query.filter_by(owner=ses...
[ "0.82002884", "0.8140903", "0.8042388", "0.8033679", "0.80168986", "0.79338187", "0.7822898", "0.77456313", "0.77341163", "0.7718728", "0.7716838", "0.7708978", "0.7628142", "0.7624304", "0.7530955", "0.74965966", "0.7481556", "0.74478734", "0.7423578", "0.7382277", "0.728820...
0.8114919
2
Sell shares of stock
def sell(): if request.method == "POST": if not request.form.get("shares"): return apology("gimme share", 400) if not lookup(request.form.get("symbol")): return apology("not correct stock", 400) if not request.form.get("shares").isdigit(): return apology(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell_stock(self, symbol):\n amount_to_sell = self.get_equity(symbol)\n chirp.order_sell_fractional_by_price(symbol, amount_to_sell)\n self.L.add_line('', symbol, 'SOLD', amount_to_sell)", "async def sell(self, ctx, name, shares: int):\n\t\tplural = 's' if shares != 1 else ''\n\t\tif shar...
[ "0.76451164", "0.748746", "0.7260813", "0.71164954", "0.7057435", "0.70490545", "0.70268077", "0.69872165", "0.6972749", "0.6966809", "0.6915586", "0.68977857", "0.68829334", "0.6849716", "0.68191767", "0.68124473", "0.68022114", "0.6801836", "0.67799073", "0.67698354", "0.67...
0.66963017
27
Sets default value for order prefix
def default_order_prefix(): return 'mag_'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_prefix(self) -> str:", "def default_prefix(self) -> str:\n return \"\"", "def default_prefix(self) -> str:\n return \"\"", "def setDefaultTopicPrefix(self, prefix):\n\n internals.blpapi_SessionOptions_setDefaultTopicPrefix(\n self.__handle,\n prefix)", ...
[ "0.7458118", "0.69559276", "0.69559276", "0.6246707", "0.6121237", "0.6042731", "0.6010271", "0.6010271", "0.59950566", "0.5959341", "0.5876922", "0.58622044", "0.58620113", "0.58606994", "0.5838946", "0.5803903", "0.57959056", "0.57950515", "0.57381994", "0.57282114", "0.567...
0.7345233
1
Import order states for instances
def import_order_states(cls, instances): OrderState = Pool().get('magento.order_state') for instance in instances: Transaction().context.update({ 'magento_instance': instance.id }) # Import order states with OrderConfig( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_owned_instances():\n\n global owned_instances\n\n owned_instances = []\n try:\n with open(state_file, 'r') as f:\n for line in f:\n # Strip spaces and skip empty lines\n inst = line.strip()\n if inst != '':\n owned_instances.append(inst)\n logging.info(\"Loaded ...
[ "0.611863", "0.5710451", "0.55662745", "0.55035776", "0.5480113", "0.54768515", "0.54705364", "0.54545605", "0.5401249", "0.5392934", "0.5383165", "0.53240365", "0.53240365", "0.5321685", "0.5317529", "0.5316439", "0.5280355", "0.52445763", "0.51902944", "0.51692367", "0.5133...
0.7806463
0
Sets default for active
def default_active(): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_active(self, active):\n self.active = active", "def set_active(self):\n self.active = True", "def set_active(self, active):\n self._active = active", "def active(self, active):\n\n self._active = active", "def active(self, active):\n\n self._active = active", "d...
[ "0.75453544", "0.75211966", "0.7276021", "0.70126075", "0.70126075", "0.70126075", "0.70126075", "0.6970733", "0.6970733", "0.6938084", "0.69131684", "0.68543226", "0.68543226", "0.6832889", "0.6776642", "0.67710924", "0.6755308", "0.6708381", "0.6620978", "0.65976095", "0.65...
0.80122274
0
Sets current company as default
def default_company(): return Transaction().context.get('company')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company(self, company):\n self._company = company", "def company(self, company):\n\n self._company = company", "def company(self, company):\n\n self._company = company", "def set_as_default (self):\n\t\ttry:\n\t\t\tself.config.set('Global', 'Default', self.currentAccount.data['name']...
[ "0.70627534", "0.6857343", "0.6857343", "0.6305711", "0.62525135", "0.6229821", "0.6217805", "0.60344994", "0.59844", "0.5886969", "0.5837648", "0.5830834", "0.58194566", "0.5790694", "0.5790694", "0.57838154", "0.5768062", "0.56869924", "0.5668195", "0.5659434", "0.5657504",...
0.7678898
0
Setup the class before adding to pool
def __setup__(cls): super(Instance, cls).__setup__() cls._sql_constraints += [ ( 'unique_url', 'UNIQUE(url)', 'URL of an instance must be unique' ) ] cls._error_messages.update({ "connection_error": "Incorrect API Settin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_class(self):\n pass", "def setUpClass(cls):\n cls.gh_pool = {}\n return cls", "def setup_class(klass):", "def setup_class(klass):", "def setup_class(cls):", "def setup_class(cls):", "def setup_class(cls):\n pass", "def setup_class(cls):\n pass", "def set...
[ "0.75574243", "0.7422462", "0.737461", "0.737461", "0.73539114", "0.73539114", "0.71656346", "0.71656346", "0.6984424", "0.6984424", "0.66569006", "0.66247773", "0.65747637", "0.6553647", "0.6470976", "0.6463053", "0.63769406", "0.63236034", "0.63013893", "0.6291692", "0.6277...
0.0
-1
Test magento connection and display appropriate message to user
def test_connection(cls, instances): try: instance, = instances except ValueError: cls.raise_user_error('multiple_instances') try: with magento.API( instance.url, instance.api_user, instance.api_key ): return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\r\n # print ('Testing connection..')\r\n get_qlik_sense.get_about()", "def test_connection(self):\n r = main.List.connection()\n self.assertTrue(r.ping(), \"Connection failed.\")", "def test_check_connection(self):\n self.assertIsNotNone(app.check_connection())", "de...
[ "0.6218213", "0.61637264", "0.6146544", "0.6034761", "0.6019937", "0.6004254", "0.5970135", "0.5933082", "0.5921556", "0.58974683", "0.586006", "0.58152586", "0.57865936", "0.57838476", "0.57683957", "0.57456696", "0.5706915", "0.5674771", "0.5674771", "0.5653467", "0.5640670...
0.6048009
3
Import the websites and their stores/view from magento
def import_websites(cls, instances): Website = Pool().get('magento.instance.website') Store = Pool().get('magento.website.store') StoreView = Pool().get('magento.store.store_view') MagentoOrderState = Pool().get('magento.order_state') try: instance, = instances ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_inventory(self, websites):\n for website in websites:\n website.export_inventory_to_magento()", "def importSites(self,sites_list):\n \"\"\" Append these sites objects to a sample \"\"\" \n self.sites = []\n for s in sites_list:\n mySite = Site(s)\n ...
[ "0.6846587", "0.6164038", "0.61030966", "0.58853394", "0.56397796", "0.5540255", "0.5497646", "0.5465208", "0.5342944", "0.52653944", "0.52565813", "0.5253915", "0.5238693", "0.51912624", "0.5140717", "0.5108908", "0.50549793", "0.50509304", "0.5028507", "0.5003324", "0.49764...
0.7438709
0
Import carriers/shipping methods from magento for instances
def import_carriers(cls, instances): InstanceCarrier = Pool().get('magento.instance.carrier') for instance in instances: with Transaction().set_context({ 'magento_instance': instance.id }): with OrderConfig( instance.url, inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_methods(self):\r\n methods = {obj['method'] for obj in self.cf_data}\r\n metadata = {obj['name']: obj for obj in self.csv_data}\r\n self.data = {}\r\n missing = set()\r\n for line in self.cf_data:\r\n if line['method'] not in self.units:\r\n ...
[ "0.5449542", "0.5294955", "0.5138079", "0.48752856", "0.48261753", "0.4798459", "0.47784653", "0.47548106", "0.47265235", "0.4684022", "0.46793112", "0.46229893", "0.4609243", "0.46083152", "0.45978007", "0.45886204", "0.45643952", "0.45614693", "0.45093706", "0.4497847", "0....
0.728472
0
Returns company related to instance
def get_company(self, name): return self.instance.company.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company(self):\n return self._company", "def company(self):\n return self._company", "def get_company(self, company_referece):\n url = 'companies/{0}'.format(company_referece)\n result = self.get(url)\n return result.get('company', result)", "def get_company(self, name)...
[ "0.73066944", "0.73066944", "0.6798454", "0.6656939", "0.653414", "0.6386832", "0.6385951", "0.6097074", "0.6040403", "0.5961637", "0.59109956", "0.58495027", "0.5824305", "0.58211327", "0.57911086", "0.57746476", "0.57398057", "0.5726027", "0.5632967", "0.55825716", "0.55561...
0.6972694
2
Sets default root category id. Is set to 1, because the default root category is 1
def default_magento_root_category_id(): return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_id(root: TreeNode):\n current_id = [0]\n init_id_helper(root, current_id)\n return current_id[0]", "def PrimaryCategory(self, default=None):\n return self.data.get('categories', [default])[0]", "def root(self) -> 'Category':\n if self.parent:\n return self.parent....
[ "0.65238833", "0.60481906", "0.5950954", "0.5714606", "0.5712186", "0.5594999", "0.55752224", "0.55726135", "0.5566532", "0.5562183", "0.55386394", "0.55160403", "0.5515742", "0.5502178", "0.5425077", "0.5389408", "0.5376485", "0.53576773", "0.5263281", "0.52428555", "0.52280...
0.82208395
0
Sets default product uom for website
def default_default_uom(): ProductUom = Pool().get('product.uom') return ProductUom.search([('name', '=', 'Unit')])[0].id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_product():\n return Product.objects.get_or_create(name='Unknown', category=get_default_category())", "def setUp(self) -> None:\n self.default = Product('Test Product')\n self.tester = Product('Tester', price=15, weight=2)", "def set_product(self, product):\n self.single_...
[ "0.56517774", "0.56510484", "0.563105", "0.54381317", "0.5406732", "0.5265254", "0.52629864", "0.52540123", "0.52490556", "0.5216789", "0.52122056", "0.519658", "0.51876277", "0.5182377", "0.5166348", "0.5162013", "0.51297545", "0.50542104", "0.5047263", "0.5036484", "0.50230...
0.64440674
0
Setup the class before adding to pool
def __setup__(cls): super(InstanceWebsite, cls).__setup__() cls._sql_constraints += [ ( 'magento_id_instance_unique', 'UNIQUE(magento_id, instance)', 'A website must be unique in an instance' ) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_class(self):\n pass", "def setUpClass(cls):\n cls.gh_pool = {}\n return cls", "def setup_class(klass):", "def setup_class(klass):", "def setup_class(cls):", "def setup_class(cls):", "def setup_class(cls):\n pass", "def setup_class(cls):\n pass", "def set...
[ "0.7556195", "0.74210316", "0.73734325", "0.73734325", "0.7353107", "0.7353107", "0.7164271", "0.7164271", "0.6981915", "0.6981915", "0.6657091", "0.66256726", "0.6572038", "0.6555716", "0.64698297", "0.64651984", "0.63758457", "0.632107", "0.6299676", "0.62898225", "0.627559...
0.0
-1
Looks for the website whose `values` are sent by magento against the instance with `instance` in tryton. If a record exists for this, return that else create a new one and return
def find_or_create(cls, instance, values): websites = cls.search([ ('instance', '=', instance.id), ('magento_id', '=', int(values['website_id'])) ]) if websites: return websites[0] return cls.create([{ 'name': values['name'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_or_create(cls, website, values):\n stores = cls.search([\n ('website', '=', website.id),\n ('magento_id', '=', int(values['group_id']))\n ])\n\n if stores:\n return stores[0]\n\n return cls.create([{\n 'name': values['name'],\n ...
[ "0.66654605", "0.5773132", "0.5575794", "0.52986217", "0.5219435", "0.5175775", "0.5101473", "0.50378966", "0.50342923", "0.50271636", "0.497034", "0.49112558", "0.48881826", "0.48387477", "0.4782479", "0.47679812", "0.47377402", "0.47104242", "0.46826082", "0.46774152", "0.4...
0.78474057
0
Exports inventory stock information to magento
def export_inventory(self, websites): for website in websites: website.export_inventory_to_magento()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_inventory_to_magento(self):\n Location = Pool().get('stock.location')\n\n product_templates = []\n instance = self.instance\n\n locations = Location.search([('type', '=', 'storage')])\n\n for magento_product_template in self.magento_product_templates:\n prod...
[ "0.6697952", "0.6533873", "0.63715094", "0.6170064", "0.6122549", "0.6118368", "0.60934365", "0.6089652", "0.60319245", "0.5859282", "0.5852072", "0.58282447", "0.5828063", "0.5802748", "0.5768997", "0.57482827", "0.57467115", "0.57139105", "0.5640052", "0.5583418", "0.557933...
0.6653359
1
Exports stock data of products from tryton to magento for this website
def export_inventory_to_magento(self): Location = Pool().get('stock.location') product_templates = [] instance = self.instance locations = Location.search([('type', '=', 'storage')]) for magento_product_template in self.magento_product_templates: product_template =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStockData():\n pass", "def export_inventory(self, websites):\n for website in websites:\n website.export_inventory_to_magento()", "def export_inventory(self, cursor, user, ids, context):\n website_obj = self.pool.get('magento.instance.website')\n\n website_id = con...
[ "0.64082617", "0.6399653", "0.63895637", "0.62795657", "0.6145077", "0.60885113", "0.6076985", "0.6049843", "0.6021914", "0.6008381", "0.5943344", "0.59400165", "0.59058166", "0.5860487", "0.58527863", "0.5842598", "0.58248246", "0.5812929", "0.57357395", "0.57285345", "0.570...
0.656638
0
Returns company related to website
def get_company(self, name): return self.website.company.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_website_companies_get_details(self):\n pass", "def get_company(self, company_referece):\n url = 'companies/{0}'.format(company_referece)\n result = self.get(url)\n return result.get('company', result)", "def run_whoxy_company_search(self,company):\n if self.whoxy_api...
[ "0.67787915", "0.65286976", "0.64474934", "0.6438675", "0.6438675", "0.6394601", "0.62661326", "0.6226491", "0.6183185", "0.611617", "0.6092316", "0.60650074", "0.60194445", "0.5988", "0.59472513", "0.5944278", "0.590658", "0.58898836", "0.5884298", "0.5875273", "0.5849969", ...
0.67437315
1
Returns instance related to website
def get_instance(self, name): return self.website.instance.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_site(self):\n raise NotImplementedError", "def website(self):\n return self._website", "def get_website(self):\n if self.website:\n return self.website\n else:\n try:\n return self.parent.get_website\n except AttributeError: # ...
[ "0.64772785", "0.636314", "0.6204019", "0.6150029", "0.6150029", "0.6122803", "0.61147714", "0.61060196", "0.5981487", "0.5979728", "0.597262", "0.5944322", "0.5904715", "0.5840119", "0.57975864", "0.57975864", "0.5797228", "0.5790714", "0.5753903", "0.57280713", "0.56908727"...
0.7607952
0
Setup the class before adding to pool
def __setup__(cls): super(WebsiteStore, cls).__setup__() cls._sql_constraints += [ ( 'magento_id_website_unique', 'UNIQUE(magento_id, website)', 'A store must be unique in a website' ) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_class(self):\n pass", "def setUpClass(cls):\n cls.gh_pool = {}\n return cls", "def setup_class(klass):", "def setup_class(klass):", "def setup_class(cls):", "def setup_class(cls):", "def setup_class(cls):\n pass", "def setup_class(cls):\n pass", "def set...
[ "0.7554398", "0.74211085", "0.7371719", "0.7371719", "0.73514915", "0.73514915", "0.7162692", "0.7162692", "0.6980408", "0.6980408", "0.6655677", "0.6627861", "0.65702707", "0.655733", "0.646866", "0.6466476", "0.6375031", "0.6319195", "0.630023", "0.628867", "0.62733835", ...
0.0
-1
Looks for the store whose `values` are sent by magento against the website with `website` in tryton. If a record exists for this, return that else create a new one and return
def find_or_create(cls, website, values): stores = cls.search([ ('website', '=', website.id), ('magento_id', '=', int(values['group_id'])) ]) if stores: return stores[0] return cls.create([{ 'name': values['name'], 'magento_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_or_create(cls, instance, values):\n websites = cls.search([\n ('instance', '=', instance.id),\n ('magento_id', '=', int(values['website_id']))\n ])\n\n if websites:\n return websites[0]\n\n return cls.create([{\n 'name': values['name'...
[ "0.7311195", "0.6705495", "0.5444057", "0.53808737", "0.5374841", "0.5243312", "0.5237537", "0.52265453", "0.51574576", "0.51567435", "0.51019216", "0.49754298", "0.4973136", "0.49432912", "0.48770675", "0.48759344", "0.4862138", "0.48415354", "0.47996405", "0.47916886", "0.4...
0.7607294
0
Exports tier prices of products from tryton to magento for this store
def export_tier_prices_to_magento(self): instance = self.website.instance for mag_product_template in self.website.magento_product_templates: product_template = mag_product_template.template product = product_template.products[0] # Get the price tiers from the produ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_export_(self, fields):\n Store = Pool().get('magento.website.store')\n\n store = Store(Transaction().context.get('active_id'))\n\n return {\n 'products_count': store.export_tier_prices_to_magento()\n }", "def get_prices(self):\n pass", "def import_price...
[ "0.75007206", "0.57632595", "0.5730589", "0.5632844", "0.55756336", "0.5540464", "0.55365473", "0.5528423", "0.54979783", "0.5493264", "0.5401977", "0.5359194", "0.5324393", "0.52958417", "0.52836686", "0.5243634", "0.5186369", "0.51700795", "0.5145529", "0.5140887", "0.51227...
0.83025616
0
Returns instance related to store
def get_instance(self, name): return self.store.instance.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_store(self):\n return self._store", "def get_resource(self):\n return self._stores", "def get_store(self, store_name: str) -> Any:\n pass", "def get(cls):\n return cls.instance", "def instance(self):\n return self.__instance", "def get_store(store_name: str):\n ...
[ "0.7551979", "0.70366335", "0.67878246", "0.6653498", "0.66288173", "0.6600048", "0.6577926", "0.6564163", "0.6541299", "0.6418138", "0.6418138", "0.63910156", "0.639095", "0.63711053", "0.63395643", "0.6328525", "0.6310312", "0.6309283", "0.62250817", "0.62165284", "0.618410...
0.7497158
1
Returns website related to store
def get_website(self, name): return self.store.website.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def website(self):\n return self._website", "def get_store(self, store_name: str) -> Any:\n pass", "def get_store(self, store_id):\n for store in self.get_stores():\n if store[\"code\"] == store_id:\n return store", "def storelocator():\n\n\treturn render_templa...
[ "0.60933346", "0.6046867", "0.6016062", "0.5945412", "0.5943508", "0.594223", "0.59373456", "0.59351546", "0.5915155", "0.59022623", "0.58764714", "0.58564603", "0.58500767", "0.58093214", "0.57855004", "0.57465243", "0.57146066", "0.57071215", "0.5671937", "0.5665069", "0.56...
0.68372726
0
Returns company related to store
def get_company(self, name): return self.store.company.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_company(self, company_referece):\n url = 'companies/{0}'.format(company_referece)\n result = self.get(url)\n return result.get('company', result)", "def company(self):\n return self._company", "def company(self):\n return self._company", "def get_company(self, name)...
[ "0.64457345", "0.6345455", "0.6345455", "0.6151367", "0.6144638", "0.6015758", "0.5981194", "0.588651", "0.58488876", "0.58255076", "0.5811751", "0.5811187", "0.5736758", "0.5736758", "0.5736758", "0.5736758", "0.56247306", "0.5568528", "0.5560751", "0.555124", "0.5547191", ...
0.6659226
0
Setup the class before adding to pool
def __setup__(cls): super(WebsiteStoreView, cls).__setup__() cls._sql_constraints += [ ( 'magento_id_store_unique', 'UNIQUE(magento_id, store)', 'A store view must be unique in a store' ) ] cls._error_messages.update({ "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_class(self):\n pass", "def setUpClass(cls):\n cls.gh_pool = {}\n return cls", "def setup_class(klass):", "def setup_class(klass):", "def setup_class(cls):", "def setup_class(cls):", "def setup_class(cls):\n pass", "def setup_class(cls):\n pass", "def set...
[ "0.7556195", "0.74210316", "0.73734325", "0.73734325", "0.7353107", "0.7353107", "0.7164271", "0.7164271", "0.6981915", "0.6981915", "0.6657091", "0.66256726", "0.6572038", "0.6555716", "0.64698297", "0.64651984", "0.63758457", "0.632107", "0.6299676", "0.62898225", "0.627559...
0.0
-1
Looks for the store view whose `values` are sent by magento against the store with `store` in tryton. If a record exists for this, return that else create a new one and return
def find_or_create(cls, store, values): store_views = cls.search([ ('store', '=', store.id), ('magento_id', '=', int(values['store_id'])) ]) if store_views: return store_views[0] return cls(**{ 'name': values['name'], 'code': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_or_create(cls, website, values):\n stores = cls.search([\n ('website', '=', website.id),\n ('magento_id', '=', int(values['group_id']))\n ])\n\n if stores:\n return stores[0]\n\n return cls.create([{\n 'name': values['name'],\n ...
[ "0.60469294", "0.55298656", "0.54436827", "0.5388281", "0.5386525", "0.5251227", "0.5241936", "0.52329993", "0.51904476", "0.514361", "0.50282407", "0.49991724", "0.49459726", "0.49037516", "0.4829308", "0.48178092", "0.48170227", "0.47974437", "0.47709832", "0.47291148", "0....
0.79743385
0
Calls wizard to import orders for store view
def import_orders_button(cls, store_views): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_order_from_store_view(self):\n Sale = Pool().get('sale.sale')\n MagentoOrderState = Pool().get('magento.order_state')\n\n new_sales = []\n instance = self.instance\n with Transaction().set_context({\n 'magento_instance': instance.id,\n 'magento_we...
[ "0.72466475", "0.7039832", "0.6421888", "0.5852894", "0.58005047", "0.56411994", "0.5609187", "0.5599366", "0.5552095", "0.55054647", "0.5487412", "0.54771256", "0.5407994", "0.5373156", "0.53110003", "0.5274243", "0.52071506", "0.52046293", "0.5194662", "0.5182003", "0.51817...
0.7385691
0
Calls wizard to export order status for store view
def export_order_status_button(cls, store_views): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_order_status(self, store_views=None):\n if store_views is None:\n store_views = self.search([])\n\n for store_view in store_views:\n store_view.export_order_status_for_store_view()", "def export_order_status_for_store_view(self):\n Sale = Pool().get('sale.sal...
[ "0.7288336", "0.72106403", "0.66292167", "0.64519197", "0.6352034", "0.61387265", "0.5909034", "0.5826499", "0.5795876", "0.5792858", "0.5707474", "0.56563604", "0.56291175", "0.5613185", "0.55068296", "0.5367808", "0.5351224", "0.53355646", "0.5288537", "0.52830464", "0.5270...
0.7584346
0
Imports sale from store view
def import_order_from_store_view(self): Sale = Pool().get('sale.sale') MagentoOrderState = Pool().get('magento.order_state') new_sales = [] instance = self.instance with Transaction().set_context({ 'magento_instance': instance.id, 'magento_website': self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_orders_button(cls, store_views):\n pass", "def import_stores(self):\n\n stores = self.product_infos['stores']\n\n for product_store in stores:\n try:\n store = Stores.objects.get(\n name=product_store\n )\n exc...
[ "0.5974712", "0.58691406", "0.5794356", "0.578453", "0.5557279", "0.55490655", "0.54773957", "0.5474218", "0.5408638", "0.54054606", "0.53851986", "0.537367", "0.5366755", "0.5356549", "0.5353029", "0.53460276", "0.52735", "0.5259739", "0.52387893", "0.51985174", "0.519066", ...
0.71493983
0
Export sales orders status to magento.
def export_order_status(self, store_views=None): if store_views is None: store_views = self.search([]) for store_view in store_views: store_view.export_order_status_for_store_view()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_order_status_for_store_view(self):\n Sale = Pool().get('sale.sale')\n\n exported_sales = []\n domain = [('magento_store_view', '=', self.id)]\n\n if self.last_order_export_time:\n domain = [('write_date', '>=', self.last_order_export_time)]\n\n sales = Sale....
[ "0.8080878", "0.7568165", "0.7052279", "0.6801584", "0.59504527", "0.5734913", "0.5717742", "0.5716764", "0.5693223", "0.5589955", "0.5435707", "0.54128766", "0.5388001", "0.53101224", "0.5294219", "0.52736944", "0.52662784", "0.52329427", "0.519866", "0.5175698", "0.5168543"...
0.71719784
2
Export sale orders to magento for the current store view. If last export time is defined, export only those orders which are updated after last export time.
def export_order_status_for_store_view(self): Sale = Pool().get('sale.sale') exported_sales = [] domain = [('magento_store_view', '=', self.id)] if self.last_order_export_time: domain = [('write_date', '>=', self.last_order_export_time)] sales = Sale.search(domain)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_shipment_status_to_magento(self):\n Shipment = Pool().get('stock.shipment.out')\n Sale = Pool().get('sale.sale')\n\n instance = self.instance\n\n sale_domain = [\n ('magento_store_view', '=', self.id),\n ('shipment_state', '=', 'sent'),\n ('ma...
[ "0.67229575", "0.6432975", "0.6346789", "0.6296307", "0.5768794", "0.5759411", "0.5717263", "0.5693412", "0.564108", "0.556255", "0.5428441", "0.53630245", "0.52866554", "0.52807623", "0.5272195", "0.5250655", "0.5202378", "0.51813996", "0.51757", "0.5057805", "0.5045959", ...
0.77887744
0
Import orders from magento for store views
def import_orders(cls, store_views=None): if store_views is None: store_views = cls.search([]) for store_view in store_views: store_view.import_order_from_store_view()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_order_from_store_view(self):\n Sale = Pool().get('sale.sale')\n MagentoOrderState = Pool().get('magento.order_state')\n\n new_sales = []\n instance = self.instance\n with Transaction().set_context({\n 'magento_instance': instance.id,\n 'magento_we...
[ "0.8316281", "0.7346102", "0.6070537", "0.5948057", "0.5888158", "0.58869237", "0.5863658", "0.5711296", "0.56941754", "0.5657132", "0.55940354", "0.55788964", "0.55533653", "0.5447958", "0.5446187", "0.54387885", "0.53899795", "0.53408515", "0.53375185", "0.5320202", "0.5295...
0.7725665
1
Export Shipment status for shipments related to current store view. This method is called by cron.
def export_shipment_status(cls, store_views=None): if store_views is None: store_views = cls.search([]) for store_view in store_views: # Set the instance in context with Transaction().set_context( magento_instance=store_view.instance.id ):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_shipment_status_to_magento(self):\n Shipment = Pool().get('stock.shipment.out')\n Sale = Pool().get('sale.sale')\n\n instance = self.instance\n\n sale_domain = [\n ('magento_store_view', '=', self.id),\n ('shipment_state', '=', 'sent'),\n ('ma...
[ "0.8125076", "0.7221847", "0.66516876", "0.62769276", "0.60418105", "0.5811156", "0.5546291", "0.55305487", "0.55091906", "0.5489711", "0.54192644", "0.54172236", "0.53858155", "0.53763556", "0.53559977", "0.53334343", "0.53119606", "0.5288046", "0.52613235", "0.5238616", "0....
0.8081001
1
Exports shipment status for shipments to magento, if they are shipped
def export_shipment_status_to_magento(self): Shipment = Pool().get('stock.shipment.out') Sale = Pool().get('sale.sale') instance = self.instance sale_domain = [ ('magento_store_view', '=', self.id), ('shipment_state', '=', 'sent'), ('magento_id', '!=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_shipment_status(cls, store_views=None):\n if store_views is None:\n store_views = cls.search([])\n\n for store_view in store_views:\n # Set the instance in context\n with Transaction().set_context(\n magento_instance=store_view.instance.id\n ...
[ "0.72959864", "0.65770334", "0.61950433", "0.61917406", "0.5866233", "0.5862453", "0.5841632", "0.57592666", "0.5728388", "0.5728388", "0.5728388", "0.5728388", "0.5728388", "0.5728388", "0.5728388", "0.5728388", "0.5728388", "0.5726259", "0.5599219", "0.5533492", "0.5525183"...
0.83704627
0
Helper method to get the current store view.
def get_current_store_view(cls): return cls(Transaction().context.get('magento_store_view'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_view(self):\n return self.view", "def view(self) -> str:\n return pulumi.get(self, \"view\")", "def _get_store(self):\n return self._store", "def GetView(self):\r\n return self.model.GetView()", "def View(self):\n return self._view", "def getCurrentView(self):\n...
[ "0.69337434", "0.6776546", "0.6570207", "0.644002", "0.636768", "0.6339466", "0.63136166", "0.63065296", "0.6254641", "0.6231597", "0.622977", "0.6139501", "0.60650826", "0.5972074", "0.59618914", "0.59374434", "0.5819738", "0.57517654", "0.5725532", "0.5725355", "0.56592387"...
0.8440489
0
Setup the class before adding to pool
def __setup__(cls): super(StorePriceTier, cls).__setup__() cls._sql_constraints += [ ( 'store_quantity_unique', 'UNIQUE(store, quantity)', 'Quantity in price tiers must be unique for a store' ) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_class(self):\n pass", "def setUpClass(cls):\n cls.gh_pool = {}\n return cls", "def setup_class(klass):", "def setup_class(klass):", "def setup_class(cls):", "def setup_class(cls):", "def setup_class(cls):\n pass", "def setup_class(cls):\n pass", "def set...
[ "0.75574243", "0.7422462", "0.737461", "0.737461", "0.73539114", "0.73539114", "0.71656346", "0.71656346", "0.6984424", "0.6984424", "0.66569006", "0.66247773", "0.65747637", "0.6553647", "0.6470976", "0.6463053", "0.63769406", "0.63236034", "0.63013893", "0.6291692", "0.6277...
0.0
-1
Test the connection and show the user appropriate message
def default_start(self, data): return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection(self):\n r = main.List.connection()\n self.assertTrue(r.ping(), \"Connection failed.\")", "def test_connection():\r\n try:\r\n connect()\r\n except:\r\n pass\r\n print ('Unable to connect.')\r\n else:\r\n main()", "def test_check_connection...
[ "0.7490747", "0.74508506", "0.7290033", "0.71781206", "0.7141763", "0.70460165", "0.69089913", "0.6852809", "0.6811199", "0.67994654", "0.67778814", "0.673718", "0.67254776", "0.6720761", "0.6685406", "0.66602486", "0.6656571", "0.6612384", "0.6587208", "0.6569297", "0.654030...
0.0
-1
Import the websites, store and store views and show user a confirmation message
def default_start(self, data): return { 'message': "This wizard has imported all the websites for this " + "magento instance. It has also imported all the stores and " + "store views related to the websites imported. If any of " + "the records existed ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n rel_sup_csv_form = RelationSupportCSVDatasetForm()\n queries_csv_form = QueriesCSVDatasetForm()\n text_file_form = TextDatasetForm()\n article_url_form = NewsArticleURLForm()\n ind_sent_form = IndividualSentenceForm()\n html_files_form = HTMLFilesForm()\n data = []\n fo...
[ "0.5696574", "0.55614066", "0.55519164", "0.5478478", "0.54566526", "0.5309509", "0.52523816", "0.5249747", "0.5243258", "0.5227952", "0.5217405", "0.521123", "0.5184404", "0.5179009", "0.51621497", "0.51396", "0.51369673", "0.51349753", "0.5115782", "0.51126957", "0.5110532"...
0.61303335
0
Import order states and show the user appropriate message
def default_start(self, data): return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_order_states(cls, instances):\n OrderState = Pool().get('magento.order_state')\n\n for instance in instances:\n\n Transaction().context.update({\n 'magento_instance': instance.id\n })\n\n # Import order states\n with OrderConfig(\n...
[ "0.6155101", "0.5849145", "0.57209134", "0.56626", "0.5599493", "0.5529732", "0.5393179", "0.5385716", "0.5292204", "0.5288195", "0.52389044", "0.52272", "0.5220959", "0.51961696", "0.5181943", "0.5181943", "0.5181943", "0.5181478", "0.5178691", "0.5160678", "0.51230294", "...
0.0
-1
Import carriers and show the user appropriate message
def default_start(self, data): return { 'message': "This wizard has imported all the carriers / " + "shipping methods for this magento instance. You should now " + "configure the imported carriers / shipping methods to " + "match the shipment carriers ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_click(self):\n path = self.path.get()\n if not path:\n self.error_label.config(text='Alege baza de date.')\n return\n\n password = self.pass_entry.get()\n if not password:\n self.error_label.config(text='Introdu parola.')\n return\n\n try:\n sharing.import_databas...
[ "0.5680752", "0.5669067", "0.54800856", "0.5428995", "0.5351158", "0.5288161", "0.528", "0.52469295", "0.5222503", "0.5153588", "0.5078875", "0.5049231", "0.5039973", "0.503053", "0.5001831", "0.49440625", "0.49394995", "0.4930786", "0.49300444", "0.49074003", "0.48968795", ...
0.57213557
0
Export price tiers and return count of products
def default_export_(self, fields): Store = Pool().get('magento.website.store') store = Store(Transaction().context.get('active_id')) return { 'products_count': store.export_tier_prices_to_magento() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_tier_prices_to_magento(self):\n instance = self.website.instance\n\n for mag_product_template in self.website.magento_product_templates:\n product_template = mag_product_template.template\n product = product_template.products[0]\n\n # Get the price tiers fr...
[ "0.668143", "0.5804564", "0.5580061", "0.5539434", "0.5399712", "0.5346444", "0.53069025", "0.52848166", "0.52742374", "0.5270996", "0.5269696", "0.5262819", "0.52455866", "0.5227559", "0.51672083", "0.5146561", "0.5138672", "0.5123716", "0.5082605", "0.5078199", "0.50692075"...
0.7045785
0
Sets default data for wizard
def default_start(self, data): return { 'message': "This wizard will export shipment status for all the " + "shipments related to this store view. To export tracking " + "information also for these shipments please check the " + "checkbox for Export Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_formset_data(self, request, step, formset):\n return None", "def set_default_values_as_needed(self):\n if self.verbose:\n click.echo('Updating required default values')\n for field in ARGUMENTS_DEFAULT_VALUES:\n if self.__class__.__name__ in ARGUMENTS_DEFAUL...
[ "0.6519002", "0.6392829", "0.6373711", "0.62287086", "0.62246954", "0.61705244", "0.6084244", "0.6082528", "0.60434717", "0.5990839", "0.5933839", "0.5886592", "0.58596873", "0.5820358", "0.5808453", "0.5786663", "0.57775867", "0.57587767", "0.57562083", "0.5755933", "0.57356...
0.555608
35
Collate function to be used when wrapping a VgSceneGraphDataset in a
def vg_collate_fn(batch): # batch is a list, and each element is (image, objs, boxes, triples) all_imgs, all_objs, all_boxes, all_masks, all_obj_to_img = [], [], [], [], [] # obj_offset = 0 for i, (img, objs, boxes, masks) in enumerate(batch): all_imgs.append(img[None]) O = objs.size(0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collate_fn(data):\n # Sort a data list by caption length\n data.sort(key=lambda x: len(x[1]), reverse=True)\n images, captions, bboxes, depends, ids, img_ids = zip(*data)\n\n # Merge images (convert tuple of 3D tensor to 4D tensor)\n images = torch.stack(images, 0)\n bboxes = torch.stack(bbox...
[ "0.5985818", "0.5981827", "0.59427935", "0.58496034", "0.58317727", "0.5751567", "0.56921464", "0.5680163", "0.56427085", "0.5603626", "0.55759823", "0.5560832", "0.5505747", "0.5493889", "0.5471393", "0.5469401", "0.5468975", "0.54273945", "0.5414179", "0.5392552", "0.537171...
0.5065233
39
Select a Pay What is Fair amount then submit the form
def choose_pwif_amount(self, pwif_amount): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_CurrentradioButton_clicked(self):\n # TODO: not implemented yet\n # raise NotImplementedError\n print(\"Select current cash deposit. If you select it, cash will be released after 7 days\")\n self.select_actor = \"Month0\"", "def click_submit_payment_button(self):\n self....
[ "0.6333765", "0.6049617", "0.5915037", "0.5801335", "0.5754221", "0.5715288", "0.56602097", "0.55916476", "0.55551785", "0.55458075", "0.5526235", "0.5431636", "0.5429419", "0.53844887", "0.5372225", "0.53633225", "0.53631485", "0.53583586", "0.5326433", "0.5318358", "0.53158...
0.532063
19
Type a PWIF amount then submit the form
def enter_pwif_amount(self, pwif_amount): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_pwif_amount(self, pwif_amount):\n raise NotImplementedError", "def test_send_inaccurate_data(self):\n self.driver.get('http://psl-outbreak.herokuapp.com/report')\n self.driver.find_element_by_xpath(\"//select[@name='state_id']/option[text()='Casanare']\").click()\n self.dri...
[ "0.63574934", "0.5679091", "0.5629604", "0.5536104", "0.54938644", "0.5485624", "0.5392728", "0.538577", "0.5369903", "0.53328675", "0.52951163", "0.52555466", "0.52504057", "0.5243308", "0.5236295", "0.52079064", "0.5151744", "0.51280564", "0.50812286", "0.50660056", "0.5040...
0.6748572
0
Check correctness of url argument
def url_validator(arg): arg = arg.lower() # If url looks like http[s]://vk.com/domain symbolic_id = constants.TXT_ID_REGEXP.match(arg) if symbolic_id: url = symbolic_id.groupdict() url["type"] = "domain" return url # If url looks like http[s]://vk.com/id123456 numeric_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_url(self):\n pass", "def check_url_invalidity(self) -> bool:\n validate = URLValidator()\n try:\n validate(self.args.url)\n return False\n except ValidationError:\n return True", "def check_url_and_raise_errors(url: str) -> None:\n if...
[ "0.85157424", "0.7993365", "0.7835496", "0.78076273", "0.77600265", "0.7707045", "0.766278", "0.75754476", "0.7501593", "0.74994123", "0.74810463", "0.7476387", "0.74463874", "0.74316704", "0.74257284", "0.7410491", "0.73404455", "0.7334545", "0.72786057", "0.7268538", "0.723...
0.7185527
24
Check that number is integer and positive
def pos_int_validator(arg): num = int(arg) if num > 0: return num else: raise argparse.ArgumentTypeError("{} - must be a positive number".format(arg))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_positive_int(item):\n if not isinstance(item, int):\n return False\n return item > 0", "def _is_pos_int(number: int) -> bool:\n return type(number) == int and number >= 0", "def _is_non_negative_int(item):\n if not isinstance(item, int):\n return False\n return item >= 0", ...
[ "0.81178755", "0.8111631", "0.80648965", "0.7962666", "0.7847979", "0.7705663", "0.7601961", "0.7552082", "0.7549978", "0.7470128", "0.7460544", "0.74022365", "0.7347824", "0.72751635", "0.72367835", "0.7224", "0.72006", "0.7171711", "0.7145779", "0.7145407", "0.7121398", "...
0.6980118
32
For every argument in kwargs sets a WITH_FOO if FOO=True or a WITHOUT_FOO if FOO=False
def set_with_options(self, **kwargs) -> None: for k, v in kwargs.items(): assert not k.startswith("WITH_"), "Invalid WITH/WITHOUT options name " + k assert not k.startswith("WITHOUT_"), "Invalid WITH/WITHOUT options name " + k assert isinstance(v, bool) self._with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kwargs(kwargs):\n run_kwargs(kwargs)", "def _UpdateWithKwargs(base, **kwargs):\n conflicts = set(kwargs.keys()) & set(base.keys())\n if conflicts:\n raise GanetiApiError(\"Required fields can not be specified as\"\n \" keywords: %s\" % \", \".join(conflicts))\n\n ba...
[ "0.64105", "0.6144896", "0.6131709", "0.60270417", "0.5965363", "0.59641284", "0.59275097", "0.59046793", "0.58989435", "0.58380234", "0.58345735", "0.5807486", "0.5805582", "0.57605976", "0.5753322", "0.57189995", "0.57189995", "0.5716972", "0.5685885", "0.5642669", "0.56208...
0.7388897
0
Strip all ELF binaries to reduce the size of the benchmark directory
def strip_elf_files(self, benchmark_dir) -> None: self.info("Stripping all ELF files in", benchmark_dir) self.run_cmd("du", "-sh", benchmark_dir) for root, dirnames, filenames in os.walk(str(benchmark_dir)): for filename in filenames: file = Path(root, filename) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_flatbuffer_binaries():\n for element in FLATBUFFERS_CONVERSION_DATA:\n for json in element.input_files:\n path = processed_json_path(json)\n if os.path.isfile(path):\n os.remove(path)", "def clean():\n clean_flatbuffer_binaries()\n clean_webp_textures()", "def scrub():\n\n\tloc...
[ "0.6843979", "0.6425804", "0.6238822", "0.6171667", "0.58739084", "0.57915837", "0.5787829", "0.57830065", "0.5750248", "0.57371056", "0.56529194", "0.56070024", "0.55917656", "0.5587348", "0.5559113", "0.5551564", "0.55382293", "0.551886", "0.5486453", "0.54620624", "0.54358...
0.8146737
0
Fail immediately, with the given message.
def fail(self, msg=None): raise Exception, msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fail(self, msg=None):\r\n raise self.failureException(msg)", "def fail(self, message, *args, **kwargs):\n self.counters[\"failure\"] += 1\n self._write(message.format(*args, **kwargs), FAILURE)", "def fail(self, message):\n logger.warning(message)\n g.failed = True", "def tc_fa...
[ "0.8109415", "0.761201", "0.7590433", "0.75791526", "0.7566061", "0.7528459", "0.7067831", "0.6895462", "0.6790964", "0.6782338", "0.67756104", "0.6773557", "0.6760443", "0.6701905", "0.6625162", "0.6528707", "0.6483209", "0.64499813", "0.64096963", "0.64075947", "0.63567835"...
0.7741948
1
Fail the test unless the expression is true.
def assert_(self, expr, msg=None): if not expr: raise Exception, msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_false(self, expr):\n if expr:\n raise AssertionError('%s is not false' % str(expr))", "def assert_false(self, expr, msg=None):\r\n assert bool(expr) is False", "def assert_true_iff(self, expression, predicate):\n\n if predicate:\n assert expression\n ...
[ "0.72989905", "0.7194617", "0.71730304", "0.689766", "0.6831849", "0.67528504", "0.6608933", "0.6601557", "0.65379804", "0.65252125", "0.6524567", "0.65149564", "0.65018296", "0.6499536", "0.6410705", "0.63981014", "0.6371282", "0.6365854", "0.6342825", "0.63272846", "0.63105...
0.56574243
60
Track KMALLOC/KFREE calls during the exection of func with args
def track_func(self, func, args): try: self.start_track() ret = func(*args) finally: self.end_track() return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _debugmallocstats(): # real signature unknown; restored from __doc__\n pass", "def cleak(self, f, *args, **kw):\n def done(result):\n k = self._checkLeakStuff[0]\n if not hasattr(self, 'msgInterval') or k % self.msgInterval == 0:\n hpd = self._checkLeakStuff[1]....
[ "0.6238595", "0.56287414", "0.5587537", "0.5427139", "0.53967756", "0.5384339", "0.53308636", "0.5297758", "0.52767473", "0.52534986", "0.5210271", "0.52063835", "0.5176014", "0.5168378", "0.51560414", "0.513596", "0.5105466", "0.5073584", "0.5049385", "0.5031526", "0.4991678...
0.0
-1
Start tracking KMALLOC/KFREE calls
def start_track(self): self.open() fcntl.ioctl(self.f_dev, self.MMLOG_SET_LOG_LEVEL, KERN_ALERT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_kmemleak():\n if os.path.exists('/sys/kernel/debug/kmemleak'):\n scan = 180\n print(\"Set kmemleak scan thread to %s seconds\" % scan)\n runcmd(\"echo scan=%s > /sys/kernel/debug/kmemleak\" % scan)\n else:\n print(\"kmemleak not supported\")", "def _debugmallocstats():...
[ "0.66124517", "0.61899114", "0.55691755", "0.5555264", "0.554103", "0.5376725", "0.53709984", "0.5329431", "0.5327228", "0.5293334", "0.5277384", "0.52386165", "0.5168708", "0.51671726", "0.51518947", "0.51067936", "0.51017237", "0.51017237", "0.51017237", "0.51017237", "0.51...
0.0
-1
Stop tracking KMALLOC/KFREE calls
def end_track(self): fcntl.ioctl(self.f_dev, self.MMLOG_SET_LOG_LEVEL, KERN_IDLE) self.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frees_memory():\n check50.c.valgrind(\"./inheritance\").exit(0)", "def free(self):\n pass", "def free(self):\n pass", "def start_kmemleak():\n if os.path.exists('/sys/kernel/debug/kmemleak'):\n scan = 180\n print(\"Set kmemleak scan thread to %s seconds\" % scan)\n ...
[ "0.63093466", "0.6222069", "0.6222069", "0.6036951", "0.591615", "0.58758307", "0.5863324", "0.58240163", "0.58106124", "0.57032835", "0.5685934", "0.5678614", "0.56703955", "0.563352", "0.5597748", "0.55873", "0.5577549", "0.55525714", "0.5479866", "0.5474728", "0.5461576", ...
0.0
-1
Validate (previous) KMALLOC/KFREE calls of a set of tasks (pids)
def validate(self, tracked_pids, test_case=stubTestcase, debug=False): out = os.popen('dmesg -c -s %d' % LOG_BUF_LEN) dmesg_lines = out.readlines() out.close() allocations = [] memory_allocated = False if debug: f = open('mm_debug.tx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bad_cgroup_processes_check():\n return CGCheck([], bad_cgroup_processes)", "def check_kpts(self):\n if 'fleurinp' in self.ctx.inputs:\n fleurinp = self.ctx.inputs.fleurinp\n else:\n fleurinp = get_fleurinp_from_remote_data(self.ctx.inputs.parent_folder)\n\n only_...
[ "0.5835271", "0.54331756", "0.54150486", "0.5370245", "0.53074366", "0.52768683", "0.52522767", "0.5199778", "0.51450527", "0.5127863", "0.5077406", "0.5031161", "0.5010177", "0.5008991", "0.49914876", "0.49872923", "0.49616095", "0.49612164", "0.4950241", "0.49074998", "0.48...
0.65229285
0
Wait for the other side of the fork to release this side
def sync(self): if self._inchild: os.read(self._pr_child, len(self.RELEASE_MSG)) else: os.read(self._pr_parent, len(self.RELEASE_MSG))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onPreFork(self):", "def wait():\n pass", "def release(self):\n\n if self._inchild:\n os.write(self._pw_child, self.RELEASE_MSG)\n else:\n os.write(self._pw_parent, self.RELEASE_MSG)", "def free_child(self):\n try:\n self.terminate()\n se...
[ "0.6155891", "0.61240005", "0.6120874", "0.6103077", "0.6102014", "0.60679287", "0.60605633", "0.59882176", "0.5970464", "0.5960445", "0.5960445", "0.5949543", "0.59348035", "0.5922919", "0.5883682", "0.5882509", "0.5879915", "0.5869981", "0.5869981", "0.5869981", "0.58698356...
0.6029344
7
Release for the other side of the fork that is syncing this side
def release(self): if self._inchild: os.write(self._pw_child, self.RELEASE_MSG) else: os.write(self._pw_parent, self.RELEASE_MSG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _release(self):\n\n os.write(self.job_pipe[1], b'+')", "async def release(self) -> None:\n ...", "async def release(self) -> None:\n ...", "async def release(self) -> None:\n ...", "def release(self):", "def release(self):\r\n pass", "def release(self):\n s...
[ "0.703684", "0.6900427", "0.6900427", "0.6900427", "0.6875046", "0.6745146", "0.6730091", "0.6527831", "0.6527831", "0.6390934", "0.63661313", "0.6281708", "0.62689257", "0.6262654", "0.6258315", "0.61609346", "0.61515474", "0.6143002", "0.6137582", "0.60939044", "0.60918385"...
0.6965916
1
Send from this side of the pipe to the other side
def send(self, message): if self._inchild: os.write(self._general_pw_child, message) else: os.write(self._general_pw_parent, message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, data):", "def send (self, data):\n return self.sending.send(data)", "def send(self, data):\n pass", "def putpipe(self):\n task = None\n try:\n task = self._queuepop()\n except:\n task = Task({'empty': True})\n self.wpipe.send(task)", ...
[ "0.65804744", "0.62524366", "0.62217945", "0.6186256", "0.6176703", "0.61714417", "0.6152953", "0.61310124", "0.61223006", "0.6088418", "0.60830045", "0.606834", "0.6032395", "0.6027364", "0.60263777", "0.60115856", "0.6011137", "0.60085106", "0.5981392", "0.5978044", "0.5978...
0.0
-1
Receive a message sent from the other side of the pipe to the this side
def receive(self, message_length=100): if self._inchild: return os.read(self._general_pr_child, message_length) else: return os.read(self._general_pr_parent, message_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, message):", "def receive(self):\n pass", "def receive(self, msg):\n pass", "def _on_read(self, line):\n # Some game logic (or magic)\n line = line.strip()\n logger.info(\"RCV> %s\", line)\n if not line:\n self.stream.close()\n ...
[ "0.7127385", "0.6792387", "0.6747292", "0.67124385", "0.6698213", "0.6660587", "0.6575856", "0.64918065", "0.6463597", "0.637378", "0.6359005", "0.6311001", "0.63057464", "0.63057464", "0.62307364", "0.621306", "0.6193883", "0.617544", "0.6139121", "0.61046267", "0.60906184",...
0.63753986
9