query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Returns conservative prior bounds (pmin, pmax) given sampling times for each observatory.
def prior_bounds_from_data(npl, ts, rvs): nobs=len(ts) dts=[np.diff(t) for t in ts] min_dt=reduce(min, [np.min(dt) for dt in dts]) tobss=[t[-1]-t[0] for t in ts] max_obst=reduce(max, tobss) min_dv=reduce(min, [np.min(np.abs(np.diff(rv))) for rv in rvs]) maxspread=reduce(max, [np.max(rv)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optimization_bounds(self, topology):\n bounds_low = np.zeros(self.number_of_parameters())\n bounds_up = np.zeros(self.number_of_parameters())\n\n for pkey, parameter in self.parameters.items():\n bounds_low[pkey] = parameter.bound_low(topology)\n bounds_up[pkey] = par...
[ "0.61832595", "0.57588667", "0.5651322", "0.564041", "0.5634838", "0.54706204", "0.5409203", "0.53503823", "0.5342432", "0.53363365", "0.5333335", "0.5330018", "0.52807766", "0.52719593", "0.5266766", "0.52606773", "0.5253961", "0.5230743", "0.52064013", "0.5176964", "0.51534...
0.63172805
0
Draw random numbers of shape ``size`` distributed flat in logarithm between ``low`` and ``high``.
def draw_logarithmic(low, high, size=1): if np.any(low <= 0.0) or np.any(high <= 0.0): raise ValueError('draw_logarithmic expects positive arguments') llow = np.log(low) lhigh = np.log(high) return np.exp(nr.uniform(low=llow, high=lhigh, size=size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, *size):\n max_value = self.alias.size(0)\n\n kk = self.alias.new(*size).random_(0, max_value).long().view(-1)\n prob = self.prob[kk]\n alias = self.alias[kk]\n # b is whether a random number is greater than q\n b = torch.bernoulli(prob).long()\n oq = ...
[ "0.62706465", "0.6168546", "0.61472845", "0.6110595", "0.6093453", "0.5831724", "0.5729024", "0.56191534", "0.5603818", "0.5594131", "0.5565909", "0.55658317", "0.55059993", "0.5449366", "0.54214203", "0.53895634", "0.5368529", "0.5361834", "0.53607714", "0.5322366", "0.53002...
0.78491837
0
Generates an initial sample of parameters drawn uniformly from the prior .
def generate_initial_sample(pmin, pmax, ntemps, nwalkers): npl = pmin.npl nobs = pmin.nobs assert npl == pmax.npl, 'Number of planets must agree in prior bounds' assert nobs == pmax.nobs, 'Number of observations must agree in prior bounds' N = pmin.shape[-1] samps=params.Parameters(arr=np.ze...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_prior(size):\n return torch.randn(size)", "def randomize(self):\n #first take care of all parameters (from N(0,1))\n x = self._get_params_transformed()\n x = np.random.randn(x.size)\n self._set_params_transformed(x)\n #now draw from prior where possible\n x...
[ "0.73352677", "0.7266806", "0.7135405", "0.7086701", "0.7080881", "0.7004341", "0.6950765", "0.68322116", "0.6757486", "0.67500263", "0.6737803", "0.67059195", "0.6700799", "0.66987205", "0.6639269", "0.6631884", "0.66122985", "0.65678334", "0.65501994", "0.6534233", "0.65311...
0.74383086
0
Returns the average of the quantiles of the data residuals over the posterior samples in psamples. The quantiles over multiple observatories are flattened into one array.
def posterior_data_mean_quantiles(ts, rvs, psamples): Nobs = len(ts) Nsamples = psamples.shape[0] Npl = (psamples.shape[-1] - 4*Nobs)/5 psamples=params.Parameters(arr=psamples, npl=Npl, nobs=Nobs) ll=LogLikelihood(ts, rvs) qs=np.zeros(sum([len(t) for t in ts])) for psample in psamples:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstructions_mean(self):\n self.assert_sampled()\n return [[j.mean().numpy() for j in i] for i in self._reconstructions]", "def results_psavg_sims():\n posterior_means = [[1.18040327516, 7.55106444832, 3.27420103073, 3.51998795534, 0.67212630002],\n [0.619197296326, 6.494206...
[ "0.5438853", "0.53853667", "0.513857", "0.51143295", "0.5108789", "0.50843376", "0.50440335", "0.49840745", "0.49840745", "0.49546733", "0.49069557", "0.48922843", "0.48532405", "0.48440713", "0.4824196", "0.4818035", "0.4816973", "0.4809339", "0.47977382", "0.4781622", "0.47...
0.62415504
0
Make synthetic precision matrix and empirical covariance matrix.
def make_synthetic_matrix(n_features, n_samples, sparsity=.98, random_state=0): prng = check_random_state(random_state) prec = make_sparse_spd_matrix(n_features, alpha=sparsity, smallest_coef=.4, largest_coef=.7, random_state=prng) cov = li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mn_cov_ ( self , size = -1 , root = False ) :\n #\n if size <= 0 : size = len ( self )\n size = min ( size , len ( self ) ) \n #\n from array import array\n matrix = array ( 'd' , [ 0 for i in range(0, size * size) ] )\n self.mnemat ( matrix , size )\n #\n import ostap.math.linalg\...
[ "0.60516495", "0.5877823", "0.57856286", "0.57798356", "0.5714626", "0.5634681", "0.5634241", "0.5608569", "0.55604804", "0.55500406", "0.5538883", "0.55216837", "0.5494331", "0.54647994", "0.5409464", "0.5397474", "0.53955364", "0.5363118", "0.53556013", "0.5354827", "0.5335...
0.6293105
0
Plot a matrix in a table.
def plot_table(mat, width=.15, ratio=4): vmax = np.abs(mat).max() vals = np.around(mat, 2) fig = plt.figure() ax = fig.add_subplot(111, frameon=False, xticks=[], yticks=[]) table = plt.table(cellText=vals, colWidths=[width]*vals.shape[1], loc='center', cellColours=plt.cm.RdBu_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_matrix(self, matrix: np.ndarray):\n sns.heatmap(matrix, annot=True)\n plt.show()", "def showMatrix(self, frame, matrix, label=''): \n M = self.matrix2Table(matrix)\n mtable = self.showTable(frame, M, label)\n return mtable", "def plot_matrix(loc_list):\n x_list...
[ "0.68654674", "0.66270876", "0.6347964", "0.63052076", "0.6269812", "0.6202961", "0.6155504", "0.6137438", "0.61339086", "0.61286443", "0.61217624", "0.6113645", "0.6092139", "0.60756713", "0.59949434", "0.59656054", "0.5892865", "0.5877521", "0.57820016", "0.5773821", "0.574...
0.6933746
0
Pull fresh data from Open AQ and replace existing data.
def refresh(): DB.drop_all() DB.create_all() # TODO Get data from OpenAQ, make Record objects with it, and add to db DB.session.commit() return 'Data refreshed!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh():\n DB.drop_all()\n DB.create_all()\n # TODO Get data from OpenAQ, make Record objects with it, and add to db\n aq_data.add_aq_to_db()\n DB.session.commit()\n return 'Data refreshed!'", "def refresh():\r\n DB.drop_all()\r\n DB.create_all()\r\n # TODO Get data from OpenAQ, ...
[ "0.7107583", "0.6050733", "0.597681", "0.58857965", "0.5744607", "0.5734073", "0.55982405", "0.5576293", "0.5548099", "0.5489543", "0.54826975", "0.54653", "0.54617256", "0.53852135", "0.5350215", "0.5341329", "0.5318105", "0.53093445", "0.5303601", "0.5300558", "0.52949953",...
0.65043575
1
Get the destination pathname from a source pathname
def path_src_to_dest(src_pathname, dest_filename_suffix=None): src_relpath = Path(src_pathname).relative_to(config["topdir"]) dest_pathname = Path(config["outdir"]).joinpath(src_relpath) if dest_filename_suffix: dest_pathname = dest_pathname.with_suffix(dest_filename_suffix) return dest_pathname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDestination(source):\n\ti = len(source)-1\n\tif source[i] == '/':\n\t\tsource = source[0:i - 1]\n\twhile i >= 0:\n\t\tif source[i] == '/':\n\t\t\tbreak\n\t\ti -= 1\n\tdestination = source[0: i]\n\treturn destination", "def bestrelpath(self, dest):\n try:\n if self == dest:\n ...
[ "0.7815231", "0.66032153", "0.65959716", "0.6490605", "0.63670933", "0.629784", "0.61708474", "0.6148273", "0.6114234", "0.6095512", "0.60766137", "0.6070404", "0.6042116", "0.6041628", "0.60336053", "0.60242707", "0.60152113", "0.60108036", "0.59943426", "0.5941626", "0.5933...
0.6820696
1
Process a markdown file and copy it to the destination
def process_file_markdown(src_pathname): dest_pathname = path_src_to_dest(src_pathname, '.html') logging.info("Processing Markdown file: %s -> %s" % (str(src_pathname), str(dest_pathname))) ensure_dest_dir(dest_pathname) with open(dest_pathname, 'w', encoding='UTF-8') as f: o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_page_markdown(self, markdown, page, config, files):\n listext = self.config['ext']\n src_file_path = page.file.abs_src_path\n prepath, ext = os.path.splitext(src_file_path)\n lang = ext.lstrip('.')\n filename = page.file.name\n if ext in listext:\n new_ma...
[ "0.6226209", "0.6111119", "0.6070878", "0.58925706", "0.58658713", "0.58396715", "0.58019733", "0.5768846", "0.5747689", "0.5685798", "0.5676189", "0.566404", "0.56561", "0.56402737", "0.55311203", "0.552163", "0.55025846", "0.55008787", "0.549469", "0.54747707", "0.54745865"...
0.75130004
0
Process all files The specific processing action depends on the file type.
def process_all_files(): src_files = get_doc_files() for src_pathname in src_files: if src_pathname.suffix in MARKDOWN_EXTENSIONS: process_file_markdown(src_pathname) elif src_pathname.suffix in STATIC_ASSET_EXTENSIONS: process_file_copytodest(src_pathname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_files(self):\n matcher = self.choose_algorithm()\n # process one file at the time for better memory management\n for i, element in enumerate(self.input):\n filepath, _ = element\n\n try:\n with open(filepath, \"r\", encoding=\"utf-8\") as readfi...
[ "0.6923511", "0.6782931", "0.66985416", "0.6443352", "0.641794", "0.64164966", "0.6404735", "0.63886476", "0.62717456", "0.62286955", "0.62142897", "0.61688447", "0.6158451", "0.6150643", "0.61071146", "0.6042156", "0.60409087", "0.60171324", "0.60055137", "0.59826595", "0.59...
0.73723686
0
Plots single sided FFT
def plotFFT(filename): fs_rate, signal = wavfile.read(filename) len_audio = len(signal.shape) print(signal.shape) print(signal[:][0]) if len_audio == 2: signal = signal.sum(axis=1) / 2 N = signal.shape[0] FFT = abs(scipy.fft(signal)) FFT_side = FFT[range(N//2)] freqs = scipy....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fft(self):\r\n\r\n self.ipx = int(self.imageData.shape[1]/2.)\r\n\r\n self.ipy = int(self.imageData.shape[2]/2.)\r\n\r\n nearf = np.absolute(self.DF[0:(self.freqs.shape[0]/2)-1,self.ipx-2:self.ipx+2,self.ipy-2:self.ipy+2])\r\n\r\n mpl.plot(self.freqs[0:(self.freqs.shape[0]/2)-1...
[ "0.72081864", "0.7085793", "0.70096654", "0.666678", "0.663691", "0.6634006", "0.6609489", "0.65550005", "0.6514818", "0.64428234", "0.64358807", "0.64106315", "0.6407862", "0.64054", "0.6353617", "0.6329611", "0.6270725", "0.62528634", "0.624896", "0.62402976", "0.62365526",...
0.7207237
1
To Train Instrument Detection Initialize a neural Net with 100 1000 frequencies as input for each audio file ,
def trainNet():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.train(positivity_files, 0)\n self.train(subjectivity_files, 1)", "def test():\r\n le = preprocessing.LabelEncoder()\r\n le.fit([\"Door Knocking\",\"Shower Running\",\"Toilet Flushing\",\"Vacuum Cleaning\",\"Keyboard Typing\", # encode class labels as numeric id val...
[ "0.68972456", "0.6880117", "0.6807847", "0.66880417", "0.668026", "0.66636807", "0.6658675", "0.6646357", "0.6613935", "0.65864086", "0.65287066", "0.6460703", "0.63921046", "0.63921046", "0.63921046", "0.63921046", "0.63921046", "0.63910156", "0.63789463", "0.6351578", "0.63...
0.7181619
0
Additional standard variables that can optionally be used in templates.
def standard_variables(self): std_vars = { 'time': { 'local': datetime.datetime.now(), 'utc': datetime.datetime.utcnow() } } return std_vars
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_vars(self):\n if not self._has(\"vars\"):\n if self._has(\"p\"):\n self._.vars = self._.p.variables()\n elif self._has(\"q\"):\n self._.vars = self._.q.variables()\n elif self._has(\"P\"):\n self._.vars = variables(self....
[ "0.62640846", "0.60485345", "0.59114224", "0.5826683", "0.58106107", "0.5753299", "0.5740808", "0.5725044", "0.5718518", "0.5712702", "0.56729376", "0.5661352", "0.5655612", "0.5645327", "0.56257856", "0.55843884", "0.5579836", "0.5536659", "0.550683", "0.5505651", "0.5472047...
0.65202695
0
Converts the feature matrix from numpy array to KaldiMatrix or KaldiCompressedMatrix.
def _convert_data(self, data): if isinstance(data, np.ndarray): data = data.astype(float_save(), copy=False) if self.compress: return KaldiCompressedMatrix.compress(data, self.compression_method) return KaldiMatrix(data) if isinstance(data, KaldiMatri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_to_features(self, img: np.ndarray) -> np.ndarray:", "def load_feature_matrix(src):\n feat_mat = smat_util.load_matrix(src)\n if isinstance(feat_mat, np.ndarray):\n feat_mat = np.ascontiguousarray(feat_mat)\n elif isinstance(feat_mat, smat.spmatrix):\n feat_...
[ "0.55183977", "0.5278449", "0.5202684", "0.5126736", "0.50405765", "0.50346196", "0.4987234", "0.49555334", "0.49138463", "0.4908572", "0.4899938", "0.4893329", "0.48353204", "0.48254713", "0.479957", "0.47969282", "0.47604373", "0.47432718", "0.47428906", "0.47403488", "0.47...
0.6106754
0
Returns and optionally stores the distance matrix for a given network. Nodes in are arranged in the matrix according to their Without the floyd parameter, simple BFS is used for APSP calculation. Be aware that this only works for unweighted networks. Since the implementation uses a Numpy matrix for storing the distance...
def get_distance_matrix_from_graph(network, nodelist): if nodelist: apspnodes = nodelist else: apspnodes = network.nodes() mapping = {} for index, node in enumerate(apspnodes): mapping.update({node:index}) nodeset = set(apspnodes) n = len(apspnodes) D = numpy.zeros((n,n)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_node_distance_matrix(\n self, datapoint: np.ndarray, som_array: np.ndarray\n ) -> np.ndarray:\n # algorithms on the full matrix\n if self.distance_metric == \"euclidean\":\n return np.linalg.norm(som_array - datapoint, axis=2)\n\n # node-by-node algorithms\n ...
[ "0.6378258", "0.63765", "0.6248437", "0.61726147", "0.5803808", "0.57704085", "0.57417667", "0.5732218", "0.5680238", "0.567566", "0.56677747", "0.56518614", "0.56441486", "0.56118584", "0.5568117", "0.5558283", "0.55483097", "0.55252606", "0.5483473", "0.54501635", "0.544721...
0.67686623
0
Handle GET requests for single game
def retrieve(self, request, pk=None): try: # `pk` is a parameter to this function, and # Django parses it from the URL route parameter # http://localhost:8000/games/2 # # The `2` at the end of the route becomes `pk` game = Game.objects.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game(self, request):\n game = get_by_urlsafe(request.urlsafe_key, Game)\n if not game:\n raise endpoints.NotFoundException('Game Not Found')\n else:\n if game.game_over:\n return game.to_form(message=\"This Game has ended!\")\n else:\n ...
[ "0.66888034", "0.66363895", "0.64767647", "0.647073", "0.6434573", "0.6400234", "0.63553363", "0.634393", "0.6320819", "0.6303164", "0.6297841", "0.62595314", "0.6243499", "0.62432027", "0.6229112", "0.6198054", "0.61873883", "0.6175521", "0.61560243", "0.61315876", "0.610940...
0.6785095
0
Handle DELETE requests for a single game
def destroy(self, request, pk=None): try: game = Game.objects.get(pk=pk) game.delete() return Response({}, status=status.HTTP_204_NO_CONTENT) except Game.DoesNotExist as ex: return Response({'message': ex.args[0]}, status=status.HTTP_404_NOT_FOUND) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_game(request, game_id):\n user = request.user\n game = Game.objects.get(id=game_id)\n\n if not user.is_staff and not user in game.moderators.all():\n return HttpResponseRedirect('/game_details/' + game_id + '/')\n\n # Not only we have to delete object from database, but also all files...
[ "0.7457039", "0.72932535", "0.7260357", "0.69909835", "0.6901931", "0.6847532", "0.6820824", "0.67531025", "0.66829526", "0.65518534", "0.6548844", "0.65336424", "0.6498319", "0.64814496", "0.6447743", "0.64435804", "0.6435766", "0.64318997", "0.6413047", "0.6384403", "0.6381...
0.75383687
0
Managing gamers signing up for games
def signup(self, request, pk=None): # A gamer wants to sign up for an game if request.method == "POST": # The pk would be `2` if the URL above was requested game = Game.objects.get(pk=pk) # Django uses the `Authorization` header to determine # which user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signup():", "def sign_up(self):\n self.log(\"Bot player signing up.\")\n self.subscribe_to_quorum_channel()\n while True:\n url = (\n \"{host}/participant/{self.worker_id}/\"\n \"{self.hit_id}/{self.assignment_id}/\"\n \"debug?finge...
[ "0.67609954", "0.650206", "0.61219937", "0.59892434", "0.59672654", "0.59607625", "0.59262365", "0.5910292", "0.5818596", "0.58168954", "0.57337415", "0.5712152", "0.5684307", "0.5663185", "0.55891526", "0.55803233", "0.55419314", "0.5534772", "0.5530431", "0.5478124", "0.547...
0.6540942
1
Returns lists of random preference orders for a specified of buyers. Arguments
def get_preferences(buyer_count=5): buyer_wants = np.random.randint(1, 4, buyer_count) seller_count = sum(buyer_wants) buyer_start = range(seller_count) seller_start = range(buyer_count) buyer_prefs = list() seller_prefs = list() for i in range(buyer_count): random.shuffle(buyer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_drink ():\n \n customer_pref = customer_order.drink_order()\n drink = []\n \n for pref in customer_pref:\n if customer_pref[pref] == True:\n drink.append(random.choice(ingredients[pref]))\n \n return drink", "def get_matches(buyer_prefs, seller_prefs, buyer_counts)...
[ "0.60050654", "0.56459045", "0.5636287", "0.5581696", "0.5522628", "0.54411304", "0.5377607", "0.5308835", "0.52995884", "0.52846533", "0.52772397", "0.52624565", "0.5234923", "0.5234923", "0.5210814", "0.5184855", "0.5133689", "0.5119745", "0.5116166", "0.50826824", "0.50702...
0.7248244
0
Matches each seller to a buyer with no unstable matches. Arguments
def get_matches(buyer_prefs, seller_prefs, buyer_counts): buyer_prefs = copy.deepcopy(buyer_prefs) seller_prefs = copy.deepcopy(seller_prefs) buyer_matches = [] for i in range(len(buyer_prefs)): buyer_matches.append([]) seller_matches = [None] * len(seller_prefs) while None in seller...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stability(buyer_prefs, seller_prefs, seller_matches):\n\n for seller, buyer in enumerate(seller_matches):\n\n seller_pref = seller_prefs[seller]\n better_buyers = seller_pref[0:seller_pref.index(buyer)]\n\n for bb in better_buyers:\n matched_seller = seller_matches.inde...
[ "0.61104155", "0.55909395", "0.55698174", "0.54890186", "0.54622793", "0.5429476", "0.53873", "0.52969694", "0.5285045", "0.5226048", "0.51746196", "0.51704836", "0.5148838", "0.5141742", "0.5132229", "0.51314723", "0.5095579", "0.5074115", "0.50718343", "0.5070093", "0.50691...
0.67571694
0
Check the stability of a list of matches. Stability is defined as a matching where no buyer prefers a seller they are not matched to who also prefers said buyer. Arguments
def check_stability(buyer_prefs, seller_prefs, seller_matches): for seller, buyer in enumerate(seller_matches): seller_pref = seller_prefs[seller] better_buyers = seller_pref[0:seller_pref.index(buyer)] for bb in better_buyers: matched_seller = seller_matches.index(bb) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_stability():\n\n residents = [Player(\"A\", [1, 2]), Player(\"B\", [2]), Player(\"C\", [2, 1])]\n hospitals = [Player(1, [\"C\", \"A\"], 3), Player(2, [\"A\", \"B\", \"C\"], 3)]\n match = HospitalResident(residents, hospitals)\n\n matching = match.solve()\n assert match.check_stabilit...
[ "0.6328185", "0.5939729", "0.59161633", "0.5770188", "0.5550039", "0.54295826", "0.53119993", "0.5306181", "0.53002584", "0.5294735", "0.52435446", "0.5045115", "0.500675", "0.49871248", "0.49855766", "0.4944164", "0.494282", "0.4937434", "0.49179742", "0.48819202", "0.484487...
0.70885044
0
Return pytz timezone give offset in minutes. If none found, then returns the EST as the default timezone. Javascript sends offset in minutes. 120 = GMT+0200, we're storing that in request.COOKIES.get('timezone_offset') minutes = request.COOKIES.get('timezone_offset') or 0
def get_timezone_from_offset(minutes, default='US/Eastern'): if minutes < 0: minutes = -minutes minus = True else: minus = False min = minutes % 60 hours = (minutes - min) / 60 offset = "%s%02d%02d" % (minus and "+" or "-", hours, min) # This is only method I found to d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timezone_offset():\n timezone = get_localzone()\n offset_minutes = timezone.utcoffset(datetime.datetime.now()).total_seconds() // SECONDS_IN_MINUTE\n return parse_int(offset_minutes)", "def get_timezone(time_zone=''):\n return pytz.timezone(time_zone)", "def get_timezone(timezone: str=None)...
[ "0.72785103", "0.6679715", "0.6583705", "0.65549064", "0.6543888", "0.6491711", "0.64791346", "0.64500356", "0.6345579", "0.63271415", "0.6276202", "0.6270148", "0.62497365", "0.6246483", "0.6226378", "0.62032956", "0.62001926", "0.61094964", "0.6066218", "0.60319906", "0.602...
0.68559456
1
follow on an unknown url should return 404
def test_follow_404(self): response = self.client.get(reverse('shortener:follow', kwargs={'slug': "fails"})) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow_redirects(self, url):\n try:\n return requests.get(url).url\n except requests.RequestException:\n return None", "def test_following_non_existing_user(self):\n response = self.client.post(\n reverse(\n 'follow',\n kwarg...
[ "0.6998348", "0.6852071", "0.65475863", "0.64777684", "0.6282614", "0.6119723", "0.6115893", "0.61138743", "0.61022586", "0.60383093", "0.6015655", "0.5979148", "0.5972463", "0.5962162", "0.59428495", "0.5912951", "0.59049004", "0.58943534", "0.58770907", "0.5874943", "0.5874...
0.72807777
0
calling from_decimal() on letters raises an EncodingError
def test_encoding_non_int_fails(self): self.assertRaises(EncodingError, base62.from_decimal, string.ascii_letters)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_illgal_character(self):\n self.assertRaises(DecodingError, base62.to_decimal, '@@@@')", "def test_decoding_non_str_fails(self):\n self.assertRaises(DecodingError, base62.to_decimal, sys.maxsize)", "def test_convert_nonnumeric_value():\n with pytest.raises(TypeError):\n pressure...
[ "0.6712188", "0.61095405", "0.6011091", "0.58963567", "0.57924646", "0.57552683", "0.57357097", "0.57234335", "0.5707907", "0.56947505", "0.5693429", "0.5693429", "0.56900626", "0.56900626", "0.56581885", "0.55696404", "0.55681103", "0.5540921", "0.55063635", "0.5486694", "0....
0.64202726
1
trying to encode a character that is not within base62 raises an EncodingError
def test_illgal_character(self): self.assertRaises(DecodingError, base62.to_decimal, '@@@@')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encoding_non_int_fails(self):\n self.assertRaises(EncodingError, base62.from_decimal, string.ascii_letters)", "def base62_encode(num, alphabet=ALPHABET):\n if (num == 0):\n return alphabet[0]\n arr = []\n base = len(alphabet)\n while num:\n rem = num % base\n num ...
[ "0.6859128", "0.66699857", "0.66699857", "0.66699857", "0.66699857", "0.6384018", "0.62883586", "0.6282206", "0.61720264", "0.61659485", "0.61273414", "0.6121925", "0.61131334", "0.60798943", "0.6070405", "0.6053329", "0.6049165", "0.6011752", "0.59600824", "0.5955402", "0.59...
0.6854086
1
Remove previous lines from the color bar
def cleanCb(axColorBar): for line in axColorBar.axes.lines: line.remove() return axColorBar
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suppressColorBar():\n dislin.nobar()", "def removeColorbar(self):\n if self._colorbar is not None:\n self._colorbar.remove()\n self._colorbar = None", "def _clear(self, event):\n if self.ignore(event) or self._changed_canvas():\n return\n self._backg...
[ "0.71303684", "0.660231", "0.6472268", "0.619576", "0.6145884", "0.61119395", "0.6065317", "0.604062", "0.60274917", "0.60210115", "0.5998631", "0.5994174", "0.5974805", "0.5931044", "0.5931044", "0.5913806", "0.5910324", "0.58925134", "0.58901626", "0.5881482", "0.5880484", ...
0.7817924
0
Fills the sudoku with a prechosen list (can be read from file) and fills in the rest with "random" numbers (19)
def fill(self, file = None): if file == None: self.prefill = {} else: f = open('sudoku.txt') self.prefill = f.read() f.close() for u in range(2* self.N**2,3* self.N**2): for val in range(self.N**2): self.setValue(val+1,0,0,self.unitlist[u][val]) # in elke N^2 square in de sudoku...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_sudoku(lst_temp):\r\n temp_index = 0\r\n for row in range(9):\r\n for col in range(9):\r\n val = lst_temp[temp_index]\r\n if val != 0:\r\n change_value(val, Point(row, col))\r\n temp_index += 1", "def generate_sudoku(self):\n\n # rand...
[ "0.677958", "0.67431647", "0.6112093", "0.6093308", "0.60833836", "0.60346204", "0.6033673", "0.6002573", "0.59757864", "0.5961343", "0.5908994", "0.586101", "0.5819024", "0.5807154", "0.5740937", "0.5713412", "0.5688407", "0.56852025", "0.5670065", "0.5652325", "0.5632649", ...
0.795898
0
Returns true if a tile exists, or false if it doesn't
def tile_exists(self, coords): return not ( coords[0] < 0 or coords[0] >= 25 or coords[1] < 0 or coords[1] >= 40)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tileExists(x, y):\n return _world.get((x, y))", "def check_tile_availability(self, row, col):\n return self.board[row][col] == 0", "def canTile(self):\n raise RuntimeError('Not implemented')\n \n return False", "def check_tile_covers_land(self, tilename=None):\n land...
[ "0.787533", "0.72520393", "0.68646425", "0.6789231", "0.67263234", "0.6716644", "0.6633904", "0.6555963", "0.6532886", "0.64995193", "0.64422536", "0.64104074", "0.6401476", "0.63654876", "0.6352619", "0.6338171", "0.627523", "0.6262617", "0.62086785", "0.6158971", "0.6143745...
0.742259
1
Scales a unit's display rectangle to screen coordiantes.
def update_unit_rect(self, unit): x, y = unit.tile_x, unit.tile_y screen_x, screen_y = x*SIZE, y*SIZE unit.rect.x = screen_x unit.rect.y = screen_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(self, sx, sy):\n frameWidth *= sx\n frameHeight *= sy\n repaint()", "def eval_screen_size():\n center_x = 32 // 2 * app_manager.get_map_width()\n center_y = 32 // 2 * app_manager.get_map_height()\n\n loc1_le = EPD(0x58DC60)\n loc1_te = EPD(0x58DC60 + 4)\n loc1_re = E...
[ "0.6639929", "0.65602237", "0.64782333", "0.64168495", "0.63549197", "0.62980515", "0.62899816", "0.6286555", "0.6229439", "0.6228933", "0.6177914", "0.61489844", "0.6106066", "0.6067261", "0.605976", "0.6058187", "0.6015277", "0.59871423", "0.5972736", "0.59648705", "0.59638...
0.7455723
0
Calculates color difference over all neighboring pixels over all color channels. The dissimilarity measure relies on the premise that adjacent jigsaw pieces in the original image tend to share similar colors along their abutting edges, i.e., the sum (over all neighboring pixels) of squared color differences (over all t...
def dissimilarity_measure0(first_piece, second_piece, orientation="LR"): rows, columns, _ = first_piece.shape() color_difference = None # piece.shape 应该是三维的矩阵 第一维代表行,第二维代表列 # 第三维度如果是彩色图像,则为3 灰度图像和黑白图像为1 # | L | - | R | if orientation == "LR": # 如果是左右关系,则取左边的最右一列的三个通道减去右边的最左一列的三个通道 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_color_distance(rgb1, rgb2):\n\n color1_rgb = sRGBColor(rgb1[0], rgb1[1], rgb1[2])\n color2_rgb = sRGBColor(rgb2[0], rgb2[1], rgb2[2])\n\n color1_lab = convert_color(color1_rgb, LabColor)\n color2_lab = convert_color(color2_rgb, LabColor)\n\n delta_e = delta_e_cie2000(color1_lab, color2_lab)...
[ "0.59443426", "0.5933423", "0.59173316", "0.58753294", "0.5859361", "0.5830542", "0.5791157", "0.57149744", "0.5708682", "0.5694798", "0.5677042", "0.5656942", "0.5608543", "0.5569199", "0.5541749", "0.554049", "0.5519073", "0.54866254", "0.5473851", "0.5472822", "0.5465966",...
0.61831427
0
Train & evaluate the VAE model
def train_vae(model, epochs: int, optimiser, loader_train: DataLoader, loader_test: DataLoader, beta: float, device: torch.device, verbose: bool = True, save: bool = True): # loss lists init # (train) total_train_loss = [] reconstruction_train_loss = [] kl_train_loss = [] # (test)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(data_dir: str = './env/data',\n vae_dir: str = './vae/model',\n epochs: int = 20\n ) -> None:\n # set random seed and deterministic backend\n SEED = 123\n np.random.seed(SEED)\n torch.manual_seed(SEED)\n torch.cuda.manual_seed(SEED)\n torch.backends.cudnn.deterministi...
[ "0.71673036", "0.7005656", "0.68949646", "0.6782185", "0.6759987", "0.666773", "0.6665484", "0.6631297", "0.6623886", "0.66078615", "0.65956473", "0.65770334", "0.6567851", "0.6563507", "0.6548026", "0.6535641", "0.64974064", "0.64903086", "0.6463899", "0.64631844", "0.642634...
0.72611
0
Get design by it's id
def get_design_id(design_id: str): design = storage.get_design(UUID(design_id)) if design is None: abort(400) return design.serialize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_designs(self):", "def get_dessert_by_id(dessert_id: int):\n return get_data_by_id(\"Desserts\", dessert_id)", "def get_object(id):", "def get_med_by_id(self):\n return \"SELECT * FROM medic WHERE id = %s\"", "def get(self, id):\n return Matstamm.find_by_id(id)", "def getDmd(self)...
[ "0.63311213", "0.6309447", "0.6089819", "0.6040134", "0.60139215", "0.59313655", "0.5839858", "0.5839858", "0.5813057", "0.57999706", "0.5788469", "0.57393354", "0.57166123", "0.56829333", "0.5643689", "0.5634991", "0.5632631", "0.56263745", "0.55991787", "0.5594078", "0.5587...
0.7091185
0
Get locus of design by id
def get_locus_of_design_id(design_id): existing_design = storage.get_design(UUID(design_id)) if existing_design is None: abort(400) result = execution.possible_positions(existing_design.robot, 40) output = list(map(lambda x: {'position': {'x': x['position'][0], 'z': x['posi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location_by_id(self, location_id):", "def get_location(self, labware_id: str) -> LabwareLocation:\n return self.get(labware_id).location", "def locate(self):\n return utils.get_object(\"crds\", self.observatory, \"locate\")", "def get_by_id(cls, name):\n\t\treturn super(Locality, cls).g...
[ "0.6050606", "0.5750205", "0.56887347", "0.5628116", "0.56142986", "0.55571204", "0.548368", "0.54005086", "0.54005086", "0.5387359", "0.5373012", "0.5343095", "0.5323943", "0.5312559", "0.52997965", "0.52954257", "0.52212054", "0.52206117", "0.5204883", "0.51911783", "0.5181...
0.664265
0
judge element is exist,The return result is true or false.
def is_element_exist(self, locator): t1 = time.time() try: self.driver.find_element(locator) self.my_print("{0} Element: <{1}> is exist, Spend {2} seconds".format(success,locator, time.time() - t1)) return True except TimeoutException: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist(self,list,a):\r\n\t\ti = 0\r\n\t\tfor elem in list:\r\n\t\t\tif (elem == a):\r\n\t\t\t\ti=i+1\r\n\t\tif (i>0):\r\n\t\t\treturn True\r\n\t\telse:\r\n\t\t\treturn False", "def isExist(data):\n return True/False", "def is_exist(self):\n try:\n if self.pathType == 'ID':\n ...
[ "0.7326738", "0.725836", "0.7174447", "0.71559846", "0.6963649", "0.6924973", "0.68580633", "0.6807948", "0.678384", "0.6759503", "0.6753746", "0.67457867", "0.67321026", "0.6707753", "0.6610276", "0.65590334", "0.6483656", "0.646101", "0.6455775", "0.6402263", "0.63802975", ...
0.7406134
0
Implicitly wait.All elements on the page.
def wait(self, secs): t1 = time.time() self.driver.implicitly_wait(secs) self.my_print("{0} Set wait all element display in {1} seconds, Spend {2} seconds".format(success, secs,time.time() - t1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self):\n try:\n confirm_modal_dialog = EC.presence_of_all_elements_located((By.CLASS_NAME, 'btn-default'))\n WebDriverWait(self.web_element, 2).until(confirm_modal_dialog)\n except TimeoutException:\n confirm_ajs_dialog = EC.presence_of_all_elements_located((...
[ "0.6774106", "0.6140227", "0.604411", "0.60229385", "0.58454835", "0.5785627", "0.57709783", "0.5755594", "0.57234937", "0.57192695", "0.56270385", "0.5626797", "0.5621867", "0.5621245", "0.55927444", "0.555113", "0.5505866", "0.55023366", "0.5485123", "0.5483368", "0.5418298...
0.6151248
1
Input a css selecter,use javascript click element.
def js_click(self, css): t1 = time.time() js_str = "$('{0}').click()".format(css) try: self.driver.execute_script(js_str) self.my_print("{0} Use javascript click element: {1}, Spend {2} seconds".format(success,js_str,time.time()-t1)) except Exception: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self) -> None:\n logging.info(f\"click element. {self.desc}\")\n js = f\"\"\"var elm = document.querySelectorAll(\"{self.css}\")[{self.index}];\n elm.style.border=\"2px solid red\";\n elm.click();\"\"\"\n self._execute_javascript(js)", "def id_cl...
[ "0.65767026", "0.6216461", "0.61339897", "0.60989267", "0.57894135", "0.5623732", "0.5614071", "0.55613613", "0.55136573", "0.5502544", "0.5444525", "0.53893334", "0.53802377", "0.5371031", "0.5371031", "0.53598744", "0.5336465", "0.53346795", "0.532027", "0.5297092", "0.5276...
0.6484632
1
Rotate counter clockwise by given angle around given axis in local coordinate system.
def rotate_local(self, angle, axis=(0., 0., 1.)): self.rotation *= aa2q(angle, glm.vec3(axis))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_global(self, angle, axis=(0., 0., 1.)):\n self.rotation = aa2q(angle, glm.vec3(axis)) * self.rotation", "def rotate_clockwise(self, angle):\r\n angle = degrees_to_radians(angle)\r\n current_angle = atan(self.x / self.y)\r\n angle += current_angle\r\n\r\n length = sel...
[ "0.73928547", "0.71643406", "0.70795226", "0.6971528", "0.6945819", "0.6878461", "0.6877881", "0.68302655", "0.6827688", "0.6783266", "0.66841495", "0.66782784", "0.6670662", "0.66611797", "0.6657584", "0.66516477", "0.6647359", "0.65800184", "0.65794575", "0.65659213", "0.65...
0.748749
0
Move by given displacement in global coordinate system.
def move_global(self, xyz): self.position += xyz
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, displacement):\n self._position = self._position + np.array(displacement)", "def _move(self):\n self.pos += self.direction # add direction vector\n self.direction += self.gravity # add gravity to direction\n self.direction = self.direction.elementwise() * self.drag ...
[ "0.71599424", "0.7121574", "0.69739336", "0.6910599", "0.6829471", "0.6662486", "0.6624079", "0.6605594", "0.65653765", "0.65229875", "0.649036", "0.6486678", "0.6419891", "0.64157003", "0.64138556", "0.6388829", "0.63627565", "0.6348988", "0.63424224", "0.6332199", "0.632610...
0.7544456
0
Rotate counter clockwise by given angle around given axis in global coordinate system.
def rotate_global(self, angle, axis=(0., 0., 1.)): self.rotation = aa2q(angle, glm.vec3(axis)) * self.rotation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def R_axis_angle(axis, angle):\n\n # Trig factors.\n ca = math.cos(angle)\n sa = math.sin(angle)\n C = 1 - ca\n\n # Depack the axis.\n x, y, z = axis\n\n # Multiplications (to remove duplicate calculations).\n xs = x * sa\n ys = y * sa\n zs = z * sa\n xC = x * C\n yC = y * C\n ...
[ "0.71005154", "0.70900816", "0.6978643", "0.69763106", "0.68740296", "0.6857633", "0.6840003", "0.6829036", "0.67823285", "0.67059314", "0.6655236", "0.6598192", "0.65935904", "0.65712935", "0.65678674", "0.65628415", "0.6562488", "0.65563333", "0.6545525", "0.6534826", "0.65...
0.7825282
0
Skip test completely if no Dockerbased XNAT instance available
def docker_available(func=None): def check_and_raise(): if 'setup_docker_xnat' in func.__name__: print('Initializing XNAT.') return fp = op.abspath('.xnat.cfg') print(fp, op.isfile(fp)) x = Interface(config=op.abspath('.xnat.cfg')) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_host():\n return not in_docker()", "def docker_allow_fallback():\n return False", "def test_need_proxy(self):\n os.environ['no_proxy'] = 'blah.com,blah2.com'\n self.assertTrue(dockerv2.need_proxy('proxy.blah3.com'))\n self.assertFalse(dockerv2.need_proxy('proxy.blah.com'))", ...
[ "0.69378114", "0.6733271", "0.6270841", "0.61562204", "0.60823655", "0.60283184", "0.6022272", "0.59598815", "0.5942479", "0.5767451", "0.5749508", "0.57380295", "0.57183486", "0.56644875", "0.5642528", "0.5562638", "0.5547674", "0.5546532", "0.5536506", "0.5506728", "0.55053...
0.68378395
1
Play russian roulette. Use 'new' to start a new round.
async def roulette(self, ctx: commands.Context, *args): if isinstance(ctx.channel, DMChannel): await ctx.send("Roulette can only be played on servers or in group chats.") return group: bool = isinstance(ctx.channel, GroupChannel) hash_code: int = hash(ctx.channel) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def russian_roulette(self, ctx, amount: int = None):\n\n session = self.manager.get_session(ctx.channel)\n if session is None:\n with self.manager.temp_session(ctx.channel, RussianRouletteSession(ctx)) as inst:\n try:\n await inst.add_member(ctx.auth...
[ "0.6880835", "0.6490289", "0.5815056", "0.5750089", "0.5742491", "0.5729538", "0.5697026", "0.55669904", "0.55635935", "0.5501709", "0.5485667", "0.5421673", "0.53926754", "0.53612477", "0.53382343", "0.53361785", "0.5334666", "0.53133357", "0.5294174", "0.52602094", "0.52557...
0.6879734
1
speed_str(float speed) > string with , separators and B/s | KiB/s | MiB/s
def speed_str(speed): if speed > 1024*1024: return '{:,.4}'.format(speed/1024/1024) + ' MiB/s' elif speed > 1024: return '{:,.4}'.format(speed/1024) + ' KiB/s' else: return '{:,.4}'.format(speed) + ' B/s'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_speed(speed):\n unit = 'bps'\n kmg = ['', 'K', 'M', 'G']\n i = 0\n while speed >= 1000:\n speed /= 1000\n i += 1\n return \"{:.2f}\".format(speed) + ' ' + kmg[i] + unit", "def speed_convert(size):\r\n power = 2 ** 10\r\n zero = 0\r\n units = {0: \"\", 1: \"Kb/s\",...
[ "0.7814756", "0.6862278", "0.66547114", "0.6566598", "0.63913155", "0.6271223", "0.6214141", "0.6205538", "0.6020402", "0.5959611", "0.5913494", "0.5903802", "0.588717", "0.585047", "0.5820893", "0.5784452", "0.5770387", "0.5766688", "0.5766226", "0.5753665", "0.5750202", "...
0.8510952
0
This method actually starts the transfer and writes out the statistics.
def start(self): import datetime with self.in_fd as in_file: with self.out_fd as out_file: with self.info_fd as info_file: self.total_bytes = 0 self.start_time = datetime.datetime.now() while 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_progress(self, stats):", "def _send(self):\n executor_id = self.status['executor_id']\n job_id = self.status['job_id']\n call_id = self.status['call_id']\n act_id = self.status['activation_id']\n\n if self.status['type'] == '__init__':\n init_key = creat...
[ "0.71215886", "0.64963603", "0.6108362", "0.60545087", "0.60371166", "0.59502673", "0.58914244", "0.58742326", "0.5850657", "0.5825628", "0.58090675", "0.57770205", "0.5729513", "0.5726948", "0.57021993", "0.56705713", "0.56651455", "0.5656119", "0.56470776", "0.56435704", "0...
0.6586207
1
Handles of server replies
def reply_handler(msg): print "Server Response: %s, %s" % (msg.typeName, msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reply_handler(msg):\n print(\"Server Response: %s, %s\" % (msg.typeName, msg))\n pass", "def handle(self):\n socket = self.request[1]\n data = self.request[0].strip()\n logger.info(\"Address {} at {} wrote: '{}'\".format(self.client_address[1], self.client_address[0], data))\n ...
[ "0.76629096", "0.66553223", "0.6645519", "0.662176", "0.6588144", "0.65254015", "0.64312863", "0.639899", "0.6365997", "0.6332262", "0.633033", "0.6302304", "0.6296347", "0.6267659", "0.6252938", "0.6237211", "0.61984926", "0.61887336", "0.61629516", "0.61628944", "0.61119646...
0.7671313
1
Create a Contract object defining what will be purchased, at which exchange and in which currency. symbol The ticker symbol for the contract sec_type The security type for the contract ('STK' is 'stock') exch The exchange to carry out the contract on prim_exch The primary exchange to carry out the contract on curr The ...
def create_contract(symbol, sec_type, exch, prim_exch, curr): contract = Contract() contract.m_symbol = symbol contract.m_secType = sec_type contract.m_exchange = exch contract.m_primaryExch = prim_exch contract.m_currency = curr return contract
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):\n await self.load_markets()\n market = self.market(symbol)\n # order types \"limit\" and \"market\" immediatley parsed \"EXCHANGE LIMIT\" and \"EXCHANGE MARKET\"\n # note: same or...
[ "0.605647", "0.6021374", "0.576684", "0.56790835", "0.5601576", "0.5555213", "0.55236983", "0.55217147", "0.54633653", "0.54632473", "0.5438681", "0.5346382", "0.53407604", "0.53043514", "0.52908975", "0.5279396", "0.52601576", "0.52305746", "0.5226109", "0.5208201", "0.51946...
0.87328726
1
Create an Order object (Market/Limit) to go long/short. order_type 'MKT', 'LMT' for Market or Limit orders quantity Integral number of assets to order action 'BUY' or 'SELL'
def create_order(order_type, quantity, action): order = Order() order.m_orderType = order_type order.m_totalQuantity = quantity order.m_action = action return order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_order(order_type, quantity, action, price = None):\n order = Order()\n order.m_orderType = order_type\n order.m_totalQuantity = quantity\n order.m_action = action\n order.m_account = ConfigMgr.get_ib_config()['account_code']\n if order_type == 'LMT':\n order.m_lmtPrice = price\n...
[ "0.8001797", "0.721019", "0.7111651", "0.6973866", "0.6950393", "0.69217306", "0.6838977", "0.68315655", "0.6824298", "0.6806495", "0.67919177", "0.67190963", "0.6627814", "0.6626678", "0.659759", "0.653215", "0.6509903", "0.64288145", "0.6380781", "0.63743025", "0.6343502", ...
0.75655824
1
Returns the url to access a particular blogauthor instance.
def get_absolute_url(self): return reverse('blogs-by-author', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n return reverse('author-detail', args=[str(self.id)])", "def get_absolute_url(self):\n return reverse('author-detail', args=[str(self.id)])", "def get_absolute_url(self):\n return reverse('author-detail', args=[str(self.id)])", "def get_absolute_url(self):\n ...
[ "0.72703695", "0.72703695", "0.72703695", "0.72703695", "0.7250402", "0.7206668", "0.70338786", "0.6936608", "0.6820081", "0.67791575", "0.647343", "0.6456801", "0.6372989", "0.6371024", "0.6371024", "0.6346951", "0.6312395", "0.62948346", "0.62751096", "0.62518233", "0.62518...
0.8021804
0
Sample frames every X seconds, resize the frame and add it to an numpy array
def sample_frames(frame_dir, fps, visualize_sample_rate): visualize_every_x_frames = visualize_sample_rate * int(fps) sampled_frames = np.empty((0, 3, IMG_DIM, IMG_DIM), dtype=np.float32) # B, C, H, W i = 0 for file in sorted(os.listdir(frame_dir)): if i % visualize_every_x_frames == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_frames(filename_raw, thr_var_per_event=5e-4, downsampling_factor=2, disable_display=False,\n filename_output_video=None):\n\n assert downsampling_factor == int(downsampling_factor), \"Error: downsampling_factor must be an integer\"\n assert downsampling_factor >= 0, \"Erro...
[ "0.6244921", "0.61682856", "0.6129182", "0.6064074", "0.6050894", "0.6037316", "0.6022225", "0.59974605", "0.597372", "0.5961255", "0.5939521", "0.5893111", "0.58840185", "0.58180964", "0.57428", "0.57267004", "0.57258826", "0.57146883", "0.5705632", "0.5685429", "0.56762886"...
0.6889909
0
Upload the extracted frames and the preview image to S3
def load_data_to_s3(frame_dir, preview_file_name, s3_bucket, frame_prefix, upload_frames, video_preview_prefix, working_dir): if upload_frames: count = 0 frames_s3_prefix = frame_prefix + frame_dir.split('/')[-1] start = time.time() for frame in os.listdir(frame_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_uploader():\n if not current_app.config['S3_KEY']:\n return ''\n if len(request.files) == 0:\n return 'No files selected'\n img = request.files['file']\n if not img or img.filename == '':\n return 'No filename'\n ext = img.filename.split('.')[-1].lower()\n if ext ...
[ "0.6675343", "0.6497543", "0.6431096", "0.6395432", "0.63769287", "0.6231634", "0.621618", "0.6210985", "0.6208489", "0.6164117", "0.61071897", "0.60737467", "0.6061896", "0.5999967", "0.5952431", "0.5931581", "0.5929783", "0.5909609", "0.5908395", "0.5890025", "0.588783", ...
0.68508595
0
Get network adapter from environment or first loopback.
def get_network_adapter() -> network.NetworkAdapter: if (ip := os.getenv('ref_ip')) is not None: # noqa: SIM112 return network.get_adapter_containing_ip(ip) # get next available loopback adapter return next(adapter for adapter in network.get_adapters() if adapter.is_loopback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _external_network(self):\n try:\n router = next(self._connection.network.routers.all())\n except StopIteration:\n raise errors.ImproperlyConfiguredError('Could not find tenancy router.')\n return self._connection.network.networks.get(router.external_gateway_info['netw...
[ "0.64374787", "0.6360085", "0.6208538", "0.6162118", "0.6123978", "0.61113894", "0.6101043", "0.60912037", "0.6047662", "0.58597225", "0.58495176", "0.5846594", "0.5832499", "0.58117396", "0.5698909", "0.56513643", "0.56490064", "0.564142", "0.56289345", "0.56115305", "0.5590...
0.8552797
0
Get location from environment or default.
def get_location() -> location.SdcLocation: return location.SdcLocation(fac=os.getenv('ref_fac', default='r_fac'), # noqa: SIM112 poc=os.getenv('ref_poc', default='r_poc'), # noqa: SIM112 bed=os.getenv('ref_bed', default='r_bed')) # noqa: SIM112
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConfigPath():\n\n global args, ConfigPathDefault\n\n if args.config_location:\n return args.config_location;\n return ConfigPathDefault;", "def get_location(self):\n return self._overridden_location or self.get_default_location()", "def _config_location(cls):\n local = cls....
[ "0.7177347", "0.69822437", "0.6899748", "0.6846995", "0.67594796", "0.67408764", "0.6567466", "0.6567466", "0.6567466", "0.6550206", "0.6428071", "0.6418596", "0.64051044", "0.6391328", "0.6383778", "0.6383778", "0.6383778", "0.6383778", "0.6373471", "0.63651264", "0.6365045"...
0.70311564
1
Get ssl context from environment or None.
def get_ssl_context() -> ssl.SSLContext | None: if (ca_folder := os.getenv('ref_ca')) is None: # noqa: SIM112 return None return mk_ssl_context_from_folder(ca_folder, private_key='user_private_key_encrypted.pem', certificate='u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_ssl_context(self):\n context = ssl.SSLContext(self.TLS_VERSION)\n context.load_cert_chain(self.ssl_cert, self.ssl_key)\n return context", "def getContext(self):\n ctx = SSL.Context(SSL.SSLv23_METHOD)\n ctx.use_certificate_file(Settings.BaseDir+'/server.pem')\n c...
[ "0.7178645", "0.7067759", "0.7032663", "0.6906664", "0.667105", "0.661573", "0.6535112", "0.65186465", "0.6505062", "0.6488944", "0.63673794", "0.6362219", "0.635696", "0.63292336", "0.6304141", "0.6238989", "0.6150658", "0.6108097", "0.60013795", "0.59824854", "0.5979148", ...
0.7796807
0
Renders the provide Rezume using template/rezume.mst template file.
def render(rezume: Rezume): base_dir = Path(__file__).absolute().parent template = base_dir / "template" / "rezume.mst" assert template is not None with template.open("r") as tf: data = rezume.dump_data() html = chevron.render(tf, {"rezume": data}) return html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recog():\n\n return render_template('recog.html')", "def render(self):\n pass", "def render(self):\n pass", "def render(self):\n pass", "def render(self):\n pass", "def render(self):\n pass", "def render(self):\n pass", "def get(self):\n return ...
[ "0.6526516", "0.63922876", "0.63922876", "0.63922876", "0.63922876", "0.63922876", "0.63922876", "0.6361408", "0.6308955", "0.62740874", "0.6142634", "0.6116638", "0.6111507", "0.60967636", "0.60754156", "0.60511714", "0.5973882", "0.5929334", "0.5927219", "0.59258807", "0.59...
0.82971025
0
Returns a new object with the same month, day, year as the calling object (self).
def copy(self): dnew = Date(self.month, self.day, self.year) return dnew
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, new_month, new_day, new_year):\n self.month = new_month\n self.day = new_day\n self.year = new_year", "def __init__(self, month, day, year):", "def __init__(self, year, month, day):", "def __init__(self, month, day, year):\n self.month = month\n self.day = day\n ...
[ "0.7616714", "0.7335453", "0.73295027", "0.7061737", "0.7014032", "0.6962942", "0.67879266", "0.6735777", "0.6664058", "0.65950024", "0.65334845", "0.64315635", "0.62427527", "0.6209779", "0.6198609", "0.6188022", "0.61878073", "0.6174517", "0.6170295", "0.6150374", "0.607127...
0.75362664
1
Decides if self and d2 represent the same calendar date, whether or not they are the in the same place in memory.
def equals(self, d2): if self.year == d2.year and self.month == d2.month and self.day == d2.day: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if self.day == other.day and self.month == other.month and self.year == other.year:\n return True\n else:\n return False", "def __eq__(self, other):\n if self.month == other.month:\n if self.day == other.day:\n if se...
[ "0.7327474", "0.70843506", "0.69978386", "0.69955295", "0.67568344", "0.6674572", "0.6666818", "0.66469276", "0.6643512", "0.66216856", "0.6603491", "0.65605384", "0.65052336", "0.6463389", "0.6428842", "0.63874286", "0.6381778", "0.63668907", "0.6357204", "0.6326482", "0.629...
0.7742764
0
changes the calling object so that it represents N calendar days BEFORE the date it originally represented
def subNDays(self, N): print self for i in range(N): self.yesterday() print self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_n_days_ahead(self, startdate, n, fmt=None):\n return startdate + datetime.timedelta(days=n)", "def _prev_month(self):\r\n self._canvas.place_forget()\r\n\r\n self._date = self._date - self.timedelta(days=1)\r\n self._date = self.datetime(self._date.year, self._date.month, 1)\r...
[ "0.59353423", "0.58411884", "0.5824707", "0.5729099", "0.56658214", "0.5655242", "0.5619501", "0.55904967", "0.5576773", "0.55663043", "0.55275434", "0.55259895", "0.5522124", "0.5513618", "0.5505", "0.5504524", "0.5501555", "0.54578924", "0.54559875", "0.5449029", "0.5436721...
0.60222596
0
returns True if the calling object is a calendar date BEFORE the argument named d2 (an object of type Date) returns False is self and d2 represent the same day or if self is AFTER d2
def isBefore(self, d2): if self.year < d2.year: return True elif self.year == d2.year and self.month < d2.month: return True elif self.year == d2.year and self.month == d2.month and self.day < d2.day: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_before(self,other_date):", "def is_before(self, other):\n if self.year > other.year:\n return False\n if self.year == other.year:\n if self.month > other.month:\n return False\n if self.year == other.year:\n if self.month == other.month:...
[ "0.76194257", "0.71506417", "0.7093044", "0.6992385", "0.6915931", "0.68639606", "0.6809329", "0.6788419", "0.6785996", "0.67289376", "0.66954887", "0.66954887", "0.6686702", "0.6642271", "0.6528611", "0.6379765", "0.6233878", "0.62327737", "0.6227459", "0.6219062", "0.619256...
0.8014479
0
returns True if the calling object is a calendar date AFTER the argument named d2 (an object of type Date) returns False is self and d2 represent the same day or if self is BEFORE d2
def isAfter(self, d2): if self.equals(d2): return False elif self.isBefore(d2): return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isBefore(self, d2):\n if self.year < d2.year:\n return True\n elif self.year == d2.year and self.month < d2.month:\n return True\n elif self.year == d2.year and self.month == d2.month and self.day < d2.day:\n return True\n else:\n return False", "def is_before(self,other_date)...
[ "0.75077987", "0.71372366", "0.7086298", "0.6838413", "0.68156666", "0.67405784", "0.65129244", "0.65059084", "0.64875185", "0.64625776", "0.6457431", "0.6406961", "0.6401933", "0.6385087", "0.63760567", "0.6274783", "0.6255542", "0.62544763", "0.62399304", "0.6124017", "0.61...
0.75769514
0
returns an integer representing the NUMBER OF DAYS between self and d2
def diff(self, d2): copyD1 = self.copy() copyD2 = d2.copy() count = 0 if copyD1.equals(copyD2): return count elif copyD1.isBefore(copyD2): while copyD1.isBefore(copyD2): count += 1 copyD1.tomorrow() return -count else: while copyD1.isAfter(copyD2): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_between(self, other):\n new_self = self.copy()\n new_other = other.copy()\n count=0\n if self.is_before(other):\n while(True):\n if new_self == new_other:\n break\n count-=1\n new_self.advance_one()\n ...
[ "0.7421999", "0.70217705", "0.7015891", "0.70060354", "0.6984977", "0.6973993", "0.69367176", "0.69147235", "0.6771477", "0.6736787", "0.6724909", "0.67015916", "0.6631658", "0.6615054", "0.65624464", "0.64617056", "0.64391494", "0.64064854", "0.63979155", "0.6366386", "0.633...
0.7299645
1
If the passed language is a variant, return its parent
def get_parent_language(lang: str) -> str: is_language_variant = "-" in lang if is_language_variant: return lang[: lang.index("-")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParent():", "def get_version(self, language):\n\n if isinstance(language, basestring):\n language = Language.get(language)\n\n for version in self.versions:\n if version.language == language:\n return version\n\n return None", "def get_language(s...
[ "0.60797113", "0.6018734", "0.5930238", "0.57886934", "0.5780646", "0.57438123", "0.57289916", "0.5696669", "0.5694845", "0.5691957", "0.56833094", "0.5668092", "0.5651179", "0.56136966", "0.55905885", "0.5588487", "0.5560915", "0.5552444", "0.5551547", "0.5506665", "0.549063...
0.7379791
0
Return all message translations that are required on boot.
def get_messages_for_boot(): messages = get_all_translations(frappe.local.lang) messages.update(get_dict_from_hooks("boot", None)) return messages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_translated_text():\n return {\n code: ''\n for code, name\n in settings.LANGUAGES\n }", "def _extract_18n_messages():\n BabelCLI().run(['', 'extract', '-F', 'babel.cfg', '-k', '_t', '--no-location', '--sort-output',\n '--omit-header', '-o', os.path.join(I...
[ "0.66692555", "0.6611699", "0.65892076", "0.6535671", "0.6471713", "0.636463", "0.6295026", "0.6211213", "0.6134869", "0.6134869", "0.6019158", "0.5999323", "0.59798187", "0.59468955", "0.594278", "0.594278", "0.59133863", "0.5900633", "0.5893161", "0.5886416", "0.5883705", ...
0.7995621
0
Load and return the entire translations dictionary for a language from apps + user translations.
def get_all_translations(lang: str) -> dict[str, str]: if not lang: return {} def _merge_translations(): all_translations = get_translations_from_apps(lang).copy() try: # get user specific translation data user_translations = get_user_translations(lang) all_translations.update(user_translations) exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_lang(lang, apps=None):\n\n\tif lang=='en':\n\t\treturn {}\n\n\tout = frappe.cache().hget(\"lang_full_dict\", lang, shared=True)\n\n\tif not out:\n\t\tout = {}\n\t\tfor app in (apps or frappe.get_all_apps(True)):\n\t\t\tpath = os.path.join(frappe.get_pymodule_path(app), \"translations\", lang + \".json\")\...
[ "0.74525684", "0.69477826", "0.66838795", "0.6574711", "0.65717417", "0.6553139", "0.6467629", "0.6460375", "0.6457447", "0.6336055", "0.63262165", "0.62614495", "0.6216522", "0.61567247", "0.6142031", "0.61204106", "0.60881054", "0.6085042", "0.60762614", "0.5987815", "0.596...
0.7437248
1
Combine all translations from `.csv` files in all `apps`. For derivative languages (esGT), take translations from the base language (es) and then update translations from the child (esGT)
def get_translations_from_apps(lang, apps=None): if lang == "en": return {} translations = {} for app in apps or frappe.get_installed_apps(_ensure_on_bench=True): path = frappe.get_app_path(app, "translations", lang + ".csv") translations.update(get_translation_dict_from_file(path, lang, app) or {}) if "-" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_translations(lang, untranslated_file, translated_file, app=\"_ALL_APPS\"):\n\tclear_cache()\n\tfull_dict = get_all_translations(lang)\n\n\tdef restore_newlines(s):\n\t\treturn (\n\t\t\ts.replace(\"|||||\", \"\\\\\\n\")\n\t\t\t.replace(\"| | | | |\", \"\\\\\\n\")\n\t\t\t.replace(\"||||\", \"\\\\n\")\n\t\...
[ "0.6750786", "0.65281385", "0.6090613", "0.59707904", "0.5891968", "0.5812921", "0.58110124", "0.57808274", "0.57644635", "0.5687877", "0.5668619", "0.56059396", "0.5555772", "0.55203915", "0.54778147", "0.5460354", "0.5453668", "0.54250836", "0.5405557", "0.53435117", "0.531...
0.6750639
1
Returns all messages (list) for a specified `app`
def get_messages_for_app(app, deduplicate=True): messages = [] modules = [frappe.unscrub(m) for m in frappe.local.app_modules[app]] # doctypes if modules: if isinstance(modules, str): modules = [modules] filtered_doctypes = ( frappe.qb.from_("DocType").where(Field("module").isin(modules)).select("name")....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_messages_for_app(app):\n\tmessages = []\n\tmodules = \", \".join(['\"{}\"'.format(m.title().replace(\"_\", \" \")) \\\n\t\tfor m in frappe.local.app_modules[app]])\n\n\t# doctypes\n\tif modules:\n\t\tfor name in frappe.db.sql_list(\"\"\"select name from tabDocType\n\t\t\twhere module in ({})\"\"\".format(m...
[ "0.7564479", "0.6858341", "0.6817746", "0.6686708", "0.6553618", "0.63832015", "0.6328123", "0.62921464", "0.62920743", "0.62573105", "0.61743414", "0.6165361", "0.61263746", "0.6086476", "0.60778743", "0.60688084", "0.6063915", "0.6063191", "0.60603523", "0.6006632", "0.6006...
0.7323146
1
Return all labels from Navbar Items, as specified in Navbar Settings.
def get_messages_from_navbar(): labels = frappe.get_all("Navbar Item", filters={"item_label": ("is", "set")}, pluck="item_label") return [("Navbar:", label, "Label of a Navbar Item") for label in labels]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items(cls) -> t.List[t.Tuple[t.Any, t.Union[str, NameTitle]]]:\n return list(cls.__labels__.items())", "def get_labels(self) -> List[str]:\n return self.labels", "def labels(self) -> Mapping[str, str]:\n return pulumi.get(self, \"labels\")", "def labels(self) -> Mapping[str, str]:\n ...
[ "0.63265485", "0.6256548", "0.61688757", "0.61688757", "0.61688757", "0.61688757", "0.61688757", "0.61688757", "0.61688757", "0.61688757", "0.61010146", "0.6079814", "0.60744786", "0.6046383", "0.600911", "0.59898907", "0.59807444", "0.59694654", "0.5955326", "0.59483004", "0...
0.7627104
0
Extract all translatable messages for a doctype. Includes labels, Python code, Javascript code, html templates
def get_messages_from_doctype(name): messages = [] meta = frappe.get_meta(name) messages = [meta.name, meta.module] if meta.description: messages.append(meta.description) # translations of field labels, description and options for d in meta.get("fields"): messages.extend([d.label, d.description]) if d.f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_messages_from_doctype(name):\n\tmessages = []\n\tmeta = frappe.get_meta(name)\n\n\tmessages = [meta.name, meta.module]\n\n\tif meta.description:\n\t\tmessages.append(meta.description)\n\n\t# translations of field labels, description and options\n\tfor d in meta.get(\"fields\"):\n\t\tmessages.extend([d.labe...
[ "0.6551545", "0.6259681", "0.57060575", "0.55480427", "0.5310939", "0.5262401", "0.51958627", "0.5157017", "0.51079404", "0.51038665", "0.50712764", "0.49744385", "0.4971144", "0.49695867", "0.49429208", "0.49290147", "0.4922138", "0.49156842", "0.4910096", "0.49036318", "0.4...
0.6539834
1
Returns messages from js files included at time of boot like desk.min.js for desk and web
def get_messages_from_include_files(app_name=None): from frappe.utils.jinja_globals import bundled_asset messages = [] app_include_js = frappe.get_hooks("app_include_js", app_name=app_name) or [] web_include_js = frappe.get_hooks("web_include_js", app_name=app_name) or [] include_js = app_include_js + web_include...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def js():\n with lcd(BASEDIR):\n js_ext = (\n 'submodules/jquery-cookie/src/jquery.cookie.js',\n 'submodules/jquery-treegrid/js/jquery.treegrid.js',\n 'submodules/bootstrap/dist/js/bootstrap.js',\n )\n js_own = (\n 'js/variables.js',\n ...
[ "0.6217054", "0.60809547", "0.60367644", "0.58267856", "0.5802923", "0.5796915", "0.5757939", "0.57492536", "0.5695297", "0.56889427", "0.5657771", "0.5492464", "0.5477332", "0.5373451", "0.52452934", "0.52360976", "0.5204163", "0.51525414", "0.51245177", "0.5084141", "0.5050...
0.63474244
0
Returns a list of transatable strings from a code file
def get_messages_from_file(path: str) -> list[tuple[str, str, str | None, int]]: frappe.flags.setdefault("scanned_files", set()) # TODO: Find better alternative # To avoid duplicate scan if path in frappe.flags.scanned_files: return [] frappe.flags.scanned_files.add(path) bench_path = get_bench_path() if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_strings(src_file):\n res = []\n try:\n res = open(src_file,'r').readlines()\n res = [x.strip() for x in res]\n except:\n res = []\n return res", "def load_codes(self, codes_file):\n with open(codes_file, \"r\") as cfile:\n codes = set([ line.strip().lowe...
[ "0.69848895", "0.6175604", "0.6124402", "0.610023", "0.60719025", "0.60711503", "0.604522", "0.6015361", "0.59906834", "0.59792006", "0.59200686", "0.58881736", "0.5861332", "0.5845954", "0.58428144", "0.58312666", "0.5825503", "0.57980675", "0.57935786", "0.578261", "0.57450...
0.6680396
1
Extracts translatable strings from a code file
def extract_messages_from_code(code): from jinja2 import TemplateError try: code = frappe.as_unicode(render_include(code)) # Exception will occur when it encounters John Resig's microtemplating code except (TemplateError, ImportError, InvalidIncludePath, OSError) as e: if isinstance(e, InvalidIncludePath): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_18n_messages():\n BabelCLI().run(['', 'extract', '-F', 'babel.cfg', '-k', '_t', '--no-location', '--sort-output',\n '--omit-header', '-o', os.path.join(I18N_PATH, 'messages.pot'), 'aliquis'])", "def extract_messages_from_code(code, is_py=False):\n\ttry:\n\t\tcode = frappe.as_un...
[ "0.68949", "0.6539807", "0.6512879", "0.6115357", "0.60902613", "0.6088147", "0.60030216", "0.59867567", "0.5933709", "0.5923882", "0.5830527", "0.5817076", "0.5807938", "0.57887924", "0.57524884", "0.573279", "0.5712957", "0.563107", "0.56271267", "0.56074834", "0.5578763", ...
0.6918703
0
Write translation CSV file.
def write_csv_file(path, app_messages, lang_dict): app_messages.sort(key=lambda x: x[1]) with open(path, "w", newline="") as msgfile: w = writer(msgfile, lineterminator="\n") for app_message in app_messages: context = None if len(app_message) == 2: path, message = app_message elif len(app_message) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(self, outputfile):\n d = csv.writer(outputfile, quoting=csv.QUOTE_ALL)\n for row in self.translations.iteritems():\n d.writerow(row)", "def write_csv(self, filelike):\r\n items = self.rows()\r\n writer = unicodecsv.writer(filelike, encoding=\"utf-8\")\r\n writer.writ...
[ "0.7842705", "0.72142833", "0.67409736", "0.66681284", "0.66015655", "0.6600977", "0.65728676", "0.6566953", "0.6543331", "0.65170884", "0.65123487", "0.6505551", "0.650296", "0.64963204", "0.64958304", "0.6467368", "0.6466191", "0.6463179", "0.6432045", "0.64244795", "0.6385...
0.7470537
1
Returns all untranslated strings for a language and writes in a file
def get_untranslated(lang, untranslated_file, get_all=False, app="_ALL_APPS"): clear_cache() apps = frappe.get_all_apps(True) if app != "_ALL_APPS": if app not in apps: print(f"Application {app} not found!") return apps = [app] messages = [] untranslated = [] for app_name in apps: messages.extend(get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_untranslated(lang, untranslated_file=None, get_all=False, app=None, write=True):\n\tclear_cache()\n\n\tmessages = []\n\tuntranslated = defaultdict(lambda: defaultdict(dict))\n\tif app:\n\t\tmessages = get_messages_for_app(app)\n\telse:\n\t\tfor app in frappe.get_all_apps(True):\n\t\t\tmessages.extend(get_m...
[ "0.6584445", "0.65648997", "0.65052485", "0.64634526", "0.6346493", "0.62578046", "0.620105", "0.61931974", "0.6145856", "0.6066353", "0.6035533", "0.6004509", "0.5979703", "0.5902814", "0.5893097", "0.58732826", "0.5835999", "0.5832829", "0.58216834", "0.5774166", "0.5748212...
0.68825924
0
Update translations from a source and target file for a given language.
def update_translations(lang, untranslated_file, translated_file, app="_ALL_APPS"): clear_cache() full_dict = get_all_translations(lang) def restore_newlines(s): return ( s.replace("|||||", "\\\n") .replace("| | | | |", "\\\n") .replace("||||", "\\n") .replace("| | | |", "\\n") .replace("|||", "\n"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_translations(lang, translated_data, app, is_file=True):\n\tclear_cache()\n\tfull_dict = load_lang(lang, [app])\n\n\tif full_dict:\n\t\tdef restore_newlines(s):\n\t\t\treturn (s.replace(\"|||||\", \"\\\\\\n\")\n\t\t\t\t\t.replace(\"| | | | |\", \"\\\\\\n\")\n\t\t\t\t\t.replace(\"||||\", \"\\\\n\")\n\t\t\...
[ "0.66791344", "0.63966095", "0.6078378", "0.60729563", "0.6036594", "0.6028217", "0.59740347", "0.5968465", "0.59569347", "0.5926012", "0.59227216", "0.5869459", "0.5791227", "0.5777387", "0.5757889", "0.57465124", "0.57136136", "0.57036763", "0.5703097", "0.56558466", "0.565...
0.6637544
1
Import translations from file in standard format
def import_translations(lang, path): clear_cache() full_dict = get_all_translations(lang) full_dict.update(get_translation_dict_from_file(path, lang, "import")) for app in frappe.get_all_apps(True): write_translations_file(app, lang, full_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, filepath):\n pass", "def read_po(self, inputfile):\n is_index = False\n lines = inputfile.readlines()\n index = ''\n value = ''\n for line in lines:\n if line.startswith('#'):\n continue\n elif line.startswith('msgid'):\n is_index = True\n ...
[ "0.6626948", "0.660755", "0.65344864", "0.650112", "0.64576405", "0.6426083", "0.6205688", "0.6152179", "0.61160636", "0.60194945", "0.59757906", "0.5965752", "0.59382874", "0.59208184", "0.5886727", "0.58723736", "0.586663", "0.5846847", "0.5812325", "0.5812325", "0.57960385...
0.663314
0
Migrate targetappspecific translations from sourceapp to targetapp
def migrate_translations(source_app, target_app): clear_cache() strings_in_source_app = [m[1] for m in frappe.translate.get_messages_for_app(source_app)] strings_in_target_app = [m[1] for m in frappe.translate.get_messages_for_app(target_app)] strings_in_target_app_but_not_in_source_app = list( set(strings_in_ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_patch_odoo(self):\n paths = [os.path.join('openerp', 'tools', 'translate.py'),\n os.path.join('odoo', 'tools', 'translate.py')]\n for path in paths:\n s_file = os.path.join(self._server_path, path)\n if not os.path.isfile(s_file):\n cont...
[ "0.5715308", "0.55745673", "0.55168104", "0.5490492", "0.54586124", "0.5419781", "0.5308909", "0.52588713", "0.5256012", "0.5236541", "0.522904", "0.5202649", "0.5195046", "0.51658565", "0.51555526", "0.5112733", "0.50993305", "0.50826365", "0.50750506", "0.50692075", "0.5049...
0.78916484
0
Append translated dict in `frappe.local.response`
def send_translations(translation_dict): if "__messages" not in frappe.local.response: frappe.local.response["__messages"] = {} frappe.local.response["__messages"].update(translation_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_translated_text():\n return {\n code: ''\n for code, name\n in settings.LANGUAGES\n }", "def get_translation(self):", "def get_lang_js(fortype: str, name: str) -> str:\n\treturn f\"\\n\\n$.extend(frappe._messages, {json.dumps(get_dict(fortype, name))})\"", "def get_lang_js...
[ "0.5645178", "0.5510957", "0.5468224", "0.5429747", "0.54025203", "0.5355868", "0.5319116", "0.5250902", "0.5245807", "0.5243739", "0.5239572", "0.5220736", "0.521488", "0.5180243", "0.5142529", "0.5140901", "0.511876", "0.51048046", "0.509845", "0.50925344", "0.50731796", ...
0.7026861
0
Getter for the grade value of the current grade instance
def get_grade(self): return self.__grade_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grade(self) -> int :\n return self.grade", "def get_value(\n self\n ) -> float:\n\n return self.average", "def get_g_score(self):\n return self._g_score", "def publish_grade(self):\r\n score = self.lcp.get_score()\r\n self.runtime.publish(\r\n s...
[ "0.8369609", "0.7082165", "0.6822362", "0.67607737", "0.6667259", "0.6656464", "0.66217035", "0.66202563", "0.661658", "0.65875876", "0.65875876", "0.65875876", "0.65620965", "0.6537988", "0.6537988", "0.6537988", "0.6512228", "0.6496693", "0.6479231", "0.64789337", "0.647634...
0.8781585
0
Getter for the student ID of the current grade instance
def get_student_id(self): return self.__student_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_student_id(self):\n return self._student_id", "def get_student(self):\n return self.student", "def get_student(self):\n return self._student", "def get_grading_id(self):\n return self._grading_id", "def get_student(self):\n return db.get(self.student_key)", "def...
[ "0.8487692", "0.73362076", "0.7248596", "0.7178025", "0.7065409", "0.68116", "0.679066", "0.66875654", "0.65918547", "0.6590938", "0.6582891", "0.65591073", "0.6555714", "0.65166616", "0.6502383", "0.6502383", "0.6502383", "0.6502383", "0.6502383", "0.6502383", "0.6502383", ...
0.8555902
0
Getter for the discipline ID of the current grade instance
def get_discipline_id(self): return self.__discipline_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course_id(self):\n return self.ID", "def get_discipline_name(self):\n return self.__discipline_name", "def get_student_id(self):\n return self.__student_id", "def get_student_id(self):\n return self._student_id", "def cisid(self):\n return self._cisid", "def get...
[ "0.6913118", "0.6868929", "0.6817603", "0.67311543", "0.66436386", "0.6582481", "0.6561987", "0.64400834", "0.6425438", "0.6415259", "0.6405952", "0.64044946", "0.6386278", "0.63797176", "0.63546896", "0.6352328", "0.63472956", "0.63415945", "0.63360286", "0.6332231", "0.6309...
0.8454621
0
Getter for the discipline's name for the current Grade instance
def get_discipline_name(self): return self.__discipline_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_student_name(self):\n return self.__student_name", "def __str__(self):\n return str(self.__student_name) + \" has grade \" + str(self.__grade_value) + \" at \" + str(self.__discipline_name)", "def _get_name(self):\n return self.name", "def get_name(self) -> str:\r\n return...
[ "0.7079603", "0.6880193", "0.6759028", "0.6706063", "0.6699811", "0.6699467", "0.6690337", "0.6684808", "0.6684808", "0.6684808", "0.66412586", "0.6621796", "0.6621796", "0.6621796", "0.6621796", "0.6621796", "0.6621796", "0.6621796", "0.6621796", "0.6621796", "0.6621796", ...
0.8392133
0
Getter for the student's name for the current Grade instance
def get_student_name(self): return self.__student_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_student(self):\n return self.student", "def __str__(self):\n return str(self.__student_name) + \" has grade \" + str(self.__grade_value) + \" at \" + str(self.__discipline_name)", "def get_name(self) -> str:\r\n return self.name", "def get_name(self): \r\n return self.name...
[ "0.7320124", "0.7260825", "0.7234937", "0.72178173", "0.7213346", "0.71864283", "0.7184898", "0.7140616", "0.7140616", "0.7140616", "0.71247065", "0.7109712", "0.7109712", "0.7109712", "0.7109598", "0.7109598", "0.70767534", "0.70767534", "0.70767534", "0.70767534", "0.707675...
0.8675116
0
Overrides the str function for grade instances
def __str__(self): return str(self.__student_name) + " has grade " + str(self.__grade_value) + " at " + str(self.__discipline_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return f\"{self.semester} | {self.school} | {self.position} | {self.class_name}\"", "def __str__(self):\n return \"student:\"+str(self.name)+\":\"+str(self.age)+\":\"+str(self.major)", "def __str__(self) -> str:", "def __str__(self) -> str:", "def __str__(self) -> str:", ...
[ "0.71322924", "0.70280325", "0.69138056", "0.69138056", "0.69138056", "0.69138056", "0.68971586", "0.6842432", "0.6839214", "0.68321973", "0.6827448", "0.6816284", "0.67801344", "0.6777593", "0.6743071", "0.67238766", "0.6723739", "0.66961354", "0.66961354", "0.6677916", "0.6...
0.8083111
0
Using torchaudio.transforms to grab MFCC features and labels which fit pytorch
def features_and_labels(soundfile, frag_length=128): label = soundfile.split('\\')[-1].split('_')[0] waveform, sample_rate = torchaudio.load(soundfile) MFCCs = transforms.MFCC(n_mfcc=128, melkwargs={'n_mels':128, 'win_length':320, 'hop_length':160, 'n_fft':1024 })(waveform[0][:]) MFCCs =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, audio, feat_kinds=['sp','mcc','f0','ap','en']):\n device = audio.device\n audio = audio.detach().cpu().numpy()\n feat = dict()\n for feat_kind in feat_kinds:\n feat[feat_kind] = list()\n\n for x in audio:\n # Preprocess\n x = x *...
[ "0.6545687", "0.64840394", "0.6444227", "0.64008653", "0.6340683", "0.62353003", "0.6219182", "0.61814654", "0.60809934", "0.5951422", "0.59291077", "0.5893627", "0.5873762", "0.58557135", "0.5834606", "0.58306265", "0.5822783", "0.58100766", "0.57669765", "0.57355034", "0.57...
0.7304945
0
Resolute the whole directory. For each file we adopt features_and_labels to grab the MFCCSs and labels, then we concatenate the MFCCs and labels, after which we shuffle them in Dataloader for better representation and training effects.
def dir_resolution(self, src_path, frag_length=128): src_path = os.path.join(self.root_path, src_path) files = os.listdir(src_path) MFCCs = None labels = None cnt = 1 total_num = len(files) for wav in files: wav_path = os.path.join(src_path, wav) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_data_dir(self, data_dir):\n categories = os.listdir(data_dir)\n for folder_name in categories:\n all_fnames_list_fname = os.path.join(data_dir, folder_name,\n folder_name + \".bmf\")\n if not os.path.isfile(all_fnames_li...
[ "0.6891191", "0.67281985", "0.6459952", "0.6419726", "0.6413108", "0.62061477", "0.61670274", "0.6143902", "0.60984755", "0.60692763", "0.60558665", "0.60204107", "0.60094136", "0.59958917", "0.5993219", "0.59861505", "0.5970218", "0.59578747", "0.5953404", "0.59519756", "0.5...
0.67848784
1
Test permuting FrameSet axes using a SkyFrame Permuting the axes of the current frame of a frame set in situ (by calling `permAxes` on the frame set itself) should update the connected mappings.
def test_FrameSetPermutationSkyFrame(self): # test with arbitrary values that will not be wrapped by SkyFrame x = 0.257 y = 0.832 frame1 = ast.Frame(2) unitMap = ast.UnitMap(2) frame2 = ast.SkyFrame() frameSet = ast.FrameSet(frame1, unitMap, frame2) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_FrameSetPermutationUnequal(self):\n # Initial mapping: 3 inputs, 2 outputs: 1-1, 2-2, 3=z\n # Test using arbitrary values for x,y,z\n x = 75.1\n y = -53.2\n z = 0.123\n frame1 = ast.Frame(3)\n permMap = ast.PermMap([1, 2, -1], [1, 2], [z])\n frame2 =...
[ "0.76181346", "0.49969777", "0.49213955", "0.4911864", "0.48749465", "0.48103952", "0.4778155", "0.47578478", "0.4733813", "0.47031477", "0.4684239", "0.46478426", "0.4607625", "0.4590625", "0.4569246", "0.4523995", "0.4502329", "0.44952422", "0.44672385", "0.4460318", "0.444...
0.82028717
0
Test that permuting FrameSet axes with nIn != nOut Permuting the axes of the current frame of a frame set in situ (by calling `permAxes` on the frame set itself) should update the connected mappings. Make nIn != nOut in order to test DM9899 FrameSet.permAxes would fail if nIn != nOut
def test_FrameSetPermutationUnequal(self): # Initial mapping: 3 inputs, 2 outputs: 1-1, 2-2, 3=z # Test using arbitrary values for x,y,z x = 75.1 y = -53.2 z = 0.123 frame1 = ast.Frame(3) permMap = ast.PermMap([1, 2, -1], [1, 2], [z]) frame2 = ast.Frame(2)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_FrameSetPermutationSkyFrame(self):\n # test with arbitrary values that will not be wrapped by SkyFrame\n x = 0.257\n y = 0.832\n frame1 = ast.Frame(2)\n unitMap = ast.UnitMap(2)\n frame2 = ast.SkyFrame()\n frameSet = ast.FrameSet(frame1, unitMap, frame2)\n ...
[ "0.67414784", "0.5697938", "0.55126363", "0.55059415", "0.54638445", "0.5372107", "0.5241461", "0.5231766", "0.51561236", "0.5102879", "0.50862706", "0.5055971", "0.5043112", "0.4973088", "0.4970074", "0.4965453", "0.48989153", "0.48948184", "0.48939347", "0.48901424", "0.488...
0.78115654
0
Function predicts area value in an unknown location based on the areatoarea or areatopoint Poisson Kriging.
def predict(self, unknown_area_points, number_of_neighbours, max_search_radius): prediction = self.k_func.predict(unknown_area_points, number_of_neighbours, max_search_radius) return prediction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictor(path):\n # get keypoints from the image in a DF\n TEST_keypoints = []\n path = cv2.cvtColor(path, cv2.COLOR_BGR2RGB)\n img = movenet_inference_flat_v10(hub_model, path)\n TEST_keypoints.append(img)\n TEST_keypoints_df = pd.DataFrame(TEST_keypoints)\n\n # Rename columns in the Dat...
[ "0.5723355", "0.5665625", "0.5470485", "0.54139686", "0.5410499", "0.53469545", "0.5344502", "0.5193771", "0.51919246", "0.5158969", "0.51501316", "0.5096641", "0.50602984", "0.5057834", "0.5034465", "0.5033032", "0.5012514", "0.4920955", "0.4918968", "0.49158666", "0.4904952...
0.6549179
0
Function regularizes whole dataset and creates new values and error maps based on the kriging type. If chosen type is area to area then function returns Geopandas GeoDataFrame with area id, areal geometry, estimated value, estimated prediction error, RMSE of prediction. If chosen type is area to point then function ret...
def regularize_data(self, number_of_neighbours, max_search_radius, data_crs="EPSG:4326"): areas_ids = self.areal_data_known[:, 0] list_of_vals = [] for a_id in areas_ids: prediction_rows = self._get_prediction_row(a_id, number_of_neighbours, max_search_radius) # Add id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_regression_map(df, only_coal=True):\n regression_map = pd.DataFrame(columns=[\"Fuel\", \"slope\", \"intercept\", \"min_val\", \"max_val\"])\n if only_coal:\n df = df[df.fuel_type == \"coal\"]\n for fuel in df.fuel_type.unique():\n temp_df = df[df[\"fuel_type\"] == fuel].copy()\n ...
[ "0.52539074", "0.5209256", "0.51522666", "0.51052946", "0.50703835", "0.49784595", "0.49778527", "0.49533156", "0.48517737", "0.4843977", "0.48254356", "0.48217475", "0.48072037", "0.48047912", "0.47924858", "0.47781545", "0.4767692", "0.47657946", "0.47596288", "0.47494495", ...
0.59640026
0
Test module journals.py by downloading journals.csv and testing shape of extracted data has 180 rows and 10 columns
def test_journals(): test_path = tempfile.mkdtemp() x_train, metadata = journals(test_path) try: assert x_train.shape == (180, 10) except: shutil.rmtree(test_path) raise()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_furniture(self):\n\n add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)\n add_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)\n add_furniture('invoice.csv', 'Alex Gonzales', 'BR02', 'Queen Mattress', 17)\n\n # Generate list of renta...
[ "0.57835835", "0.55504376", "0.5542925", "0.5541012", "0.55314946", "0.55193686", "0.5485054", "0.5478811", "0.5470811", "0.5430811", "0.5420464", "0.5403592", "0.5352353", "0.5343877", "0.53379554", "0.53257203", "0.5323983", "0.5321546", "0.5315496", "0.5297438", "0.5292821...
0.6703763
0
Opens the Buganizer url in the Chrome Browser and scrapes the webpage's source html to get the links for all the issues under the componentid.
def scrape_issues(self, url): try: self.driver.get(url) except common.exceptions.InvalidSessionIdException: self.driver.close() error_message = "ERROR: Failed to reach URL, check "\ "specified URL in constants.py\n" self.logger.log(error_message) return [] except Exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def openNewIssueUrl(self):\r\n url = QUrl(\"https://github.com/Freeseer/freeseer/issues/new\")\r\n QDesktopServices.openUrl(url)", "def visit_all_issues_in_list(self, issues):\n for issue in issues:\n self.driver.implicitly_wait(3)\n self.driver.get(issue)\n config_type_text = sel...
[ "0.5919638", "0.58162516", "0.576486", "0.5741829", "0.57077444", "0.5615245", "0.55784756", "0.55586386", "0.5550047", "0.55428475", "0.54789764", "0.5455549", "0.54487735", "0.5448626", "0.54362655", "0.5435568", "0.5407659", "0.5395814", "0.5374557", "0.5369067", "0.536534...
0.69480836
0
From the list of buganizer issues, visit each issue with the webdriver, find the reporter from an html tag send issue html to message_parsing_utility to be parsed.
def visit_all_issues_in_list(self, issues): for issue in issues: self.driver.implicitly_wait(3) self.driver.get(issue) config_type_text = self.driver.find_element_by_xpath("/html/body/b-service-bootstrap/"\ "app-root/div[7]/div/div/edit-issue-page/b-resolving-issue-references/div[2]/div[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_issues(self, url):\n try:\n self.driver.get(url)\n except common.exceptions.InvalidSessionIdException:\n self.driver.close()\n error_message = \"ERROR: Failed to reach URL, check \"\\\n \"specified URL in constants.py\\n\"\n self.logger.log(error_message)\n return []\...
[ "0.70684487", "0.62912136", "0.61083233", "0.59577924", "0.5827052", "0.5784197", "0.57594097", "0.56995815", "0.5654476", "0.54628205", "0.54601973", "0.54352313", "0.54164195", "0.5216515", "0.521272", "0.5200309", "0.5200226", "0.5149228", "0.5148666", "0.51370823", "0.512...
0.7092747
0
Scrape all advanced fields from a RoutingTarget Buganizer Issue
def scrape_queue_info(self, advanced_fields): source_html = self.driver.page_source soup = BeautifulSoup(source_html, "html.parser") severity_tag = soup.find("div", "bv2-issue-metadata-field-inner "\ "bv2-issue-metadata-field-severity") severity = severity_tag["aria-label"].replace( " valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_routing_targets(self, advanced_fields):\n source_html = self.driver.page_source\n soup = BeautifulSoup(source_html, \"html.parser\")\n try:\n show_all = self.driver.find_element_by_id(\"bv2-issue-metadata-list-4-more\")\n show_all.click()\n show_all = self.driver.find_element_by_...
[ "0.7713654", "0.54770523", "0.54455316", "0.5295992", "0.52034366", "0.51422", "0.51173514", "0.511575", "0.51122963", "0.50632423", "0.50037414", "0.49961174", "0.49717402", "0.49483138", "0.49464095", "0.4919574", "0.48905483", "0.48504505", "0.48457265", "0.48365772", "0.4...
0.656218
1
Scrape all advanced fields from a RoutingTarget Buganizer Issue
def scrape_routing_targets(self, advanced_fields): source_html = self.driver.page_source soup = BeautifulSoup(source_html, "html.parser") try: show_all = self.driver.find_element_by_id("bv2-issue-metadata-list-4-more") show_all.click() show_all = self.driver.find_element_by_id("bv2-issue-m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_queue_info(self, advanced_fields):\n source_html = self.driver.page_source\n soup = BeautifulSoup(source_html, \"html.parser\")\n severity_tag = soup.find(\"div\", \"bv2-issue-metadata-field-inner \"\\\n \"bv2-issue-metadata-field-severity\")\n severity = severity_tag[\"aria-label\"].re...
[ "0.656218", "0.54770523", "0.54455316", "0.5295992", "0.52034366", "0.51422", "0.51173514", "0.511575", "0.51122963", "0.50632423", "0.50037414", "0.49961174", "0.49717402", "0.49483138", "0.49464095", "0.4919574", "0.48905483", "0.48504505", "0.48457265", "0.48365772", "0.48...
0.7713654
0
Return a total of `num` random samples and labels. Mimicks the mnist.train.next_batch() function
def next_batch(num, data, labels): idx = np.arange(0 , len(data)) np.random.shuffle(idx) idx = idx[:num] data_shuffle = [data[i] for i in idx] labels_shuffle = [labels[i] for i in idx] return np.asarray(data_shuffle), np.asarray(labels_shuffle)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_batch(num, data, labels):\n idx = np.arange(0, len(data))\n np.random.shuffle(idx)\n idx = idx[:num]\n data_shuffle = [data[i] for i in idx]\n labels_shuffle = [labels[i] for i in idx]\n \n return np.asarray(data_shuffle), np.asarray(labels_shuffle)", "def ne...
[ "0.6891144", "0.6830833", "0.63632464", "0.6281471", "0.6275252", "0.6201188", "0.6174942", "0.6142057", "0.6138394", "0.61206514", "0.6116791", "0.6075215", "0.6054932", "0.6029934", "0.6014392", "0.598679", "0.5984626", "0.59697586", "0.59603626", "0.59552246", "0.5938416",...
0.6933328
0
POST request to create a valid team in database
def test_post_team(self): response = self.client.post(url_for('teams'), data={ 'name': 'test team', 'capacity': 11, 'number_players': 6, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n req = team_req.parse_args(strict=True)\n curr_user = api.user.get_user()\n if curr_user[\"teacher\"]:\n raise PicoException(\"Teachers may not create teams\", 403)\n req[\"team_name\"] = req[\"team_name\"].strip()\n if not all(\n [\n ...
[ "0.79959697", "0.7724525", "0.76015633", "0.7561775", "0.7447651", "0.743541", "0.7377837", "0.7367278", "0.7318445", "0.72648257", "0.722233", "0.7212253", "0.7125656", "0.71181744", "0.70906293", "0.708581", "0.7075323", "0.6973152", "0.68631893", "0.6804662", "0.67360556",...
0.80973095
0
player number cannot be a empty
def test_player_number_cannot_be_empty(self): with self.assertRaises(Exception) as context: self.client.post( url_for('teams'), data={ 'name': 'team', 'capacity': '5', 'number_players': 'hello', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_num_players(num_players):\n \n try:\n\tnum_players = int(num_players)\n except ValueError:\n\treturn None\n if num_players < 2 or num_players > 4:\n return None\n\n return num_players", "def enough_players():\n return True", "def SelectPlayer(self):\n\n player = input(...
[ "0.66977656", "0.6385544", "0.6348341", "0.63268924", "0.61899865", "0.6139229", "0.61374456", "0.61094064", "0.60811144", "0.6046342", "0.6008706", "0.5914257", "0.5887272", "0.57951015", "0.5778498", "0.5777042", "0.5770641", "0.57653236", "0.5763992", "0.5750957", "0.57075...
0.6929696
0
pitch_postcode cannot be a empty
def test_pitch_postcode_cannot_be_empty(self): with self.assertRaises(Exception) as context: self.client.post( url_for('teams'), data={ 'name': 'team', 'capacity': '11', 'number_players': '1', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pitch_postcode_length(self):\n with self.assertRaises(Exception) as context:\n self.client.post(\n url_for('teams'),\n data={\n 'name': 'team',\n 'capacity': '11',\n 'number...
[ "0.65764123", "0.60340387", "0.5626135", "0.5612466", "0.55946106", "0.5583271", "0.53661996", "0.529294", "0.5222145", "0.5222145", "0.5222145", "0.5163425", "0.5148325", "0.50922865", "0.50922865", "0.50837094", "0.5075694", "0.50661093", "0.50603104", "0.5041943", "0.50311...
0.7474278
0
pitch_postcode must be fewer than 8 character
def test_pitch_postcode_length(self): with self.assertRaises(Exception) as context: self.client.post( url_for('teams'), data={ 'name': 'team', 'capacity': '11', 'number_players': '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pitch_postcode_cannot_be_empty(self):\n with self.assertRaises(Exception) as context:\n self.client.post(\n url_for('teams'),\n data={\n 'name': 'team',\n 'capacity': '11',\n 'number_players': '1',\n ...
[ "0.68165445", "0.5974245", "0.5805453", "0.5583695", "0.5577443", "0.5540056", "0.5485245", "0.5436021", "0.54209876", "0.53664035", "0.53635174", "0.5358223", "0.5351246", "0.5350252", "0.5310552", "0.5294924", "0.52869827", "0.5275066", "0.5266998", "0.5253421", "0.52335024...
0.74989283
0
To set `payroll_id` and set `state = 'done'`
def action_done(self, payroll): self.payroll_id = payroll self.date_done = payroll.date_payroll self.state = 'done'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_set_done(self):\n self.ensure_one()\n self.write({\"state\": \"done\"})\n self.credit_control_line_ids.write({\"state\": \"done\"})\n return True", "def action_payslip_done(self):\n for recd in self.late_check_in_ids:\n recd.state = 'deducted'\n ret...
[ "0.6185564", "0.60995096", "0.5869406", "0.575969", "0.57338566", "0.57096726", "0.57083595", "0.55526006", "0.55448234", "0.55183035", "0.5485711", "0.54563105", "0.544745", "0.5410483", "0.53973025", "0.538477", "0.5375823", "0.53601676", "0.53398156", "0.525954", "0.521634...
0.75810933
0
To get recordset of rapel based on employee and pay period.
def get_employee_rapel_pay(self, employee_id, year_pay, month_pay): return self.search([ ('year_pay', '=', year_pay), ('month_pay', '=', month_pay), ('employee_id', '=', employee_id), ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_results(self):\n self.ensure_one()\n Result = self.env['sla.employee.view']\n dom = []\n if self.supplier_category_name:\n if self.supplier_category_name == 'employee':\n dom += [('pay_to', '=', 'employee')]\n elif self.supplier_category...
[ "0.57123214", "0.5697924", "0.5684732", "0.5339572", "0.53176624", "0.5301057", "0.52452046", "0.522237", "0.5207651", "0.51459855", "0.5109143", "0.5063053", "0.50590104", "0.5021293", "0.50212413", "0.5010067", "0.50082755", "0.49951124", "0.49939287", "0.4986779", "0.49504...
0.7033032
0
gets the price of an item based on the item code provided returns "Get price" currently
def get_price(item_code): output = "Get price for item {}.".format(item_code) print(output) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getprice():\n\n print(\"Get price\")\n latest_price = get_latest_price(item_code)\n return latest_price", "def get_price(item):\n return float(item[1])", "def _get_product_price(self, product_code: str) -> float:\n return float(self._product_prices[product_code])", "def get_price(self)...
[ "0.7892862", "0.7391328", "0.66978556", "0.65503925", "0.65408695", "0.6529588", "0.65179396", "0.645546", "0.6454885", "0.6454885", "0.63570976", "0.6352167", "0.6352167", "0.6352167", "0.63217175", "0.63206077", "0.6276482", "0.62730235", "0.6268507", "0.6217629", "0.618606...
0.82407415
0