query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Determine whether a point is within a bounding box
def in_area_of_interest (lat, long, min_lat, max_lat, min_long, max_long): if lat is None or long is None: return False lat = float(lat) long = float(long) if ((lat >= min_lat and lat <= max_lat) and (long >= min_long and long <= max_long)): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_point_in_box(x, y, bbox):\n if x < 200 and y < 200:\n return True\n return False", "def check_inside(point, bbox):\n return bbox[0] < point[0] < bbox[2] and bbox[1] < point[1] < bbox[3]", "def pointInBox(x, y, box):\n e = boxToExtent(box)\n return x >= e[0] and x <= e[2] and y >= e...
[ "0.8777382", "0.84752095", "0.8006039", "0.7970451", "0.79576534", "0.7925058", "0.7915042", "0.78511554", "0.77799624", "0.7778337", "0.7719331", "0.7696998", "0.7655951", "0.7579815", "0.7529728", "0.7528136", "0.7474669", "0.7474669", "0.743603", "0.7411609", "0.73976195",...
0.0
-1
Get the current SparkSession. This should almost never be called directly instead you should call with_spark_session, with_cpu_session, or with_gpu_session for spark_session. This is to guarantee that the session and it's config is setup in a repeatable way.
def get_spark_i_know_what_i_am_doing(): return _spark
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOrCreate(self) -> \"SparkSession\":\n return SparkSession(connectionString=self._options[\"spark.connect.location\"])", "def get_active_spark_session() -> Optional[SparkSession]:\n if is_spark_context_stopped():\n return None\n return SparkSession.getActiveSession()", "def get_sp...
[ "0.83361834", "0.8017564", "0.72829324", "0.71886766", "0.7124039", "0.70395494", "0.7002167", "0.69029814", "0.6891381", "0.6889373", "0.68796927", "0.68790424", "0.67660606", "0.6756618", "0.67470205", "0.67470205", "0.67470205", "0.67470205", "0.67470205", "0.67470205", "0...
0.5767239
77
Finds appropriate final for the existing initial in the beginning of the string
def final_finder(self, seq, init_length, fs): # print('call final_finder, input = '+seq) where_final=seq[init_length:] if len(where_final)>0: letter=where_final[0] if letter in fs: if len(where_final) > 1: yo = where_final[0] == 'ё' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_with_the_beggining(rna: str):\n return 0", "def initial_finder(self, seq, ins):\n# print('call initial_finder, input = '+seq)\n letter=seq[0]\n if letter in ins:\n if letter in ['д','т','ц','с']:\n next_letter=seq[:2]\n if next_letter in ...
[ "0.6504398", "0.64863306", "0.62235117", "0.6147827", "0.6123986", "0.6117677", "0.6115104", "0.6099541", "0.6037493", "0.6006822", "0.59931403", "0.59713787", "0.59424376", "0.58818465", "0.5862199", "0.58426005", "0.57888037", "0.5776179", "0.5762034", "0.57319695", "0.5713...
0.6029499
9
This nifty function returns optimally different N colors.
def get_good_colors(N): HSV_tuples = [(x*1.0/N, 0.5, 1) for x in range(N)] return(255 * np.array(map(lambda x: colorsys.hsv_to_rgb(*x), HSV_tuples)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colors(n):\n color = cm.rainbow(np.linspace(0, 1, n))\n return color", "def unique_colors_rgb(n):\r\n hues = []\r\n # i is in the range 0, 1, ..., n - 1\r\n for i in range(1, n + 1):\r\n hues.append(360.0 / i)\r\n\r\n hs = []\r\n for hue in hues:\r\n h = math.floor(hue ...
[ "0.81784624", "0.76313496", "0.76093274", "0.74209183", "0.72971255", "0.7240023", "0.723426", "0.72120696", "0.7147514", "0.7129822", "0.7117894", "0.7109832", "0.7101755", "0.7039201", "0.7016885", "0.6901744", "0.68700016", "0.68700016", "0.68700016", "0.6859234", "0.68417...
0.7962473
1
Sets the password for the current user
def set_password(self, raw_password): self.password = security.generate_password_hash(raw_password, length=12)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpassword(self, pwd):\n pass", "def set_password(self, password):\n self.password = password", "def set_password(self, password):\n self.PASS = password", "def set_password(self, password):\n self.PASSWORD = password", "def set_password(self, password):\n self.authe...
[ "0.84354645", "0.8294644", "0.8171011", "0.81626123", "0.81604874", "0.79363024", "0.7900748", "0.789865", "0.78963995", "0.7885437", "0.783411", "0.78173596", "0.779471", "0.7791343", "0.7780889", "0.7749631", "0.77423096", "0.77415335", "0.77415335", "0.7714359", "0.7677772...
0.75310177
34
The protocol that is prepended to the path when no protocol is specified.
def default_protocol(self): return "sftp://"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full(self):\n url = (self.scheme + ':') if self.scheme else ''\n url += '//' + self.netloc + self.relative()\n return url", "def protocol(self, code):\n return self.url.scheme", "def get_protocol():\n if https():\n protocol = 'https'\n else:\n protocol = 'htt...
[ "0.7042303", "0.68645024", "0.6796369", "0.66449445", "0.6639021", "0.66347957", "0.6587682", "0.65815717", "0.6463956", "0.6432269", "0.64169014", "0.63885194", "0.637642", "0.63464826", "0.63070315", "0.63038194", "0.6285968", "0.6284639", "0.6273279", "0.6232282", "0.61876...
0.6496454
8
List of valid protocols for this remote provider.
def available_protocols(self): return ["ssh://", "sftp://"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocols(self):\n if self._protocols is None:\n uri = \"/loadbalancers/protocols\"\n resp, body = self.method_get(uri)\n self._protocols = [proto[\"name\"] for proto in body[\"protocols\"]]\n return self._protocols", "def get_protocols(self):\r\n\r\n ret...
[ "0.7651498", "0.74760866", "0.7419388", "0.7419388", "0.7416596", "0.73027986", "0.71258956", "0.71041834", "0.7048602", "0.6874758", "0.68362963", "0.6821392", "0.6777845", "0.6715972", "0.6657224", "0.6510108", "0.6402245", "0.634065", "0.634065", "0.6271006", "0.6240057", ...
0.76382434
1
Get positions associated with this trajectory.
def positions(self, session): positions = session.query( Timepoint.position_x, Timepoint.position_y, Timepoint.position_z).filter( Timepoint.id.between(self.start_timepoint_id, self.end_timepoint_id)) return np.array(positions.all())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_positions(self):\n return self.positions", "def positions(self) -> PositionT:\n return self._positions", "def get_positions(self):\n\n return np.array([p.position for p in self.particles])", "def positions(self) -> List[MetatraderPosition]:\n return self._positions", "de...
[ "0.84711593", "0.8203754", "0.79634273", "0.7848154", "0.7775634", "0.7673052", "0.7620762", "0.76060194", "0.7578538", "0.754801", "0.7509511", "0.7438377", "0.72961754", "0.7236715", "0.7198844", "0.71925884", "0.7185704", "0.71019137", "0.7048299", "0.7012711", "0.698081",...
0.7812257
4
Get velocities associated with this trajectory.
def velocities(self, session): velocities = session.query( Timepoint.velocity_x, Timepoint.velocity_y, Timepoint.velocity_z).filter( Timepoint.id.between(self.start_timepoint_id, self.end_timepoint_id)) return np.array(velocities.all())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocities(self):\n\n return np.array([p.velocity for p in self.particles])", "def velocity_trajectory(self):\n return self._read(MX_VELOCITY_TRAJECTORY)", "def velocity(self):\n return self._vel.to_list()", "def velocities(self, return_np=False):\n if return_np:\n ...
[ "0.80992746", "0.7651511", "0.75910735", "0.7439461", "0.7437422", "0.7411741", "0.7396428", "0.73263454", "0.69972074", "0.696681", "0.6852393", "0.6852393", "0.6658361", "0.65947944", "0.6468669", "0.6456955", "0.6335266", "0.63252604", "0.6323118", "0.6269025", "0.62665343...
0.8118398
0
Create a Flask application using the app factory pattern.
def create_app(): app = Flask(__name__) settings = { 'DEBUG': True, 'WEBPACK_MANIFEST_PATH': './build/manifest.json', 'SECRET_KEY': 'the quick brown fox jumps over the lazy dog', 'SQLALCHEMY_DATABASE_URI': 'sqlite:///db.sqlite', 'SQLALCHEMY_COMMIT_ON_TEARDOWN': True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app():\n app = Flask(__name__)\n app.config.from_object('app.configs.config')\n app.config.from_object('app.configs.settings')\n return app", "def create_app(config=Config):\r\n # Initialise app and configuration\r\n app = Flask(__name__)\r\n app.config.from_object(config)\r\n\r\n...
[ "0.8629991", "0.8587432", "0.8567094", "0.8560846", "0.8548992", "0.8533256", "0.8532855", "0.85154873", "0.8468547", "0.84618294", "0.84501874", "0.8400496", "0.83925307", "0.8380182", "0.8366697", "0.8356823", "0.8333603", "0.83313555", "0.8325678", "0.8316702", "0.8298241"...
0.76400965
99
Returns the prefix of 'fork_proof' until first common block with 'proof' (included) and the index of the first common block in 'proof'
def truncate_fork_proof(self, proof, fork_proof): lca = 0 fixed_fork_proof = [] for h, s in fork_proof: fixed_fork_proof.append((h, s)) index = self.header_in_proof(h, proof) if index >= 0: lca = index break return fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_fork_proof_filename(self, mainblocks, fork_index, forkblocks):\n return (\n self.proof_dir()\n + \"proof_\"\n + str(mainblocks)\n + \"_-\"\n + str(fork_index)\n + \"_+\"\n + str(forkblocks)\n + \".pkl\"\n ...
[ "0.6036129", "0.56677", "0.55868095", "0.5318388", "0.5290814", "0.5212556", "0.5109114", "0.50985086", "0.5083289", "0.50599456", "0.5046585", "0.50303346", "0.4998983", "0.49905926", "0.49814957", "0.4972389", "0.49185932", "0.48938513", "0.48541486", "0.48350638", "0.48179...
0.69225454
0
Inicializa os atributos first_name, last_name, birthday, username
def __init__(self, first_name, last_name, birthday, username): self.first_name = first_name self.last_name = last_name self.birthday = birthday self.username = username self.login_attempts = 0 self.age = self.set_birthday()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, first_name, last_name, email, mobile, user_name):\n self.first_name = first_name\n self.last_name = last_name\n self.email = email\n self.mobile = mobile\n self.user_name = user_name", "def __init__(self, first_name, last_name, age, gender):\n self.fir...
[ "0.72359663", "0.6952287", "0.6933373", "0.6933373", "0.6903471", "0.6882865", "0.6835947", "0.68204296", "0.6761467", "0.6761467", "0.6761467", "0.6761467", "0.6761467", "0.6761467", "0.6761467", "0.6761467", "0.6741649", "0.67281073", "0.6722837", "0.6678801", "0.66787654",...
0.74937445
0
Initialize the RoBERTa weights for pretraining from scratch.
def init_params(module): if isinstance(module, torch.nn.Linear): module.weight.data.normal_(mean=0.0, std=0.02) if module.bias is not None: module.bias.data.zero_() if isinstance(module, torch.nn.Embedding): module.weight.data.normal_(mean=0.0, std=0.02) if module.pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)", "def init_weights(self, pretrained=None):\n self.online_backbone.init_weights() # backbone\n for online_neck in self.online...
[ "0.759782", "0.75005144", "0.7489344", "0.74103695", "0.7356487", "0.7306913", "0.7301942", "0.7244464", "0.7244009", "0.72021514", "0.7183205", "0.71815354", "0.71640164", "0.70826256", "0.70263875", "0.7012906", "0.7001938", "0.6962845", "0.6946414", "0.69345844", "0.691405...
0.0
-1
Return an accumulator function that takes a single numeric argument and accumulates that argument into total, then returns total. >>> acc = make_accumulator() >>> acc(15) 15 >>> acc(10) 25 >>> acc2 = make_accumulator() >>> acc2(7) 7 >>> acc3 = acc2 >>> acc3(6) 13 >>> acc2(5) 18 >>> acc(4) 29
def make_accumulator(): sum = [] def accumulator(x): sum.append(x) total = 0 for elem in sum: total += elem return total return accumulator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_accumulator():\n pass # replace with your solution", "def create_accumulator(self):\n raise NotImplementedError", "def make_accumulator_nonlocal():\n total = 0\n def akumalate(x):\n nonlocal total\n total = total + x \n return total\n return akumalate", "def ...
[ "0.69172853", "0.6434933", "0.6258502", "0.6211058", "0.612421", "0.612421", "0.6039905", "0.6028204", "0.60177207", "0.59702575", "0.59314597", "0.5864398", "0.580567", "0.5756715", "0.5719138", "0.5702417", "0.56508857", "0.5623562", "0.5620629", "0.54984903", "0.54888505",...
0.75680274
0
Return an accumulator function that takes a single numeric argument and accumulates that argument into total, then returns total. >>> acc = make_accumulator_nonlocal() >>> acc(15) 15 >>> acc(10) 25 >>> acc2 = make_accumulator_nonlocal() >>> acc2(7) 7 >>> acc3 = acc2 >>> acc3(6) 13 >>> acc2(5) 18 >>> acc(4) 29
def make_accumulator_nonlocal(): total = 0 def akumalate(x): nonlocal total total = total + x return total return akumalate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_accumulator():\n sum = []\n def accumulator(x):\n sum.append(x)\n total = 0\n for elem in sum:\n total += elem\n return total\n return accumulator", "def make_accumulator():\n pass # replace with your solution", "def create_accumulator(self):\n rai...
[ "0.72292084", "0.6776719", "0.6225273", "0.6104024", "0.60464644", "0.58669615", "0.5792564", "0.5581595", "0.55052733", "0.5468486", "0.5432375", "0.54273343", "0.53780293", "0.5372026", "0.53283644", "0.529984", "0.529984", "0.5293362", "0.5284647", "0.52454", "0.52083284",...
0.8228942
0
Initialize the model. Weights are initialized to small random values and biases are initialized to zero. Weights and biases are stored in the
def __init__(self, input_size, hidden_size, output_size, std=1e-4): self.params = {} self.params['W1'] = std * np.random.randn(input_size, hidden_size) self.params['b1'] = np.zeros(hidden_size) self.params['W2'] = std * np.random.randn(hidden_size, output_size) self.params['b2'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self) -> None:\n nn.init.kaiming_normal_(self._U)\n nn.init.kaiming_normal_(self._W)\n nn.init.kaiming_normal_(self._V)\n\n nn.init.normal_(self._b)", "def init_weights(model):\n ...", "def _initialize_weights(self):\n pass", "def InitWeights(self):\...
[ "0.76824474", "0.7617724", "0.75832707", "0.7547074", "0.7516082", "0.74999434", "0.74890685", "0.7443786", "0.74371445", "0.7393023", "0.73923856", "0.73923856", "0.73923856", "0.7347765", "0.73190415", "0.7305585", "0.7300658", "0.7296879", "0.7293287", "0.72304404", "0.720...
0.0
-1
Reshape a 4D tensor of image data to a grid for easy visualization.
def visualize_grid(Xs, ubound=255.0, padding=1): (N, H, W, C) = Xs.shape grid_size = int(ceil(sqrt(N))) grid_height = H * grid_size + padding * (grid_size - 1) grid_width = W * grid_size + padding * (grid_size - 1) grid = np.zeros((grid_height, grid_width, C)) next_idx = 0 y0, y1 = 0, H ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reshape(self, data):\n\n\t\td = np.zeros((32,32,3))\n\t\td_r = data[0:1024].reshape(32,32)\n\t\td_g = data[1024:2048].reshape(32,32)\n\t\td_b = data[2048:].reshape(32,32)\n\n\t\tfor h in range(32):\n\t\t for w in range(32):\n\t\t for c in range(3):\n\n\t\t if c == 0 : d[h,w,c] = d_r[h,w]\...
[ "0.69275147", "0.68927044", "0.66429174", "0.66399515", "0.6569427", "0.65163445", "0.64027023", "0.63976663", "0.6344992", "0.63068163", "0.62804306", "0.6278322", "0.62271667", "0.6149602", "0.6141104", "0.61091465", "0.608741", "0.60288805", "0.5931444", "0.5919866", "0.59...
0.0
-1
Tokenize text. Checks for add_prefix_space; handles accordingly.
def encode(self, text: str) -> List[str]: if self.add_prefix_space: text = f' {text}' # constants for readability FINAL = 1 SPLITABLE = 0 pieces: List[Tuple[str, int]] = [(text, SPLITABLE)] for special_token in self._special_tokens.keys(): i = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return text.split(' ')", "def tokenize(self, text):\n\n text = convert_to_unicode(text)\n\n output_tokens = []\n for token in whitespace_tokenize(text):\n chars = list(token)\n if len(chars) > self.max_input_chars_per_word:\n output_tokens.append(self.unk_token)\n ...
[ "0.69731855", "0.69462204", "0.67840964", "0.6744452", "0.6723315", "0.6636732", "0.6613293", "0.66086936", "0.6586379", "0.64890635", "0.6482547", "0.64719623", "0.6459763", "0.64515984", "0.6450444", "0.6432965", "0.64255637", "0.639371", "0.63857424", "0.6384636", "0.63830...
0.0
-1
Tokenize using Gpt2 BPE tokenizer.
def gpt2_tokenize(self, text: str): return self.bpe_tokenize(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize (self, text):\n if self.type == \"gpt2\":\n return self._tokenizer.tokenize(text)\n if self.type == \"bpe\":\n return self._tokenizer.EncodeAsPieces(text)", "def _tokenize(self, text):\n bpe_tokens = []\n for token in re.findall(self.pat, text):\n ...
[ "0.687929", "0.67572945", "0.64769626", "0.6442713", "0.6226997", "0.6158872", "0.6085537", "0.60330755", "0.59015256", "0.58886445", "0.5860805", "0.57932", "0.57040703", "0.5693508", "0.56695867", "0.5667489", "0.56334084", "0.5624651", "0.5618376", "0.5615", "0.5604609", ...
0.7900036
0
Return a sequence of BPEtokens from the text.
def bpe_tokenize(self, text: str) -> List[str]: return self.bpe.encode(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tokenize(self, text):\n bpe_tokens = []\n for token in re.findall(self.pat, text):\n bpe_tokens.extend([t for t in self.bpe(token).split(\" \")])\n return bpe_tokens", "def _tokenize(self, text: str) -> List[str]:\n tokens = []\n for token in re.findall(self._pa...
[ "0.84533674", "0.79552776", "0.75899315", "0.7553431", "0.7354912", "0.72681004", "0.71521646", "0.7140753", "0.6992216", "0.6924547", "0.6887083", "0.68444735", "0.68028706", "0.67906797", "0.6781835", "0.6773047", "0.6723961", "0.67196184", "0.66787004", "0.66550314", "0.66...
0.79793483
1
Convert a vector of IDs to a string. Converts a vector (iterable of ints) into a string, with each token separated by the delimiter (default ``' '``).
def vec2txt(self, vector: List[int]) -> str: tokens = [self._index_lookup(idx) for idx in vector] text = self.bpe.decode(tokens) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_to_str(vector):\n output_str = \"[\"\n for i in vector:\n output_str += str(i) + \", \"\n output_str = output_str[:-2] + \"]\"\n return output_str", "def stringify(vec):\n line = \"\"\n for v in vec: \n line += str(v)+\",\"\n return line[:-1]", ...
[ "0.71467876", "0.7004644", "0.69701", "0.65466064", "0.6472608", "0.6381667", "0.63486797", "0.62186414", "0.61884373", "0.615916", "0.6129425", "0.60274935", "0.600327", "0.5985542", "0.5984306", "0.5948397", "0.5932644", "0.59297", "0.5923613", "0.5906003", "0.5897926", "...
0.5421353
59
Get path to device Returns
def path(self): return self._path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_path(self):\n return self._engine.device_path()", "def device_path(self):\n return self._device_path", "def _get_device_path(self, connection_info):\n mount_path = self._get_mount_path(connection_info)\n return os.path.join(mount_path, connection_info['data']['name'])", ...
[ "0.8567297", "0.8357072", "0.759747", "0.7507442", "0.7399353", "0.730129", "0.71707857", "0.7139689", "0.7110824", "0.6956383", "0.6900391", "0.66961676", "0.6638523", "0.6578572", "0.6568287", "0.6556761", "0.65145344", "0.65145344", "0.6507716", "0.6498858", "0.6494834", ...
0.0
-1
Test that an attempt to add a topic by an unauthenticated user fails
def test_topic_submission_unauthenticated(self): topic_data = {'name': 'PostedTopic'} # Try with unauthenticated user (should fail) response = self.client.post('/topics/', topic_data, format='json') self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_topic_submission_non_staff(self):\n topic_data = {'name': 'PostedTopic'}\n # Try with free authenticated\n self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.free_token.key)\n response = self.client.post('/topics/', topic_data, format='json')\n self.assertEqual(r...
[ "0.7691029", "0.7420523", "0.73918724", "0.7241643", "0.7239827", "0.71022105", "0.69290817", "0.6843764", "0.67550004", "0.6744476", "0.66760015", "0.6582037", "0.65727323", "0.64932996", "0.64806724", "0.64806235", "0.64461315", "0.64250994", "0.6414499", "0.64098954", "0.6...
0.8186521
0
Check that an authenticated user can access a topic
def test_single_topic_retrieval_authenticated(self): self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.free_token.key) response = self.client.get('/topic/Topic 1/', format='json') data = json.loads(response.content) self.assertEqual(response.status_code, status.HTTP_200_OK) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_topic_retrieval_authenticated(self):\n self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.free_token.key)\n response = self.client.get('/topics/', format='json')\n data = json.loads(response.content)\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n ...
[ "0.70851797", "0.70010316", "0.70010316", "0.6946185", "0.6940789", "0.6892911", "0.67047775", "0.66921407", "0.66921407", "0.66921407", "0.651007", "0.6436121", "0.6401158", "0.633687", "0.63004017", "0.6274719", "0.624575", "0.6241417", "0.62304896", "0.62040776", "0.620178...
0.68443596
6
Gets the current organization
def get_org(self): return Org.deserialize(self._get_single('org', {}, from_results=False))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization(self):\n return self._tower.get_organization_by_id(self._data.get('organization'))", "def get_organization(self):\n return self.reference[REF_ORGANIZATION][REF_VALUE]", "def organization_current_get(request):\n if request.organization:\n return request.organization.slug...
[ "0.8365602", "0.83431554", "0.78126556", "0.78037596", "0.76222175", "0.7610173", "0.7515312", "0.7285391", "0.7284314", "0.72149926", "0.72015625", "0.714974", "0.7137949", "0.7126743", "0.6982778", "0.6981135", "0.6948353", "0.69405967", "0.69192415", "0.6896074", "0.689607...
0.7455882
7
Updates the configuration information in the catalog.
def update_config(): dburl = dbconn.DbURL() conn = dbconn.connect(dburl, utility=True) logger.info('Updating catalog...') sql = "SELECT gp_activate_standby()" dbconn.execSQL(conn, sql) conn.commit() conn.close() logger.info('Database catalog updated successful')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conf_update(self):\n pass", "def update(self):\n self.save_config_file()", "def update_configs(self, config):\n for what in self.plugins: # backend, repo etc.\n for key in self.plugins[what]: # s3, filesystem etc.\n # print(\"Updating configuration of\", what...
[ "0.6957198", "0.6939233", "0.6549464", "0.650648", "0.6373588", "0.6360476", "0.6249494", "0.6162477", "0.61604637", "0.61403096", "0.61029786", "0.60967916", "0.60956615", "0.60859114", "0.60628897", "0.599833", "0.5945838", "0.5919373", "0.588443", "0.5877999", "0.58527386"...
0.66104096
2
Checks if the gpsyncmaster process is running.
def check_gpsync_running(options): return gp.getSyncmasterPID('localhost', options.master_data_dir) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isRunning(self):\n if not self.hasBeenStarted():\n return False\n \n if not self._slave_dhcp_client_proc.poll(): # Poll our direct child (sudo)\n return False\n \n for pid in self._all_processes_pid:\n if not self._checkPid(pid):\n ...
[ "0.7660873", "0.7509967", "0.74740016", "0.73999083", "0.7362178", "0.73276377", "0.73108155", "0.72690094", "0.72119063", "0.7155337", "0.71464986", "0.7123168", "0.7106698", "0.71064216", "0.7092272", "0.7004716", "0.6997182", "0.69735944", "0.69693404", "0.6948965", "0.694...
0.82756114
0
Determines if we are running inside of a gunicorn process.
def running_in_gunicorn(): process_check = False try: # Is this a gunicorn process? if hasattr(sys, 'argv'): for arg in sys.argv: if arg.find('gunicorn') >= 0: process_check = True elif os.path.isfile("/proc/self/cmdline"): wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gunicorn():\n # fmt: off\n if os.name == \"nt\":\n print(\"Sorry, gunicorn is not available on windows\")\n exit(1)\n specter_gunicorn = SpecterGunicornApp(config=None)\n specter_gunicorn.run()", "def _ServerIsRunning( self ):\n return utils.ProcessIsRunning( self._gocode_handle ...
[ "0.6328807", "0.6025046", "0.59816766", "0.59427446", "0.59371257", "0.59124607", "0.5765382", "0.5760677", "0.57023394", "0.56423384", "0.561056", "0.56010705", "0.55936104", "0.55420935", "0.55373627", "0.55339676", "0.551627", "0.54778796", "0.544401", "0.54347944", "0.543...
0.87763053
0
combines lists into a single string
def concat_json(corpus): new_corpus = ' '.join(corpus) return new_corpus
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string", "def listToStringFormat(self, list) ->str:\n string = ''\n for element in list:\n string = string + str(element) + \"\\n\"\n return string", "def listToString(L):\r\n S...
[ "0.76283526", "0.734844", "0.7332902", "0.7294538", "0.72431105", "0.720123", "0.7179508", "0.71750575", "0.7139563", "0.71107775", "0.7063473", "0.70395356", "0.70255876", "0.70049584", "0.70037574", "0.69663775", "0.6953621", "0.6948518", "0.6921201", "0.69114035", "0.69067...
0.0
-1
Constructor registers required visa name and resource manager handle as class attributes. Initiates device handle to None
def __init__(self, rm, visaName): self.rm = rm self.visaName = visaName self.handle = None self.timeout = 5 #default timeout value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, device_handle):\n\n self.device_handle = device_handle", "def __init__(self):\n self._device_info = None", "def __init__(self):\n import visa\n\n rm = visa.ResourceManager()\n target = 'Agilent Technologies,8163B,MY48208514,V5.25(72637)'\n\n for dev ...
[ "0.7202857", "0.6961231", "0.68139666", "0.67441726", "0.67354673", "0.66945916", "0.6592244", "0.6453252", "0.6446044", "0.64066863", "0.6369176", "0.6369086", "0.63621855", "0.6310466", "0.6266502", "0.62636983", "0.6247163", "0.6246054", "0.62321836", "0.62283134", "0.6215...
0.6304306
14
Provide a "zero value" for the type, compatible in dimensions with the provided ``value`` (e.g., a zero vector)
def zero(self, value): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_zeros(self, shape):\r\n return numpy.zeros(shape, dtype=self.dtype)", "def zero_val(self):\r\n self.piDD = {\"[0]\": None}\r\n self.top_node = \"[0]\"\r\n self.dim = 0", "def Zero(dtype=None):\n return Constant(0.0, dtype=dtype)", "def values(value, shape, dtype=K.flo...
[ "0.6850535", "0.66939825", "0.6570053", "0.6426577", "0.6379816", "0.63710946", "0.63710946", "0.63077116", "0.62514496", "0.6235996", "0.619775", "0.6151911", "0.6130113", "0.61229855", "0.61035347", "0.6096001", "0.60484684", "0.60484684", "0.6041714", "0.60417014", "0.6019...
0.77672267
0
Return the ghost position considered most likely by our current model.
def getMostLikelyPos(self): mostLikelyPos = None mostLikelyProb = None beliefDist = self.getBeliefDistribution() for part in self.particles: currProb = beliefDist[part] if mostLikelyPos is None or currProb > mostLikelyProb: mostLikelyPos = part mostLikelyProb = currProb ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGhostGoal(self, gameState):\n enemies = [gameState.getAgentState(i) for i in self.getOpponents(gameState)]\n ghost = [a for a in enemies if not a.isPacman and a.getPosition() != None]\n myPos = self.getCurrentObservation().getAgentState(self.index).getPosition()\n if len(ghost) >...
[ "0.68020844", "0.6776744", "0.6767892", "0.6739302", "0.6678001", "0.6666229", "0.6541564", "0.6426933", "0.6425937", "0.6425727", "0.6425727", "0.64240336", "0.6415314", "0.64045924", "0.63838553", "0.6369763", "0.63661844", "0.63661844", "0.63621676", "0.63343173", "0.63260...
0.60919905
59
Sets the first_name of this ApiCreateUser.
def first_name(self, first_name): self._first_name = first_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_first_name(self, first_name):\n self.first_name = first_name", "def first_name(self, name):\n self._first_name = name", "def first_name(self, first_name):\n if first_name is None:\n raise ValueError(\"Invalid value for `first_name`, must not be `None`\") # noqa: E501\n\...
[ "0.82840514", "0.7804813", "0.75748736", "0.7562617", "0.7468363", "0.7468363", "0.70900446", "0.7012503", "0.696567", "0.6706558", "0.6632535", "0.6489563", "0.6449575", "0.64358115", "0.6351745", "0.6351745", "0.6290188", "0.6268522", "0.6268522", "0.6268522", "0.6268137", ...
0.78500754
9
Sets the last_name of this ApiCreateUser.
def last_name(self, last_name): self._last_name = last_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_last_name(self, last_name):\n self.last_name = last_name", "def setLastname(self, lastname):\n self.lastname = lastname\n return self", "def lastname(self, lastname):\n\n self._lastname = lastname", "def last_name(self, name):\n self._last_name = name", "def last_...
[ "0.7899366", "0.7581795", "0.7336264", "0.7335938", "0.7281499", "0.6923646", "0.6601541", "0.6590861", "0.64360315", "0.64360315", "0.63050866", "0.6298679", "0.6230194", "0.6146401", "0.61400867", "0.61277753", "0.6077291", "0.6077291", "0.6077291", "0.6077291", "0.60676694...
0.75508946
10
Sets the password of this ApiCreateUser.
def password(self, password): self._password = password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_password(self, password):\n\n self.password = bcrypt.generate_password_hash(password)", "def set_password(self, password):\n self.password = password", "def set_password(self, password):\n self.password = generate_password_hash(password)", "def set_password(self, password):\n ...
[ "0.7569658", "0.75412476", "0.7529651", "0.7424518", "0.74234474", "0.740829", "0.7384946", "0.73749655", "0.73749655", "0.73473185", "0.73174644", "0.7258208", "0.72026306", "0.72016877", "0.7187275", "0.7134158", "0.70616955", "0.7016133", "0.7015449", "0.70122325", "0.7012...
0.71415734
18
Sets the status of this ApiCreateUser.
def status(self, status): if self.local_vars_configuration.client_side_validation and status is None: # noqa: E501 raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 allowed_values = ["active", "locked", "disabled", "changepassword"] # noqa: E501 if se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n self.status = status", "def set_status(self, status):\n # TODO log to db\n self.status = status", "def test_set_user_status(self...
[ "0.65133536", "0.65133536", "0.65133536", "0.63500416", "0.62891114", "0.62697387", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774", "0.62640774"...
0.62241644
36
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ApiCreateUser): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, ApiCreateUser): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.8456082", "0.83912885", "0.81436425", "0.81406975", "0.8131807", "0.8093013", "0.80912536", "0.80912536", "0.80912536", "0.8084505", "0.8084505", "0.8075543", "0.8075543", "0.8065009", "0.80417395", "0.80417395", "0.80417395", "0.80417395", "0.80417395", "0.80417395", "0.8...
0.0
-1
Get bookmark counts per domain for a set of bookmarks.
def count_by_domain( bookmarks: Iterator[sqlite3.Row] ) -> Dict[str, int]: counts = {} for bookmark in bookmarks: key = bookmark["url"].display_domain if key not in counts: counts[key] = cherrypy.engine.publish( "bookmarks:doma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bookmark_stats(request):\r\n bookmark_count = BmarkMgr.count()\r\n unique_url_count = BmarkMgr.count(distinct=True)\r\n return _api_response(request, {\r\n 'count': bookmark_count,\r\n 'unique_count': unique_url_count\r\n })", "def domain_count(self, url: Url) -> int:\n\n sql...
[ "0.6782979", "0.61377466", "0.61032593", "0.56535363", "0.5621936", "0.5609579", "0.5579951", "0.53599304", "0.5348809", "0.53208125", "0.5319914", "0.5318016", "0.53063786", "0.52663606", "0.52474993", "0.52397895", "0.5204962", "0.5179946", "0.51618093", "0.51443076", "0.51...
0.8372352
0
Priority Queue constructor method.
def __init__(self): self.dict = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priority_queue():\n from src.priorityq import PriorityQueue\n priority_queue = PriorityQueue()\n return priority_queue", "def __init__(self, *args):\n this = _libsbml.new_Priority(*args)\n try: self.this.append(this)\n except: self.this = this", "def __init__(self,k,x,y):\n ...
[ "0.7677465", "0.7296557", "0.7251821", "0.71273446", "0.7078991", "0.70632946", "0.7032628", "0.6940273", "0.68929386", "0.6870056", "0.68341726", "0.6800709", "0.6763921", "0.6734797", "0.6728725", "0.67237735", "0.6715893", "0.67144924", "0.67118245", "0.6703275", "0.669239...
0.0
-1
Establish figure setup with subplots.
def getSetup(figsize, gridd, multz=None, empts=None): sns.set(style="whitegrid", font_scale=0.7, color_codes=True, palette="colorblind", rc={"grid.linestyle": "dotted", "axes.linewidth": 0.6}) # create empty list if empts isn't specified if empts is None: empts = [] if multz is None: m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_figure(self):\n\n plt.figure(1)\n plt.clf()\n\n # Two main axes\n self._tsne_window = plt.axes([0.05, 0.05, 0.4, 0.4])\n self._main_window = plt.axes([0.05, 0.55, 0.4, 0.4])\n\n # Nine sub axes\n self._sub_windows = []\n for row in range(3):\n ...
[ "0.76958567", "0.749131", "0.7275107", "0.7181476", "0.71661067", "0.7017503", "0.69431347", "0.6824381", "0.6815413", "0.6813725", "0.6806582", "0.6789073", "0.67691576", "0.67462534", "0.671325", "0.6609621", "0.65829384", "0.65783787", "0.6575226", "0.65705746", "0.6564328...
0.6707028
15
Checks whether password is valid for user, tries to avoid timing attacks.
def is_password_correct(username: str, password: str) -> bool: user = User.query.filter_by(username=username).first() if user is None: # We need to prevent timing-based side-channel attacks # that could be exploited for user enumeration password_hash = _CHECK_HASH_ANYWAY else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass", "def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]))\n\n valid_password(None, pass_field)", "def _check_password(self, password)...
[ "0.78246236", "0.77548677", "0.7628582", "0.76030827", "0.7587207", "0.7578026", "0.75390357", "0.7538208", "0.75296605", "0.7492888", "0.7476429", "0.74678195", "0.74333286", "0.74327207", "0.7426207", "0.7418069", "0.7412159", "0.7401178", "0.73902905", "0.7372283", "0.7369...
0.0
-1
Returns probability of variable taking on a "state" given "parentstates" This method is a simple lookup in the conditional probability table, it does not calculate anything.
def probability(self, state, parentstates): if not isinstance(state, int): raise TypeError(f"Expected state to be of type int; got type {type(state)}.") if not isinstance(parentstates, dict): raise TypeError(f"Expected parentstates to be of type dict; got type {type(parentstates)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_probability_of_state(state):\n p = compute_log_probability_of_text(state[\"text\"], state[\"char_to_ix\"], \n state[\"frequency_statistics\"], state[\"transition_matrix\"])\n \n return p", "def getnodeprobs(self, node_p=None, parent_states=None):\n ...
[ "0.6875037", "0.6661049", "0.65830684", "0.65791667", "0.6572518", "0.65018827", "0.6396448", "0.63704896", "0.62373734", "0.6208282", "0.60877115", "0.607937", "0.6071279", "0.6066414", "0.60638475", "0.6032118", "0.60280424", "0.6021494", "0.5988089", "0.5937896", "0.593785...
0.876945
0
Adds an edge from one variable to another in the network. Both variables must have been added to the network before calling this method.
def add_edge(self, from_variable, to_variable): if from_variable not in self.variables.values(): raise ValueError("Parent variable is not added to list of variables.") if to_variable not in self.variables.values(): raise ValueError("Child variable is not added to list of variable...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, v1, v2):\n pass # TODO", "def add_edge(self, vertex1, vertex2):\n\n vertex1.add_outgoing_node(vertex2)\n vertex2.add_incoming_node(vertex1)", "def add_edge(self, n1, n2, weight):\n self.edges[n1.identifier][n2.identifier] = weight", "def add_edge(self, n1, n2, ...
[ "0.74670506", "0.737735", "0.72625434", "0.7254013", "0.72430503", "0.7241259", "0.7221408", "0.71802413", "0.71552324", "0.7141597", "0.7111728", "0.7102019", "0.70838153", "0.7078364", "0.7075918", "0.7069939", "0.70667267", "0.7059868", "0.7045763", "0.7039363", "0.6991168...
0.75098205
0
Create the PConvUnet. If variable data size, set data_rows and data_cols to None
def __init__(self, data_rows=128, data_cols=128, weight_filepath=None,inference_only=False, net_name='default', gpus=1): self.weight_filepath = weight_filepath self.data_rows = data_rows self.data_cols = data_cols self.img_overlap = 30 self.inference_only = inference_only ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unet():\n inputs = Input((img_rows, img_cols, 1))\n conv1 = Conv2D(32, (3, 3), activation='relu', padding='same')(inputs)\n conv1 = Conv2D(32, (3, 3), activation='relu', padding='same')(conv1)\n pool1 = MaxPooling2D(pool_size=(2, 2))(conv1)\n\n conv2 = Conv2D(64, (3, 3), activation='relu', p...
[ "0.6257657", "0.6084616", "0.59108645", "0.5729787", "0.56837165", "0.5605725", "0.55451787", "0.5540791", "0.55403966", "0.5535931", "0.5534691", "0.55064917", "0.54370636", "0.53986883", "0.5394083", "0.5377542", "0.53648275", "0.53636694", "0.5361258", "0.5339088", "0.5334...
0.49907824
81
Count the number of rows in a data frame Return the data frame counting number of values each column of df
def count(df): df_count_dict = dict() for i, col in enumerate(df.columns): df_count_dict[col] = df[col].count() df_count = pd.DataFrame(df_count_dict, index=['Count']) return df_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_values(df,value=0,axis=0):\n \n return (df == value).astype(int).sum(axis=1-axis)", "def data_count(self):\r\n\r\n shp = self.df.shape\r\n row_count = shp[0]\r\n return row_count", "def count_entries(df, *args):\n \n #Initialize an empty dictionary: cols_count\n ...
[ "0.7444141", "0.7435567", "0.7332497", "0.725425", "0.7079579", "0.6984152", "0.69706225", "0.6946158", "0.69371367", "0.6873948", "0.6821664", "0.67707634", "0.67120755", "0.67061836", "0.6700464", "0.6686793", "0.6677457", "0.65922916", "0.65912133", "0.65431505", "0.651771...
0.82595336
0
Calculate quantile values (25%, 50%, 75%) of data in each column in a data frame Return the data frame calculating the quantile values of data in each column of df
def quantile(df): df_quantile_dict = dict() for i, col in enumerate(df.columns): df_quantile_dict[col] = [df[col].quantile(0.25), df[col].quantile(0.5), df[col].quantile(0.75)] df_quantile = pd.DataFrame(df_quantile_dict, index=['Quantile (25%)', 'Quantile (50%)', 'Quantile (75%)']) pd.set_option('prec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getquantile(df, low=0.1, high=0.9):\n q1 = df.quantile(low)\n q3 = df.quantile(high)\n print(q1)\n print(q3)\n return df[df<q1],df[df>q3]", "def normalize_quantiles(df):\n M = df.values.copy()\n\n Q = M.argsort(axis=0)\n m,n = M.shape\n\n # compute quantile vector\n quantiles = ...
[ "0.6923515", "0.6755445", "0.6726396", "0.6712304", "0.66732675", "0.6672203", "0.65379256", "0.6515497", "0.63787097", "0.63745576", "0.62693137", "0.6257521", "0.62258136", "0.6215715", "0.61886966", "0.61278194", "0.6097395", "0.60973287", "0.60827404", "0.60744447", "0.60...
0.8064678
0
Calculate the coefficient of variation of data in each column of a data frame Return the data frame storing the coefficient of variation of data in each column of df
def coeff_variation(df): df_coeff_dict = dict() for i, col in enumerate(df.columns): df_coeff_dict[col] = [df[col].std() / df[col].mean()] df_coeff = pd.DataFrame(df_coeff_dict, index=['Coeefficient of Variation']) pd.set_option('precision', 2) # set output display precision in 2 decimal places re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_data(df):\n cols = df.columns\n sum = df.sum(axis=1)\n df_new = df.loc[:,cols[1]:cols[-1]].div(sum, axis=0)\n return df_new", "def estimateCovariance(df):\n import numpy as np\n m = df.select(df['scaledFeatures']).map(lambda x: x[0]).mean()\n dfZe...
[ "0.6777264", "0.6297776", "0.620117", "0.6134756", "0.6116155", "0.60713226", "0.60713226", "0.5990437", "0.59884435", "0.5921438", "0.5913866", "0.58637226", "0.5861806", "0.58443433", "0.5830381", "0.581873", "0.57336956", "0.5725797", "0.5691557", "0.5680072", "0.5674473",...
0.77735484
0
Get package version. If no file return empty
def _get_package_version(): file = join(get_root(), 'VERSION') if exists(file): with open(file) as file: return file.read() return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n\n current_dir = os.path.dirname(os.path.realpath(__file__))\n version_path = os.path.join(current_dir, VERSION_FILE)\n\n with open(version_path, 'r') as version_fd:\n return version_fd.read().strip()", "def version(version_file=default_version_file, osp_package=default_osp_pa...
[ "0.7862243", "0.7718955", "0.7715279", "0.76233286", "0.7536525", "0.7481337", "0.74566495", "0.7434582", "0.7416315", "0.739349", "0.7374908", "0.73561203", "0.7353495", "0.7312504", "0.7312504", "0.73112655", "0.72833306", "0.7270493", "0.72498435", "0.72337055", "0.7232792...
0.86852396
0
saves into a csv
def save_to_file_csv(cls, list_objs): f_name = cls.__name__ + ".csv" with open(f_name, 'w', newline='') as f: if list_objs is None or list_objs == []: f.write("[]") else: if cls.__name__ == 'Rectangle': h = ['id', 'width', 'hei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_csv(self, filename): # DONE\n self.data.to_csv(filename)", "def save_csv(self):\n if not self.__is_csv():\n # creates the csv file if it did not exist.\n self.__create_csv()\n try:\n with open(self.__csv_file_name, 'a', newline='', encoding='utf-8') ...
[ "0.826135", "0.7793586", "0.76861036", "0.7594757", "0.7551063", "0.74792004", "0.74374306", "0.742743", "0.73932505", "0.73600066", "0.7314766", "0.7307525", "0.7287429", "0.7277141", "0.7272538", "0.7268541", "0.72408915", "0.7229592", "0.72173005", "0.7213289", "0.7195206"...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2 c = 2 * m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
Encode the Amplitude into CSV format.
def encode_csv(self, dt, ss_code, ss_config, blank, bin_size): str_result = [] for beam in range(self.element_multiplier): for bin_num in range(self.num_elements): # Get the value val = self.Amplitude[bin_num][beam] # Create the CSV s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv(self):\n return '{:.6f},{},{}'.format(self.sample_time, self.value, self.status)", "def csv(self):\n return '{:.6f},{:.6f},{},{}'.format(\n self.sample_time, self.value_time, self.value, self.status)", "def toCsv(self, csv_path):\n ser = pd.Series(self)\n ser.to_csv(csv_p...
[ "0.67478204", "0.6700819", "0.62866646", "0.61557317", "0.6065151", "0.6004344", "0.5988709", "0.5988709", "0.5982883", "0.59545183", "0.59026086", "0.58935064", "0.58594626", "0.5838659", "0.5835032", "0.5830365", "0.58200127", "0.5815997", "0.5749347", "0.57133895", "0.5681...
0.6931896
0
Removes all relations from patched data.
def remove_relations(data=None, **kwargs): if request.method == 'OPTIONS': return keys_to_delete = [] for key, val in data.iteritems(): if type(data[key]) is list: keys_to_delete.append(key) for key in keys_to_delete: del data[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeTmpRelations(self):\n for rel in Item.RELS:\n delattr(self, 'tmp_{}'.format(rel))", "def _clean_data_on_db(self):\n self._review_obj.delete_many({\n 'entity_id': self._entity_id,\n })", "def delete(self):\n for obj in self:\n _unset_related...
[ "0.67140204", "0.6455568", "0.6337633", "0.63131124", "0.62446815", "0.6190276", "0.61534166", "0.60374516", "0.6033138", "0.6033138", "0.6033138", "0.5998219", "0.599732", "0.5953319", "0.5930222", "0.59030896", "0.59030896", "0.58921844", "0.58610255", "0.5845649", "0.58395...
0.67338175
0
Returns true if the head of the snake is in the same position as an apple, otherwise returns false. The head of the snake is the final element in the snake list.
def apple_test(snake, board): return board.board[snake.snake[-1][1]][snake.snake[-1][0]] == "a"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apple_in_snake(self):\n for p in snake.nodes:\n if p == self.apple:\n return True\n return False", "def is_ate(self, snake_x, snake_y):\n if snake_x == self.x and snake_y == self.y:\n return True", "def check_apple(self):\n if self.nodes[0] =...
[ "0.82804906", "0.6415298", "0.62952095", "0.60529107", "0.6011994", "0.5917902", "0.57784027", "0.56879157", "0.56660795", "0.56368804", "0.56249446", "0.5554827", "0.5549523", "0.5525887", "0.5503104", "0.54068685", "0.5392866", "0.5391586", "0.5369516", "0.5346485", "0.5333...
0.71202666
1
Tests if the field is a OneToOneField. If a route exists for this field's model and it's target model, ensure this is the field that should be used to join the the two tables.
def _filter_one2one(self, field): if isinstance(field, models.OneToOneField): if self._join_allowed(field.model, field.rel.to, field): return field
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_related_one2one(self, rel):\n field = rel.field\n if isinstance(field, models.OneToOneField):\n if self._join_allowed(rel.parent_model, rel.model, field):\n return rel", "def allow_relation(self, obj1, obj2, **hints):\n if (\n obj1._meta.label...
[ "0.6432983", "0.5610659", "0.54294074", "0.5429102", "0.53602386", "0.527183", "0.52544534", "0.52448857", "0.5222093", "0.51960945", "0.5159376", "0.5119522", "0.49791703", "0.4929335", "0.48836753", "0.4850413", "0.482581", "0.48066378", "0.47761446", "0.47643787", "0.47637...
0.72543687
0
Tests if this RelatedObject represents a OneToOneField. If a route exists for this field's model and it's target model, ensure this is the field that should be used to join the the two tables.
def _filter_related_one2one(self, rel): field = rel.field if isinstance(field, models.OneToOneField): if self._join_allowed(rel.parent_model, rel.model, field): return rel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_one2one(self, field):\n if isinstance(field, models.OneToOneField):\n if self._join_allowed(field.model, field.rel.to, field):\n return field", "def allow_relation(self, obj1, obj2, **hints):\n if (\n obj1._meta.label_lower in self.route_encuestas or...
[ "0.7127669", "0.59652066", "0.5784414", "0.5783634", "0.5774796", "0.5615379", "0.55627906", "0.5482189", "0.5343726", "0.5320097", "0.5252952", "0.5250731", "0.52360576", "0.52273184", "0.5223983", "0.51934505", "0.51843", "0.5154437", "0.5096623", "0.5083829", "0.50523585",...
0.67805064
1
Tests if this field is a ForeignKey. If a route exists for this field's model and it's target model, ensure this is the field that should be used to join the the two tables.
def _filter_fk(self, field): if isinstance(field, models.ForeignKey): if self._join_allowed(field.model, field.rel.to, field): return field
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isForeignKey(cls, _field):\n return isinstance(_field, fields.ForeignKeyField)", "def isForeignKey(self):\n return self._foreignKey", "def _filter_related_fk(self, rel):\n field = rel.field\n if isinstance(field, models.ForeignKey):\n if self._join_allowed(rel.parent_...
[ "0.7084627", "0.6769837", "0.6413649", "0.58019847", "0.57855636", "0.5689534", "0.5668583", "0.56441414", "0.5640483", "0.5568142", "0.55012286", "0.5471998", "0.54698074", "0.54644835", "0.5441331", "0.5429922", "0.53804934", "0.53610194", "0.53146863", "0.5289472", "0.5288...
0.6932029
1
Tests if this RelatedObject represents a ForeignKey. If a route exists for this field's model and it's target model, ensure this is the field that should be used to join the the two tables.
def _filter_related_fk(self, rel): field = rel.field if isinstance(field, models.ForeignKey): if self._join_allowed(rel.parent_model, rel.model, field): return rel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_fk(self, field):\n if isinstance(field, models.ForeignKey):\n if self._join_allowed(field.model, field.rel.to, field):\n return field", "def isForeignKey(cls, _field):\n return isinstance(_field, fields.ForeignKeyField)", "def isForeignKey(self):\n ret...
[ "0.7011864", "0.6826253", "0.6785149", "0.6005135", "0.5983279", "0.597368", "0.5922101", "0.58798677", "0.58700687", "0.58460355", "0.5805568", "0.5790304", "0.57772136", "0.562784", "0.56067526", "0.55733424", "0.55512494", "0.5548611", "0.5518151", "0.5502844", "0.54830766...
0.68277216
1
Returns a list of JOIN connections that can be manually applied to a QuerySet object. See `.add_joins()` This allows for the ORM to handle setting up the JOINs which may be different depending on the QuerySet being altered.
def get_joins(self, model, **kwargs): node_path = self._node_path(model) joins = [] for i, node in enumerate(node_path): # ignore each subsequent first join in the set of joins for a # given model if i > 0: joins.extend(node.get_joins(**kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joins(self):\n return self._joins", "def get_joins(self, **kwargs):\n kwargs.setdefault('nullable', self.nullable)\n\n if django.VERSION < (1, 7):\n kwargs.setdefault('outer_if_first', self.nullable)\n\n joins = []\n # setup initial FROM clause\n copy = kw...
[ "0.71101946", "0.70173943", "0.673386", "0.61273474", "0.5879717", "0.56646603", "0.5511987", "0.5421328", "0.53752714", "0.5343265", "0.52763104", "0.52763104", "0.52203184", "0.5207282", "0.52055025", "0.5199943", "0.51791143", "0.51493305", "0.514017", "0.51153594", "0.510...
0.634292
3
Takes a `models.Field` instance and returns a query string relative to the root model.
def query_string_for_field(self, field, operator=None, model=None): if model: if model._meta.proxy and \ model._meta.proxy_for_model is not field.model: raise ModelTreeError('proxied model must be the field model') else: model = field.model ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_query(self):\r\n\r\n split = self.path_s.split(\"?\", 1)\r\n if len(split) == 1: return \"\"\r\n else: return split[1]", "def query_path(self):\n\n return '/search/{query}/{page}'", "def field_path(self) -> str:\n return pulumi.get(self, \"field_path\")", "def field...
[ "0.6095897", "0.6088002", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "0.6078557", "...
0.65267235
0
Constructor for the creation of a node in a Linked List chain
def __init__(self, key, value): self.key = key self.value = value self.next = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n node = ListNode(0) # dummy\n self.head = node\n self.tail = node\n self.len = 0", "def __init__(self):\n self.head = ListNode()", "def __init__(self):\n self.head = PrefixNode('', False)", "def __init__(self, head: ListNode):\n self.head...
[ "0.7413", "0.7365796", "0.7325737", "0.7231195", "0.7231195", "0.7231195", "0.7231195", "0.7231195", "0.7035727", "0.6972258", "0.6893458", "0.6884542", "0.6850907", "0.68316936", "0.6771286", "0.6751224", "0.66953355", "0.6674617", "0.66725296", "0.6669687", "0.66429126", ...
0.0
-1
List all subscriptions in the tenant.
def list_subscriptions_command(client: KeyVaultClient) -> CommandResults: response = client.list_subscriptions_request() readable_output = tableToMarkdown('Subscriptions List', response, ['subscriptionId', 'tenantId', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllSubscriptions(self):\n return self.request(\n \"getAllSubscriptions\",\n )", "def GetSubscriptions(self):\n\n return self.__GetJson(\"/subscriptions\", True)", "def listSubscriptions() -> object:\n\n db = Db()\n return db.Subscriptions.objects().to_json()", "de...
[ "0.8035786", "0.7226261", "0.72258407", "0.7086792", "0.70776016", "0.6984204", "0.6983721", "0.6912258", "0.68588793", "0.66833955", "0.66468096", "0.6555108", "0.6513404", "0.65121925", "0.6400548", "0.6395195", "0.6367344", "0.6361999", "0.63297665", "0.63160646", "0.62571...
0.68806654
8
Apply one step of gradient descent on the loss function `loss`, with stepsize `step_size`, and returns the updated parameters of the neural network.
def update_params(self, loss, step_size=0.5, first_order=False): #grads = torch.autograd.grad(loss, self.parameters(), # create_graph=not first_order) self.optim.zero_grad() loss.backward() nn.utils.clip_grad_norm(self.parameters(), self.grad_clip_norm) self.optim.step...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_params(self, loss, step_size=0.5, first_order=False):\n grads = torch.autograd.grad(loss, self.parameters(),\n create_graph=not first_order)\n updated_params = OrderedDict()\n for (name, param), grad in zip(self.named_parameters(), grads):\n updated_params[name...
[ "0.68319064", "0.6696704", "0.6502688", "0.625313", "0.62398595", "0.6239656", "0.6238582", "0.62382096", "0.6225333", "0.62092435", "0.616521", "0.6116684", "0.60662365", "0.604013", "0.6036855", "0.6036855", "0.60286844", "0.6027265", "0.6012288", "0.6002277", "0.59572786",...
0.6775933
1
Draw detected bounding boxes.
def boxes_filter(dets, bbox_id=1, class_name='None', color=(255, 255, 255), scale=1.0, thresh=0.5, min_size=(2, 2)): _objs = [] inds = np.where(dets[:, -1] >= thresh)[0] if len(inds) == 0: return _objs for i in inds: bbox = dets[i, :4] / scale bbox_confidence = dets[i, -1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_boxes(self, bounding_boxes, output):\n for i, bb in enumerate(bounding_boxes):\n\n if bb[2] > output.shape[1] or bb[3] > output.shape[0] or bb[0] < 0 or bb[1] < 0:\n continue\n cv2.rectangle(\n np.asarray(output), (bb[0], bb[1]), (bb[2], ...
[ "0.77598673", "0.7638101", "0.7510348", "0.72977304", "0.7150563", "0.7103931", "0.7101873", "0.7083905", "0.7020769", "0.6993739", "0.6974172", "0.69637305", "0.6859061", "0.68521667", "0.68319523", "0.6830371", "0.6809837", "0.6805064", "0.67750585", "0.6774759", "0.6742592...
0.0
-1
list of values, find the first index closest to the target
def find_index(vec_vals,target): target=np.atleast_1d(target) #turn scalar into iterable, no op if already array vec_vals=np.array(vec_vals) index_list=[] for item in target: first_index=np.argmin(np.abs(vec_vals - item)) index_list.append(first_index) return index_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_nearest(numbers, target):\n numbers = np.asarray(numbers)\n idx = (np.abs(numbers - target)).argmin()\n return numbers[idx]", "def _get_index_closest_val(list, val):\n\n return min(range(len(list)), key=lambda i: abs(list[i]-val))", "def closest_value_index(val, lst):\n ...
[ "0.79877585", "0.78621215", "0.76162183", "0.7527833", "0.7460819", "0.7441944", "0.74199677", "0.7359263", "0.73556554", "0.7317626", "0.7300372", "0.72569174", "0.7247898", "0.7238868", "0.7215002", "0.7137729", "0.71359056", "0.7125038", "0.711125", "0.711125", "0.710519",...
0.73963726
7
Initializes an API instance.
def __init__(self, key): self._key = key self.log = logging.getLogger(__name__) self.base_url = "https://osu.ppy.sh/api/{}?k=" + self._key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.api = Api(consumer_key=credentials[\"consumer_key\"],\n consumer_secret=credentials[\"consumer_secret\"],\n access_token_key=credentials[\"access_token_key\"],\n access_token_secret=credentials[\"access_token_secret...
[ "0.78006256", "0.76134866", "0.7568439", "0.75531006", "0.75356835", "0.7535342", "0.75169504", "0.7471052", "0.7429334", "0.73568124", "0.7318394", "0.7285327", "0.7281806", "0.7273331", "0.7227702", "0.7151092", "0.7149876", "0.71258557", "0.7061571", "0.705841", "0.7049321...
0.0
-1
Split a dataframe into a train and test set
def split_df(df, test_size=.10, random_state=42): train_df, test_df = train_test_split(df, test_size=test_size, random_state=random_state) return train_df, test_df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_test_split(df):\n training_size = int(len(df) * .67)\n test_size = int(len(df) - training_size)\n train, test = df[0:training_size], df[training_size:len(df)]\n return train, test", "def train_test_split(df, test_size=0.3):\r\n # split df here\r\n train_size = int(df.shape[0] * (1 - t...
[ "0.8687677", "0.8679001", "0.84975994", "0.8479245", "0.8389284", "0.8317432", "0.82733214", "0.8199719", "0.81595784", "0.8105398", "0.80834407", "0.8063808", "0.8036414", "0.79702836", "0.7887742", "0.77327996", "0.7688568", "0.7650159", "0.7625151", "0.7585574", "0.7573206...
0.8235048
7
Edit VM size configuration of a project. Passing empty string value will remove project from a VM size category.
def edit_project_vm_size( project_name: str, config_client: ConfigAzureClient = Depends(get_config_azure_client), vm_size: VMSizes | Literal[""] = Body(embed=True), ): config_client.set_project_vm_size(project_name, vm_size or None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_size(self, new_bunch_size):\n self.bunch_size = new_bunch_size", "def change_ram_qty(self, vm_name, size_mb):\n vm_id = self._get_vm_id_by_name(vm_name)\n flavor_id = self.connection.get_flavor_by_ram(size_mb).id\n\n try:\n self.connection.compute.resize_server(vm_i...
[ "0.54475933", "0.53949726", "0.5328427", "0.5310221", "0.5140511", "0.51007795", "0.5088823", "0.5048857", "0.50260985", "0.49107397", "0.48879477", "0.48345664", "0.4829681", "0.48136324", "0.48122758", "0.4788685", "0.478289", "0.4773701", "0.4773242", "0.47650912", "0.4735...
0.76543856
0
Computes the forward pass for an affine (fullyconnected) layer. The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N examples, where each example x[i] has shape (d_1, ..., d_k). We will reshape each input into a vector of dimension D = d_1 ... d_k, and then transform it to an output vector of dimensio...
def affine_forward(x, w, b): out = None ########################################################################### # TODO: Implement the affine forward pass. Store the result in out. You # # will need to reshape the input into rows. # ################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine_forward(x, w, b):\n out = None\n \n # reshape the input into (N, d_1 *...* d_k)\n input_shape = x.shape\n prod = 1\n for i in range(1,len(input_shape)):\n prod *= input_shape[i]\n\n a = x.reshape(x.shape[0],prod)\n out = np.dot(a,w) + b\n \n cache = (x, w, b)\n re...
[ "0.6998358", "0.6884048", "0.6687758", "0.65118337", "0.6506395", "0.6459772", "0.6447961", "0.6414125", "0.6406224", "0.63576955", "0.6356106", "0.634593", "0.6335362", "0.6323145", "0.63084984", "0.63041466", "0.62997454", "0.62980896", "0.6297971", "0.6291862", "0.6287952"...
0.6348984
11
Computes the backward pass for an affine layer.
def affine_backward(dout, cache): x, w, b = cache dx, dw, db = None, None, None ########################################################################### # TODO: Implement the affine backward pass. # ####################################################################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = layers.relu_backward(dout, relu_cache)\n dx, dw, db = layers.affine_backward(da, fc_cache)\n return dx, dw, db", "def affine_backward(dout, cache):\n x, w, b = cache\n dx, dw, db = None, None, None\n ###############...
[ "0.75195765", "0.73108387", "0.7302581", "0.7302581", "0.7302581", "0.7302581", "0.72437024", "0.718039", "0.7174265", "0.71736616", "0.71681154", "0.71321785", "0.71093744", "0.7098627", "0.70855993", "0.70688856", "0.704539", "0.70410854", "0.6994073", "0.69874126", "0.6985...
0.7515717
1
Computes the forward pass for a layer of rectified linear units (ReLUs).
def relu_forward(x): out = None ########################################################################### # TODO: Implement the ReLU forward pass. # ########################################################################### out = np.maximum(0, x) #############...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_relus(self):\n\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n ...
[ "0.67781115", "0.6632084", "0.6605096", "0.6526154", "0.6511326", "0.64492893", "0.6385915", "0.6269099", "0.6206479", "0.61808866", "0.6153661", "0.61401606", "0.6063327", "0.605535", "0.60494256", "0.604728", "0.6020283", "0.5998557", "0.59922504", "0.5971186", "0.59643835"...
0.58001614
37
Computes the backward pass for a layer of rectified linear units (ReLUs).
def relu_backward(dout, cache): dx, x = None, cache ########################################################################### # TODO: Implement the ReLU backward pass. # ########################################################################### dx = dout * (x > 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relu_backward(self, dUpper, cache):\n x = cache\n #############################################################################\n # TODO: Implement the ReLU backward pass. #\n #########################################################################...
[ "0.70412636", "0.694716", "0.6897693", "0.6847592", "0.6847592", "0.6846935", "0.6841099", "0.68178034", "0.6766849", "0.6754919", "0.67536426", "0.67530656", "0.67419785", "0.6739244", "0.6713423", "0.6708748", "0.6699276", "0.66860896", "0.6665928", "0.6665928", "0.6665928"...
0.6696307
18
Convenience layer that performs an affine transform followed by a ReLU
def affine_relu_forward(x, w, b): a, fc_cache = affine_forward(x, w, b) out, relu_cache = relu_forward(a) cache = (fc_cache, relu_cache) return out, cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine_layernorm_relu_forward(x, w, b, gamma, beta, ln_param):\n fc_out, fc_cache = affine_forward(x, w, b)\n norm_out, norm_cache = layernorm_forward(fc_out, gamma, beta, ln_param)\n out, relu_cache = relu_forward(norm_out)\n cache = (fc_cache, norm_cache, relu_cache)\n return out, cache", "def affineT...
[ "0.6848942", "0.65821934", "0.648105", "0.64699006", "0.6463087", "0.6463087", "0.6463087", "0.6463087", "0.62628835", "0.6260788", "0.62383676", "0.62174976", "0.6196862", "0.61698824", "0.6155895", "0.6155852", "0.6124598", "0.60800135", "0.6056793", "0.60549027", "0.605344...
0.72396773
3
set logger level to INFO
def set_log_info(): set_log_level_format(logging.INFO, '%(asctime)s %(levelname)s:%(name)s:%(message)s')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_level_info(loggers=[\"vaex\"]):\n set_log_level(loggers, logging.INFO)", "def log_info(self, msg):\n self.log(msg, level=LOG_INFO)", "def loginfo(self, msg):\n self.logger.info(msg)", "def log_info(self, msg):\n self.logger.info(msg)", "def log(self, msg):\n log.m...
[ "0.74036115", "0.7351019", "0.72148365", "0.71757716", "0.7169846", "0.7143662", "0.70610005", "0.7045136", "0.69612265", "0.695386", "0.69421446", "0.694169", "0.68945", "0.6877003", "0.6863229", "0.68453217", "0.6836823", "0.68036646", "0.67933124", "0.67811984", "0.6779641...
0.7767203
0
Set logger level and format.
def set_log_level_format(level, format): formatter = logging.Formatter(fmt=format) logger.handlers[0].setFormatter(formatter) logger.setLevel(level)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_logger(self, level):\n log.basicConfig(\n format='[%(asctime)s %(levelname)s]: %(message)s',\n level=log._nameToLevel.get(level.upper(), log.DEBUG))", "def setLogLevel(self,value):\n self.PDFreactorConfiguration.in1[\"logLevel\"] = value", "def _set_logger(self, le...
[ "0.75328964", "0.7516207", "0.7485943", "0.74267536", "0.72920215", "0.72700924", "0.72204626", "0.71320343", "0.7101901", "0.7080053", "0.70730275", "0.7067666", "0.7051171", "0.70327723", "0.7029139", "0.70218116", "0.70072067", "0.6999228", "0.69948256", "0.6987871", "0.69...
0.76595855
0
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary password = dictionary.get('password') name = dictionary.get('name') tag_ids = dictionary.get('tagIds') eld_advers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.8317533", "0.81689686", "0.81689686", "0.81188685", "0.808892", "0.7977596", "0.7949056", "0.79225504", "0.78983366", "0.7893884", "0.7887517", "0.7882494", "0.7881197", "0.7876339", "0.78581846", "0.78387725", "0.78037786", "0.78037786", "0.78037786", "0.78037786", "0.780...
0.75897974
78
Get previous value for direction and speed. Returns ActionOut Previous (direction, speed) tuple for relative actions.
def get_pre_action(self): act = ActionOut() act.speed = self.speed if self.config.direction_type == DirectionType.HEADING: act.dir = self.heading elif self.config.direction_type == DirectionType.STEERING: act.dir = self.steering return act
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_direction_backwards(self, direction):\r\n return direction_backwards[direction]", "def _get_direction(self, action, direction):\n left = [2,3,1,0]\n right = [3,2,0,1]\n if direction == 0:\n new_direction = action\n elif direction == -1:\n new_direc...
[ "0.6076192", "0.59882724", "0.59442836", "0.5870353", "0.5833274", "0.5819874", "0.5756624", "0.5755088", "0.5721165", "0.56954294", "0.56071323", "0.55129224", "0.5511683", "0.55102605", "0.55097055", "0.5483802", "0.54277796", "0.542034", "0.54124224", "0.54035324", "0.5390...
0.62399465
0
Get mean lidar data.
def mean_lidar(self, bins=12, relative=False): every = int(360 / bins) if relative is True: x = self.lidar_relative else: x = self.lidar_absolute x = x.reshape((-1, every)) return np.mean(x, axis=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mean(self):\n self.meanval = np.mean(self.adulist)", "def get_mean_of_dataset(train_data_loader, args, idx=0):\n meter = AverageMeter()\n for i in train_data_loader:\n if isinstance(i, list):\n meter.update(i[idx])\n else:\n meter.update(i)\n data_mean ...
[ "0.7057644", "0.6730877", "0.66848236", "0.6682252", "0.66629845", "0.65891695", "0.6577949", "0.6569015", "0.6458197", "0.6457365", "0.6422946", "0.64073145", "0.6402291", "0.63775605", "0.63775605", "0.63559073", "0.6331921", "0.63245344", "0.6320915", "0.63183767", "0.6269...
0.6560634
8
Return an iterator over the parameters (if any). The iterator has the same order as get_params_grad. The elements returned by the iterator are editable inplace.
def get_params_iter(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params_iter(self):\n return itertools.chain(np.nditer(self.W, op_flags=['readwrite']),\n np.nditer(self.b, op_flags=['readwrite']))", "def params_with_grad(self) -> List[Parameter]:\n return [p for p in self.parameters() if p.grad is not None]", "def params_w...
[ "0.7512843", "0.7350124", "0.7270569", "0.7133222", "0.686863", "0.67067677", "0.6674968", "0.6581909", "0.6552274", "0.6537611", "0.6537611", "0.6526105", "0.6306226", "0.6271036", "0.62509674", "0.6234052", "0.62195385", "0.6163327", "0.6135617", "0.60692143", "0.5985063", ...
0.7128284
4
Return a list of gradients over the parameters. The list has the same order as the get_params_iter iterator. X is the input. output_grad is the gradient at the output of this layer.
def get_params_grad(self, X, output_grad): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params_grad(self, X, output_grad):\n JW = X.T.dot(output_grad)\n Jb = np.sum(output_grad, axis=0)\n return [g for g in itertools.chain(np.nditer(JW), np.nditer(Jb))]", "def gradient(self, node, output_grad):\n return [output_grad, output_grad]", "def gradient(self, node, out...
[ "0.84572774", "0.7508135", "0.7495668", "0.73628736", "0.73628736", "0.7315574", "0.7312526", "0.7164749", "0.71257406", "0.7105775", "0.7101116", "0.7085119", "0.70572406", "0.70412076", "0.70188177", "0.6992223", "0.69575894", "0.6954603", "0.694641", "0.6889138", "0.682883...
0.8274612
1
Perform the forward step linear transformation. X is the input.
def get_output(self, X): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n x = self.lin(x)\n\n return x", "def forward(self, x):\n x = self.sparseModel(x)\n x = self.linear(x)\n return x", "def forward(self, x):\n return self.l1(x)", "def forward(self, x, **kwargs):\n\n\t\toutput = self.lin1(x)\n\t\toutput = self.lin...
[ "0.78196967", "0.78167725", "0.7367827", "0.7338931", "0.7210416", "0.7182924", "0.716749", "0.716749", "0.716749", "0.7159463", "0.71134436", "0.7106139", "0.7096794", "0.7049805", "0.7032724", "0.70214635", "0.7011207", "0.69987196", "0.6978379", "0.6978379", "0.69762003", ...
0.0
-1
Return the gradient at the inputs of this layer. Y is the precomputed output of this layer (not needed in this case). output_grad is the gradient at the output of this layer (gradient at input of next layer). Output layer uses targets T to compute the gradient based on the output error instead of output_grad
def get_input_grad(self, Y, output_grad=None, T=None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input_grad(self, Y, output_grad):\n return output_grad.dot(self.W.T)", "def get_input_grad(self, Y, output_grad):\n return np.multiply(ReLU_Der(Y), output_grad)", "def get_input_grad(self, Y, output_grad):\n return np.multiply(logistic_deriv(Y), output_grad)", "def get_input_grad...
[ "0.7918568", "0.7686882", "0.7535455", "0.73901004", "0.7265463", "0.7249724", "0.7218724", "0.7218724", "0.72161746", "0.7210566", "0.71470034", "0.71293074", "0.7120052", "0.7109056", "0.7104818", "0.7088414", "0.70878685", "0.7074955", "0.7066357", "0.7063907", "0.7054003"...
0.803751
0
Initialize hidden layer parameters. n_in is the number of input variables. n_out is the number of output variables.
def __init__(self, n_in, n_out): self.W = np.random.randn(n_in, n_out) * 0.1 self.b = np.zeros(n_out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_parameters(self, n_in, n_out):\n #self.input = input\n \n # parameters\n W_i_init = self.uniform_weight(n_in, n_out)\n self.W_i = theano.shared(value=W_i_init, name='W_i', borrow=True)\n \n self.params = [ self.W_i ]", "def __init__(self, m_in, n_hid, n_o...
[ "0.75068676", "0.73300445", "0.70677334", "0.70647705", "0.7008385", "0.6959278", "0.69574106", "0.6919026", "0.68726116", "0.6849472", "0.681036", "0.6799331", "0.6766631", "0.6751028", "0.6731683", "0.6670479", "0.66649777", "0.66494703", "0.6612854", "0.6611358", "0.658734...
0.6460819
29
Defines a onehot encoding array for specified index.
def one_hot(index): output = np.zeros(100) output[index] = 1 return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot(index):\n classNum=2#1\n onehot = np.zeros(classNum)#这代表种类类型\n onehot[index] = 1.0\n return onehot", "def one_hot(index, dims, dtype=np.uint8):\n\n seq_len = len(index)\n ret = np.zeros((seq_len, dims), dtype)\n for i in range(seq_len):\n ret[i][index[i]]=1\n\n return re...
[ "0.8623009", "0.8526019", "0.8452525", "0.8304615", "0.8234413", "0.7850017", "0.78417283", "0.7827304", "0.7799253", "0.77824956", "0.77414185", "0.75635886", "0.7556846", "0.74951917", "0.7480593", "0.747049", "0.74646866", "0.74583596", "0.73808664", "0.736309", "0.7312017...
0.87401515
0
Returns unspent transaction balance for a given public key.
def get_balance(pub_key, blocks): balance = 0 for block in blocks: if block.transactions.to_pk == pub_key: balance += block.transactions.amount if block.transactions.from_pk == pub_key: balance -= block.transactions.amount return balance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account_balance(unspent_outputs):\n return sum(output[\"value\"] for output in unspent_outputs.values())", "def get_wallet_balance(self, walletId, currency):\n return", "def balance(self, date=None):\r\n\r\n qs = self._entries()\r\n if date:\r\n qs = qs.filter(transac...
[ "0.5885487", "0.5719444", "0.56902117", "0.567527", "0.5659281", "0.56399536", "0.5580581", "0.55722743", "0.5546668", "0.55227065", "0.5496131", "0.54322803", "0.5421806", "0.5412379", "0.5411639", "0.5399782", "0.53500855", "0.5331782", "0.5320737", "0.53198594", "0.5307876...
0.67212254
0
Calculates the total gas density distribution
def getGasDensity(grid=None, ppar=None): mesh = np.meshgrid(grid.x, grid.y, grid.z, indexing='ij') if ppar['crd_sys'] == 'sph': rr = mesh[0] tt = mesh[1] pp = mesh[2] xx = rr * np.sin(tt) * np.sin(pp) yy = rr * np.sin(tt) * np.cos(pp) zz = rr * np.cos(tt) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density(self):\n return (1e-3*self.molar_mass) * self.pressure / (gas_constant * self.temperature) # kg/m^3", "def fGasDensity(GasGravity, Temperature, Pressure):\n\tGasConstant = 8.314\n\tPress = Pressure / 145.038 # MPa\n\tTemp = Temperature + 273.16 # Deg K\n\tPr = Press / (4.892 - (0.4048 * GasGra...
[ "0.71246976", "0.69465566", "0.67306685", "0.6410357", "0.62949795", "0.6269599", "0.626525", "0.6260228", "0.6186723", "0.61853653", "0.617477", "0.6128605", "0.61184174", "0.60929406", "0.608601", "0.6082533", "0.6082533", "0.6082533", "0.6049827", "0.6004767", "0.5997749",...
0.6994993
1
Returns the table name for this repository.
def table_name(self) -> str: return self.model._meta.db_table
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table_name(self):\n return self._table", "def table_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"table_name\")", "def table_name() -> str:\n pass", "def table(self):\n return self._table_name", "def table_name(self) -> pulumi.Input[str]:\n return ...
[ "0.82748", "0.82637185", "0.8112258", "0.7999641", "0.78599066", "0.78599066", "0.78599066", "0.77608806", "0.76477003", "0.7512858", "0.7442876", "0.74084663", "0.73887527", "0.73285073", "0.7034749", "0.702189", "0.6892916", "0.6888258", "0.6852236", "0.68435985", "0.683430...
0.80808324
3
Define a pretrained model to use. params training True for training mode, False for test mode. returns model a model for training or test.
def get_model(training = True): # download the model model = models.alexnet(pretrained = True) # define the FC layers classifier = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(9216, 2024)), ('relu', nn.ReLU()), ('dropout', nn.Dropout(p = .7)), ('fc2', nn.Linear(2024, 516...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pretrained_model(model_name, n_classes):\n\n if model_name == 'vgg16':\n model = models.vgg16(pretrained=True)\n\n # Freeze early layers\n for param in model.parameters():\n param.requires_grad = False\n n_inputs = model.classifier[6].in_features\n\n # Add o...
[ "0.6809797", "0.6580505", "0.6549405", "0.6540274", "0.64882255", "0.64824384", "0.64065886", "0.6401762", "0.63960826", "0.63715506", "0.63633484", "0.6355317", "0.63497865", "0.6336184", "0.63135195", "0.6306535", "0.6274274", "0.62690586", "0.6231239", "0.62281173", "0.622...
0.65795845
2
Preprocess an image to feed the model. params img PIL image. returns img preprocessed tensor image.
def preprocess(img): # standard mean and std for the model mean = np.array([0.485, 0.456, 0.406]) std = np.array([0.229, 0.224, 0.225]) # resize img = img.resize(size = (224, 224)) # transforms to numpy img = np.array(img, dtype = np.float64) # Mean and Std img = (img - mean)/std ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self, img):\n img_ = image.load_img(img, target_size=(299, 299))\n img_ = image.img_to_array(img_)\n img_ = np.expand_dims(img_, axis=0)\n img_ = preprocess_input(img_)\n return img_", "def preprocess(self, im, mean=None):\r\n # preprocessing for all pretr...
[ "0.7884702", "0.74426657", "0.7070077", "0.687904", "0.6874277", "0.6844147", "0.68041897", "0.68041897", "0.6767351", "0.67615294", "0.6743081", "0.6728418", "0.67210937", "0.6695991", "0.6657512", "0.6650531", "0.6647138", "0.66239464", "0.65570956", "0.6549486", "0.6539712...
0.73933655
2
Return a JSONserializable representation of this result. The output of this function can be converted to a serialized string
def json(self): return { "qualified_name": self.qualified_name, "description": self.description, "data": self.data, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return json.dumps(self.as_dict())", "def to_json(self):\n return json.dumps(self.serialize())", "def to_json(self):\n return json.dumps(self.for_json())", "def tojson(self):\n return json.dumps(self.jsonable())", "def _toJSON(self):\n\n return json....
[ "0.8424164", "0.8293793", "0.8217683", "0.81915045", "0.8184411", "0.8159761", "0.80613476", "0.8061119", "0.8054152", "0.8054152", "0.80284095", "0.8028207", "0.8028207", "0.8028207", "0.8023654", "0.8022", "0.80133784", "0.80133784", "0.80133784", "0.80093104", "0.80093104"...
0.0
-1
Test that invalid assignment throws a TypeError.
def test_invalid_assignment(): with pytest.raises(TypeError): PropertyAndConditions(property=LinkByUID('id', 'a15')) with pytest.raises(TypeError): PropertyAndConditions(property=Property("property"), conditions=[Condition("condition"), LinkByUID('scope', 'id')])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_error_for_computing_missing_type():\n with pytest.raises(ValueError):\n compute_type(\"missing_type\", {})", "def test_add_assignment_type_checking(self):\r\n stmt = AssignmentStatement('table', [])\r\n with self.assertRaises(StatementException):\r\n stmt.add_ass...
[ "0.6923433", "0.6909115", "0.6875627", "0.67500514", "0.6740249", "0.67324466", "0.6725503", "0.6685543", "0.6678759", "0.66671157", "0.66615397", "0.66235274", "0.66124415", "0.6600779", "0.6580775", "0.65743834", "0.6560061", "0.65450007", "0.6533935", "0.653258", "0.651419...
0.7343256
0
Checks that queries with a TransactionNow() parameter are not cached.
def test_transaction_now(self): obj = Test.objects.create(datetime='1992-07-02T12:00:00') qs = Test.objects.filter(datetime__lte=TransactionNow()) with self.assertRaises(UncachableQuery): self.assert_tables(qs, Test) self.assert_query_cached(qs, [obj], after=1) obj.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cache_and_no_cache(self):\r\n q = Addon.objects.no_cache().cache(12).filter(id=1)\r\n eq_(q.timeout, 12)\r\n\r\n no_cache = q.no_cache()\r\n\r\n # The querysets don't share anything.\r\n eq_(q.timeout, 12)\r\n assert no_cache.timeout != 12\r\n\r\n assert no...
[ "0.65873754", "0.65434366", "0.6111932", "0.60805", "0.6062309", "0.5831925", "0.5749737", "0.57496566", "0.57154137", "0.5707434", "0.56087804", "0.559169", "0.55760676", "0.5576006", "0.55711", "0.5567866", "0.5561702", "0.5535374", "0.5533996", "0.5518297", "0.5511918", ...
0.7330192
0
Write dockercompose to a path in order to use it with dockercompose ( config check )
def __write_docker_compose(path, docker_compose, already_existed): if path.lower().endswith((".yml", ".yaml")): file_path = path dir_name = os.path.dirname(path) else: dir_name = path file_path = os.path.join(dir_name, DEFAULT_DC_FILENAMES[0]) if os.path.isdir(dir_name) is Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_compose_file(pytestconfig: Any) -> Any:\n return os.path.join(str(pytestconfig.rootdir), \"./\", \"docker-compose.yml\")", "def docker_compose_file(pytestconfig):\n return os.path.join(\n str(pytestconfig.rootdir),\n 'tests',\n 'docker-compose.yml'\n )", "def create(pat...
[ "0.72773117", "0.6826645", "0.6804615", "0.6153526", "0.6096249", "0.5946425", "0.5809439", "0.5750655", "0.5641869", "0.55633897", "0.54744136", "0.5454378", "0.5443656", "0.5438875", "0.5408235", "0.53471535", "0.5344977", "0.53430104", "0.5338488", "0.5337685", "0.5324776"...
0.7942182
0
Load a dockercompose project from path
def __load_project(path): file_path = __get_docker_file_path(path) if file_path is None: msg = "Could not find docker-compose file at {}".format(path) return __standardize_result(False, msg, None, None) return __load_project_from_file_path(file_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __load_docker_compose(path):\n file_path = __get_docker_file_path(path)\n if file_path is None:\n msg = \"Could not find docker-compose file at {}\".format(path)\n return None, __standardize_result(False, msg, None, None)\n if not os.path.isfile(file_path):\n return (\n ...
[ "0.6835263", "0.6689488", "0.6439544", "0.622838", "0.6009252", "0.5995533", "0.59210384", "0.588785", "0.58126724", "0.57850766", "0.576354", "0.57551694", "0.5711305", "0.5657802", "0.5614034", "0.55559033", "0.55520815", "0.5512243", "0.5510658", "0.54853284", "0.5443572",...
0.8517256
0
Get the content of the dockercompose file into a directory path Path where the dockercompose file is stored on the server
def get(path): file_path = __get_docker_file_path(path) if file_path is None: return __standardize_result( False, "Path {} is not present".format(path), None, None ) salt_result = __read_docker_compose_file(file_path) if not salt_result["status"]: return salt_result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_compose_file(pytestconfig: Any) -> Any:\n return os.path.join(str(pytestconfig.rootdir), \"./\", \"docker-compose.yml\")", "def docker_compose_file(pytestconfig):\n return os.path.join(\n str(pytestconfig.rootdir),\n 'tests',\n 'docker-compose.yml'\n )", "def __write_do...
[ "0.75657314", "0.709417", "0.6934029", "0.6886011", "0.67807806", "0.6409151", "0.6285854", "0.61683273", "0.6044491", "0.59650165", "0.58391017", "0.5771815", "0.5720905", "0.5691218", "0.5683606", "0.56742376", "0.5627102", "0.56093", "0.5573163", "0.55534405", "0.5431933",...
0.6638801
5
Create the definition of a dockercompose service This fails when the service already exists This does not pull or up the service This wil rewrite your yaml file. Comments will be lost. Indentation is set to 2 spaces path Path where the dockercompose file is stored on the server service_name Name of the service to creat...
def service_create(path, service_name, definition): compose_result, loaded_definition, err = __load_compose_definitions( path, definition ) if err: return err services = compose_result["compose_content"]["services"] if service_name in services: msg = "Service {} already exist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_upsert(path, service_name, definition):\n compose_result, loaded_definition, err = __load_compose_definitions(\n path, definition\n )\n if err:\n return err\n services = compose_result[\"compose_content\"][\"services\"]\n if service_name in services:\n msg = \"Servic...
[ "0.68075156", "0.66995794", "0.63227934", "0.6103154", "0.5950564", "0.59071606", "0.5882466", "0.58698624", "0.5853003", "0.56863904", "0.56229836", "0.5621275", "0.56046015", "0.55999744", "0.55704623", "0.5559334", "0.5555121", "0.5498306", "0.54369533", "0.5411161", "0.53...
0.79874635
0
Create or update the definition of a dockercompose service This does not pull or up the service This wil rewrite your yaml file. Comments will be lost. Indentation is set to 2 spaces path Path where the dockercompose file is stored on the server service_name Name of the service to create definition Service definition a...
def service_upsert(path, service_name, definition): compose_result, loaded_definition, err = __load_compose_definitions( path, definition ) if err: return err services = compose_result["compose_content"]["services"] if service_name in services: msg = "Service {} already exist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_create(path, service_name, definition):\n compose_result, loaded_definition, err = __load_compose_definitions(\n path, definition\n )\n if err:\n return err\n services = compose_result[\"compose_content\"][\"services\"]\n if service_name in services:\n msg = \"Servic...
[ "0.74985135", "0.6445458", "0.60631627", "0.5978318", "0.59001344", "0.55588377", "0.55379766", "0.55068725", "0.5487751", "0.54670787", "0.5425984", "0.54113424", "0.54099447", "0.5391461", "0.53341955", "0.53015614", "0.5273596", "0.52600443", "0.5246454", "0.5232178", "0.5...
0.6854243
1
Do not return anything, modify rooms inplace instead.
def wallsAndGates(self, rooms: List[List[int]]) -> None: if len(rooms)==0: return rooms n, m = len(rooms), len(rooms[0]) for i in range(n): for j in range(m): if rooms[i][j] == 0: q= [(i,j,0)] while q: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rooms(self, rooms):\n\n self._rooms = rooms", "def _add_rooms(self):\r\n rooms = self.model.get_all_rooms()\r\n\r\n for room in rooms:\r\n self._add_room(room)", "def rooms(*args):\n send.system_message('\\n'.join(rooms()))", "def all_rooms(self):\n pass", ...
[ "0.67922723", "0.6150443", "0.5985418", "0.59520423", "0.5938853", "0.5910455", "0.5802791", "0.5788961", "0.57677865", "0.56960684", "0.56584203", "0.56518275", "0.5649922", "0.56375164", "0.5580176", "0.5570199", "0.5540112", "0.5534412", "0.5534412", "0.5529608", "0.549605...
0.535828
35
Checks whether there is a four in a row in the downward right diagonal
def check_down_right(self, i, j, board): color = board.pieceAt(i, j) row = True for k in range(4): row &= board.pieceAt(i+k, j+k) is color if row: return color else: return Color.EMPTY
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_diagonal_four(self, row, col):\r\n return self.is_neg_diagonal_four(\r\n row, col) or self.is_pos_diagonal_four(row, col)", "def is_pos_diagonal_four(self, row, col):\r\n player = self.board[row][col]\r\n consecutive = 0\r\n\r\n current = player\r\n i = row\r\...
[ "0.80697626", "0.79389244", "0.7929298", "0.78796417", "0.7733377", "0.75398463", "0.74274844", "0.7236405", "0.71303105", "0.69762534", "0.69188464", "0.69162035", "0.68777204", "0.6788734", "0.67829597", "0.6773064", "0.67599905", "0.6751465", "0.67349017", "0.66804975", "0...
0.6458254
30
Make XML to UTF8 String.
def tostring(self, encoding="utf-8"): return tostring(self.dom, encoding)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_tostring(tree):\n if six.PY2:\n return ET.tostring(tree)\n else:\n return ET.tostring(tree, encoding='unicode')", "def xml_to_string(xml, encode_base64=True):\n xml_string = etree.tostring(xml, xml_declaration=True, encoding='utf-8', pretty_print=True)\n if encode_base64:\n ...
[ "0.710719", "0.68319476", "0.66769594", "0.65126383", "0.6419384", "0.6393383", "0.6357978", "0.631629", "0.63001513", "0.62554073", "0.6238711", "0.6228109", "0.6215047", "0.6211786", "0.61151385", "0.6099358", "0.6078633", "0.6055261", "0.60503304", "0.60116404", "0.6007575...
0.5930737
25