query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
print out a set of column headings
def printHeadings(headings, format): print("") print(format % headings) # how wide should a dash be dashes = 0 for s in headings: if len(s) > dashes: dashes = len(s) # create a line with that many dashes s = "" while dashes > 0: s += '-' dashes -= 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def columnTitles(self):\n \n pass", "def columnTitles(self):\n \n pass", "def print_column_names(self):\n counter = 1\n try:\n for col_names in self.cursor.description:\n # print(self.cursor.description[col_names][0])\n print(\"\"\"Attr...
[ "0.7428256", "0.7428256", "0.7366831", "0.71996266", "0.71262294", "0.7073909", "0.7065758", "0.70184225", "0.7011047", "0.69628793", "0.68577343", "0.68374974", "0.68102086", "0.6808478", "0.6774094", "0.67638534", "0.67233557", "0.66981995", "0.6683833", "0.6661272", "0.665...
0.6680496
19
print out a size with the appropriate unit suffix
def printSize(sz, unit=1000): fmt10 = ["%dB", "%dKiB", "%dMiB", "%dGiB", "%dTiB", "%dPiB"] fmt2 = ["%dB", "%dKB", "%dMB", "%dGB", "%dTB", "%dPB"] fmt = fmt10 if unit == 1000 else fmt2 i = 0 while i < len(fmt): if sz < unit: break sz /= unit i += 1 return fmt[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sizeof_fmt(size, suffix='B'):\r\n for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:\r\n if abs(size) < 1024.0:\r\n return f'{size:3.1f} {unit}{suffix}'\r\n size /= 1024.0\r\n return f'{size:3.1f} Y{suffix}'", "def format_size(size):\n size = float(size)\n for unit in ['bit...
[ "0.7967207", "0.77675575", "0.7738173", "0.7724627", "0.75752074", "0.752115", "0.7514448", "0.74665457", "0.7454024", "0.7452294", "0.7434771", "0.74308723", "0.73925203", "0.7369652", "0.73430955", "0.73430955", "0.7312293", "0.73056585", "0.7280283", "0.7270896", "0.722881...
0.8110585
0
print out a time in an appropriate unit
def printTime(t): if t < 2 * MINUTE: return "%d seconds" % (t / SECOND) if t < 5 * HOUR: return "%d minutes" % (t / MINUTE) if t < 3 * DAY: return "%d hours" % (t / HOUR) if t < YEAR: return "%d days" % (t / DAY) if (t % YEAR) == 0: return "%d years" % (t / YE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_time(t):\n print(\"Time is %.2d:%.2d:%.2d\"%(t.hour,t.minute,t.second))", "def print_time(self):\n print('%.2d:%.2d:%.2d' % (self.hour, self.minute, self.second))", "def print_time(s, start_time):\n print(\"%s, time %ds, %s.\" % (s, (time.time() - start_time), time.ctime()))\n sys.std...
[ "0.7638004", "0.7474871", "0.70115083", "0.6985422", "0.6863995", "0.6811769", "0.6808201", "0.6712119", "0.66642284", "0.65760577", "0.65497994", "0.65276873", "0.6514214", "0.64789295", "0.64748365", "0.6457335", "0.6439744", "0.6428694", "0.64256114", "0.64196414", "0.6402...
0.7288681
2
print out a durability in a reasonable format
def printDurability(d): if d < .99999: return "%6.3f%%" % (d * 100) else: nines = 0 while d > .9: nines += 1 d -= .9 d *= 10 return "%d-nines" % (nines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nice_output(self):\n return 'Pitch: {0} at {1}: {2}'.format(\n self.pitch_type, self.start_speed, self.des)", "def pretty_str(self, unit_time):\n return \"{}: {} left and {}% done\".format(self.name, get_time_str(self.time * unit_time), round((self.total_time - self.time) / self.tota...
[ "0.61984223", "0.60872424", "0.60736126", "0.60736126", "0.5913698", "0.58824956", "0.5882147", "0.5882147", "0.5821221", "0.5758424", "0.57571703", "0.5739486", "0.5727247", "0.57142395", "0.5679935", "0.5608496", "0.56013834", "0.55811", "0.55756927", "0.5565094", "0.556344...
0.6071856
4
print out a probability in a reasonable format
def printProbability(p): if p > .0000001: return "%9.6f%%" % (p * 100) else: return "%9.3e" % (p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n prob = str(round(self.probability, 5))\n dprob = str(round(self.postdProbability, 5))\n output = \"dprob: \" + dprob + \" \\tprob: \" + prob + \"\\t: \"\n for key in self.attackDict.keys():\n output += key + \" \"\n return output", "def format_probability(chance, n=4):\n...
[ "0.7008854", "0.69079965", "0.6850042", "0.67920554", "0.6706265", "0.65928787", "0.6556326", "0.65150875", "0.6484869", "0.6395371", "0.6380937", "0.63522184", "0.62861836", "0.62230384", "0.6202777", "0.61732423", "0.61580294", "0.6151522", "0.6142543", "0.6141717", "0.6109...
0.80756766
0
run and report a set of specified simulations tests actual list of simulations to run (print a header line for each None test) period simulation period verbosity output options
def Run(tests, period=YEAR, verbosity="all"): # figure out what output he wants headings = True parms = True descr = True if verbosity == "parameters": descr = False elif verbosity == "headings": parms = False descr = False elif verbosity == "data only": parm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\tresults = []\n\n\tconfig = configparser.ConfigParser()\n\tconfig.read(\"simulation.ini\")\n\tsettings = config['sim']\n\n\tcompleted_obj_hw = int(settings[\"ClientsPerCampaign\"]) * float(settings[\"CompletedPctgHW\"])\n\texceeded_obj_hw = float(settings[\"ExceededPctgHW\"])\n\tsignificance_level = ...
[ "0.66855633", "0.6444111", "0.6423009", "0.63771325", "0.63536066", "0.6350432", "0.6322105", "0.6304921", "0.62810755", "0.6244929", "0.6231836", "0.6231481", "0.6206141", "0.6166658", "0.61662865", "0.61633986", "0.61437416", "0.60853714", "0.60736054", "0.606979", "0.60636...
0.70470625
0
Function for setting the color range of a plot.
def set_color_range(mic, N, indx, mat, quat, rod): first = True #print(indx) for i in range(N): if i in indx: mat[i,:,:] = RotRep.EulerZXZ2Mat(mic.snp[i,6:9]/180.0*np.pi) quat[i,:] = RotRep.quaternion_from_matrix(mat[i,:,:]) rod[i,:] = RotRep.rod_from_quate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setColorBarRange(start=1,end=254):\n dislin.colran(start,end)", "def set_colormap_range(self):\n cmin = self.settingsWidget.ui.colormap_min\n cmax = self.settingsWidget.ui.colormap_max\n region = self.plot.getHistogramWidget().region\n\n if(self.sender() == region):\n ...
[ "0.8215091", "0.7468511", "0.7109257", "0.67486906", "0.65688646", "0.6499905", "0.6471031", "0.6469902", "0.6400476", "0.63015574", "0.62633973", "0.6258973", "0.62575865", "0.6116931", "0.6020242", "0.5986115", "0.5984191", "0.59652615", "0.5948478", "0.5913041", "0.5897966...
0.61357
13
Function that checks if a string x is that of a numerical value
def is_float(x): try: float(x) except ValueError: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isnum(self, x):\n\n return x in '1234567890.-'", "def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)", "def is_some_number(mystring):\n # print(Bcolors.cyan + re.findall(r\".*\\\\(.*)\", inspect.stack()[0][1])[0] + \" --- \"\n # + inspect.stack()[0][3] + \"()\...
[ "0.7822679", "0.7567585", "0.7523138", "0.75093275", "0.7441029", "0.74222386", "0.73752314", "0.7369164", "0.7337491", "0.73187983", "0.73058134", "0.7300748", "0.7293591", "0.7293591", "0.7293591", "0.7198686", "0.716271", "0.7161545", "0.7160261", "0.71473813", "0.71310437...
0.0
-1
Function that runs the main loop Returns
def run(): square_s = input("Is your data file a square matrix file? [y/n]: ") assert(square_s == "y" or square_s == "Y" or square_s == "n" or square_s == "N"), "Please enter in 'y' or 'n' format." if square_s == "y" or square_s == "Y": is_square = True else: is_square = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n main()", "def main_loop(self):\n # main loop...don't ever exit\n while True:\n # collect data\n # get the time...the local clock is set with NTP regularly\n self._get_time()\n \n # get the latest metar data from the closest location\n self._get_metar()\n \...
[ "0.7868547", "0.7794168", "0.7726057", "0.7713218", "0.76401484", "0.7506694", "0.7290598", "0.7290598", "0.7161035", "0.7127927", "0.71084046", "0.70540714", "0.70376754", "0.6989831", "0.6983434", "0.69737995", "0.6970171", "0.6953087", "0.6942654", "0.6942654", "0.69379056...
0.0
-1
Using a combination of data [and suffix] pinch and twist an array of numbers.
def sparse_hash(data, rounds=1, suffix=None): data = data if suffix is None else data + suffix hash = [x for x in range(256)] hash_length = len(hash) pos = 0 skip = 0 for round in range(rounds): for instruction in data: # reverse the number of hash digits from the pos ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onetwo_beep_gen(numbeep, interval, finalstim_tc, finalstim_nb):\n##### if one beep:#############################################################\n\n # 8ms + 50ms + 8ms = 195 + 1220 + 195 which is a total of 1610 samples\n interval = 0.050\n gap = np.zeros(24414. * interval, float)\n onebeep_tc = np...
[ "0.504756", "0.49947897", "0.49193612", "0.48903674", "0.48394477", "0.48082486", "0.47910482", "0.47910482", "0.4781527", "0.47504583", "0.4746146", "0.47451112", "0.4735967", "0.470217", "0.47013378", "0.46999824", "0.4698733", "0.46851736", "0.46697286", "0.46351287", "0.4...
0.0
-1
Takes in a sparse hash and xors all numbers in groups of 'block_size' a 256 length sparse hash will generate a 'block_size' numbered array.
def dense_hash(hash_, block_size=16): results = list() for index in range(0, len(hash_), block_size): block = hash_[index:index + block_size] total = 0 for i in block: total ^= i results.append(total) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dense_hash(hash):\n dense_hash = []\n for i in range(0, len(hash), 16):\n block = reduce(lambda x, y: x ^ y, hash[i:i+16])\n dense_hash.append(block)\n return dense_hash", "def k1xk2(data: typing.List[int], hash_size: int = 256) -> int:\n kk = sparse_knot_hash(data, hash_size, 1)...
[ "0.64490837", "0.60304624", "0.59660774", "0.5825108", "0.57991964", "0.5717893", "0.56716293", "0.56199217", "0.5568617", "0.55538166", "0.54708904", "0.5447922", "0.5439429", "0.5383834", "0.5338911", "0.5331041", "0.53225833", "0.5314728", "0.5307399", "0.52971476", "0.526...
0.7294205
0
Can be used to describe anyone who is playing, but will describe me at the beginning of the game
def __init__(self, name, fave_football_team): self.name = name self.fave_football_team = fave_football_team
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def who_goes_first(self):\n if random.randint(0, 1) == 0:\n return 'computer'\n return 'player'", "def show_myhero(self):\n description = (self.name + ' Level is: ' + str(self.level) + ' Age is: ' + str(\n self.age) + ' Rank is: ' + self.rank + ' health is: ' + str(self...
[ "0.6429199", "0.61463565", "0.60963666", "0.60843235", "0.6071096", "0.60621256", "0.60448706", "0.59654844", "0.5950625", "0.5902745", "0.5893237", "0.5866605", "0.5788793", "0.57887214", "0.57846844", "0.5770601", "0.5769687", "0.57649755", "0.57466066", "0.5746066", "0.573...
0.0
-1
Choosing your team and opponent
def choose_team(): blah = True global team_choice global opponent_choice while blah: team_choice = input("Which NFL team would you like to play with? \n").title() NFL_teams = ["Jets", "Bills", "Dolphins", "Patriots", "Titans", "Texans", "Colts", "Jaguars", "Broncos", "Chiefs", "Chargers", "Rai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_opponent(self):\n possible_opponents = [\n self.data['personalities'].pop(),\n self.data['events'].pop()\n ]\n title = 'Recruit a member or gain experience:'\n options = []\n for possible_opponent in possible_opponents:\n option = card_...
[ "0.7527788", "0.651584", "0.6435174", "0.640273", "0.64010537", "0.6302428", "0.6267415", "0.61891365", "0.6188227", "0.6178674", "0.616317", "0.61611134", "0.6142924", "0.61102605", "0.6105685", "0.6103712", "0.60909766", "0.60868555", "0.60826194", "0.6060774", "0.605628", ...
0.7136275
1
Player decides whether they want to return the kickoff, associated gain on kickoff depending on input
def kickoff(): kickoff_choice = input(f"The {opponent_choice} are kicking off to your end zone. Do you want to return the kickoff? \n").lower() global kick_return global location if kickoff_choice == "yes": if random.random() < 0.1: if random.random() < 0.7: kick_retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_func():\n global gain\n if random.random() < 0.8:\n if random.random() < .9:\n gain = random.randint(0, 5) #For example, you have an 80% chance of gaining between 1 and 9 yards on a run play, and you have about a 72% chance to gain between 1 and 6 yards\n else:\n gain = random...
[ "0.6319561", "0.62356794", "0.6226591", "0.6195144", "0.6065509", "0.6050107", "0.6003843", "0.59457415", "0.5942352", "0.5925448", "0.58969015", "0.5894861", "0.5847418", "0.58423024", "0.58215815", "0.5810432", "0.5764698", "0.57618344", "0.575565", "0.57321423", "0.5730262...
0.6866473
0
Determines yard gain on running play
def run_func(): global gain if random.random() < 0.8: if random.random() < .9: gain = random.randint(0, 5) #For example, you have an 80% chance of gaining between 1 and 9 yards on a run play, and you have about a 72% chance to gain between 1 and 6 yards else: gain = random.randint(6,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dcgain(sys):\n return sys.dcgain()", "def _gain(self):\n return None", "def gain(self):\n return self[1]", "def gain(self) -> int:\n return self._gain", "def update_playback_gain(self, val):\n self.playbackGain = 10**(5.0*(val - self.speedDial.maximum()/2)/self.speedDial....
[ "0.6587091", "0.62599635", "0.6200276", "0.6061966", "0.5924991", "0.58686435", "0.58041745", "0.56663793", "0.56192064", "0.56159306", "0.55986327", "0.5584499", "0.5583384", "0.5576937", "0.5571284", "0.554195", "0.5529443", "0.5524498", "0.5494729", "0.5489482", "0.5483618...
0.6012537
4
Determines yard gain on passing play
def pass_func(): global gain if random.random() < 0.35: gain = 0 #You don't gain yardage if the pass is incomplete print("The pass is incomplete.\n") elif random.random() > 0.35 and random.random() < 0.43: if random.random() < .7: gain = random.randint(1, 5) else: gai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gain(self):\n return None", "def gain(self):\n return self[1]", "def gain(self) -> int:\n return self._gain", "def update_playback_gain(self, val):\n self.playbackGain = 10**(5.0*(val - self.speedDial.maximum()/2)/self.speedDial.maximum())", "def dcgain(sys):\n return sy...
[ "0.64661837", "0.6415016", "0.6104374", "0.59965986", "0.5939903", "0.5935967", "0.58814234", "0.5853398", "0.581609", "0.57570386", "0.5736254", "0.5732244", "0.57280487", "0.57192993", "0.569461", "0.5688064", "0.5660062", "0.5658602", "0.56367904", "0.5631949", "0.56276673...
0.6713752
0
Bottleneck block for ResNeXt. If style is "pytorch", the stridetwo layer is the 3x3 conv layer, if it is "caffe", the stridetwo layer is the first 1x1 conv layer.
def __init__(self, inplanes, planes, groups=1, base_width=4, base_channels=64, **kwargs): super(Bottleneck, self).__init__(inplanes, planes, **kwargs) if groups == 1: width = self.planes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _bottleneck(x: tf.Tensor, depth: int, depth_bottleneck: int, stride: int, rate: int = 1) -> tf.Tensor:\n with tf.variable_scope(None, 'bottleneck_v2', [x]):\n depth_in = slim.utils.last_dimension(x.get_shape(), min_rank=4)\n preact = slim.batch_norm(x, activation_fn=tf.nn.relu, sco...
[ "0.6889076", "0.6795593", "0.67665195", "0.6523262", "0.6499701", "0.6218676", "0.6191233", "0.6187817", "0.61875874", "0.61188823", "0.60808504", "0.5914599", "0.5914326", "0.5914326", "0.59128946", "0.58922887", "0.5889086", "0.5873635", "0.5873635", "0.58704764", "0.585307...
0.0
-1
Pack all blocks in a stage into a ``ResLayer``
def make_res_layer(self, **kwargs): return ResLayer( groups=self.groups, base_width=self.base_width, base_channels=self.base_channels, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_stage(num_blocks, input_channels, output_channels, stride, expand_ratio, norm, activation):\n blocks = []\n blocks.append(\n InvertedResBlock(input_channels, output_channels, stride=stride, expand_ratio=expand_ratio,\n norm=norm, activation=activation, use_shortcut=Fal...
[ "0.62111896", "0.6077535", "0.5642527", "0.5591934", "0.55416477", "0.5539544", "0.5538041", "0.5529021", "0.55200046", "0.54654443", "0.5445331", "0.5445331", "0.54439485", "0.54404974", "0.54329515", "0.5399873", "0.5393651", "0.5337562", "0.5324735", "0.5324147", "0.529566...
0.0
-1
ppiFile the name of input file to be parsed, which should be a file with one PPI at each line returns ppbConf, an adjacency matrix represented as a numpy array
def getConf(ppiFile): validpattern = re.compile('^[\w _\-.,\t"\':;]+$') splitpattern = re.compile('[\t ;,]+') numericpattern = re.compile('^[0-9. \t,\-]+') ### collect node names ### finfile = open(ppiFile, 'r') names = {} index = 0 for temp in finfile: temp = temp.strip('\t \n\r') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readPfile(filename):\n\n with smart_open(filename, \"rb\") as f:\n # Read header\n # Assuming all data are consistent\n for line in f:\n tokens = line.decode().split()\n if tokens[0] == \"-pfile_header\":\n headerSize = int(tokens[4])\n el...
[ "0.6192037", "0.58578134", "0.5780167", "0.57182866", "0.5705861", "0.5597269", "0.55652106", "0.5564362", "0.55439883", "0.5541717", "0.5494945", "0.54893816", "0.548049", "0.5466671", "0.546124", "0.544112", "0.54269356", "0.5412758", "0.53786016", "0.5374732", "0.53634465"...
0.76946753
0
Function that maps helper functions to option entered
def dispatch(ch): if(ch == "1"): b1() elif(ch == "2"): b2() elif(ch == "3"): b3() else: print("Error: Invalid Option")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __choose_options(self):\n\t\tswitcher = {\n\t\t\t0: self.__zero,\n\t\t\t1: self.__one,\n\t\t\t2: self.__two,\n\t\t\t3: self.__three,\n\t\t\t4: self.four,\n\t\t\t5: self.four,\n\t\t\t6: self.four,\n\t\t\t7: self.four,\n\t\t}\n\t\tfunc = switcher.get(self.__options(), lambda: \"Invalid option\")\n\t\treturn func...
[ "0.6700154", "0.61381847", "0.6029187", "0.5890568", "0.586972", "0.58272517", "0.57739186", "0.57490337", "0.5740765", "0.56789273", "0.56414676", "0.56257343", "0.5584021", "0.557838", "0.5540199", "0.5539945", "0.5539914", "0.5533887", "0.5532508", "0.5516099", "0.54937947...
0.5469205
23
Trip is an independent table
def d113(): try: row = {} print("Enter Vehicle's details: ") while True: row["ChassisNo"] = input("Chassis Number (integer): ") if row["ChassisNo"] != '': try: row["ChassisNo"] = int(row["ChassisNo"]) break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trips(self) -> Tuple[Trip]:\n ...", "def create_simple_trips(tours, households, persons, trace_hh_id):\n\n logger.info(\"Running simple trips table creation with %d tours\" % len(tours.index))\n\n tours_df = tours.to_frame()\n\n # we now have a tour_id column\n tours_df.reset_index(inp...
[ "0.6550611", "0.63067746", "0.6140956", "0.60403574", "0.60078037", "0.594432", "0.58633554", "0.574974", "0.56700605", "0.55899435", "0.55866647", "0.5530094", "0.5522383", "0.55037534", "0.5468205", "0.5413393", "0.539458", "0.53460616", "0.53455234", "0.5323009", "0.531092...
0.0
-1
MATERIAL should be updated along with BELONGS_TO which contains `IDnumber`, `ChassisNo`, `Model`, `MatName`, `WingName`
def d114(): tmp = sp.call('clear', shell=True) print () print ("Insert Material (Query)") print () try: row = {} print("Enter Material details: ") while True: row["Name"] = input("Material Name: ") if row["Name"] != '': row["Name"] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_material(obj, mat):\n if not has_material(obj, mat.name):\n obj.data.materials.append(mat)", "def set_material(self, material):\r\n for b in self.buf:\r\n b.set_material(material)", "def create_blender_material(self, ogremat, mat, meshId, matIdx):\n logger.debug(\"create_blend...
[ "0.60823786", "0.6042933", "0.5889305", "0.5757764", "0.57329404", "0.57257676", "0.57234836", "0.55613345", "0.55553347", "0.5536481", "0.5505619", "0.5462696", "0.54444814", "0.539518", "0.5303347", "0.5277466", "0.52473974", "0.5243334", "0.5204655", "0.5201424", "0.516103...
0.49658856
34
Only have to make sure that there is only one wing per personnel and vehicle
def h1(pid, cno, mdl, mat, wng): try: cur = con.cursor() print() chassisnos = get_values("BELONGS_TO","ChassisNo") models = get_values("BELONGS_TO","Model") if wng is None: print("This is an invalid input") return False if pid is None and (c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def won(self, vehicles):\n return vehicles[0].x == self.size - 2", "def avoids(w, forbidden):\n\treturn set(w).isdisjoint(set(forbidden))", "def continueCheck(building, lift):\n\n continue_lift = False\n # if passengers remain in any of the dictionaries, both same length.\n for i in range(0,len...
[ "0.5374783", "0.53616667", "0.52596354", "0.5177859", "0.50081074", "0.50024396", "0.49865574", "0.49453175", "0.49276868", "0.49215102", "0.4904473", "0.48815972", "0.48504478", "0.48390892", "0.48256508", "0.48201686", "0.48201415", "0.48075408", "0.4785895", "0.4785568", "...
0.47742835
20
Change the bot's discord game/stream!
async def _set(Type=None,*,thing=None): server = len(bot.servers) if Type is None: await bot.say('Usage: `.presence [game/stream] [message]`') else: if Type.lower() == 'stream': await bot.change_presence(game=discord.Game(name=thing,type=1,url='https://www.twitch.tv/a'),statu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def stream(self, ctx, streamer=None, *, stream_title=None):\n # [p]set stream <streamer> <stream_title>\n\n server = ctx.message.server\n\n current_status = server.me.status if server is not None else None\n\n if stream_title:\n stream_title = stream_title.strip()\n ...
[ "0.70109564", "0.68822455", "0.6671628", "0.653264", "0.64807236", "0.63751477", "0.63281924", "0.6198349", "0.61466295", "0.612521", "0.60996115", "0.60762423", "0.60760796", "0.6037178", "0.6022677", "0.5978298", "0.59709203", "0.58689505", "0.5831055", "0.5820006", "0.5809...
0.6065055
13
Automatically removes code blocks from the code.
def cleanup_code( content): # remove ```py\n``` if content.startswith('```') and content.endswith('```'): return '\n'.join(content.split('\n')[1:-1]) # remove `foo` return content.strip('` \n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_process_code_block(block):\n if 'indent' in block and block['indent']:\n indent = r'^' + block['indent']\n block['content'] = re.sub(indent, '', block['icontent'],\n flags=re.MULTILINE)", "def clean_code(ls):\r\n ls = remove_white_space...
[ "0.69041", "0.68703216", "0.67584676", "0.6666892", "0.66578245", "0.65801555", "0.65633136", "0.65602493", "0.6497586", "0.64269185", "0.6405686", "0.63828623", "0.63365126", "0.6305939", "0.628164", "0.62530655", "0.620662", "0.6188894", "0.61441284", "0.6132309", "0.607823...
0.6688275
3
Get stars from query text. According to format of the query text different methods are called.
def getStars(queries, lcs_fold, query_path=None, progb_txt="Querying stars: "): ORDINARY_QUERY_KEY = "QUERY:" stars = [] for query in tqdm(queries, desc=progb_txt): query = query.strip() if query.startswith(ORDINARY_QUERY_KEY): stars += getStarsFromRemoteDb( que...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSimpleRating(self,ratingLine):\n\n ratingStepartist = re.search(\"^\\[([\\d]+\\.?[\\d]?)/10\\](.*)\\{(.*)\\}[\\s]*\\((.*)\\)$\", ratingLine)\n passRating = re.search(\"^\\[([\\d]*\\.?[\\d]?)(PASS).*\\]\", ratingLine)\n plus = re.search(\"^\\[([\\d]*\\.?[\\d]?)(\\+\\+).*\\]\", ratingLine...
[ "0.5948951", "0.58353686", "0.5699146", "0.5515522", "0.5428978", "0.5378395", "0.53607404", "0.5349942", "0.5316735", "0.5293226", "0.5238394", "0.5216603", "0.5174512", "0.5134198", "0.5081347", "0.5047674", "0.49897566", "0.49563116", "0.49219772", "0.48989", "0.48985943",...
0.62427163
0
Get stars from folder/s. If path is iterable (case that more folders were given, light curves from that all folder will be loaded
def getStarsFromFolder(single_path, lcs_fold): p, restr = _check_sample_name(single_path) try: st = StarsProvider().getProvider( "FileManager", {"path": os.path.join(lcs_fold, p)}).getStars() stars = _split_stars(st, restr) except KeyError: raise IOError("\n\nThere no fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sar_paths(directory_path: str) -> list:\n dataset_path = Path(directory_path)\n\n path_generator = dataset_path.rglob('*.tif')\n paths = sorted([path for path in path_generator if path.is_file()])\n return [sar_set(*g) for k, g in groupby(paths, key=lambda path: re.match(TYPE_REGEX, path.name)[...
[ "0.6114552", "0.60083556", "0.5877471", "0.58240753", "0.5820839", "0.57919365", "0.57441986", "0.5722332", "0.5715297", "0.5675058", "0.56288785", "0.5609739", "0.55748695", "0.55511475", "0.5519499", "0.54943717", "0.5487072", "0.5483709", "0.5482678", "0.54466915", "0.5430...
0.7668567
0
This method parsing the query text in order to return desired stars from remote database.
def getStarsFromRemoteDb(query, query_path): try: db_key, query_file = query.split(":") except: QueryInputError( "Key for resolving stars source was not recognized:\n%s" % query) queries = StatusResolver( os.path.join(query_path, query_file)).getQueries() stars = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_for_query(query):\n index = query.find('@')\n if index == -1:\n return \"\"\n elif index == len(query)-1:\n # Make sure the final return doesn't index outside the list.\n return \"\"\n else:\n return query[index+1:]", "def process_query(self, query_str):\n ...
[ "0.56206834", "0.5586432", "0.55854344", "0.55172074", "0.54510283", "0.535934", "0.52816796", "0.5249843", "0.5221207", "0.5220947", "0.5200863", "0.51649463", "0.5164076", "0.51512545", "0.51384133", "0.5105419", "0.51047957", "0.5100868", "0.5099509", "0.5096608", "0.50962...
0.5791404
0
This takes a netcdf fill and pulls out the lat and lons array
def nc_getLatsandLons(fn): from netCDF4 import Dataset # load the netcdf file ncf1 = Dataset(fn, mode='r') # Pull out the lon and lat data lats = ncf1.variables["lat"][:] lons = ncf1.variables["lon"][:] return lats, lons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_2D_netCDF(filename, var_name, lat_name, lon_name):\n data = Dataset(filename, 'r')\n var = data[var_name][:]\n lats = data[lat_name][:]\n lons = data[lon_name][:]\n data.close()\n return var, lats, lons", "def get_ecmwf_lat_lon(nc_file):\n from netCDF4 import Dataset\n \n fh =...
[ "0.6686081", "0.65038174", "0.64324605", "0.63821316", "0.63641685", "0.6291383", "0.6236775", "0.611699", "0.60048854", "0.5986861", "0.5980002", "0.5972642", "0.5938534", "0.59312713", "0.5917963", "0.58900464", "0.5883775", "0.5870067", "0.58416015", "0.5827574", "0.581921...
0.6993417
0
setup and save a netcdf file
def write_netcdf(ncinfo): # ========== Create new netcdf ========== NAME=nc.netcdf_file(ncinfo.fname,'w') # ========== Set up the Dimensions ========== NAME.createDimension('time', None) #Question: Shouldn't time be unlimited? # NAME.createDimension('lev',11) NAME.createDimension('lat',ncinfo.lat) NAME...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_netcdf(self, outfile):", "def save_to_disk(self, filename='ens_state.nc'):\n self.to_netcdf(filename)", "def save_to_netcdf(img, filename):\n filename = os.path.join(datadir, filename + '.nc')\n print('Saving: ' + filename)\n img.to_netcdf(filename)", "def read_netcdf(self,filename):",...
[ "0.77461386", "0.7399838", "0.7267147", "0.7080664", "0.7080244", "0.68906844", "0.6874828", "0.68231076", "0.68165976", "0.6804859", "0.67870426", "0.6741072", "0.67256397", "0.66731715", "0.6647463", "0.65752", "0.6552807", "0.6535576", "0.647932", "0.6437388", "0.64214903"...
0.7063954
5
(str) > str Replaces 3 or more consecutive newlines with 2 newlines. Removes multiple newlines at the end of the string.
def beautify(text): text = re.sub('\n{3,}', '\n\n', text) text = re.sub('\n+$', '\n', text) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify(s):\n\tl = s.splitlines(True)\n\ttry:\n\t\tif l[1] in ('\\r\\n', '\\n', '</br>'):\n\t\t\tl = everyother(l)\n\texcept IndexError:\n\t\tpass\n\ttry:\n\t\tif l[-1] not in ('\\r\\n', '\\n', '</br>'):\n\t\t\tl.append('\\r\\n')\n\texcept IndexError:\n\t\tpass\n\treturn ''.join(l)", "def cleanup_newlines(str...
[ "0.710905", "0.68628454", "0.67626935", "0.65454465", "0.6492721", "0.64468503", "0.6399429", "0.6366013", "0.6259932", "0.6204685", "0.61964625", "0.61156934", "0.6046275", "0.6034635", "0.6033117", "0.5945784", "0.5924168", "0.5903102", "0.5898147", "0.5855274", "0.5854465"...
0.7270905
0
(str) > str Generator function, yields all .rst files' names from the given path.
def list_files(folder_path): try: for name in os.listdir(folder_path): base, ext = os.path.splitext(name) if ext != '.rst': continue yield os.path.join(folder_path, name) except OSError as ex: log.error('Exception occured in list_files: {0}'.fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan_docs():\n\n\n def scan_file(fn):\n f = open(fn)\n\n for l in f:\n m = re.search(r\"\\.\\. (\\w+):: ([.\\w+]+)\", l)\n\n if not m:\n continue\n\n name_kind[m.group(2)] = m.group(1)\n\n for i in os.listdir(\"source\"):\n if i.endswit...
[ "0.6643023", "0.6321115", "0.6180466", "0.6087502", "0.6051104", "0.59749836", "0.5908224", "0.5885887", "0.5877877", "0.5859597", "0.5819454", "0.58117485", "0.5770539", "0.5751046", "0.5707234", "0.5693174", "0.56727237", "0.5656135", "0.56490225", "0.5645481", "0.5626505",...
0.70348614
0
(str) > dict, str Reads file at given path, interprets its content, returning a metadata dictionary, that will be used at template render, and text content.
def read_file(file_path): raw_metadata = "" content = "" try: with open(file_path, 'rb') as f: for line in f: if line.strip() == '---': break raw_metadata += line for line in f: content += line except IOE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content(self, file_path: str) -> Tuple[defaultdict, str]:\n if not os.path.exists(file_path): # If file doesn't exist\n raise FileNotFoundError(f\"{fg(1)} Could not find file: {file_path}{fg(15)}\\n\")\n html = self.__html__(file_path)\n metadata = self.__metadata__()\n ...
[ "0.7257744", "0.6562548", "0.65443784", "0.6472406", "0.6455771", "0.6454604", "0.6451337", "0.6428394", "0.63324225", "0.6325068", "0.6200013", "0.612579", "0.6113794", "0.6112224", "0.6104595", "0.6103509", "0.60870445", "0.6027246", "0.59874994", "0.59812385", "0.5966934",...
0.6521285
3
(str, str, str) > None Writes output .html file using the path, filename and content received. Creates output directory if it does not exist.
def write_output(directory, name, html): if not os.path.isdir(directory): os.mkdir(directory) with open(os.path.join(directory, '.'.join((name, 'html'))), 'w') as f: f.write(beautify(html))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_file(self, slug, folderpath, html):\n # check directories\n if not os.path.isdir(folderpath):\n try:\n os.makedirs(folderpath)\n self.info(\"Creating directory \" + folderpath)\n except Exception as e:\n self.err(e)\n ...
[ "0.69191366", "0.68946815", "0.6861655", "0.6787746", "0.677637", "0.669781", "0.669775", "0.65559417", "0.64281124", "0.6404245", "0.6380128", "0.6371389", "0.631972", "0.63082826", "0.6286958", "0.6281795", "0.6272514", "0.622664", "0.62128615", "0.6191709", "0.6179286", ...
0.67756796
5
(str, str) > None Initializes jinja environment, creates desired output from the files found in folder_path.
def generate_site(folder_path, output_path): log.info("Generating site from {0}".format(folder_path)) jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader( os.path.join(folder_path, 'layout'))) for file_path in list_files(folder_path): metadata, content = read_file(file_path) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jinja_files(self, val: Pattern):\n self[\"jinja_files\"] = str(val)", "def new(root: str = \".\", name: str = \"piccolo_project\"):\n tree = os.walk(TEMPLATE_DIR)\n\n router = get_routing_framework()\n\n template_context = {\n \"router\": router,\n \"router_dependencies\": ROUTE...
[ "0.6169542", "0.60679686", "0.60545796", "0.59503293", "0.58086735", "0.5763365", "0.56672734", "0.5580044", "0.55667", "0.5536887", "0.54676056", "0.5458258", "0.54351616", "0.54244095", "0.5400392", "0.5299988", "0.52996176", "0.529737", "0.52925354", "0.52380043", "0.52066...
0.57296884
6
() > None Configures argument parser, generates site files.
def main(): parser = argparse.ArgumentParser() parser.add_argument("layout_path", help="relative path to the directory " "containing .rst files with site content and jinja " "templates that define the site structure") parser.add_argument("output_path", help="r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):\n\n parent_parser = argparse.ArgumentParser(add_help=False)\n parent_parser.add_argument('--debug', '-d', action='count', default=0)\n parent_parser.add_argument('--version', '-v', action='version',\n version='%(prog)s {version}'.format(version=version.__ve...
[ "0.6615437", "0.6609897", "0.66001606", "0.6552956", "0.6536455", "0.6516835", "0.6481947", "0.6475446", "0.6441392", "0.6417566", "0.6365299", "0.6311957", "0.6306291", "0.6297207", "0.6176481", "0.6133819", "0.6131787", "0.607976", "0.6054829", "0.60472035", "0.6026954", ...
0.7562603
0
Takes in a trained policy, runs the policy for a specified number of rollouts, and returns the results of the experiment.
def _run_policy(env, policy, num_rollouts): start_states, final_states, goal_states, actions, paths = [], [], [], [], [] for i in range(num_rollouts): path = rollout( env, policy, max_path_length=100, animated=False, ) obs = path["observat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollout(env, our_policy, expert_policy, num_rollouts, max_steps):\n returns = []\n observations = []\n actions = []\n for i in range(num_rollouts):\n # print('iter', i)\n obs = env.reset()\n done = False\n totalr = 0.\n steps = 0\n while not done:\n ...
[ "0.7071595", "0.70170295", "0.68903935", "0.6639821", "0.6559121", "0.6324267", "0.620789", "0.6170936", "0.6127437", "0.60635906", "0.60242164", "0.6003384", "0.5966104", "0.5851238", "0.58464557", "0.5844492", "0.5844492", "0.58353084", "0.5820814", "0.5737581", "0.5696761"...
0.7488749
0
Parse a shot of the form "letterNUMBER" to array coordinates.
def shotparser(shot: str): characters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 't', 'u', 'v', 'w', 'x', 'y', 'z'] # Get index of letter return int(shot[1:]) - 1, characters.index(shot[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gx_coords1(s: str) -> list[float]:\n return numarray(s.split(\" \"))", "def coords1(s: str) -> list[float]:\n return numarray(re.sub(SPACE, \"\", s).split(\",\"))", "def mapToCoordinates(self, shot):\r\n toks = shot.split(\"-\")\r\n return Coordinates(ord(toks[0]) - ord(\"A\"), int(toks...
[ "0.5952631", "0.5823283", "0.57569534", "0.5628835", "0.55996495", "0.5588718", "0.5460892", "0.5442877", "0.5430098", "0.53694767", "0.5343003", "0.5340652", "0.53300834", "0.53288764", "0.5307314", "0.52952194", "0.52372366", "0.5217806", "0.51957154", "0.51949483", "0.5188...
0.5715052
3
Attacks a random point on a board that has not been previously attacked.
def enemyattack(playerboard): while True: attempt = shotgenerator() # Generates a valid shot if playerboard[attempt[0]][attempt[1]] == " " or playerboard[attempt[0]][attempt[1]] == "O": break return attempt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_attack(self, board):\n board_size = board.get_board_size()\n \n coordinate = self._pick_potential_coordinate(board_size)\n \n if not coordinate:\n coordinate = self._pick_unconnected_coordinate(board_size)\n attack_result = board.set_attac...
[ "0.69671375", "0.6635215", "0.66189456", "0.6607825", "0.6607825", "0.65785706", "0.631702", "0.6306051", "0.630326", "0.62780935", "0.622881", "0.62050444", "0.6174146", "0.6149704", "0.6112133", "0.60293716", "0.59930074", "0.59873855", "0.5954399", "0.5915794", "0.5871713"...
0.6238277
10
Prints a board with a title. board = [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], ]
def boardprinter(board: list, title: str): padding = " " header = padding + " |A|B|C|D|E|F|G|H|I|J|" protoboard = "" for i in range(10): newrow = str(board[i]) newrow = newrow.replace("[", "#|").replace( ", ", "|").replace("'", "").replace("]", "|") # Prep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_board(self):\n num_rows = len(self.board)\n num_cols = len(self.board[0])\n \n for i in range(num_rows):\n if i % 3 == 0 and i != 0:\n print(\"- - - - - - - - - - - -\")\n \n for j in range(num_cols):\n if j % 3 == 0 and j != 0:\n print(\" | \", end=\"\")...
[ "0.7980977", "0.79472417", "0.7928891", "0.7881975", "0.7878489", "0.78713536", "0.7841725", "0.7832346", "0.78164923", "0.7790345", "0.77899647", "0.77899647", "0.77850956", "0.77644897", "0.77406794", "0.7719308", "0.7688303", "0.76780593", "0.76677835", "0.76352805", "0.76...
0.8417716
0
Generates a valid shot
def shotgenerator(): return random.randint(0, 9), random.randint(0, 9)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createNewShot(*args):\n createDir.createShot(pi.shotsFolder)", "def createShot(shotFolder, *args):\n createShotUI(shotFolder)", "def make_shot(self, target, force):\n intersections = self._get_edge_intersections(target)\n\n if target[0] > self.cue_coords[0]:\n start = max(int...
[ "0.65291405", "0.61991775", "0.61182004", "0.60835326", "0.60244423", "0.5980719", "0.59457535", "0.5912019", "0.5864049", "0.5780368", "0.572628", "0.5722106", "0.567072", "0.5562419", "0.55616623", "0.5552547", "0.55457574", "0.55451393", "0.551989", "0.55038774", "0.549977...
0.70925194
0
Validates a ship placement. Assumes points are already valid.
def shipvalidator(point1: tuple, point2: tuple, board: list): valid = True # Is horizontal if point1[0] == point2[0]: # No collisions for i in range(min(point1[1], point2[1]), max(point1[1], point2[1])): if board[point1[0]][i] != " ": valid = False # Is vertic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_ship(cls, ship_type, star_square, orientation):\n try:\n cls.validate_square(star_square)\n cls.validate_type(ship_type)\n cls.check_if_fit_in_grid(ship_type, star_square, orientation)\n except ValueError as e:\n raise ValueError('%s for %s at ...
[ "0.7364583", "0.7090558", "0.6627818", "0.63202465", "0.6307072", "0.6304159", "0.614453", "0.611397", "0.6086512", "0.60463244", "0.6039142", "0.603421", "0.6026416", "0.6020171", "0.60170776", "0.599188", "0.5988496", "0.59128296", "0.5907643", "0.58383584", "0.5812146", ...
0.6815466
2
Places a ship on an board. Assumes ship is valid.
def placeship(point1: tuple, point2: tuple, board: list): # Is horizontal if point1[0] == point2[0]: for i in range(min(point1[1], point2[1]), max(point1[1], point2[1]) + 1): board[point1[0]][i] = "O" # Is vertical elif point1[1] == point2[1]: for i in range(min(point1[0], po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_ship(self, row, col, ship, aligment):\n self._validate_place_params(row, col, ship, aligment)\n\n if aligment == ShipPosition.HORIZONTAL:\n # Place ship in horizontal position, populating in right direction\n for i in range(self.get_col_index(col), ship.LENGH + self.ge...
[ "0.8136066", "0.77643454", "0.7752637", "0.740094", "0.7397912", "0.73814833", "0.735342", "0.71544975", "0.7044392", "0.70412576", "0.69499886", "0.69271797", "0.68341196", "0.68257225", "0.675496", "0.6746818", "0.6714631", "0.67056274", "0.6677966", "0.65760803", "0.653700...
0.65420336
20
Generate a ship of length N.
def generateship(length: int): length = length - 1 vertical = bool(random.randint(0, 1)) if vertical: col1 = random.randint(0, 9) row1 = random.randint(0, 9 - length) col2 = col1 row2 = row1 + length return (col1, row1), (col2, row2) if not vertical: col1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ship(length, *args):\n coord = (randint(0, 10 - length), randint(0, 10 - length))\n check = True\n while check:\n check = False\n if args:\n for arg in args:\n check = point_in_ship(arg, coord) if check == False else True\n while point_in_s...
[ "0.71276236", "0.6535593", "0.6233696", "0.61020637", "0.60862756", "0.60614854", "0.6044193", "0.6028837", "0.5943878", "0.58799267", "0.58623815", "0.5815113", "0.5723559", "0.5715128", "0.5660159", "0.5649343", "0.5647397", "0.56422246", "0.5617939", "0.561721", "0.5591131...
0.658633
1
Return True for leap years, False for nonleap years
def is_leap(year): return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_leap_year():", "def is_leap_year(self):\n\n yr = self.year\n if not yr%4 == 0:\n return False\n elif not yr%100 == 0: #if divisible by 4 and not divisible by 100\n return True\n elif not yr%400 == 0: #if divisible by 4, divisible by 100 and not divisible 4...
[ "0.91418904", "0.8760494", "0.8699257", "0.8699257", "0.85824883", "0.85733265", "0.8568897", "0.8495486", "0.8475959", "0.8471232", "0.8421707", "0.8419007", "0.83912635", "0.837288", "0.83475894", "0.8343614", "0.8324799", "0.8307901", "0.8289238", "0.8282688", "0.82801807"...
0.84470236
10
Returns no of days in that month in that year.
def days_in_month(year, month): if not 1 <= month <= 12: return 'Invalid Month' if month == 2 and is_leap(year): return 29 return month_days[month]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_month(year, month):\n num_days = monthrange(year, month)[1]\n return num_days", "def numDays(month, year):\n\tif month in [9, 4, 6, 11]:\n\t\treturn 30\n\telif month == 2 and year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):\n\t\treturn 29\n\telif month == 2:\n\t\treturn 28\n\telse:\n\t\t...
[ "0.81629515", "0.8069864", "0.79608065", "0.784114", "0.77834785", "0.7639529", "0.7614766", "0.75591195", "0.73463625", "0.728101", "0.7228919", "0.717201", "0.7168249", "0.7129094", "0.7107501", "0.71060723", "0.7065934", "0.7065934", "0.7065934", "0.7061095", "0.70126194",...
0.7311546
9
Stores min, max and avg box sides (for height and width)
def boxes_stats(self): all_boxes = [] nb_detections = [] convexities = [] all_ids = set() for image_id in self.dataset_handler.image_ids: masks, ids = self.dataset_handler.load_mask(image_id) all_ids = all_ids.union(set(ids)) boxes = utils.extr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_box(self, state, min_x, min_y, max_x, max_y):\n ret_val, min_x.value, min_y.value, max_x.value, max_y.value = self._get_box(state.encode(), min_x.value, min_y.value, max_x.value, max_y.value)\n return ret_val", "def box_size(self) -> np.ndarray:\n return self.upper - self.lower + 1",...
[ "0.6205536", "0.61921114", "0.61921114", "0.6136274", "0.6073941", "0.6073941", "0.6055319", "0.5978771", "0.59486884", "0.59391594", "0.58966076", "0.5886958", "0.5836002", "0.5829803", "0.5827152", "0.58222336", "0.5815708", "0.58145404", "0.5793903", "0.57711303", "0.57473...
0.0
-1
Filter results according to stats.
def filter(self, result): convexities = [] for mask_idx in range(result.masks.shape[2]): mask = result.masks[:, :, mask_idx] props = regionprops(mask.numpy().astype(np.int8))[0] convexities.append(props.filled_area/props.convex_area) convexities = np.array(co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(self, filters):", "def filterRansac():\n pass", "def filter_results(results, main_class=None):\n # Gets request parameters/arguments\n args = get_request_args()\n # Big block of ifs to filter\n if args['user_id']: results = results.filter(User.user_id==args['user_id'])\n if args['f...
[ "0.67229635", "0.6499244", "0.6495151", "0.6472337", "0.64192593", "0.635806", "0.63370085", "0.6204995", "0.61245126", "0.60211843", "0.60050136", "0.598326", "0.59564465", "0.59132177", "0.5856923", "0.5845993", "0.58319396", "0.5794037", "0.5786162", "0.5761385", "0.575883...
0.0
-1
Get now as microseconds since the UNIX epoch.
def now(): return int(datetime.datetime.now().strftime("%s")) * 1000
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(self):\n # this only returns second precision, which is why we don't use it\n #now = calendar.timegm(datetime.datetime.utcnow().utctimetuple())\n\n # this returns microsecond precision\n # http://bugs.python.org/msg180110\n epoch = datetime.datetime(1970, 1, 1)\n ...
[ "0.7489993", "0.74439853", "0.72787327", "0.7272514", "0.72541904", "0.7161329", "0.7107288", "0.70058936", "0.69860166", "0.69800115", "0.69408554", "0.69129497", "0.6905701", "0.6893554", "0.68712544", "0.6860828", "0.6805546", "0.6799936", "0.67947143", "0.6786573", "0.676...
0.6928512
11
Get now as microseconds since the UNIX epoch.
def datetime_to_epoch(datetime_obj): return int(datetime_obj.strftime("%s")) * 1000
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(self):\n # this only returns second precision, which is why we don't use it\n #now = calendar.timegm(datetime.datetime.utcnow().utctimetuple())\n\n # this returns microsecond precision\n # http://bugs.python.org/msg180110\n epoch = datetime.datetime(1970, 1, 1)\n ...
[ "0.74894196", "0.7442043", "0.7278196", "0.7273182", "0.7252672", "0.71613514", "0.71069956", "0.70050436", "0.6984224", "0.69784194", "0.69391435", "0.69267714", "0.6912264", "0.6905124", "0.689079", "0.68695486", "0.68592054", "0.68064374", "0.6800234", "0.6795791", "0.6785...
0.0
-1
environment init before test
def setUp(self): # excel文件1.xlsx的路径 # 加载excel中的测试数据 excel_path = os.path.join(os.path.dirname(__file__), '1.xlsx') excel_obj = ExcelUtil(excel_path, 'Sheet1') print("start test") pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def initialize():\n environment = Environment()\n environment.setup()", "def testInit(self):\n self.globalInit()\n self.test.start()", "def SetupEnvironment(self):\n pass", "def setUp(self) -> None:\n self.s3 = boto3.client('s3')\n...
[ "0.8477952", "0.7773781", "0.7656406", "0.75087535", "0.73838836", "0.73441076", "0.7292142", "0.7292142", "0.72866803", "0.7260709", "0.7255964", "0.7255964", "0.7222324", "0.72035205", "0.7152396", "0.7147133", "0.70943093", "0.7089195", "0.7052635", "0.70239663", "0.702188...
0.0
-1
environment clear after test
def tearDown(self): print("end test") pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n tests.utils.cleanup_environment()", "def tearDown(self):\n tests.utils.cleanup_environment()", "def teardown_test_env():\n if not keep_tmp_dirs:\n print('\\nCleaning up temporary directories...')\n shutil.rmtree(tmp_elm_dpath, ignore_errors=True)...
[ "0.80781776", "0.80781776", "0.8025331", "0.795834", "0.78031003", "0.72159874", "0.71568036", "0.7120855", "0.7064884", "0.7049674", "0.70482063", "0.704096", "0.704096", "0.704096", "0.704096", "0.70360094", "0.70360094", "0.702821", "0.69660354", "0.6965543", "0.6965543", ...
0.0
-1
Apply the image transformation specified by a matrix.
def apply_transform(x, transform_matrix, channel_axis=0, fill_mode='constant', cval=0.): x = np.rollaxis(x, channel_axis, 0) final_affine_matrix = transform_matrix[:2, :2] final_offset = transform_matrix[:2, 2] channel_images = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_transform(img,\n transform_matrix):\n rows,cols = img.shape[:2]\n dst = cv2.warpAffine(img,transform_matrix,(cols,rows))\n\n\n return dst", "def apply_transform_matrix(self, img: np.ndarray, transform_matrix):\n h, w = img.shape[0], img.shape[1]\n transform_matrix = tr...
[ "0.7891312", "0.7722452", "0.77214634", "0.6940536", "0.69030356", "0.6731182", "0.6722956", "0.6610788", "0.6610788", "0.6405551", "0.63846016", "0.632801", "0.6246744", "0.6242733", "0.6241952", "0.6209053", "0.6175359", "0.61352855", "0.6126648", "0.6123695", "0.6076114", ...
0.6429553
10
Read png images from input directory in batches.
def load_images(input_dir, batch_shape, vgg_batch_shape): ens_images = np.zeros(batch_shape) inc_images = np.zeros(batch_shape) tcd_images = np.zeros(batch_shape) vgg_images = np.zeros(vgg_batch_shape) filenames = [] idx = 0 batch_size = batch_shape[0] for filepath in tf.gfile.Glob(os.path.join(input_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_images(input_dir, batch_shape):\n images = np.zeros(batch_shape)\n filenames = []\n idx = 0\n batch_size = batch_shape[0]\n for filepath in tf.gfile.Glob(os.path.join(input_dir, '*.png')):\n with tf.gfile.Open(filepath) as f:\n image = imread(f, mode='RGB').astype(np.float) / 255.0\n # Ima...
[ "0.7794853", "0.77915066", "0.77869236", "0.77746576", "0.77045417", "0.75936383", "0.7586308", "0.7476024", "0.7464507", "0.7414358", "0.70712256", "0.70034915", "0.69416773", "0.68530375", "0.68395364", "0.68052876", "0.6768019", "0.67624897", "0.67129254", "0.66466576", "0...
0.68980294
13
Constructs model and return probabilities for given input.
def __call__(self, ens_x_input, vgg_x_input, inc_x_input, tcd_x_input): reuse = True if self.built else None logits = None aux_logits = None weights = [[0.7, 0.1], [0.2, 0.1]] all_inputs = [[ens_x_input, tcd_x_input], [inc_x_input, tcd_x_input]] scopes = [inception_resnet_v2.inception_resnet_v2_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(cls, input):\n clf = cls.get_model()\n print('input=')\n print(input)\n return clf.predict(input)", "def predict_proba(self, inputs):\n return self.model.predict_proba(inputs)", "def run(self, input):\n\n with torch.no_grad():\n input_tensor = se...
[ "0.63823074", "0.6323266", "0.62877744", "0.6283942", "0.62525046", "0.61957985", "0.6172311", "0.6114245", "0.61092055", "0.6090099", "0.6075938", "0.60474825", "0.60085744", "0.6007718", "0.5942609", "0.59334004", "0.5921581", "0.5892854", "0.5889096", "0.5858429", "0.58498...
0.0
-1
Send emails to recipients.
def send(self, smtp_server_instance: SMTPServer = None): if not self.can_send_now(): return with SendMailContext(self, smtp_server_instance) as ctx: message = None for recipient in self.recipients: if recipient.is_mail_sent(): continue message = ctx.build_message(recipient.recipient) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email_users():\n\n # Get users emails\n users_emails = User.objects.exclude(\n Q(email='') |\n Q(email=None)\n ).values_list(\n 'email',\n flat=True\n )\n\n # Send email to each user\n # for email_user in users_emails:\n\n title = 'Se han calculado nuevos H...
[ "0.7351532", "0.7231405", "0.72113985", "0.7196959", "0.7194989", "0.7145822", "0.70656997", "0.7054774", "0.7039921", "0.7032839", "0.696968", "0.6959936", "0.69466656", "0.6911196", "0.6857288", "0.6817667", "0.6813234", "0.68113726", "0.68011487", "0.6783675", "0.67317784"...
0.6068696
97
Remove low priority older than 31 days in Outbox or configured in Log Settings.
def clear_old_logs(days=30): days = days or 31 email_queue = frappe.qb.DocType("Email Queue") email_recipient = frappe.qb.DocType("Email Queue Recipient") # Delete queue table ( frappe.qb.from_(email_queue) .delete() .where(email_queue.modified < (Now() - Interval(days=days))) ).run() # delete ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_priorities_from_all_not_due_today(self):\n\n today = datetime.now().date()\n\n for item in self.api_wrapper.get_all_items():\n\n try:\n item_due_date = datetime.strptime(item['due']['date'], \"%Y-%m-%d\").date()\n if item['priority'] != 1 and item_d...
[ "0.61522824", "0.6127307", "0.585736", "0.5584973", "0.5424045", "0.53852594", "0.5287806", "0.5262454", "0.52023005", "0.5179946", "0.51432645", "0.5141446", "0.51373243", "0.5134785", "0.5101212", "0.50913", "0.50795054", "0.5073887", "0.506944", "0.50674236", "0.5040266", ...
0.49397492
30
This is equivalent to EmailQueue.send. This provides a way to make sending mail as a background job.
def send_mail(email_queue_name, smtp_server_instance: SMTPServer = None): record = EmailQueue.find(email_queue_name) record.send(smtp_server_instance=smtp_server_instance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mail(self, msg):\n mail_queue.put(msg)", "def send_async_email(self, msg):\n with app.app_context():\n result = mail.send(msg)\n print result", "def quick_email(self, send_to, subject, body, style=None):\n message = Message(body, style=style)\n\n self....
[ "0.7172754", "0.68388176", "0.6546201", "0.6405928", "0.63104117", "0.6251", "0.6232571", "0.6101235", "0.607073", "0.60418105", "0.5989472", "0.5973994", "0.5913236", "0.5909689", "0.58735156", "0.5871084", "0.5864278", "0.585043", "0.5849195", "0.5838661", "0.5824061", "0...
0.66771394
2
Build message specific to the recipient.
def build_message(self, recipient_email): message = self.queue_doc.message if not message: return "" message = message.replace( self.message_placeholder("tracker"), self.get_tracker_str(recipient_email) ) message = message.replace( self.message_placeholder("unsubscribe_url"), self.get_unsubscribe_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_message(self):\n msg_type = self.msg_type\n if msg_type == \"PUBMSG\":\n msg_type = \"PRIVMSG\"\n ret = \"{} {}\".format(msg_type, self.target)\n if self.content:\n ret += \" :{}\".format(self.content)\n return ret + \"\\r\\n\"", "def build_m...
[ "0.6769794", "0.6737969", "0.62899005", "0.6173471", "0.61571157", "0.6078235", "0.6017565", "0.60136795", "0.59706426", "0.5963227", "0.5956112", "0.5827875", "0.5805116", "0.57555825", "0.57555825", "0.57119703", "0.57029104", "0.569709", "0.5649452", "0.5649261", "0.563867...
0.72548765
0
Add index in `tabCommunication` for `(reference_doctype, reference_name)`
def on_doctype_update(): frappe.db.add_index( "Email Queue", ("status", "send_after", "priority", "creation"), "index_bulk_flush" ) frappe.db.add_index("Email Queue", ["message_id(140)"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_index():", "def typesense_index_referral(ref, client=None):\n if not client:\n client = typesense_client()\n\n ref_document = {\n 'id': str(ref.pk),\n 'created': ref.created.timestamp(),\n 'type': ref.type.name,\n 'referring_org': ref.referring_org.name,\n ...
[ "0.5856325", "0.57169074", "0.5688665", "0.5684541", "0.5623131", "0.5605301", "0.55933005", "0.55597967", "0.5525972", "0.52962345", "0.52801585", "0.52396655", "0.523762", "0.5230654", "0.52270794", "0.5187034", "0.5185155", "0.5145689", "0.5129705", "0.510814", "0.5104973"...
0.46001127
86
Add email to sending queue (Email Queue)
def __init__( self, recipients=None, sender=None, subject=None, message=None, text_content=None, reference_doctype=None, reference_name=None, unsubscribe_method=None, unsubscribe_params=None, unsubscribe_message=None, attachments=None, reply_to=None, cc=None, bcc=None, message_id=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mail(self, msg):\n mail_queue.put(msg)", "def _send_mail(self, sender, subject, body, html=None):\n self.emails.append((sender, subject, body, html))", "def _send_mail(self, sender, subject, body, html=None):\n self.emails.append((sender, subject, body, html))", "def send_mail(email_que...
[ "0.7520886", "0.7370168", "0.7370168", "0.714263", "0.7081094", "0.69674784", "0.6915373", "0.6751236", "0.64361167", "0.6408204", "0.640441", "0.6377486", "0.6270715", "0.62467325", "0.61820465", "0.6142096", "0.6090388", "0.60861367", "0.6045202", "0.60185254", "0.6003094",...
0.0
-1
Build and return the email queues those are created. Sends email incase if it is requested to send now.
def process(self, send_now=False): final_recipients = self.final_recipients() queue_separately = (final_recipients and self.queue_separately) or len(final_recipients) > 20 if not (final_recipients + self.final_cc()): return [] queue_data = self.as_dict(include_recipients=False) if not queue_data: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_email_queue():\n g.setdefault('email_queue', [])", "def send_queued_mail():\r\n now = datetime.datetime.now(g.tz)\r\n if not c.site:\r\n c.site = Default\r\n\r\n clear = False\r\n session = smtplib.SMTP(g.smtp_server)\r\n # convienence funciton for sending the mail to the singly...
[ "0.6772418", "0.62025726", "0.6147615", "0.6054284", "0.6054284", "0.6054284", "0.6054284", "0.6054284", "0.6054284", "0.6054284", "0.6054284", "0.6054284", "0.58631426", "0.5812916", "0.5798254", "0.5771639", "0.5767222", "0.5765894", "0.5718625", "0.5701637", "0.5682031", ...
0.65649277
1
Creates a new instance of the appropriate class based on discriminator value
def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> PrintTaskDefinition: if not parse_node: raise TypeError("parse_node cannot be null.") return PrintTaskDefinition()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> OnenoteEntityHierarchyModel:\n if not parse_node:\n raise TypeError(\"parse_node cannot be null.\")\n try:\n mapping_value = parse_node.get_child_node(\"@odata.type\").get_str_value()\n except ...
[ "0.65867877", "0.65305114", "0.6343514", "0.6252549", "0.60611624", "0.60551363", "0.6040931", "0.60100836", "0.59928304", "0.59867793", "0.59777546", "0.59384596", "0.59132653", "0.5886811", "0.58785224", "0.5829891", "0.5829891", "0.5826961", "0.5816853", "0.58128166", "0.5...
0.51968336
69
The deserialization information for the current model
def get_field_deserializers(self,) -> Dict[str, Callable[[ParseNode], None]]: from .app_identity import AppIdentity from .entity import Entity from .print_task import PrintTask from .app_identity import AppIdentity from .entity import Entity from .print_task import Print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_info(self):\n if not self._model_info:\n self._load_model_info()\n try:\n data = json.loads(self._model_info)\n except (TypeError, ValueError):\n data = {}\n return data", "def _post_deserialize (self):\n pass", "def _serialise(self)...
[ "0.7466499", "0.707194", "0.67322314", "0.6634526", "0.6614095", "0.64530206", "0.6389254", "0.63054293", "0.63052577", "0.6239454", "0.62091255", "0.619561", "0.6184919", "0.6148526", "0.60944825", "0.6040633", "0.6039713", "0.6035496", "0.60268706", "0.602527", "0.6023899",...
0.0
-1
Serializes information the current object
def serialize(self,writer: SerializationWriter) -> None: if not writer: raise TypeError("writer cannot be null.") super().serialize(writer) writer.write_object_value("createdBy", self.created_by) writer.write_str_value("displayName", self.display_name) writer.write_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n pass", "def serialize(self):", "def serialize(self, obj):\n pass", "def _serialise(self):\n # TODO (M Foley)\n pass", "def serialize(self):\n raise NotImplementedError(\"Abstract class, implemented in sub class\")", "def serialize(self):\n\n\t\tre...
[ "0.8327273", "0.8142914", "0.7973026", "0.78005224", "0.77396905", "0.7624675", "0.76167446", "0.7545493", "0.743923", "0.7393768", "0.7392551", "0.73903686", "0.73865026", "0.73563176", "0.73563176", "0.7347126", "0.7302598", "0.72678256", "0.72639143", "0.72588915", "0.7251...
0.0
-1
check if a param is a python reserved word. if so append the PREPEND_STR and return. If not just return the param
def check_param(param): return PREPEND_STR+param if keyword.iskeyword(param) else param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_name(p):\n prefix = ['limit_', 'error_', 'fix_']\n for prf in prefix:\n if p.startswith(prf):\n return p[len(prf):]\n return p", "def format_parameter(param, required):\n\n param_string = check_param(flatten_param(param))\n if not required:\n param_string += '=No...
[ "0.62164277", "0.60627276", "0.59327525", "0.58690375", "0.5847756", "0.58377063", "0.57170993", "0.5695834", "0.5646491", "0.5615303", "0.5615303", "0.558056", "0.5556343", "0.5556343", "0.5484624", "0.5424852", "0.5399515", "0.53664017", "0.53664017", "0.5356545", "0.530470...
0.81484944
0
clean param looks for parameters with '' and removes them
def clean_param(param): if '<' in param: param = param.replace("<", "") if '>' in param: param = param.replace(">", "") return param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_params(self, url):\n if isinstance(url, unicode):\n url = url.encode(\"utf-8\")\n parts = list(urlparse.urlsplit(url))\n if not parts[3]:\n return url\n query = urlparse.parse_qsl(parts[3])\n query = [q for q in query if self._is_param_allowed(*q)]...
[ "0.69229156", "0.6752244", "0.65578884", "0.6452081", "0.64409894", "0.6366064", "0.628932", "0.6192528", "0.6158099", "0.6077513", "0.6062495", "0.6045371", "0.60109264", "0.6010546", "0.5998438", "0.59780425", "0.59707963", "0.59661484", "0.5924474", "0.59158826", "0.591525...
0.7192391
0
Turn a parameter that looks like this param[name_one][name_two][name_three] into this param_name_one_name_two_name_three
def flatten_param(param): param = param.replace(']', '').replace('[', '_').replace('<','').replace('>','') if param.startswith('_'): param = param.replace('_', '', 1) return param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parameterize_string(raw):\n\n parts = []\n s_index = 0\n\n for match in _PARAMETER_PATTERN.finditer(raw):\n parts.append(raw[s_index:match.start()])\n parts.append({u\"Ref\": match.group(1)})\n s_index = match.end()\n\n if not parts:\n return GenericHelperFn(raw)\n\n ...
[ "0.5780257", "0.5667719", "0.5615841", "0.55319816", "0.5456321", "0.5438268", "0.53272706", "0.5323091", "0.5322933", "0.5312868", "0.53086865", "0.52487105", "0.5246531", "0.5241464", "0.5229589", "0.5199713", "0.5155024", "0.5140652", "0.5140652", "0.513402", "0.5124002", ...
0.679576
0
Determines if a parameter should be treated as an array
def is_array_param(param): return param.get('tags') and param['tags']['type'] == 'array'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_array(self):\n return False", "def is_array(val):\n return (\n isinstance(val, tuple) or \\\n isinstance(val, dict) or \\\n isinstance(val, list)\n )", "def IsArray(obj):\n return isinstance(obj, (list, tuple))", "def is_array(self, arr):\n return isinstance(arr, np.ndarray...
[ "0.75525606", "0.7493666", "0.74254745", "0.7411446", "0.734913", "0.7297551", "0.7130163", "0.7086796", "0.7065588", "0.70564675", "0.6974437", "0.6965529", "0.68480897", "0.68339354", "0.67768043", "0.67439604", "0.6680122", "0.664659", "0.6624795", "0.6542464", "0.64139646...
0.80148953
0
build_payload creates a list of parameters to be used in the payload of the api call
def build_payload(parameters): payload = [] for param in parameters: """ Do not include path parameters in the payload """ if param['paramType'] != 'path': field_name = clean_param(param['name']) field = flatten_param(field_name) if is_array_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_payload(self, **kwargs):\n\n return None", "def build_payload():\n payload = json.dumps({\"method\": \"ListAccounts\", \"params\": {}, \"id\": 1})\n return payload", "def _build_payload(self, body: Dict) -> Dict[str, Any]:\n return {'jsonrpc': '2.0',\n 'id': self._i...
[ "0.73088354", "0.71508425", "0.6918581", "0.69140506", "0.6796427", "0.67317855", "0.66412216", "0.6116565", "0.6034691", "0.6007825", "0.5997449", "0.5952233", "0.59042174", "0.5879261", "0.5848162", "0.5779257", "0.5766688", "0.5747198", "0.5743052", "0.57350177", "0.572885...
0.72281057
1
format_parameter build the a parameter to be used in the paramter list of the methods calls we are creating
def format_parameter(param, required): param_string = check_param(flatten_param(param)) if not required: param_string += '=None' return param_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _params_formatter(field, description):\n heads = ['param']\n types = _or_types(field)\n if types:\n heads.append(types)\n heads.append(rst.escape(field['name']))\n tail = description\n return heads, tail", "def render_param(self, format):\n\t\tdef renderer(ctx, data):\n\t\t\tparName ...
[ "0.6774295", "0.6679267", "0.6585214", "0.6363438", "0.6351442", "0.633546", "0.63323075", "0.61973155", "0.6140997", "0.6104696", "0.60986304", "0.6089245", "0.60883564", "0.5919709", "0.59121525", "0.59110725", "0.5835087", "0.58008426", "0.579243", "0.5762046", "0.57561606...
0.6277223
7
get paramters creates the parameter list for the method call Places all required params at the begining of the param list
def get_parameters(parameters): arg_list = [] opt_list = [] for param in parameters: param_name = param['name'] param_required = param['required'] if param_required: arg_list.append(format_parameter(param_name, param_required)) else: opt_list.append(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(self):", "def get_params(self):\n pass", "def get_params(self):\n raise NotImplementedError", "def params():\n raise NotImplementedError", "def get_params(self):\n return []", "def get_params(self, deep=...):\n ...", "def parameters(self):", "def para...
[ "0.77528787", "0.7571475", "0.7385595", "0.7349339", "0.72589153", "0.7256588", "0.7008006", "0.69573146", "0.68612456", "0.6818249", "0.67983365", "0.6753536", "0.6746479", "0.6741851", "0.67194295", "0.67194295", "0.67194295", "0.67127293", "0.66983944", "0.66978526", "0.66...
0.6139878
71
get paramters creates the parameter list for the method calls in rst format
def get_parameter_descriptions(parameters): lines = [] opt_lines = [] for param in parameters: param_name = check_param(flatten_param(param['name'])) if param['required']: required = 'required' lines.append(':param {0}: ({1}) {2}'.format(param_name, required, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(self):", "def parameters(self):", "def params(self):\n pass", "def params():\n raise NotImplementedError", "def _formal_params(self, doclet):\n name, paren, params = self.arguments[0].partition('(')\n return ('(%s' % params) if params else '(%s)' % ', '.join(d...
[ "0.7224196", "0.68872964", "0.6800735", "0.66922843", "0.6662566", "0.6645085", "0.6556769", "0.65225315", "0.6496837", "0.64939827", "0.6491988", "0.6447467", "0.643595", "0.643595", "0.6430054", "0.6428785", "0.64283556", "0.6427815", "0.63589954", "0.6352107", "0.63115436"...
0.0
-1
get paramters creates the parameter list for the method call
def get_path_parameters(parameters): param_list = [] for param in parameters: if param['paramType'] == 'path': param_name = param['name'] param_list.append('{0}={1}'.format(param_name, param_name)) return param_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(self):", "def get_params(self):\n pass", "def get_params(self):\n raise NotImplementedError", "def get_params(self):\n return []", "def _get_parameters(self) -> list:\n return self.parameters", "def params():\n raise NotImplementedError", "def get_param...
[ "0.79626054", "0.76968235", "0.7587891", "0.7461619", "0.73960304", "0.73912436", "0.73753273", "0.7243488", "0.7119335", "0.7075366", "0.70457923", "0.70423514", "0.70313346", "0.70313346", "0.70131594", "0.70106745", "0.69905233", "0.695566", "0.6907039", "0.69069386", "0.6...
0.0
-1
Check for the existance of enums in the parameter list. If an enum exists, we need to build a tuple of the emum names as well as the code that will validate the the enum. We create two lists one that contains the enums as tuples and another that contains the valdiate code. The method returns a list that consistes of th...
def check_for_enums(parameters): enum_line = '' enum_lines = [] validate_enums = [] for param in parameters: if 'enum' in param: param_name = check_param(flatten_param(param['name'])) param_enum = param['enum'] enum_line = param_name + '_types = (' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_available_enum(enum_type: Type[Enum]) -> List[str]:\n return [f\"{i}: {v}\" for (i, v) in enumerate(enum_type)] # type: ignore[var-annotated]", "def handle_enum(enum_annotations: Any) -> list:\n result = []\n for attribute in list(enum_annotations):\n result.append(attribute...
[ "0.6401213", "0.63181007", "0.63141215", "0.61072165", "0.60310066", "0.56923455", "0.56852007", "0.55856186", "0.55427897", "0.5502843", "0.548926", "0.5463231", "0.542895", "0.5422927", "0.5402525", "0.5377337", "0.5361586", "0.5300357", "0.5296258", "0.5267555", "0.5186078...
0.7524469
0
convert camelCase to camel_case
def convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_camel_case(name):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', name)\n return re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()", "def _to_camel_case(text: str) -> str:\n return \"\".join(word.title() for word in text.split(\"_\"))", "def camel_case(value: str, **kwargs: Any) -> str:\n ...
[ "0.8216925", "0.8098905", "0.7977879", "0.78845215", "0.7877296", "0.7851086", "0.78430486", "0.7833407", "0.77893585", "0.7788128", "0.77770317", "0.77436364", "0.77385837", "0.7737896", "0.771665", "0.771665", "0.7715725", "0.77044356", "0.7662114", "0.7646547", "0.7639699"...
0.6941522
76
check the parameter list for the pre_attachment[] parameter. This param is not correct, it's simply a placeholder for the
def check_for_pre_attachment_param(parameters): for idx, param in enumerate(parameters): if param['name'] == 'pre_attachment[*]': del parameters[idx] parameters.insert(idx, pre_attachment_content_type) parameters.insert(idx + 1, pre_attachment_parent_folder_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_provider_attachment_create(self, resource_dict):\n pass", "def required_attachments(self, required_attachments):\n\n self._required_attachments = required_attachments", "def pre_customer_attachment_create(self, resource_dict):\n pass", "def setPreUp(self, pre):\n # type: (...
[ "0.5808577", "0.5733911", "0.55609274", "0.530507", "0.52761936", "0.5258297", "0.52529293", "0.5246867", "0.5238447", "0.5232915", "0.5209431", "0.5200901", "0.51895285", "0.5150902", "0.5100585", "0.5098105", "0.5080987", "0.50742763", "0.50629646", "0.50629646", "0.5062964...
0.8184055
0
build method is used build the methods of the class we are processing.
def build_method(method_name, description, parameters, api_path, http_method, summary, return_type): allow_per_page = False parameters = check_for_pre_attachment_param(parameters) arg_list = get_parameters(parameters) param_descriptions = get_parameter_descriptions(parameters) payload = build_payloa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build(self):", "def _build(self):", "def build(self):", "def build(self):", "def build(self):", "def build(self) -> None:", "def _build_impl(self):", "def build(self):\n pass", "def build(self):\n pass", "def build (self):\n raise NotImplementedError", "def build(self)...
[ "0.736621", "0.736621", "0.735565", "0.735565", "0.735565", "0.7179113", "0.7177833", "0.7170467", "0.7170467", "0.70449257", "0.6981165", "0.69558483", "0.69547623", "0.69329727", "0.6886207", "0.6885989", "0.68603706", "0.67853916", "0.6755418", "0.65356845", "0.6430983", ...
0.0
-1
build class reads in the api call for a class and contructs a class object to be written to a file.
def build_module(json_api_url): resp = urllib.request.urlopen(json_api_url) json_resp = json.load(resp) apis = json_resp['apis'] content = line_format('from canvas_sdk import client, utils', NONE) content += '\n\n' """ Extract the data needed to build the method from the json source ""...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, api=None):\n self.file = open(OUTPUT_FILE, \"w\")", "def createClassFile( p ):\n create_modules( p[\"package\"] )\n name = p[\"protocol\"][\"name\"]\n name.lower()\n path = os.path.join( *p[\"package\"].split( \".\" ) )\n with open( \"./%s/%s.py\" % ( path, name ), \"w\" ) as f:\n ...
[ "0.6720253", "0.6239841", "0.620899", "0.6151118", "0.6045171", "0.5912636", "0.58857656", "0.58770084", "0.58720964", "0.5856519", "0.57769555", "0.575365", "0.5580163", "0.55573606", "0.5530266", "0.55120766", "0.55050176", "0.5504219", "0.5500604", "0.5449884", "0.54467934...
0.0
-1
Create the canvas_sdk/methods directory if it doesn't already exist
def create_sdk_directories(): try: os.makedirs(METHODS_DIR) init_file = METHODS_DIR+'/__init__.py' if not os.path.isfile(init_file): new_init_file = open(init_file, 'w') new_init_file.close() except OSError as exception: if exception.errno != errno.EEXIST...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(argv=None):\n if argv is None:\n argv = sys.argv\n\n parser = argparse.ArgumentParser(description='Build Canvas SDK methods')\n parser.add_argument('-u','--url', help='Base Canvas url, default is (https://canvas.instructure.com)')\n args = vars(parser.parse_args())\n\n \"\"\"\n De...
[ "0.6024213", "0.5447391", "0.54416734", "0.5415922", "0.5409212", "0.5375797", "0.52315885", "0.52250993", "0.51826185", "0.5177353", "0.51455146", "0.5119641", "0.5115451", "0.50884795", "0.50842744", "0.50561905", "0.5041633", "0.5029327", "0.50157297", "0.49913386", "0.497...
0.7748334
0
the main method of the script calls the url provided by the user via command line arguments or a displays a usage message
def main(argv=None): if argv is None: argv = sys.argv parser = argparse.ArgumentParser(description='Build Canvas SDK methods') parser.add_argument('-u','--url', help='Base Canvas url, default is (https://canvas.instructure.com)') args = vars(parser.parse_args()) """ Default to instruct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args):\n parser = create_parser()\n\n if not args:\n parser.print_usage()\n sys.exit(1)\n\n parsed_args = parser.parse_args(args)\n scrape_url(parsed_args.url)", "def main():\n\n # Title\n st.title(\"AB URL Helper\")\n st.subheader(\"Paste URL link below\")\n\n ####...
[ "0.7676096", "0.72840065", "0.7260419", "0.7059537", "0.70089793", "0.7007226", "0.6997864", "0.69791156", "0.69606084", "0.69430315", "0.6926483", "0.6851956", "0.6725049", "0.67130995", "0.67058045", "0.66876036", "0.66785455", "0.6665331", "0.66448766", "0.66308403", "0.66...
0.0
-1
This method is to find scores which are stored in dB.
def __fillScores(self, contentScores): list_of_data_frames = list() for cntScr in contentScores: res = json.loads(cntScr.score) df_pro = pd.DataFrame(res) df_pro["productId_requested"] = cntScr.productId df_pro["cart_score"] = self.cart_score_repository...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db2score(self):\n print(\"db2score\")\n self.score.array_frame_start = self.arrayFrameStart\n self.score.array_frame_end = self.arrayFrameEnd\n self.score.arraySet = self.arraySet\n self.score.arrayGame = self.arrayGame\n self.score.arrayScore = self.arrayScore\n ...
[ "0.6539071", "0.6111469", "0.5994292", "0.59466934", "0.5894456", "0.58336383", "0.58269984", "0.574957", "0.57047516", "0.570122", "0.5692787", "0.5640297", "0.5611841", "0.55991805", "0.55441713", "0.5531436", "0.5517619", "0.5495602", "0.547449", "0.5464151", "0.5445944", ...
0.0
-1
This method demapp entity objects to data frame. It will help programmer to analys using pandas library.
def __object_demapper(self, data: list) -> pd.DataFrame: data = pd.DataFrame.from_records([s.to_dict() for s in data]) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pandas_convert(self):\n data = {}\n\n for names in self.data[0]:\n col_values = []\n\n if names in objects:\n for items in self.data[0][names]:\n col_values = []\n\n col_name = names + \"_\" + items\n\n ...
[ "0.6892027", "0.6508207", "0.6472042", "0.6281258", "0.6169941", "0.61465824", "0.613803", "0.61098313", "0.6088293", "0.6079013", "0.6077937", "0.6062319", "0.60613316", "0.6043503", "0.60430515", "0.60380507", "0.60380507", "0.60380507", "0.60380507", "0.60380507", "0.60256...
0.6550998
1
the method is to calculate the first products.
def __set_bias_score(self, row, best_score): if row.productid == best_score: result = 1 else: result = row.final_score return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_price(self, date = None):\n\t\tif date is None:\n\t\t\tdate = datetime.now()\n\t\tself.price = 0\n\t\t# Getting list of product in cart\n\t\tcontent = self.cart.cart_content_set.all()\n\t\t# Dictionnary in order to compute minimum state of multi promotion\n\t\tstate = {\n\t\t\t'products':{},\n\t\t\t'pr...
[ "0.64534867", "0.644534", "0.644534", "0.6229142", "0.58825815", "0.5860691", "0.5853895", "0.58197695", "0.56922", "0.56867915", "0.5632201", "0.56160545", "0.5575754", "0.55730057", "0.55730057", "0.55730057", "0.5558104", "0.55553544", "0.554885", "0.5529817", "0.5513311",...
0.0
-1
get the top products.
def __get_top(self, result, top=10): result = result.sort_values(by="bias_score", ascending=False).drop_duplicates(subset='productid', keep="first") print(result) result = result[:top].sort_values(by="final_score", ascending=False).productid return list(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_products():\n products = product.Product.query. \\\n order_by(desc(product.Product.likes)).all()[:6]\n context = {\n 'products': products\n }\n return render_template('stores/topstores.html', **context)", "def top(self, **kwargs):\n return self.client.api.top(self.id, **k...
[ "0.82457525", "0.68613315", "0.66651356", "0.6496626", "0.6484569", "0.6435276", "0.63997036", "0.6326196", "0.6323446", "0.6315343", "0.6285002", "0.6270289", "0.62692916", "0.6223334", "0.62199473", "0.6199094", "0.6195963", "0.616619", "0.6165667", "0.6154092", "0.61534995...
0.6796019
2
get the top products with more detail.
def __get_top_with_detail(self, result, top=10): result = result.sort_values(by="bias_score", ascending=False).drop_duplicates(subset='productId', keep="first")[ :top] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_products():\n products = product.Product.query. \\\n order_by(desc(product.Product.likes)).all()[:6]\n context = {\n 'products': products\n }\n return render_template('stores/topstores.html', **context)", "def top(self, **kwargs):\n return self.client.api.top(self.id, **k...
[ "0.7941322", "0.68568563", "0.6373423", "0.63633126", "0.6357755", "0.63397264", "0.6330925", "0.62385094", "0.62217975", "0.6208066", "0.61090535", "0.6041962", "0.6031527", "0.6023199", "0.60011786", "0.59878904", "0.5984639", "0.59839493", "0.59718734", "0.59687245", "0.59...
0.68398494
2
This is prediction method.
def predict(self, products: list): try: self.log.info("Prediction is started.") contentScores: list = self.content_score_repository.get_by_products(products) df = self.__fillScores(contentScores) result = self.__get_top(df) self.log.info("Top values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_prediction(self):\n raise NotImplementedError", "def predict(self):\n raise NotImplementedError", "def predict_proba(self):\n ...", "def _predict(self, x):\n pass", "def _predict(self, testX):\n pass", "def predict(self, predPoints=None):", "def predict_only(...
[ "0.8059006", "0.78803074", "0.7860856", "0.774276", "0.76850456", "0.7635276", "0.760205", "0.75458163", "0.75458163", "0.75458163", "0.7529297", "0.7527876", "0.7512121", "0.7512121", "0.74871856", "0.7483808", "0.7418165", "0.7404916", "0.7338522", "0.7328177", "0.7263635",...
0.0
-1
Gets the variables in the template from the logs limited to the ones represented by asterisks ('') only. These are the only ones being considered in the triples. As the pointers advance on both the log and the template the variables are only collected when is encountered on the template
def __get_vars_list(self, template_idx, log): template = self.templates[template_idx].split() log = log.split() variables = [] pt = pl = 0 while pt < len(template) and pl < len(log): if template[pt] == log[pl]: pt += 1 pl += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_placeholders(template):\n return [p[1] for p in string.Formatter().parse(template)\n if p[1] is not None and len(p[1]) > 0]", "def find_template_variables(code):\n return re.findall(re_template_var, code)", "def get_variables(self):\n return [self.g_t, self.m_t]", "def context(te...
[ "0.5529201", "0.5246363", "0.51169056", "0.5084532", "0.5074781", "0.49252644", "0.4919884", "0.486573", "0.48477352", "0.48411506", "0.48227668", "0.48202914", "0.4777373", "0.476468", "0.47486478", "0.473558", "0.47355154", "0.47204447", "0.47187525", "0.47119597", "0.47052...
0.687035
0
Wait for the call count on the mock to reach or exceed a threashold, or a timeout occurs. Useful for multithreaded testing.
def wait_for_calls(mock, count, timeout_seconds): timeout = datetime.datetime.now() + datetime.timedelta(seconds=timeout_seconds) while mock.call_count < count: time.sleep(0.01) if datetime.datetime.now() > timeout: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_before_call(self):\n while (dt.datetime.now() - self._last_call_ts) <= dt.timedelta(\n seconds=self.api_timeout\n ):\n time.sleep(0.5)\n self._last_call_ts = dt.datetime.now()", "def wait_fluently(condition: Callable, timeout: TimeoutType, err_msg: str):\n ...
[ "0.6498459", "0.6334335", "0.632674", "0.6275306", "0.62697285", "0.6268087", "0.62155145", "0.616202", "0.6141317", "0.61329114", "0.60898757", "0.6051971", "0.60427356", "0.6019092", "0.60161436", "0.6015936", "0.6009689", "0.6005865", "0.596967", "0.5925834", "0.58968174",...
0.7268512
0
Return all states formated as a dictionary
def state_format(states: list) -> list: return list(map(_format_n0, states))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def states():\n states = storage.all(State).values()\n return jsonify([item.to_dict() for item in states])", "def all_states():\n dict = storage.all(State)\n list = []\n for state in dict.values():\n list.append(state.to_dict())\n return jsonify(list)", "def get_states():\n all_stat...
[ "0.77571523", "0.7694623", "0.7661228", "0.7641882", "0.75851685", "0.7568326", "0.7566142", "0.75567716", "0.75191", "0.7493844", "0.7472908", "0.74583113", "0.7420259", "0.740409", "0.73985374", "0.7392214", "0.7369381", "0.73459816", "0.73459816", "0.7301348", "0.7300903",...
0.0
-1
Return a human readable string.
def __str__(self): return f"#{self.number}| {self.active}| {self.name}: {self.desc}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return 'str-human.%s' % self.name", "def __str__(self):\n return f\"{self._desc:16s}\"", "def summary_string(self) -> str:", "def get_human_readable(self):\n\n def yesno(key):\n if getattr(self, key) and getattr(self, key) > 0:\n return \"Y\...
[ "0.7690259", "0.7156136", "0.71460164", "0.7129925", "0.6952552", "0.6923994", "0.689927", "0.6893318", "0.6868879", "0.6835699", "0.6826505", "0.6824305", "0.68146354", "0.6811943", "0.6803569", "0.6789633", "0.6782024", "0.6780865", "0.6779728", "0.6779728", "0.6779728", ...
0.0
-1
Return a string to display in the visual mode.
def __repr__(self): return f"{self.number} {self.name}: {self.desc}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self) -> str:\n return f'[{self.font}]{self.text}[{self.font}]' if self.font else self.text", "def __repr__(self):\n return self._format() if self.always_visible or not self.is_pointless() else ''", "def display(self) -> str:\n lines, _, _, _ = self._display_aux()\n return ...
[ "0.6805551", "0.67020464", "0.6681074", "0.6531612", "0.6505154", "0.64923066", "0.6411581", "0.6372688", "0.62355006", "0.6220548", "0.6206158", "0.6187882", "0.61819524", "0.61762536", "0.6133741", "0.6095917", "0.6095917", "0.6075232", "0.60512745", "0.6040153", "0.6035276...
0.0
-1
Print the description of the measure for the player.
def menu(self): print(f"{str(self)}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self) -> str:\r\n description = \"The player must aim to put the most possible units \" + \\\r\n \"of \" + colour_name(self.colour) + \" on the outer\" +\\\r\n \" perimeter.\"\r\n return description", "def description(self) -> str:\r\n ...
[ "0.6940499", "0.69227624", "0.6609904", "0.65955704", "0.6549176", "0.6460658", "0.6451413", "0.64315027", "0.64310527", "0.63806295", "0.63690436", "0.63690436", "0.63664997", "0.63568395", "0.6350418", "0.6337432", "0.6329141", "0.6290839", "0.6274496", "0.6263658", "0.6253...
0.0
-1
Returns the active status T|F of the measure.
def is_active(self): return self.active
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_lsp_frr_operational_status_active(self):\n return self.__lsp_frr_operational_status_active", "def _tstat_alpha(self):\n return _handle_ab(self._tstat_all, self.use_const)[0]", "def get_status():\n return ('off', 'off')", "def get_current_s(self):\n return 1 if self.ff_states[0] e...
[ "0.65024024", "0.62104243", "0.610275", "0.6102556", "0.6042355", "0.59762746", "0.59715307", "0.59574205", "0.58851373", "0.58848566", "0.586097", "0.58262444", "0.5805399", "0.5769604", "0.5743072", "0.57369876", "0.5720854", "0.56900233", "0.56890976", "0.56871843", "0.568...
0.0
-1
Switches the measure status and returns the correct effect factor.
def update_return_factor(self): if not self.active: effect = self._activate_return_factor() elif self.active: effect = self._deactivate_return_factor() return effect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deactivate_return_factor(self):\n self.active = False\n effect = 1 / self.factor\n return effect", "def _activate_return_factor(self):\n self.active = True\n effect = self.factor\n return effect", "def effectiveness(self):\n self._effectiveness = 0.20 * sel...
[ "0.6460598", "0.6209007", "0.6098955", "0.57197714", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0.565701", "0....
0.5943068
3
Helper function for update_return_factor > activates.
def _activate_return_factor(self): self.active = True effect = self.factor return effect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_return_factor(self):\n if not self.active:\n effect = self._activate_return_factor()\n elif self.active:\n effect = self._deactivate_return_factor()\n return effect", "def _deactivate_return_factor(self):\n self.active = False\n effect = 1 / sel...
[ "0.7619489", "0.7287964", "0.58440965", "0.5589851", "0.55477417", "0.55023503", "0.5478167", "0.5450696", "0.5412159", "0.54077435", "0.5368345", "0.53519577", "0.53423446", "0.53316164", "0.5300739", "0.52776587", "0.5277615", "0.52698386", "0.52678233", "0.52527237", "0.52...
0.7389867
1
Helper function for update_return_factor > deactivates.
def _deactivate_return_factor(self): self.active = False effect = 1 / self.factor return effect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_return_factor(self):\n if not self.active:\n effect = self._activate_return_factor()\n elif self.active:\n effect = self._deactivate_return_factor()\n return effect", "def _activate_return_factor(self):\n self.active = True\n effect = self.facto...
[ "0.72491986", "0.7173555", "0.565905", "0.548633", "0.52655476", "0.52646697", "0.5120895", "0.5088434", "0.50735825", "0.5009577", "0.49936694", "0.4986948", "0.49810562", "0.49603486", "0.49565622", "0.4942595", "0.49352244", "0.4931155", "0.4921053", "0.49184957", "0.49069...
0.8133898
0
Generates JSON for all categories
def allCategoriesJSON(): categories = db_session.query(Category).all() return jsonify(categories=[c.serialize for c in categories])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_categories_handler():\n categories = getAllCategories()\n return jsonify(categories=[i.serialize for i in categories])", "def get_all_categories():\n return jsonify({\n \"success\": True,\n \"categories\": _read_all_categories()\n })", "def categoriesJSON():\n ...
[ "0.80022", "0.7764015", "0.7749237", "0.7702453", "0.7634991", "0.76159203", "0.75909245", "0.7532368", "0.74889326", "0.7449233", "0.74030787", "0.7385225", "0.7377895", "0.7366753", "0.73639095", "0.7266052", "0.721529", "0.714454", "0.7087932", "0.7027108", "0.6994505", ...
0.78281426
1
Generates JSON for a book specified by the book_id
def bookJSON(book_id): book = db_session.query(Book).filter_by(id=book_id).one() return jsonify(book=book.serialize)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_info(book_id):\n\n book = data_manager.get_book(book_id)\n if not book:\n return jsonify({\"error\": \"No book found\"})\n if book.has_records == False:\n return jsonify({'book_id': book_id,\n 'title': book.title,\n 'author': book.author...
[ "0.68194824", "0.66605145", "0.6633134", "0.6563902", "0.65159816", "0.65159816", "0.6498835", "0.6487234", "0.64699584", "0.6375881", "0.6324021", "0.63159806", "0.63023865", "0.6282721", "0.62815195", "0.6272364", "0.60790217", "0.59934425", "0.5943473", "0.5903797", "0.589...
0.8344132
0
Generates JSON for a category with all books in the category Specified by the category_id
def categoryWithBooksJSON(category_id): books = db_session.query(Book).filter_by(category_id=category_id).all() return jsonify(Category=[b.serialize for b in books])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_category_items(category_id):\n items = session.query(Item).filter(Item.category_id == category_id)\n return jsonify(json_list=[i.to_json() for i in items.all()])", "def categoryItemJSON(category_id):\n category = db.getByCategory(category_id)\n items = db.getItemsByCategory(category_id)\n ...
[ "0.7138958", "0.7041303", "0.69258463", "0.6853855", "0.67250127", "0.6645023", "0.66027105", "0.65864533", "0.6539297", "0.6498139", "0.642202", "0.6416721", "0.63761836", "0.6373455", "0.6321239", "0.62749213", "0.62676096", "0.6253013", "0.62493944", "0.6240726", "0.622268...
0.8570861
0