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
Introduces an extra covariate from the top principal component of given genes. The extra covariate is the top principal component of normalized expressions of the selected genes. Adding a covariate from housekeeping pathway can reveal celltypespecific activities in coexpression networks.
def pccovt(dt, dc, namet, genes, condcov=True): import numpy as np nt, ns = dt.shape nc = dc.shape[0] if nt == 0 or ns == 0: raise ValueError('Empty normalized expression.') if len(namet) != nt or dc.shape[1] != ns: raise ValueError('Incompatible input shapes.') t1 = set(genes) - set(namet) if len(t1) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate_append(self, gene):\n gene.chromosome.append(self.tactics.mutate_select())", "def add_computed_gas_concentrations(self):\n # Extract the z-coordinate and T, S, P profile\n zs = self.interp_ds.coords[self.ztsp[0]].values\n Ts = self.interp_ds[self.ztsp[1]].values\n Ss...
[ "0.5194077", "0.5187386", "0.5158979", "0.50324756", "0.50209093", "0.49759465", "0.48945737", "0.48906866", "0.48844033", "0.4860594", "0.48288906", "0.4827173", "0.4805636", "0.47915083", "0.47868857", "0.47625545", "0.47588858", "0.47491845", "0.47405082", "0.47343692", "0...
0.0
-1
Calculate distance between flights [meters]
def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2): return Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_distance(self):\n # set Trigger to HIGH\n GPIO.output(self.GPIO_TRIGGER, True)\n\n # set Trigger after 0.01ms to LOW\n time.sleep(0.00001)\n GPIO.output(self.GPIO_TRIGGER, False)\n\n start_time = time.time()\n stop_time = time.time()\n\n # save St...
[ "0.72201097", "0.71907485", "0.71884704", "0.71884704", "0.71884704", "0.71884704", "0.71884704", "0.7180129", "0.7170095", "0.7147977", "0.71034956", "0.6982827", "0.68724227", "0.6850562", "0.68134516", "0.68134516", "0.67764556", "0.6757319", "0.6689581", "0.6682707", "0.6...
0.65282255
32
Flying formation box calculation
def calculateFFBox(qOfFlights): # if qOfFlights == 2: rows=2; columns=1 # else: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_ft(self):\n \n # Create a function which is able to evaluate B**2\n ffunc = scipy.interpolate.interp1d(self.psigrid, self.e.getF()[self.tind])\n def b2_func(R, Z, psi):\n bt = ffunc(psi)/R\n br = -self.psifunc.ev(R, Z, dy=1)/R\n bz = self.p...
[ "0.64013517", "0.6395771", "0.6101848", "0.60527843", "0.5713939", "0.5679622", "0.5649706", "0.5587416", "0.5569904", "0.55439585", "0.5499885", "0.5495949", "0.54799724", "0.547841", "0.54695714", "0.5405273", "0.5377096", "0.53553575", "0.53518355", "0.53368825", "0.533627...
0.6472747
0
Calculate track [degrees] between flights [degrees]
def calculateTrackBetweenFlights(lat1,lon1,lat2,lon2): return Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['azi1']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def steps_to_angle():\n pass", "def getFlightAngles():\n\n flight_angles = RoboCaller().call(\"getFlightAngles\", \"int\")\n for i in range(len(flight_angles)):\n flight_angles[i] = (flight_angles[i] + 2**15) % 2**16 - 2**15\n return flight_angles", "def getTheta(self, trackWidth):\n leftDist =...
[ "0.61580503", "0.6018533", "0.5900657", "0.5821334", "0.5786489", "0.5732119", "0.5710629", "0.5670621", "0.5646427", "0.56237847", "0.55656844", "0.55639803", "0.55621606", "0.5554743", "0.5529634", "0.5524188", "0.55181473", "0.5487468", "0.5469649", "0.5459477", "0.5450718...
0.7136936
0
Checking if tracks match
def checkTracks(track1,track2): matched=True if abs(track1-track2) <= TRACKS_DIFFERENCE else False return matched
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_matching_tracks(self):\n\n # 5037: Pop 101 (feat. Anami Vice) by Marianas Trench\n # 8755 : Satisfied (feat. Miguel & Queen Latifah) by Sia\n # 6699 : Un Besito Mas (feat. Juan Luis Guerra) by Jesse & Joy\n targets = {5037: '2fGFaTDbE8aS4f31fM0XE4',\n 8755: '1...
[ "0.7484322", "0.7024405", "0.6608633", "0.6429307", "0.6215027", "0.6211795", "0.61840993", "0.617188", "0.615257", "0.61429", "0.61068577", "0.60989845", "0.6077977", "0.6003023", "0.6001033", "0.5992812", "0.59848595", "0.59843254", "0.59752345", "0.59705555", "0.5970469", ...
0.75236106
0
Convert minute decimal to degrees
def convertMinuteDecimalToDregrees(toconvert): converted=[] for toc in toconvert: converted.append(float(toc)/60) return converted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_degrees(value):\n\tdegree = float(value[0][0]) / float(value[0][1])\n\tminutes = float(value[1][0]) / float(value[1][1])\n\tseconds = float(value[2][0]) / float(value[2][1])\n\n\treturn degree + (minutes / 60.0) + (seconds / 3600.0)", "def _degrees_to_decimal(degrees: int = 0, minutes: int = 0, se...
[ "0.7733007", "0.74747765", "0.6911304", "0.667877", "0.6673944", "0.66725844", "0.6526622", "0.6500051", "0.6492633", "0.6422218", "0.6391977", "0.634116", "0.6294259", "0.6272148", "0.62294006", "0.62027407", "0.61648023", "0.6125914", "0.6099448", "0.607805", "0.6066341", ...
0.6169177
16
Returns the latitude and longitude of a point at a distance dist [m] with a degree deg from lat,lon
def getPoint(lat,lon,deg,dist): point={} point['LAT'] = Geodesic.WGS84.Direct(lat,lon,deg,dist)['lat2'] point['LON'] = Geodesic.WGS84.Direct(lat,lon,deg,dist)['lon2'] return point
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearlonlat_zl(lon,lat,lonp,latp): # needed for the next function get_FVCOM_bottom_temp \r\n # approximation for small distance \r\n cp=np.cos(latp*np.pi/180.) \r\n dx=(lon-lonp)*cp\r\n dy=lat-latp \r\n xi=np.argmin(abs(dx)) \r\n yi=np.argmin(abs(dy))\r\n min_dist=111*np.sqrt(dx[xi]**2+dy[y...
[ "0.6628833", "0.6418653", "0.63349956", "0.6279293", "0.6263374", "0.6240362", "0.61993515", "0.61689377", "0.61456704", "0.613241", "0.6097714", "0.6058454", "0.6048507", "0.60454327", "0.6029386", "0.6023586", "0.60026014", "0.6000665", "0.59811217", "0.59565634", "0.592133...
0.7408886
0
Rounding up to next 10th
def roundUP(x): return int(ceil(x / 10.0)) * 10
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_to_ten(number):\n count = len(str(int(number)))\n if number == 1:\n count = 0\n elif number % 10 == 0:\n count = count - 1\n return 10 ** count", "def ceil_10(i: int) -> int:\n return 10 ** (math.ceil(math.log10(i)))", "def round_down(x):\n return int(math.floor(x / 10...
[ "0.7207234", "0.71097803", "0.70817935", "0.6654321", "0.66502357", "0.66133153", "0.6575453", "0.6546644", "0.6546644", "0.65458024", "0.65342224", "0.6529193", "0.64893955", "0.64686424", "0.6445025", "0.64087844", "0.6399145", "0.6374356", "0.63725233", "0.6344676", "0.632...
0.70038676
3
Call in a loop to create terminal progress bar
def printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', printEnd="\r"): percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total))) filledLength = int(length * iteration // total) bar = fill * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_progress_bar():\n\n if simple_tregex_mode:\n total_files = len(list(to_iterate_over.keys()))\n else:\n total_files = sum(len(x) for x in list(to_iterate_over.values()))\n\n par_args = {'printstatus': kwargs.get('printstatus', True),\n 'root': r...
[ "0.7400073", "0.7334518", "0.73030293", "0.72114635", "0.7152515", "0.7069976", "0.70643955", "0.70033044", "0.69770426", "0.697326", "0.6963388", "0.69553655", "0.69377124", "0.6929504", "0.6929504", "0.6929504", "0.6927856", "0.6923215", "0.691907", "0.691907", "0.69161355"...
0.6713112
65
Use the current date, add ".0", to build a suffix for the Docker tag.
def _build_tag_suffix() -> str: now = datetime.datetime.now(tz=datetime.timezone.utc).astimezone() return now.strftime(".%Y%m%d.0")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_time():\n return time.strftime(\"%Y-%m-%d_%I.%M%p_\")", "def build_image_name(self, tag):\n return self.repository_name + ':' + tag", "def date_tag():\n import pylab\n pylab.figtext(0.04, 0.02, str(datetime.datetime.today())[:16], size=8)", "def docker_image_tag(self, app):\n ...
[ "0.6210457", "0.60344297", "0.60149807", "0.5938053", "0.58830386", "0.58757097", "0.58196324", "0.57140756", "0.56970084", "0.5608625", "0.5577733", "0.55712014", "0.54981995", "0.54633343", "0.54130644", "0.5384314", "0.5372933", "0.536144", "0.53580433", "0.5355393", "0.53...
0.7845467
0
Prepare the runtime configuration object.
def build_config( *, quiet: bool, release: str, sp_osi: str | None, tag_suffix: str | None ) -> Config: def osi_version() -> str: """Determine the sp-osi version to use; parse "wip" in a special way.""" if sp_osi is None: return find.find_sp_osi_version() if sp_osi == "wip"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare(self, config, **kwargs):\n pass", "def prepare(ctx, resource_config, **_):\n # Save the parameters\n ctx.instance.runtime_properties['resource_config'] = resource_config", "def prepare(ctx, resource_config, **_):\n # Save the parameters\n ctx.instance.runtime_properties['resource...
[ "0.69406295", "0.67943025", "0.67943025", "0.6721797", "0.6625044", "0.6394849", "0.63929623", "0.63929623", "0.63911015", "0.6372157", "0.62646556", "0.62536085", "0.62495214", "0.62383896", "0.6232336", "0.6195492", "0.61678916", "0.6159406", "0.61367565", "0.6132165", "0.6...
0.0
-1
Determine the sposi version to use; parse "wip" in a special way.
def osi_version() -> str: if sp_osi is None: return find.find_sp_osi_version() if sp_osi == "wip": return find.find_sp_osi_version() + defs.VERSION_WIP_SUFFIX return sp_osi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friendly_of_version(self, ofproto):\n if ofproto.OFP_VERSION == 1:\n _of_version = \"1.0\"\n elif ofproto.OFP_VERSION == 4:\n _of_version = \"1.3\"\n else:\n _of_version = \"Unknown version \" + \\\n str(ofproto.OFP_VERSION)\n...
[ "0.57119393", "0.5551508", "0.5551508", "0.5520948", "0.52187574", "0.5203324", "0.51943564", "0.5150682", "0.51446897", "0.5108943", "0.5092248", "0.50849783", "0.5068254", "0.5054343", "0.50500673", "0.5028197", "0.5011638", "0.5010556", "0.5002635", "0.4990394", "0.4989962...
0.6766283
0
Parse commandline options, gather files, invoke dockerbuild.
def main( *, component: list[str], no_cache: bool, pull: bool, quiet: bool, release: str, sp_osi: str | None, tag_suffix: str | None, ) -> None: def build_component(component: str) -> None: """Rebuild the container for a single component.""" parts: Final = component....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser(\n epilog=main.__doc__, formatter_class=argparse.RawDescriptionHelpFormatter\n )\n parser.add_argument(\n \"-d\", \"--dry-run\", action=\"store_true\", default=0, help=\"Dry run mode.\"\n )\n parser.add_argument(\n \"-v\",\n ...
[ "0.7279959", "0.69949806", "0.68058133", "0.62453103", "0.62307316", "0.6033709", "0.59829897", "0.5977832", "0.5965809", "0.5962728", "0.5942266", "0.59304446", "0.59273386", "0.5906537", "0.5900152", "0.5889238", "0.5850362", "0.58262885", "0.58184934", "0.5806111", "0.5800...
0.5504103
63
Rebuild the container for a single component.
def build_component(component: str) -> None: parts: Final = component.split("-", maxsplit=1) if len(parts) != 2: # noqa: PLR2004 # this will go away with match/case sys.exit(f"Internal error: build_component() invoked with {component=!r}") kolla_component, kolla_service = parts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self):\n self.rebuild = False\n self.redraw = True", "def rebuild(context):\n clean(context)\n build(context, cache=False)", "def main(\n *,\n component: list[str],\n no_cache: bool,\n pull: bool,\n quiet: bool,\n release: str,\n sp_osi: str | None,\n tag_s...
[ "0.5731498", "0.5508753", "0.5297388", "0.5239832", "0.52090853", "0.50444996", "0.5013207", "0.4967973", "0.49337313", "0.49103594", "0.48967397", "0.48830613", "0.48656592", "0.48563054", "0.48440525", "0.48366556", "0.48345816", "0.48149598", "0.48129988", "0.4789811", "0....
0.55748755
1
Returns a dictionary by postal code
def getPostalCodeDic(csvfname = 'CP.csv'): cpdic = {} reader = csv.DictReader(open(csvfname), delimiter=':') for row in reader: cpdic[row['CP']] = row['arrondissement'].split('|')[-1] return cpdic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info_on_postalcode(_, postalcode):\n fourpp = int(postalcode[0:4])\n chars = postalcode[4:6]\n streets = get_streets(fourpp, chars)\n if streets:\n street = streets[0]\n town = street.postcode.city.get_official_name()\n address = street.street\n data = {'found': True...
[ "0.7154499", "0.65496707", "0.6497123", "0.6474546", "0.636072", "0.6249927", "0.6224747", "0.6188381", "0.6188381", "0.61097205", "0.6104695", "0.6028556", "0.60070556", "0.6002241", "0.5994236", "0.599213", "0.59867954", "0.5954562", "0.59533644", "0.5902092", "0.5902092", ...
0.62186724
7
Group some charactesitics by postal code area (first 3 letters)
def postalcode_area_studies(): dfpawnshop = pd.read_csv(pawnmtl.csv) cpdic = getPostalCodeDic() for ik in cpdic.keys(): print ik, cpdic[ik]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_postalCA(self):\n \n index = self.index\n \n if len(self.words[index]['word']) != 3:\n return None, 0\n postal = self.words[index]['word']\n index += 1\n if index == self.length:\n return None, 0\n \n if ...
[ "0.6344374", "0.57528186", "0.568245", "0.56237084", "0.5567839", "0.5556221", "0.54706067", "0.54336405", "0.53458565", "0.5316024", "0.5240724", "0.5203791", "0.5191933", "0.51890206", "0.51539314", "0.5117294", "0.5079633", "0.5059187", "0.50442296", "0.50300467", "0.50061...
0.61772764
1
Fills in placeholders with previous entries (if such available) should be called via ajax (similar to evaluate)
def placeholders_fill_in_last_response(): task_key = request.vars.task_key if auth.is_logged_in(): rows = db(task_query(task_key)).select() if len(rows) > 1: raise RuntimeError("DB error: learn table has too many (%s) entries with task_key=%s, user_id=%s " % (len(rows), task_key, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_placeholder(update):\n pass", "def FillForm(string_for_substitution, dictionary_of_vars):\n return_string = string_for_substitution\n for i in re.findall(\"//%%(.*)%%//\", string_for_substitution):\n return_string = re.sub(\"//%%\" + i + \"%%//\", dictionary_of_vars[i],\n ...
[ "0.55820477", "0.55585647", "0.53613096", "0.5329101", "0.5301409", "0.51870173", "0.5107881", "0.50597113", "0.50417787", "0.50273234", "0.5014483", "0.4979621", "0.49399748", "0.48602873", "0.48537135", "0.4786001", "0.4781956", "0.4773322", "0.47684172", "0.47568554", "0.4...
0.71383286
0
Lists all tasks in one page. (but doesn't interact well)
def overview(): # TODO: fix ajax https://groups.google.com/d/msg/web2py/YyVilc2ywdg/ZLtN3Gg3Ft0J # TODO: fix ?plain link in results from plugin_introspect import get_task_code lesson = request.args[0] # controller with lesson contents # lesson = request.vars.lesson_controller # controller with less...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tasks():\n\n task = Task(connection=connection, cursor=cursor)\n\n all_tasks = task.get_all_tasks()\n\n context = {\n 'all_tasks': all_tasks\n }\n\n return render_template('pages/tables/tasks.html', **context)", "def task_list(request):\n ip = get_ip(request)\n tasks = Task.o...
[ "0.8026122", "0.76993227", "0.7477762", "0.73576254", "0.7288799", "0.7222285", "0.7132676", "0.70180285", "0.69829726", "0.6938006", "0.692218", "0.68650395", "0.68588275", "0.6856229", "0.6855329", "0.6755733", "0.6697299", "0.6679942", "0.66633856", "0.66408896", "0.660845...
0.57762873
80
func returns true only if leave can be granted
def isLeaveLeft(self,leave_type,days): if leave_type == 1 : return days<=self.earned_balance elif leave_type == 2 : return days<=self.hp_balance elif leave_type == 3 : return days*2<=self.hp_balance else : return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_leave_team(uid):\n current_user = get_user(uid=uid)\n current_team = api.team.get_team(current_user[\"tid\"])\n if current_team[\"team_name\"] == current_user[\"username\"]:\n return False\n if current_team[\"creator\"] == uid and current_team[\"size\"] != 1:\n return False\n i...
[ "0.6118813", "0.5955954", "0.5953626", "0.59532577", "0.59532577", "0.585946", "0.5846823", "0.57779187", "0.5727706", "0.5714538", "0.5692051", "0.5681357", "0.5681357", "0.55972326", "0.55932873", "0.5589373", "0.5589373", "0.5589373", "0.5589373", "0.55799425", "0.556054",...
0.60508454
1
For CV Extract val_perc% of the training set as the validation set.
def get_train_val(train: datasets, test_transform: transforms, dataset: str, val_perc: float = 0.1): dataset_length = train.data.shape[0] directory = 'datasets/val_permutations/' create_if_not_exists(directory) file_name = dataset + '.pt' if os.path.exists(directory + file_name): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_train_validation_and_test(num_examples, val_percentage, test_percentage):\n all_samples_idx = np.arange(num_examples)\n np.random.shuffle(all_samples_idx)\n test_examples = int(np.ceil(num_examples * test_percentage))\n val_examples = int(np.ceil(num_examples * val_percentage))\n # Train a...
[ "0.64801544", "0.60825336", "0.60825336", "0.60382175", "0.6003134", "0.5998898", "0.5993488", "0.59562606", "0.59560895", "0.59555876", "0.59392226", "0.58753514", "0.5857634", "0.5845691", "0.5838349", "0.58149654", "0.5813357", "0.58046526", "0.58020353", "0.5790992", "0.5...
0.7022956
0
DNS query to get TXT record list of google networks
def google_rr_dns_query(record: str) -> Optional[str]: try: res = resolver.resolve(record, 'TXT') return str(res.rrset[0].strings[0], 'utf-8') except (resolver.NoAnswer, resolver.NXDOMAIN) as error: raise NetworkError(f'Error querying TXT record for {record}: {error}') from error
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getdns(self):\r\n filename = r\"dns_profiles.txt\"\r\n fp = open(filename)\r\n data = []\r\n for lines in fp.readlines():\r\n data.append(list(map(float, lines.split())))\r\n #use the fundamental string function 'append','split' to extract floating point number...
[ "0.6515697", "0.6348239", "0.6325451", "0.6286375", "0.62465525", "0.6237042", "0.6229455", "0.6229455", "0.6196531", "0.6195094", "0.6082494", "0.60716206", "0.60715824", "0.6052533", "0.60521525", "0.60312563", "0.60121626", "0.5998611", "0.5934739", "0.59268296", "0.590494...
0.6482904
1
Process RR records from google DNS query response
def process_google_rr_ranges(record: str, loader_class): networks = [] includes = [] for field in google_rr_dns_query(record).split(' '): match = RE_IPV4.match(field) if match: networks.append(loader_class(match.groupdict()['prefix'])) continue match = RE_IP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_results(name: str) -> dict:\n full_response = {}\n\n target_name = dns.name.from_text(name)\n\n # lookup CNAME\n response = lookup(target_name, dns.rdatatype.CNAME)\n cnames = []\n if response is not None:\n for answers in response.answer:\n for answer in answers:\n ...
[ "0.66161937", "0.66074276", "0.64001393", "0.6262115", "0.61206967", "0.6015989", "0.59909105", "0.5970188", "0.59087396", "0.59045297", "0.58733094", "0.58220786", "0.58080715", "0.5787766", "0.5785906", "0.576722", "0.56518716", "0.5635267", "0.56103927", "0.560525", "0.560...
0.61517274
4
Fetch Google Cloud network records from DNS
def fetch(self) -> None: self.__networks__.clear() networks = process_google_rr_ranges(self.__address_list_record__, self.loader_class) for network in networks: self.__networks__.append(network) self.updated = datetime.now() self.__networks__.sort(key=attrgetter('vers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getdnsrecords(self, kasserver):\n assert kasserver.get_dns_records(\"example.com\") == self.RESPONSE_PARSED", "def get_dns_records_from_godaddy(self) -> list:\n\n headers = {\"Authorization\": \"sso-key {}:{}\".format(self.api_key, self.secret_key)}\n dns_records = []\n for d...
[ "0.6299495", "0.62732345", "0.62699765", "0.61988145", "0.61988145", "0.60955775", "0.59956884", "0.5995656", "0.5985841", "0.5976454", "0.59750307", "0.59472066", "0.59440017", "0.5943444", "0.5930596", "0.5923132", "0.5863196", "0.5852882", "0.5832026", "0.580668", "0.57661...
0.579002
20
Fill the missing values(NaN) in a column with the mode of that column
def fill_with_mode(filename, column): df=None df=pd.read_csv(filename) df[column].fillna(df[column].mode()[0], inplace=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode_impute(self, column_val):\n mode = column_val.mode()[0]\n column_val = column_val.fillna(mode)\n return column_val", "def mode(x):\n return np.nan if x.isnull().all() else x.value_counts().index[0]", "def fillna_mode(data, columns, verbose=True):\n for col in columns:\n ...
[ "0.7750419", "0.763749", "0.73803926", "0.697029", "0.6689113", "0.64293534", "0.62759024", "0.61410797", "0.6137281", "0.5843072", "0.5806205", "0.5802235", "0.572879", "0.56844723", "0.5682938", "0.55548185", "0.54915226", "0.54466385", "0.5386464", "0.53801", "0.53771603",...
0.7190468
3
Fill the missing values(NaN) in column with the mean value of the group the row belongs to. The rows are grouped based on the values of another column
def fill_with_group_average(df, group, column): #df=None df[column].fillna(df.groupby(group)[column].transform('mean'), inplace=True) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_mean(df):\n df = df.fillna(df.mean().fillna(0).to_dict())\n return df", "def mean_impute(self, column_val):\n mean = np.mean(column_val)\n column_val = column_val.fillna(mean)\n return column_val", "def filling_nan_values(df: pd.DataFrame) -> pd.DataFrame: \n ratio = df.c...
[ "0.733223", "0.6911329", "0.6804728", "0.6377485", "0.63724154", "0.6184612", "0.6125718", "0.61130387", "0.61074495", "0.60799503", "0.6020397", "0.6011322", "0.6011322", "0.59590447", "0.58487135", "0.5830829", "0.5822329", "0.58109444", "0.57864994", "0.57757205", "0.57416...
0.8269875
0
Return all the rows(with all columns) where the value in a certain 'column' is greater than the average value of that column. row where row.column > mean(data.column)
def get_rows_greater_than_avg(df, column): df= df[df[column] > df[column].mean()] return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_rows_by_highest_abs_val_mean(df, max_=MAX_NUM_ROWS):\n top_rows = numpy.abs(df.mean(axis=1)).nlargest(max_)\n return df.ix[top_rows.index]", "def demo_one_filter():\n data = [1.3, 2.7, 0.8, 4.1, 4.3, -0.1]\n avg = np.mean(data)\n print \"average value is:\", avg\n\n # create iterator...
[ "0.6379522", "0.6149635", "0.58458763", "0.5754565", "0.56743234", "0.56359506", "0.56359506", "0.56054884", "0.56054884", "0.54775643", "0.5467246", "0.5397171", "0.5395946", "0.5346881", "0.5316547", "0.5313301", "0.5276455", "0.52631354", "0.524703", "0.52108675", "0.52035...
0.8586459
0
Takes a junitxml filename or path to said file. From this file it extracts the testsuite node and adds it to the junit_docker.xml file, in the process it adds a name to the testsuite (the suite param) and changes the classname from tests. to {suite}. Finaly, it removes the original file. This is because jenkins was not...
def merge_to_junit_xml(filename: str, suite: str) -> None: junit_docker = Path("junit_docker.xml") if junit_docker.exists(): tree = ElementTree.parse(junit_docker) root = tree.getroot() for testsuite in root: if testsuite.get("name", None) == suite: root.remov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_xunit(self, filename):\n suite_node = ElementTree.Element(\"testsuite\")\n suite_node.attrib[\"name\"] = self.testsuite.name\n suite_node.attrib[\"tests\"] = str(self.testsuite.ntests)\n suite_node.attrib[\"failures\"] = str(self.testsuite.nfailed)\n if self.testsuite.pack...
[ "0.6713883", "0.58498186", "0.5828557", "0.57560843", "0.5434094", "0.54201895", "0.54086524", "0.53342706", "0.532954", "0.53058827", "0.52480894", "0.5212408", "0.52075857", "0.5189893", "0.51804215", "0.5173441", "0.5135969", "0.5100733", "0.5098095", "0.50912726", "0.5074...
0.84821534
1
get all versions of inmanta packages into a freeze file, to make the environment inside docker like the one outside
def pip_lock_file() -> None: with open("requirements.freeze.all", "w") as ff: subprocess.check_call([sys.executable, "-m", "pip", "freeze"], stdout=ff) with open("requirements.freeze.tmp", "w") as ff: subprocess.check_call(["grep", "inmanta", "requirements.freeze.all"], stdout=ff) # pip free...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze():\n dependencies = sh('pip freeze', capture=True).split(os.linesep)\n\n with open('requirements.txt', 'w') as file:\n for dep in dependencies:\n if not dep.startswith('bones-testing'):\n file.write(dep+'\\n')", "def freeze():\n proc = subprocess.run(['pip', '...
[ "0.71111107", "0.6972196", "0.6772253", "0.6622416", "0.6376752", "0.62745297", "0.6273083", "0.62702495", "0.6251193", "0.60614055", "0.5943885", "0.592271", "0.58881456", "0.5876001", "0.58746445", "0.57682693", "0.5724752", "0.570974", "0.56927276", "0.56916934", "0.567225...
0.70190084
1
Return the list of docker files that should be used to run the tests against.
def _get_dockerfiles_for_test() -> str: project_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) dockerfiles_dir = os.path.join(project_root_dir, "dockerfiles") if sys.version_info[0:2] == (3, 6): return os.path.join(dockerfiles_dir, "centos7.Dockerfile") elif sys.version_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_docker_files():\n docker_dirs = []\n if os.path.exists(TMP_DIR):\n docker_dirs = [os.path.join(TMP_DIR, d) for d in os.listdir(TMP_DIR)\n if os.path.isdir(os.path.join(TMP_DIR, d)) and\n not d.endswith('_working')]\n docker_dirs.sort(key=lamb...
[ "0.7441755", "0.64881", "0.64146507", "0.63096654", "0.6147907", "0.61174136", "0.6047549", "0.6022984", "0.6019697", "0.59687704", "0.59673595", "0.5958125", "0.5927277", "0.5920401", "0.5885158", "0.58813536", "0.58701384", "0.58612794", "0.58572733", "0.5732197", "0.573187...
0.75666106
0
log_loss / cross_entropy / categorical_crossentropy X is the logits y is labels (num_examples, 1) Note that y is not onehot encoded vector. It can be computed as y.argmax(axis=1) from onehot encoded vectors of labels if required.
def cross_entropy(X, y, using_onehot=True): M = y.shape[0] if using_onehot : log_likelihood = -np.log(np.max(X * y, -1)) else: log_likelihood = -np.log(X[range(M), y]) # 找到y对应的那个类别所对应的logit loss = np.sum(log_likelihood) / M return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_cross_entropy(y, label):\r\n losses = np.sum((- np.log(y + g_epsilon) * label), axis=1)\r\n return losses\r\n pass", "def cross_entropy_loss(self, logits, labels):\n return F.cross_entropy(logits, labels)", "def softmax_cross_entropy_loss(logit, labels):\n p = softmax(logit)\n ...
[ "0.7834664", "0.7679004", "0.7651251", "0.7648797", "0.7558988", "0.7466316", "0.74370956", "0.73649174", "0.7329104", "0.731339", "0.7216395", "0.72037876", "0.71983844", "0.71960145", "0.71808535", "0.7131986", "0.7122538", "0.7113255", "0.70872647", "0.7056309", "0.7031268...
0.8200977
0
Goes through the first column of input table and returns the first sequence of dates it finds.
def get_dates(raw_table) -> "list of dates": dates = [] found_first = False for i, dstr in enumerate([raw_table[i][0] for i in range(0, len(raw_table))]): if dstr: if len(dstr.split("/")) == 3: d = datetime.datetime.strptime(dstr, '%m/%d/%Y') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_date(self, rows: List[Row], column: DateColumn) -> Date:\n cell_values = [row.values[column.name] for row in rows if row.values[column.name] is not None]\n if not cell_values:\n return Date(-1, -1, -1)\n if not all([isinstance(value, Date) for value in cell_values]):\n ...
[ "0.6035555", "0.60046345", "0.5898772", "0.5828134", "0.58066106", "0.5686725", "0.5653263", "0.56269705", "0.56151915", "0.5590684", "0.54638934", "0.54195327", "0.54144526", "0.5412872", "0.5412872", "0.5394708", "0.5388206", "0.5380963", "0.5372471", "0.5351405", "0.529901...
0.65179384
0
Returns a table with the above typesignature
def get_main(self) -> 'table[category: str][label: str][date: date]': raw_table = self.get_raw_table("M") categories = raw_table[0] labels = raw_table[1] dates = self.get_dates(raw_table) def next_cat_col(i): n = 1 while True: if i+n > le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tabletype(cls) -> str:\n raise NotImplementedError", "def table_fields() -> Dict[str, TableFieldDetails]:\n return {\n \"REPEATS\": TableFieldDetails(\n subtype=\"uint\",\n bit_low=0,\n bit_high=15,\n description=\"Number of times the line wil...
[ "0.6464375", "0.640342", "0.63984394", "0.6265669", "0.6230377", "0.6176702", "0.6088018", "0.60787135", "0.6041828", "0.59850144", "0.5953835", "0.5947861", "0.59363157", "0.5927567", "0.5908001", "0.59076387", "0.5898174", "0.5863914", "0.584051", "0.58125615", "0.58109164"...
0.0
-1
Invoke aggregation functions on the groups.
def agg(self, args): result = DataFrame() add_col_values = True ctx = ffi.new('gdf_context*') ctx.flag_sorted = 0 ctx.flag_method = self._method ctx.flag_distinct = 0 sort_result = True if not isinstance(args, str) and isinstance( args, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agg(self, values, agg_func):\n assert len(values) > 0, \"Empty list of values\"\n f = agg_func.strip().lower()\n assert f in self.__AGGREGATIONS, \"Aggregation function \" + agg_func + \" is not valid\"\n\n ret = 0 # just to avoid \"Local variable might be referenced before assignm...
[ "0.66204065", "0.6618009", "0.65976167", "0.6521944", "0.6484414", "0.6461728", "0.62845874", "0.6251258", "0.62443835", "0.6219322", "0.621212", "0.61765426", "0.6172474", "0.61363953", "0.61157423", "0.61086196", "0.6084602", "0.6065689", "0.60556585", "0.604062", "0.600465...
0.0
-1
Initialize parameters and build model. Params ======
def __init__(self, state_size, action_size, seed, fc1_units=400, fc2_units=300): super(Actor, self).__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Linear(state_size, fc1_units) self.fc2 = nn.Linear(fc1_units, fc2_units) self.fc3 = nn.Linear(fc2_units, action_size) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)\n self._params = self.find_params()", "def build_model():", "def build_model(self):\n pass", "def build_model(self):\n pass", "def __init__(self, param_dictionary):\n\n BaseModel.__init__(self)\n\n ...
[ "0.79983556", "0.77646637", "0.73733515", "0.73733515", "0.72585744", "0.7250074", "0.7170411", "0.71661454", "0.7156735", "0.70888656", "0.70778716", "0.70772207", "0.7069133", "0.70286226", "0.70094854", "0.697547", "0.69357735", "0.6890618", "0.6884159", "0.6858014", "0.68...
0.0
-1
Build an actor (policy) network that maps states > actions.
def forward(self, state): x = F.relu(self.fc1(state)) x = F.relu(self.fc2(x)) return F.tanh(self.fc3(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ...
[ "0.6934474", "0.6363443", "0.6269951", "0.6208458", "0.6200558", "0.6186873", "0.6146386", "0.61460924", "0.6127505", "0.6019301", "0.60004425", "0.5977054", "0.59594935", "0.5952402", "0.59490156", "0.5928663", "0.59146357", "0.58966", "0.58931005", "0.5890896", "0.5879405",...
0.0
-1
Initialize parameters and build model. Params ======
def __init__(self, state_size, action_size, seed, fcs1_units=400, fc2_units=300): super(Critic, self).__init__() self.seed = torch.manual_seed(seed) self.fcs1 = nn.Linear(state_size, fcs1_units) self.fc2 = nn.Linear(fcs1_units+action_size, fc2_units) self.fc3 = nn.Linear(fc2_unit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)\n self._params = self.find_params()", "def build_model():", "def build_model(self):\n pass", "def build_model(self):\n pass", "def __init__(self, param_dictionary):\n\n BaseModel.__init__(self)\n\n ...
[ "0.79983556", "0.77646637", "0.73733515", "0.73733515", "0.72585744", "0.7250074", "0.7170411", "0.71661454", "0.7156735", "0.70888656", "0.70778716", "0.70772207", "0.7069133", "0.70286226", "0.70094854", "0.697547", "0.69357735", "0.6890618", "0.6884159", "0.6858014", "0.68...
0.0
-1
Build a critic (value) network that maps (state, action) pairs > Qvalues.
def forward(self, state, action): xs = F.relu(self.fcs1(state)) x = torch.cat((xs, action), dim=1) x = F.relu(self.fc2(x)) return self.fc3(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mdp, discount=0.9, iterations=100):\n self.mdp = mdp\n self.discount = discount\n self.iterations = iterations\n self.values = util.Counter() # A Counter is a dict with default 0\n self.actions = {}\n\n # iterating over all states and over all possible ...
[ "0.6132123", "0.59163797", "0.59157", "0.58904874", "0.5794722", "0.57863766", "0.5771404", "0.57188874", "0.5713755", "0.57092625", "0.5698217", "0.5637596", "0.5634502", "0.55850405", "0.5553164", "0.55405605", "0.55399173", "0.5538429", "0.55051076", "0.5504184", "0.548564...
0.0
-1
Initialize an Agent object. Params ======
def __init__(self, state_size, action_size, random_seed): self.state_size = state_size self.action_size = action_size self.seed = random.seed(random_seed) # Actor Network (w/ Target Network) self.actor_local = Actor(state_size, action_size, random_seed).to(device) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self, parameters, agent_parameters):\n pass", "def agent_init(self):\n pass", "def __init__(self, agent: AEA) -> None:\n self._agent = agent\n super().__init__()", "def __init__(self, agent):\n self.agent = agent", "def __init__(self, env, agent, agent_config, re...
[ "0.79139704", "0.79062563", "0.7890495", "0.78534234", "0.7575216", "0.7516901", "0.73301405", "0.73091286", "0.7075451", "0.7004984", "0.6965934", "0.6950615", "0.69317085", "0.6925955", "0.6921634", "0.69078135", "0.69025207", "0.6858101", "0.6774211", "0.6771336", "0.67638...
0.0
-1
Save experience in replay memory, and use random sample from buffer to learn.
def step(self, state, action, reward, next_state, done): # Save experience / reward self.memory.add(state, action, reward, next_state, done) # Learn, if enough samples are available in memory if len(self.memory) > BATCH_SIZE: experiences = self.memory.sample() se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experience_replay(self):\n s,a,r,sp,done = self.memory.sample(self.batch_size)\n # TODO: 5 lines missing.\n raise NotImplementedError(\"\")\n self.Q.fit(s, target=target)", "def learn(self, observation, action, reward, next_observation):\n\n # log transition in replay buffe...
[ "0.7433853", "0.7182571", "0.6887522", "0.6787751", "0.67327946", "0.66384697", "0.66352594", "0.66169816", "0.6545486", "0.64974546", "0.6452976", "0.63883555", "0.63314533", "0.62207323", "0.6160261", "0.6122092", "0.6121862", "0.60919756", "0.600603", "0.60014266", "0.5992...
0.57875043
44
Returns actions for given state as per current policy.
def act(self, state, add_noise=True): state = torch.from_numpy(state).float().to(device) self.actor_local.eval() with torch.no_grad(): action = self.actor_local(state).cpu().data.numpy() self.actor_local.train() if add_noise: action += self.noise.sample() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActions(self, state): \n util.raiseNotDefined()", "def get_available_actions(self, state):\n pass", "def getLegalActions(self, state):\n return self.actionFn(state)", "def getLegalActions(self,state):\n return self.actionFn(state)", "def get_actions(self, state: TState...
[ "0.81847", "0.78752404", "0.77772415", "0.77585727", "0.7377628", "0.73220915", "0.72467107", "0.72087854", "0.7112076", "0.71091956", "0.7075793", "0.706494", "0.70488673", "0.7009308", "0.7006878", "0.69928527", "0.6989333", "0.69823205", "0.6970077", "0.695084", "0.6893704...
0.0
-1
Initialize parameters and noise process.
def __init__(self, size, seed, mu=0., theta=0.15, sigma=0.2): self.mu = mu * np.ones(size) self.theta = theta self.sigma = sigma self.seed = random.seed(seed) self.reset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noisePreset() :\n s.noisePreset()", "def __init__(self, init_pos, init_stdev, num_particles, sense_noise):\n self.particles = np.random.multivariate_normal(\n init_pos, [[init_stdev**2, 0], [0, init_stdev**2]], num_particles)\n self.weights = np.array(\n [1. / num_parti...
[ "0.7101346", "0.70631665", "0.6602473", "0.6492304", "0.6487118", "0.6473944", "0.6457828", "0.64518017", "0.6436474", "0.64171517", "0.6410189", "0.64020544", "0.63967407", "0.63947", "0.63871187", "0.6379632", "0.6376569", "0.6375367", "0.63648623", "0.636282", "0.6358098",...
0.0
-1
Reset the internal state (= noise) to mean (mu).
def reset(self): self.state = copy.copy(self.mu)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.noise.reset()", "def reset_mean(self,new_mean):\n self.mean = new_mean\n return", "def reset_mean(self,new_mean):\n self.mean = new_mean\n return", "def reset(self):\r\n self.state = copy.copy(self.mu)", "def reset_noise(self):\n self...
[ "0.74993044", "0.731824", "0.731824", "0.7221547", "0.7054404", "0.6920203", "0.6804126", "0.6722018", "0.6638218", "0.6487654", "0.64531523", "0.644851", "0.6378336", "0.6294833", "0.6273222", "0.62725455", "0.62401325", "0.6212884", "0.620958", "0.6179472", "0.61784506", ...
0.7179871
13
Update internal state and return it as a noise sample.
def sample(self): x = self.state dx = self.theta * (self.mu - x) + self.sigma * np.array([random.random() for i in range(len(x))]) self.state = x + dx return self.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(self):\r\n if self.buffer_offset + self.frames_per_buffer - 1 > self.x_max:\r\n #relleno con ceros al final si es necesario\r\n xs = np.arange(self.buffer_offset, self.x_max)\r\n tmp = np.random.random_sample(len(xs)) #ruido\r\n out = np.append(tmp, np.z...
[ "0.714246", "0.70262074", "0.7019928", "0.7017388", "0.70095986", "0.70085543", "0.69479555", "0.6933186", "0.6918169", "0.69066644", "0.6793376", "0.679279", "0.6706677", "0.6600781", "0.65804875", "0.658038", "0.6545549", "0.65050507", "0.65047514", "0.6486035", "0.6478043"...
0.696567
10
Initialize a ReplayBuffer object. Params ======
def __init__(self, action_size, buffer_size, batch_size, seed): self.action_size = action_size self.memory = deque(maxlen=buffer_size) # internal memory (deque) self.batch_size = batch_size self.experience = namedtuple("Experience", field_names=["state", "action", "reward", "next_state"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_buffers(self) -> None:", "def __init__(self,buffer_size,state_dim,action_dim,random_seed=123):\n print(\"Creating Replay Buffer object\")\n self.buffer_size=buffer_size\n self.state_dim=state_dim\n self.action_dim=action_dim\n self.pointer=0\n self.states...
[ "0.7179922", "0.71348315", "0.7095774", "0.7038826", "0.6901109", "0.68320125", "0.6716544", "0.66727585", "0.66353625", "0.66353625", "0.6620665", "0.66036975", "0.6512894", "0.6481674", "0.63724715", "0.6287487", "0.62687814", "0.62557834", "0.62473136", "0.6244778", "0.623...
0.0
-1
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): e = self.experience(state, action, reward, next_state, done) self.memory.append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71451885", "0.7106998", "0.7101183", "0.69837016", "0.68905056", "0.68842727", "0.6755663", "0.6712557", "0.6677425", "0.64961654", "0.6488678", "0.6486...
0.71984994
19
Randomly sample a batch of experiences from memory.
def sample(self): experiences = random.sample(self.memory, k=self.batch_size) states = torch.from_numpy(np.vstack([e.state for e in experiences if e is not None])).float().to(device) actions = torch.from_numpy(np.vstack([e.action for e in experiences if e is not None])).float().to(device) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experience_replay(batch_size):\n memory = []\n while True:\n experience = yield rsample(memory, batch_size) if batch_size <= len(memory) else None\n memory.append(experience)", "def sample(self):\n sample_ind = np.random.choice(len(self.memory), self.batch_size)\n # get the ...
[ "0.7664635", "0.74570787", "0.743932", "0.7405311", "0.7355313", "0.72966963", "0.7283894", "0.7274549", "0.7262714", "0.72463816", "0.7175717", "0.70837855", "0.70716524", "0.6962316", "0.69450194", "0.69399315", "0.6939355", "0.68166035", "0.68011534", "0.6798414", "0.67423...
0.72717017
9
Return the current size of internal memory.
def __len__(self): return len(self.memory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573752", "0.82169205", "0.8200361", "0.8087402", "0.8021614", "0.7890747", "0.78219426", "0.78017354", "0.77905464", "0.7758844", "0.77559924", "0.77559924", "0.775519", "0.77544576", "0.7733221", "0.7732168", "0.7720068", "0.77145016", "0.77092093", "0.77077913", "0.7697...
0.75127405
56
Returns the list of tweets with a given hashtag in JSON format
def getByHashtags(hashtag): # set page_limits. The default is 1 pages_limit = request.args.get('pages_limit') or 1 pages_limit = int(pages_limit) raw_response = get_response(tw_api, 'search/tweets', { 'q': '#' + hashtag, 'count': 100 }, pages_limit) list_response = convert_resp2list(raw_response)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_by_hashtag(tweets: list, hashtag: str) -> list:\n tweets_with_hashtag = {} # findall(): Kui tekstis on rohkem kui üks regulaaravaldisele vastav alamsõne saab kõikide vastete järjendi moodustada funktsiooniga findall()\n pattern = r\"#\\w+\" # \\w : tähed, numbrid, alakriips, + : 1 või rohkem\n ...
[ "0.76560086", "0.7615131", "0.7581406", "0.74934655", "0.7097482", "0.6735754", "0.66883725", "0.6683702", "0.6654017", "0.6516785", "0.6509575", "0.6500619", "0.64606947", "0.64300966", "0.6401342", "0.6375272", "0.63466364", "0.62755454", "0.62103456", "0.62082505", "0.6136...
0.8051795
0
Returns the list of tweets that certain user has on his/her own feed in JSON format
def getByUser(user): # set page_limits. The default is 1 pages_limit = request.args.get('pages_limit') or 1 pages_limit = int(pages_limit) raw_response = get_response(tw_api, 'statuses/user_timeline', {'screen_name' : user, 'count': 100 }, pages_limit) list_response = convert_resp2list(raw_respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tweets():\n tweets = []\n tuples = query_db('''\n select message.*, user.* from message, user\n where message.author_id = user.user_id\n order by message.pub_date desc limit ?''', [PER_PAGE])\n for tuple in tuples:\n tweet = {}\n tweet[\"username\"] = tuple['use...
[ "0.76220906", "0.7430845", "0.73542595", "0.7189915", "0.7110895", "0.7102954", "0.7074875", "0.70694584", "0.70401484", "0.70161813", "0.69428825", "0.6917667", "0.6847355", "0.6838028", "0.6788498", "0.67787576", "0.674706", "0.67252034", "0.67236316", "0.67139184", "0.6710...
0.6519412
32
Test that density function matches PREM data
def test_density(self, radius, density): earth = PREM() assert earth.density(radius) == pytest.approx(density, rel=1e-5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_density_multiple(self):\n earth = PREM()\n radii = np.linspace(0, 6500e3, 6501)\n expected = [earth.density(r) for r in radii]\n assert np.array_equal(earth.density(radii), expected)", "def test_probability_density(self):\n # Setup\n copula = GaussianMultivariat...
[ "0.7480488", "0.7271635", "0.703942", "0.6949342", "0.68497336", "0.6821402", "0.63796705", "0.62271595", "0.6138389", "0.6098383", "0.6075495", "0.6065135", "0.6052958", "0.6026504", "0.60213983", "0.59962875", "0.5994202", "0.59728694", "0.59714186", "0.5946404", "0.5934536...
0.7195933
2
Test density function for multiple values at once
def test_density_multiple(self): earth = PREM() radii = np.linspace(0, 6500e3, 6501) expected = [earth.density(r) for r in radii] assert np.array_equal(earth.density(radii), expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_density_multiple(self):\n earth = CoreMantleCrustModel()\n radii = np.linspace(0, 6500e3, 6501)\n expected = [earth.density(r) for r in radii]\n assert np.array_equal(earth.density(radii), expected)", "def test_probability_density(self):\n # Setup\n copula = Gau...
[ "0.72719777", "0.6636601", "0.62585735", "0.6246495", "0.6211138", "0.61260253", "0.6116143", "0.61090654", "0.60379136", "0.603717", "0.60360193", "0.6025429", "0.5937065", "0.5931737", "0.58895713", "0.58884156", "0.58661264", "0.5830155", "0.58052385", "0.5774332", "0.5773...
0.73319197
0
Test that density function matches expected values
def test_density(self): earth = CoreMantleCrustModel() assert earth.density(0) == 14 assert earth.density(1e6) == 14 assert earth.density(3.464e6) == 14 assert earth.density(3.5e6) == 3.4 assert earth.density(5e6) == 3.4 assert earth.density(6.338e6) == 3.4 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_probability_density(self):\n # Setup\n copula = GaussianMultivariate(GaussianUnivariate)\n copula.fit(self.data)\n X = np.array([2000., 200., 0.])\n expected_result = 0.032245296420409846\n\n # Run\n result = copula.probability_density(X)\n\n # Check...
[ "0.7774412", "0.74849635", "0.74603015", "0.73902315", "0.7264768", "0.71258044", "0.70391285", "0.66695005", "0.6665446", "0.65862334", "0.65077114", "0.65031046", "0.64996", "0.6485135", "0.64739573", "0.64614797", "0.641072", "0.6374778", "0.6325379", "0.6299548", "0.62893...
0.74113595
3
Test density function for multiple values at once
def test_density_multiple(self): earth = CoreMantleCrustModel() radii = np.linspace(0, 6500e3, 6501) expected = [earth.density(r) for r in radii] assert np.array_equal(earth.density(radii), expected)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_density_multiple(self):\n earth = PREM()\n radii = np.linspace(0, 6500e3, 6501)\n expected = [earth.density(r) for r in radii]\n assert np.array_equal(earth.density(radii), expected)", "def test_probability_density(self):\n # Setup\n copula = GaussianMultivariat...
[ "0.73319197", "0.6636601", "0.62585735", "0.6246495", "0.6211138", "0.61260253", "0.6116143", "0.61090654", "0.60379136", "0.603717", "0.60360193", "0.6025429", "0.5937065", "0.5931737", "0.58895713", "0.58884156", "0.58661264", "0.5830155", "0.58052385", "0.5774332", "0.5773...
0.72719777
1
Do we already have a Perforce changelist for this commit, this branch_id?
def _already_copied_commit(self, commit_sha1, branch_id): if not self.already_copied_commit_runner: return False return self.already_copied_commit_runner.already_copied_commit( commit_sha1, branch_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_overlap(self, fe_commit):\n # +++ Avoid O(b branches * r rev) checks when\n # overlap is impossible because current branch\n # overlaps no other branch.\n if self._current_branch not in self._overlapping_branch_list():\n...
[ "0.64315134", "0.6328375", "0.6261193", "0.6239598", "0.6227657", "0.59354573", "0.5868586", "0.5824664", "0.5822315", "0.5812011", "0.5798778", "0.5786599", "0.5727815", "0.57184166", "0.5701332", "0.566373", "0.5639015", "0.5632566", "0.5618279", "0.5603345", "0.5570023", ...
0.59355044
5
Inflate a partiallycreated Branch with a proper depot branch to hold its files, and a branch view to map that depot branch to the Git work tree.
def finish_branch_definition(self, commit, branch): assert self._finish_branch_definition self._finish_branch_definition.finish_branch_definition(commit, branch) self._invalidate_branch_cache()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gitShowBranch(self):\n self.vcs.gitShowBranch(self.project.getProjectPath())", "def build_backbone(self):\n backbone = self.arch.backbone\n self.backbone = build_blocks(backbone, 'backbone')", "def ensure_branch_preflight(self, commit, branch_id):\n log = LOG.getChild('ensure_...
[ "0.5416224", "0.5366409", "0.52509016", "0.51907897", "0.5136267", "0.50686383", "0.50684017", "0.503435", "0.50267994", "0.5008548", "0.49765694", "0.4954662", "0.48620453", "0.48607203", "0.48550877", "0.48112443", "0.47259447", "0.47248703", "0.47190118", "0.47162136", "0....
0.46080792
36
Run a preflight check on a set of commits from Git.
def check_prt_and_commits(self, prt, commits, marks): self._current_prt = prt self.fast_export_marks = marks self.fast_export_marks.set_head(prt.ref) self.check_p4gf_user_write_permission() self.check_commits(commits)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_commits(self, commits):\n LOG.info('Checking Perforce permissions and locks')\n self.ctx.checkpoint(\"copy_to_p4._preflight_check\")\n\n # Stop if files are opened in our repo client\n # We expect this to be none, since we have the view lock\n opened = self.ctx.p4.run([...
[ "0.67673117", "0.66285557", "0.64389014", "0.6341568", "0.603385", "0.5920693", "0.5874083", "0.5823515", "0.56425464", "0.56258106", "0.5607207", "0.5594147", "0.5505189", "0.5428804", "0.54132754", "0.5401277", "0.5383099", "0.5375471", "0.53560066", "0.53531677", "0.535282...
0.0
-1
Ensure gitfusionuser has permissions to write to depot.
def check_p4gf_user_write_permission(self): gf_client_map = P4.Map() gf_client_map.insert("//...", "//client/...") utp = p4gf_protect.UserToProtect(self.ctx.p4) prot = utp.user_to_protect(p4gf_const.P4GF_USER) gf_write_filter = prot.map_for_perm(p4gf_protect.WRITE) gf_wri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_writable_(self):\n self._check_within_context_()\n if self._mode != 'w':\n raise Exception('Cannot update database: read only mode')", "def fix_permissions(cls):\n\n try:\n build_dir = environ[\"TRAVIS_BUILD_DIR\"]\n commands = [\n \...
[ "0.61675584", "0.59262735", "0.5913495", "0.57361317", "0.57273996", "0.5724241", "0.5694993", "0.56913006", "0.56799525", "0.56661433", "0.56573737", "0.5642319", "0.5618935", "0.56070924", "0.5567714", "0.5564018", "0.5546084", "0.55418223", "0.5533661", "0.54613906", "0.54...
0.66640127
0
Return a dict of depot_path => user of any locked files.
def _find_locked_by(self): fstat_flags = NTR('otherLock | otherOpen0 & headType=*+l') any_locked_files = {} # depot_path : user for branch_chunk in self.ctx.iter_writable_branch_chunks(): # Skip any newly defined branches: they're new, won't contain any # files yet, and ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLockInfoOfNonDerivedFiles(self, ids, wspLockId):\n sql = \"\"\"\n SELECT cdb_file.cdb_lock,\n cdb_file.cdb_lock_id,\n cdb_file.cdbf_object_id,\n cdb_file.cdb_object_id,\n angestellter.name AS mapped_cdb_lock_name\n FROM\n ...
[ "0.5967704", "0.58132005", "0.5756078", "0.5530532", "0.55011237", "0.54566556", "0.538601", "0.5357067", "0.5334322", "0.5324496", "0.53202266", "0.5259777", "0.5258062", "0.5243739", "0.5193406", "0.5120801", "0.50814766", "0.5075854", "0.5063202", "0.50581175", "0.5055285"...
0.7146783
0
Ensure the entire sequence of commits will (likely) go through without any errors related to permissions or locks. Raises an exception if anything goes wrong.
def check_commits(self, commits): LOG.info('Checking Perforce permissions and locks') self.ctx.checkpoint("copy_to_p4._preflight_check") # Stop if files are opened in our repo client # We expect this to be none, since we have the view lock opened = self.ctx.p4.run(['opened', '-m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_commit(self):\n # TODO: Test errors while committing and recovery\n pass", "def commit_unless_managed(self):\n if not self.is_managed():\n self.commit()", "def check_commit(self, commit):\n # pylint: disable=too-many-branches\n if LOG.isEnabledFor(logging....
[ "0.70281065", "0.62827456", "0.61202234", "0.6114499", "0.6076478", "0.6076178", "0.60664564", "0.6021291", "0.6021291", "0.6021291", "0.6021291", "0.6021291", "0.6007565", "0.59706897", "0.596416", "0.5880884", "0.5870122", "0.5866803", "0.5857918", "0.58138025", "0.5733545"...
0.6676914
1
Prior to copying a commit, perform a set of checks to ensure the commit will (likely) go through successfully.
def check_commit(self, commit): # pylint: disable=too-many-branches if LOG.isEnabledFor(logging.DEBUG): LOG.debug('check_commit() Checking mark={} sha1={} file-ct={} -- {}' .format( commit['mark'] , p4gf_util.abbrev(commit['sha1']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_commit(self):\n # TODO: Test errors while committing and recovery\n pass", "def _already_copied_commit(self, commit_sha1, branch_id):\n if not self.already_copied_commit_runner:\n return False\n return self.already_copied_commit_runner.already_copied_commit(\n ...
[ "0.68284607", "0.66471356", "0.66081774", "0.6199275", "0.6157117", "0.6093024", "0.6084923", "0.6052497", "0.5968763", "0.57908607", "0.5786348", "0.5701899", "0.5692958", "0.5673335", "0.5656668", "0.5576239", "0.5540796", "0.553174", "0.5514142", "0.5512178", "0.54859316",...
0.6170334
4
Prior to copying a commit, perform a set of checks for a specific branch to ensure the commit will (likely) go through successfully.
def check_commit_for_branch( self , commit , branch_id , any_locked_files , case_conflict_checker ): rev = commit['sha1'] if LOG.isEnabledFor(logging.DEBUG): LOG.debug(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_branch(opt, params):\n\n # Check the current branch and hash\n _get_branch(opt)\n\n if params.git_branch != opt.git_branch or params.git_hash != opt.git_hash:\n msg = 'You are not on the right branch or commit. Please run the following in the repository: \\n'\n msg += f'git checko...
[ "0.66593283", "0.653673", "0.64837676", "0.64365125", "0.63583773", "0.628439", "0.6173651", "0.6014642", "0.6005059", "0.5976242", "0.5954787", "0.58620733", "0.5859521", "0.5851176", "0.58046544", "0.57973", "0.579227", "0.57077634", "0.56944895", "0.56923765", "0.56910425"...
0.72327125
0
If not already switched to and synced to the correct branch for the given commit, do so. If this is a new lightweight branch, perform whatever creation we can do at preflight time. We don't have commits/marks for any notyetsubmitted parent commits, so the depot_branch_info will often lack a correct parent or fully popu...
def ensure_branch_preflight(self, commit, branch_id): log = LOG.getChild('ensure_branch_preflight') branch = self.ctx.branch_dict().get(branch_id) # branch should never be None here. p4gf_branch_id.Assigner() must # create Branch objects for each assignment. if self._curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_commit_for_branch( self\n , commit\n , branch_id\n , any_locked_files\n , case_conflict_checker ):\n rev = commit['sha1']\n if LOG.isEnabledFor(logging.DEBUG):\n ...
[ "0.6567766", "0.615474", "0.6144223", "0.6067799", "0.5996831", "0.5930555", "0.5926467", "0.58662117", "0.58450073", "0.5838003", "0.58024377", "0.57683945", "0.5761088", "0.574812", "0.56977725", "0.5657013", "0.56563455", "0.56526315", "0.5631415", "0.56144863", "0.5603229...
0.6462633
1
Does this branch map our placeholder file? Returns nonFalse if mapped, None or empty string if not.
def _is_placeholder_mapped(self): return self.ctx.gwt_path( p4gf_const.P4GF_EMPTY_CHANGELIST_PLACEHOLDER).to_depot()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isBasedInHiddenFile(self):\n #type: () -> Optional[bool]\n return (\n None if self.realFileName is None #if before\n else self.realFileName != self.fileName\n )", "def fileProcessed(self,fileInstance):\n if hasattr(fileInstance,\"name\"): name=fileInstance.n...
[ "0.56640106", "0.5638936", "0.55160695", "0.5359276", "0.5341279", "0.5287153", "0.5251435", "0.52480775", "0.521388", "0.5208746", "0.5203581", "0.51782346", "0.51517147", "0.5145897", "0.51427215", "0.51353425", "0.5104298", "0.5096157", "0.5081865", "0.506784", "0.5066481"...
0.693119
0
check if author is authorized to submit files.
def _check_protects(self, p4user, blobs): pc = ProtectsChecker(self.ctx, p4user, self.ctx.authenticated_p4user, self.ctx.foruser) pc.filter_paths(blobs) if pc.has_error(): raise PreflightException(pc.error_message())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize(self, action, author_id=None):\n return False", "def can_manage(self, filename):\n return False", "def authorize(self, action, author_id=None):\n if Serializable.authorize(self, action, author_id=author_id):\n return author_id == self.author.id\n return Fals...
[ "0.67265445", "0.6572943", "0.6460481", "0.64090806", "0.6379417", "0.6375925", "0.6344279", "0.6316515", "0.6315356", "0.6313261", "0.6280241", "0.6255119", "0.6184559", "0.61551064", "0.61456263", "0.6113984", "0.61127067", "0.61127067", "0.6108889", "0.6078575", "0.6071434...
0.0
-1
If any of the files in this commit intersect any fully populated branch (other than the current branch), then reject this commit. Shared/common/overlapping paths in branch views must be readonly from Git. Otherwise you end up with a Git push of commit on one Git branch inserting changes into other Git branches behind G...
def _check_overlap(self, fe_commit): # +++ Avoid O(b branches * r rev) checks when # overlap is impossible because current branch # overlaps no other branch. if self._current_branch not in self._overlapping_branch_list(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_commit_for_branch( self\n , commit\n , branch_id\n , any_locked_files\n , case_conflict_checker ):\n rev = commit['sha1']\n if LOG.isEnabledFor(logging.DEBUG):\n ...
[ "0.70267016", "0.6255848", "0.6211556", "0.6012206", "0.5753158", "0.57477814", "0.574088", "0.5717972", "0.57146573", "0.5703639", "0.5662798", "0.5624615", "0.5610022", "0.5576558", "0.5571656", "0.5534969", "0.5534018", "0.5515806", "0.5472234", "0.5436517", "0.5434736", ...
0.7310925
0
If this is a stream branch, check that all files in the commit are writable. If any of the files is not writable then reject this commit.
def _check_stream_writable(self, fe_commit): if not self._current_branch.stream_name: return prefix = self._current_branch.writable_stream_name + '/' for fe_file in fe_commit['files']: gwt_path = fe_file['path'] depot_path = self.ctx.gwt_path(gwt_path).to_de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_stream_in_classic(self, fe_commit):\n if self._current_branch.stream_name:\n return\n\n depot_re = re.compile(r'^//([^/]+)/([^/]+)/.*$')\n for fe_file in fe_commit['files']:\n gwt_path = fe_file['path']\n depot_path = self.ctx.gwt_path(gwt_path).to...
[ "0.730989", "0.62108445", "0.6002569", "0.59505546", "0.5941183", "0.5897741", "0.5511451", "0.5413663", "0.5360557", "0.53083956", "0.52989227", "0.5220939", "0.5215751", "0.5145717", "0.5142257", "0.50900465", "0.5081833", "0.5081318", "0.50811625", "0.50787395", "0.5073544...
0.8073145
0
If this is a classic branch, check that none of the files in the commit are in stream depots and thus not writable. If any of the files is not writable then reject this commit.
def _check_stream_in_classic(self, fe_commit): if self._current_branch.stream_name: return depot_re = re.compile(r'^//([^/]+)/([^/]+)/.*$') for fe_file in fe_commit['files']: gwt_path = fe_file['path'] depot_path = self.ctx.gwt_path(gwt_path).to_depot() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_stream_writable(self, fe_commit):\n if not self._current_branch.stream_name:\n return\n prefix = self._current_branch.writable_stream_name + '/'\n for fe_file in fe_commit['files']:\n gwt_path = fe_file['path']\n depot_path = self.ctx.gwt_path(gwt_...
[ "0.73341", "0.6207531", "0.6191185", "0.6037307", "0.5875063", "0.5831943", "0.56964684", "0.5686395", "0.56552875", "0.56157583", "0.5488412", "0.5477116", "0.54372096", "0.5435764", "0.5399177", "0.53548175", "0.5332237", "0.53187644", "0.5318055", "0.53075296", "0.52779925...
0.71837646
1
Return True if the named path was introduced in the HEAD commit.
def _path_added(self, path, fecommit): # Because git-fast-export includes the entire tree in its output, # regardless of whether the requested commit is the first in the # branch or not, we need to check the repo itself to be certain if # this path was truly introduced in this commit, or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_has_object(project: Project, name: str) -> bool:\n ret = project.git(\"rev-parse\", \"--verify\", name, _ok_code=[0, 128])\n return ret.exit_code == 0", "def test_heads_contains_true(repository: Repository) -> None:\n assert repository.head.name in repository.heads", "def _is_branch(self, refe...
[ "0.6516155", "0.63896835", "0.6222142", "0.6222135", "0.60880154", "0.60826945", "0.6018103", "0.5985125", "0.59479386", "0.5940511", "0.59299994", "0.59243816", "0.59173447", "0.5912473", "0.5822935", "0.58216715", "0.5808256", "0.5804621", "0.5717881", "0.56875396", "0.5678...
0.6642211
0
We have changed our branch_dict (or more likely finish_branch_definition()ed a branch within that dict) in a way that invalidates any cached calculations that consumed the branch dict.
def _invalidate_branch_cache(self): self._cached_overlapping_branch_list = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish_branch_definition(self, commit, branch):\n assert self._finish_branch_definition\n self._finish_branch_definition.finish_branch_definition(commit, branch)\n self._invalidate_branch_cache()", "def tree_removeDeadBranches():\n nonlocal d_tree\n d_tree = { k : v...
[ "0.60243195", "0.56031704", "0.548174", "0.54290056", "0.52304393", "0.52058154", "0.5188001", "0.5129975", "0.5117015", "0.511483", "0.51062316", "0.5055685", "0.5053761", "0.50004244", "0.49610597", "0.4951123", "0.49497518", "0.4948754", "0.49486953", "0.49447733", "0.4924...
0.6802069
0
Return a list of fully populated branches that overlap other fully populated branches. Caches the result because we check every file revision path for overlap, and for huge repos with thousands of nonoverlapping LW branches, just iterating through the branch list starts to waste measurable CPU time.
def _overlapping_branch_list(self): if self._cached_overlapping_branch_list is not None: return self._cached_overlapping_branch_list have_overlap = set() for outer in p4gf_branch.iter_fp_non_deleted(self.ctx.branch_dict()): outer_lhs = P4.Map() outer_lhs.inse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_branches_to_merge(branch):\n branches = [(branch, branch.subfolder or '')]\n for dependency in branch.branch_dependency_ids:\n branches.append((dependency.merge_with_branch_id, dependency.merge_subfolder or ''))\n return branches[::-1]", "def branches_full(config, args):\...
[ "0.6201244", "0.6164248", "0.61058915", "0.6089111", "0.60666037", "0.58286184", "0.5817222", "0.574742", "0.57133055", "0.570316", "0.5672118", "0.5664436", "0.56305796", "0.55732614", "0.55578953", "0.54982585", "0.5476394", "0.5456892", "0.5438345", "0.5427029", "0.5400545...
0.7866057
0
Return a string suitable for use in progress messages as a short hint to what we're processing. If we have a PreReceiveTuple with a Git branch/tag name, return that name (minus any refs/heads/ prefix). If not, return None.
def _curr_ref_ui_name(self): if not (self._current_prt and self._current_prt.ref): return None s = self._current_prt.ref prefixes = ["refs/heads/", "refs/tags/"] for p in prefixes: if s.startswith(p): return s[len(p):] return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_branch_name(branch):\n return branch.replace('refs/heads/', '')", "def GetPrefix():\n m = BRANCH_REGEX.match(RCS_FILE)\n if m:\n return m.group(1)\n return DEFAULT_DEPOT", "def get_current_remote_name(self) -> str:\n match = self.status()\n\n if match.branch_upstream is No...
[ "0.5595505", "0.5560799", "0.5542163", "0.5362832", "0.52647954", "0.5257069", "0.52282697", "0.51733804", "0.516051", "0.5108076", "0.51070267", "0.51055515", "0.50913596", "0.50558054", "0.5049445", "0.5048159", "0.5032945", "0.502492", "0.50247127", "0.49994317", "0.499059...
0.5560326
2
If gfe_file is under Git LFS control, require that its large file content exist somewhere, either in our upload cache (it's new!) or in depot dedupe storage (already got it).
def _check_lfs(self, fe_commit, fe_file): # Deleted files carry no LFS pointer. if "sha1" not in fe_file: return # Symlinks and non-files carry no LFS pointer. if fe_file.get("mode") not in [ FileModeStr.PLAIN ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_managed_keep_source_false_http(\n file, tmp_path, remote_grail_scene33, modules\n):\n name = str(tmp_path / \"testfile\")\n # Run the state\n ret = file.managed(\n name=name,\n source=remote_grail_scene33.url,\n source_hash=remote_grail_scene33.hash,\n keep_sou...
[ "0.5939489", "0.5912179", "0.58820075", "0.5847848", "0.58317304", "0.5623303", "0.5542459", "0.5534037", "0.5512348", "0.5486995", "0.54663646", "0.54334575", "0.5396594", "0.5396052", "0.5381335", "0.53738886", "0.53469056", "0.5326318", "0.530705", "0.530241", "0.52834505"...
0.6616472
0
Init P4.Map objects for author, pusher, view and combination.
def __init__(self, ctx, author, pusher, foruser): self.ctx = ctx self.author = author self.pusher = pusher self.foruser = foruser self.ignore_author_perms = ctx.repo_config.getboolean(p4gf_config.SECTION_GIT_TO_PERFORCE, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _makeimap(self):\n self.map_[\"source\"] = \"nasa\"\n self.map_[\"instrument\"] = \"goes\"\n self.map_[\"physobs\"] = \"irradiance\"\n self.map_[\"provider\"] = \"sdac\"", "def _makeimap(self):\n self.map_['source'] = 'GOES'\n self.map_['provider'] = 'NOAA'\n ...
[ "0.68036133", "0.6746899", "0.65235424", "0.6522511", "0.6463134", "0.63889253", "0.61330837", "0.6050521", "0.6023813", "0.6009249", "0.5919711", "0.5908313", "0.5898451", "0.58272535", "0.5820471", "0.58028877", "0.57888293", "0.57360286", "0.5729971", "0.5729444", "0.57280...
0.5611728
31
Init view map for client.
def init_view(self): self.view_map = self.ctx.clientmap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_viewing_client():\n\n # Read configuration settings\n config = gis.get_config()\n if config.opt_gis_layout == 1:\n window = True\n else:\n window = False\n\n # @ToDo Make Configurable\n toolbar = True\n\n map = define_map(window=window, toolbar=toolbar, config=config)\n\n...
[ "0.73483825", "0.6393654", "0.6328302", "0.62651557", "0.6215494", "0.621435", "0.6202144", "0.61714244", "0.60852766", "0.60486645", "0.5990444", "0.595002", "0.59376174", "0.593404", "0.5898968", "0.58576566", "0.5853716", "0.5853698", "0.5803742", "0.5777687", "0.576832", ...
0.90606475
0
Run list of paths through filter and set list of paths that don't pass.
def filter_paths(self, blobs): # check against one map for read, one for write # if check fails, figure out if it was the view map or the protects # that caused the problem and report accordingly self.author_denied = [] self.pusher_denied = [] self.foruser_denied = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_filter(excl_filter, paths):\n misses = set()\n for p in paths:\n if re.search(excl_filter, p) is None:\n misses.add(p)\n\n return misses", "def clean_dir_filtered(dr, filters):\n # type: (path, List[str]) -> None\n for f in os.listdir(dr):\n for fltr in filters...
[ "0.6571253", "0.6168529", "0.6118564", "0.60856956", "0.6034449", "0.6013353", "0.5978687", "0.58510804", "0.58142954", "0.58128434", "0.57699585", "0.5687041", "0.5659206", "0.56480026", "0.5642498", "0.5623489", "0.5614679", "0.5568684", "0.556686", "0.550684", "0.5481009",...
0.6176403
1
Return True if any paths not passed by filters.
def has_error(self): return len(self.unmapped) or len(self.author_denied) \ or len(self.pusher_denied) or len(self.foruser_denied) \ or len(self.fusion_denied)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered(self):\n if not is_tagged(self.tags, self.opt.tags):\n log(\"Skipping %s as it does not have requested tags\" %\n self.path, self.opt)\n return False\n\n if not aomi.validation.specific_path_check(self.path, self.opt):\n log(\"Skipping %s a...
[ "0.71966785", "0.7133227", "0.6744628", "0.65370727", "0.65001875", "0.63030595", "0.62818235", "0.6164135", "0.61271316", "0.5999745", "0.599604", "0.5980685", "0.5966975", "0.5960473", "0.5958504", "0.5940341", "0.5933335", "0.59280807", "0.5905047", "0.5895779", "0.58827",...
0.0
-1
Return message indicating what's blocking the push.
def error_message(self): if len(self.unmapped): return _('file(s) not in client view') if len(self.author_denied): restricted_user = self.author elif len(self.pusher_denied): restricted_user = self.pusher elif len(self.foruser_denied): rest...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blocking_condition(self):\n return self.__blocking_condition", "def get_message(self):\n message = self.feedback_log.get(block=True)\n self.feedback_log.task_done()\n return message", "def getBusyMessage(self):\n return self.__busyMessage", "async def view_current_block...
[ "0.6408421", "0.58077586", "0.5786143", "0.56341577", "0.5633069", "0.5584771", "0.5559529", "0.54919946", "0.5488921", "0.5442665", "0.5437276", "0.5415029", "0.5396947", "0.53934175", "0.53638595", "0.536091", "0.5355774", "0.5327811", "0.5327811", "0.5257515", "0.5257515",...
0.0
-1
Return loggable string for a single fe_commit['files'] element.
def _log_fe_file(fe_file): mode = ' ' if 'mode' in fe_file: mode = fe_file['mode'] sha1 = ' ' if 'sha1' in fe_file: sha1 = p4gf_util.abbrev(fe_file['sha1']) return NTR('{mode} {action} {sha1} {path}') \ .format( mode = mode , action = fe_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_list_str(self):\n curr_file_index = self.app.current_file_index()\n files = self.app.get_files();\n file_list = files[curr_file_index:] + files[:curr_file_index]\n str_list = []\n for f in file_list:\n fname = f.name + ([\"\", \"*\"][f.is_changed()])\n ...
[ "0.6204323", "0.5932406", "0.5878049", "0.57989603", "0.57780176", "0.57196337", "0.5701259", "0.55389786", "0.5513501", "0.54978555", "0.5449646", "0.54407847", "0.5358694", "0.5305338", "0.5279703", "0.52198076", "0.52079505", "0.52038187", "0.51883763", "0.51697344", "0.51...
0.57862025
4
Print the given message to the error stream, as well as to the log.
def _print_error(msg): sys.stderr.write(msg + '\n') LOG.error(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(message):\n print(message, file=sys.stderr)", "def log_error(message):\n sys.stderr.write(message)\n sys.stderr.flush()", "def log_error(self, message):\n u = six.text_type\n log_line = (\n u('{0:%Y-%m-%d %H:%M:%S} [FALCON] [ERROR] {1} {2}?{3} => {4}\\n').\n ...
[ "0.7898539", "0.7735587", "0.76756036", "0.75126797", "0.74449044", "0.7419306", "0.7378443", "0.7376303", "0.73306", "0.73223484", "0.7314951", "0.7312553", "0.72963977", "0.7293763", "0.72898746", "0.7254633", "0.7225247", "0.7214274", "0.72096974", "0.7171879", "0.7138568"...
0.7820772
1
Check if c will be rejected by P4D as nonprintable. P4D rejects "nonprintable" characters with
def is_p4d_printable(c): if ord(c) < 0x20: return False if ord(c) == 0x7F: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_printable(c):\n return ord(c)>=32 or c in ['\\r','\\n', '\\t']", "def is_printable(s):\n for c in s:\n if c not in PRINTABLE_CHARACTERS:\n return False\n return True", "def is_printable(b):\n return b in e(string.printable)", "def is_string_printable(string_):\n return...
[ "0.8065967", "0.7819546", "0.7561507", "0.70877075", "0.6687797", "0.66823083", "0.66677797", "0.66154623", "0.6585473", "0.65472776", "0.6435375", "0.64282465", "0.6415623", "0.63944894", "0.6227201", "0.6072948", "0.60558593", "0.60486054", "0.6011463", "0.59352165", "0.592...
0.7970663
1
Test the given name for illegal characters. Return None if okay, otherwise an error message.
def check_valid_filename(name, ctx): for idx, c in enumerate(name): if not is_p4d_printable(c): fullname = name[:idx] + "x{ch:02X}".format(ch=ord(c)) + name[idx:] return _("Perforce: Non-printable characters not allowed in Perforce: " "character x{ch:02X} in file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validname(name):\r\n return len(name)>0 and (\r\n Context.__invalid_character.search(name) is None)", "def invalid_name(name):\n if any(not item.isalpha() for item in str(name)):\n return True\n return False", "def name_valid(name):\n return name.isalpha()", ...
[ "0.7793227", "0.77333903", "0.7610386", "0.74310243", "0.7350821", "0.72848845", "0.70523953", "0.6986217", "0.6936929", "0.69232976", "0.69111687", "0.6899121", "0.68835676", "0.6855843", "0.68477637", "0.68248713", "0.68212366", "0.6808106", "0.6778517", "0.671407", "0.6599...
0.6773812
19
The function is meant to make use of the sqoop export functionality to export data from hive to mysql db.
def hive_to_mysql(hive_conn, username, password, host, port, export_dir, table_name): # the input fields terminated by parameter is to specify os.system("sqoop export --connect jdbc:mysql://{0}:{1}/hive --username " \ "{2} --password {3} --table {4} --export-dir {5} --input-fields-terminated-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(dest_dir, db_host, db_port, db_name, db_schema, db_username, db_password, ssl_mode,\n force, cores, memory_per_core, default_partition_col, partition_col,\n nr_partitions):\n partition_col_dict = {k: v for k, v in partition_col}\n nr_partitions_dict = {k: v for k, v in nr_partitions}...
[ "0.6315057", "0.6245598", "0.6017175", "0.5787101", "0.5758232", "0.573403", "0.56615156", "0.5621154", "0.5613762", "0.56111676", "0.55346966", "0.55025053", "0.54620385", "0.5452798", "0.5428737", "0.5426115", "0.54060113", "0.5380885", "0.5377392", "0.5359161", "0.5295265"...
0.78318924
0
Create new map item
def create(self, mapItem: MapItem) -> int: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_map(self):\n self.wizard = NewMap(self)", "def add(self, item):\n self._dict[item] = item", "def add_map(new_prot, new_target, map_path, map_type):\n hotspot_map = HotspotMap.objects.get_or_create(\n map_type=map_type, target_id=new_target, prot_id=new_prot\n )[0]\n hotspot_ma...
[ "0.663403", "0.6446372", "0.62781554", "0.61970216", "0.618926", "0.6137825", "0.6078885", "0.5993192", "0.5991251", "0.5985686", "0.59658325", "0.5953617", "0.59227896", "0.590874", "0.58784914", "0.58716595", "0.5857414", "0.5817465", "0.5817132", "0.5809343", "0.580722", ...
0.7733658
0
Update map item in database
def update(self, mapItem: MapItem): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item(self, table, item):", "def update(self, mapper_info: dict):\n self.update_from_dict(\n [\n \"form_id\",\n \"form_name\",\n \"form_revision_number\",\n \"process_key\",\n \"process_name\",\n ...
[ "0.6819395", "0.6547382", "0.6486562", "0.64180374", "0.6259836", "0.6173413", "0.61376715", "0.6136338", "0.6133015", "0.6133015", "0.61063683", "0.6041662", "0.59641296", "0.5876489", "0.5864035", "0.58607227", "0.5849195", "0.58311784", "0.58310145", "0.5828876", "0.581150...
0.77123857
0
Delete Map item from database and all his translates
def delete(self, mapitem_id: int): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete():\n\t# Create session\n\ts = Session()\n\ts.query(Lookup).delete(synchronize_session=False)\n\ts.commit()", "def test_delete_saved_app_map_search(self):\n pass", "def delete(self, key):\n app.logger.info('Request to Delete a map_object with key [%s]', key)\n map_object = Map.ge...
[ "0.60695505", "0.60244024", "0.5943307", "0.58938456", "0.5815377", "0.58143026", "0.57671386", "0.5745031", "0.57079214", "0.57064176", "0.569948", "0.5697754", "0.5660007", "0.56400824", "0.5629807", "0.56289786", "0.5627679", "0.56257826", "0.56040335", "0.5601899", "0.559...
0.7070288
0
Get map item from database
def get(self, mapitem_id: int) -> MapItem: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapdata():\n return getmapdata(db, MyTable)", "def get_db_item(self, key, item_key):\n return self.get_db_items(key).get(item_key)", "def get_map_item(self, idx, col=0, absolute=False):\n\n return self.itemDataMap[self.itemIndexMap[idx] if not absolute else idx][self.get_real_col(col)]", ...
[ "0.6950481", "0.6852836", "0.65755594", "0.65000963", "0.64465505", "0.6368746", "0.6318184", "0.6285017", "0.62202585", "0.61964667", "0.61231244", "0.605938", "0.604496", "0.60364556", "0.60216033", "0.5915674", "0.591564", "0.5902572", "0.58843106", "0.5884206", "0.5880697...
0.74543875
0
Get list of map items for selected lang
def get_all(self, lang: str = None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_concept_mapping(self, lang):\n concepts = self.filter(active=True, lang=lang)\n return group_keys_by_value_lists(Concept.objects.get_concept_item_mapping(concepts, lang))", "def get_langs(id):", "def list(self):\n for key, value in self.languages.iteritems():\n prin...
[ "0.6933556", "0.6791755", "0.6202333", "0.60564715", "0.6018329", "0.59928876", "0.59139585", "0.58982617", "0.58469373", "0.5843785", "0.5796447", "0.57480514", "0.57101274", "0.5703919", "0.5663914", "0.5649781", "0.5592568", "0.55881494", "0.55463994", "0.5546072", "0.5523...
0.6805568
1
Function untuk merapihkan content text.
def tag_visible(element): if element.parent.name in ['style', 'script', 'head', 'title', 'meta', '[document]']: return False if isinstance(element, bs4.element.Comment): return False if re.match(r"[\n]+", str(element)): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addContent(text):", "def getText():", "def getText():", "def getText():", "def getText():", "def getText():", "def get_text(self):", "def text(self) -> str:", "def obtain_text():\n pass", "def render_text(self):\n if self.text_type == 1:\n return markdown.markdown(self.te...
[ "0.7356162", "0.734588", "0.734588", "0.734588", "0.734588", "0.734588", "0.71811664", "0.70948446", "0.69077384", "0.68699956", "0.6725609", "0.67089015", "0.66547245", "0.6591793", "0.6578998", "0.64360684", "0.64287376", "0.6423191", "0.64015144", "0.6381138", "0.6335498",...
0.0
-1
Function untuk crawling page.
def crawl(url): try: # kondisi berhenti time_now = time.time() - start_time time_now_int = int(time_now) if time_now_int >= 900: return # memasukan url kedalam visited_url visited_url.append(url) # crawl page print("page yang sedang di cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crawl_page(self, keyword, since=None, to=None, page=None):\n data = self.get_news(keyword, since, to, page)\n print(current_process())\n print('crawling page no.: ' + str(page))\n urls = self.get_urls(data)\n p = Process()\n p.start(urls)", "def _scrape(self):", "d...
[ "0.72147655", "0.7195813", "0.7007661", "0.69976723", "0.690198", "0.67948085", "0.668166", "0.6551637", "0.6532941", "0.6446895", "0.64234966", "0.6419477", "0.64160395", "0.6397469", "0.6392632", "0.6373003", "0.63583755", "0.63407713", "0.6332828", "0.6304358", "0.6284927"...
0.68507415
5
Test an execution plan with downloadable git files
def test_execution_plan_type_downloable_git(self, mock_makedir, mock_path, mock_git): mock_makedir.return_value = None mock_path.return_value = True mock_git.clone.return_value = None template = self.get_template_downloable_git() fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download_deployment_run_test_report(self):\n pass", "def test_download_file(token):\n\n # github => repo => release => asset_list => asset => url => download\n\n g_h = github.Github(token, per_page=100)\n repo = g_h.get_repo(TEST_SLUG, lazy=False)\n release = repo.get_release(TEST_TAG...
[ "0.65409565", "0.6530164", "0.6279986", "0.6256195", "0.6231449", "0.6157987", "0.6156309", "0.61558706", "0.61408335", "0.60977995", "0.604785", "0.594729", "0.5861912", "0.5824399", "0.57773626", "0.5769683", "0.57622266", "0.5680721", "0.5665056", "0.5652566", "0.5651526",...
0.6872425
0
Test an execution plan with downloadable files
def test_execution_plan_type_downloable(self, mock_requests, open_mock, mock_makedir, mock_mkdir, mock_path): mock_path.return_value = True mock_mkdir.return_value = None mock_makedir.return_value = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download_deployment_run_test_report(self):\n pass", "def test_download(self):\n pass", "def test_download1(self):\n pass", "def test_download2(self):\n pass", "def test_get_file_executors(self):\n pass", "def test_execution_plan_type_downloable_no_Url(self, moc...
[ "0.72344524", "0.71944124", "0.7117503", "0.7021579", "0.6708915", "0.66976917", "0.6520385", "0.64298606", "0.6284724", "0.62664706", "0.6221968", "0.60801256", "0.60785764", "0.6078353", "0.5968767", "0.59485716", "0.5918836", "0.58923244", "0.5865805", "0.58115375", "0.580...
0.66285175
6
Test an execution plan with svn files.
def test_execution_plan_type_svn(self, mock_makedir, mock_subproc_popen): process_mock = mock.Mock() attrs = {'communicate.return_value': ('ouput', 'ok'), 'poll.return_value': 0} process_mock.configure_mock(**attrs) mock_subproc_popen.return_value = process_mock ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_file_with_svn_and_revision(self):\n self._test_get_file(\n tool_name='Subversion',\n revision='123',\n base_commit_id=None,\n expected_revision='123')", "def test_get_file_with_svn_and_base_commit_id(self):\n self._test_get_file(\n ...
[ "0.60671014", "0.59154356", "0.5870971", "0.57437944", "0.56704193", "0.56515604", "0.5607383", "0.5580017", "0.55432963", "0.55121726", "0.55041003", "0.5493844", "0.5489692", "0.54305446", "0.5429826", "0.5413528", "0.5403241", "0.53945506", "0.5375887", "0.53562385", "0.53...
0.75792676
0
It validates the URL.
def test_execution_plan_type_downloable_no_Url(self, mock_makedir): mock_makedir.return_value = None template = bunch.Bunch( ID='ID', Files={ 'mycoockbook': { 'Name': 'mycoockbook.txt', 'Type': 'Downloadable' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_url(self):\n pass", "def check_url_invalidity(self) -> bool:\n validate = URLValidator()\n try:\n validate(self.args.url)\n return False\n except ValidationError:\n return True", "def _validate_url(url):\n if not url or url.count(...
[ "0.9250963", "0.8142023", "0.8085926", "0.7872061", "0.7859318", "0.77950835", "0.7775939", "0.7774141", "0.77158886", "0.7710965", "0.76844054", "0.7651919", "0.76397765", "0.7636951", "0.76281685", "0.7623424", "0.7619525", "0.7618471", "0.7617189", "0.7611723", "0.76107705...
0.0
-1
It tests the putfile method when the file is a git URL.
def test_putfile_downloable(self, mock_exists, mock_makedir, path, mock_git): path.return_value = True mock_git.clone.return_value = None mock_makedir.return_value = None mock_exists.return_value = True template = self.get_template_downloable_git()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_put_object_from_file(self):\n self.get_file(20)\n response = self.bos.put_object_from_file(self.BUCKET, self.KEY, self.FILENAME)\n self.check_headers(response, [\"etag\"])", "def test_put(self):\n\n url = reverse('file')\n\n data = {\n 'shard_id': self.shard...
[ "0.6706774", "0.63879323", "0.6381982", "0.6340921", "0.61182505", "0.60106695", "0.5981439", "0.5970494", "0.5970211", "0.596653", "0.58173615", "0.58156675", "0.5809103", "0.57895106", "0.57847863", "0.57716465", "0.5758242", "0.5747862", "0.5727234", "0.5717429", "0.568027...
0.57081753
20
It tests the putfile method.
def test_putfile_file(self, mock_makedir, mock_path, mock_exists, open_mock): mock_path.return_value = True mock_makedir.return_value = None mock_exists.return_value = True context_manager_mock = mock.Mock() open_mock.return_value = context_manager_mock ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testPut(self):\n # XXX - not actually a unit test\n expectedOutput = (b'Transferred ' + self.testDir.asBytesMode().path +\n b'/testfile1 to ' + self.testDir.asBytesMode().path +\n b'/test\"file2')\n def _checkPut(result):\n self....
[ "0.76568115", "0.7472499", "0.74572754", "0.7397002", "0.69837624", "0.6948096", "0.68508565", "0.6841168", "0.6836475", "0.6748098", "0.6694531", "0.66749036", "0.6657019", "0.6639871", "0.6637743", "0.66143906", "0.6593999", "0.6567201", "0.6462694", "0.6432023", "0.6423938...
0.6964206
5
Helper function to parse operator attributes in required format.
def parse_helper(attrs, attrs_name, alt_value=None): tuple_re = re.compile('\([0-9L|,| ]+\)') if not attrs: return alt_value attrs_str = None if attrs.get(attrs_name) is None else str(attrs.get(attrs_name)) if attrs_str is None: return alt_value attrs_match = tuple_re.search(attrs_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_operator(self) -> Tuple:\n string = \"\".join(self.buffer)\n negated = string.endswith(\"not\")\n if not string.strip(\"\\t\\n\\r \"):\n params = False, 1, 1\n elif string.strip() == \"not\":\n params = True, 1, 1\n elif OPTION_RE.match(string):\n...
[ "0.6725491", "0.6504174", "0.60399365", "0.5768193", "0.568222", "0.5623086", "0.55767065", "0.5555738", "0.5527093", "0.5487211", "0.5448368", "0.54458135", "0.54440624", "0.54395884", "0.54087675", "0.53957385", "0.5389283", "0.5360415", "0.5338996", "0.5338996", "0.5338996...
0.0
-1
Helper function to convert padding format for pad operator.
def transform_padding(pad_width): num_pad_values = len(pad_width) onnx_pad_width = [0]*num_pad_values start_index = 0 # num_pad_values will always be multiple of 2 end_index = int(num_pad_values/2) for idx in range(0, num_pad_values): if idx % 2 == 0: onnx_pad_width[start_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_padding(g, op, block):\n\n input_x = g.get_node(op.input(\"X\")[0])\n input_padding = op.input(\"Paddings\")\n if input_padding:\n padding = g.get_node(input_padding[0])\n padding = infer_value(padding, g.get_params()).numpy().tolist()\n else:\n padding = op.attr(\"padd...
[ "0.68323696", "0.6653805", "0.6588574", "0.6539116", "0.6471568", "0.6465333", "0.64627033", "0.6430866", "0.63953453", "0.63670754", "0.6362064", "0.6358119", "0.63537", "0.63283384", "0.63223386", "0.6321739", "0.6320306", "0.6287044", "0.62865645", "0.62791353", "0.6271379...
0.68918765
0
Helper function to convert string to list. Used to convert shape attribute string to list format.
def convert_string_to_list(string_val): result_list = [] list_string = string_val.split(',') for val in list_string: val = str(val.strip()) val = val.replace("(", "") val = val.replace(")", "") val = val.replace("L", "") val = val.replace("[", "") val = val.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2list(input):\n if isinstance(input, str):\n return [input]\n\n else:\n return input", "def to_list(value):\n if hasattr(value, '__iter__') and not isinstance(value, str):\n return list(value)\n return [value]", "def _convert_str_to_list(cls, v: Union[List[str], str]) ->...
[ "0.73350626", "0.7006628", "0.69769", "0.6960579", "0.6908072", "0.68899715", "0.68545306", "0.6836377", "0.6827319", "0.67761135", "0.6765714", "0.67551106", "0.6631985", "0.6618425", "0.6563515", "0.6554849", "0.65231544", "0.65141433", "0.6511315", "0.64754456", "0.647153"...
0.65169
17
Helper function to convert a string version of Boolean attributes to integer for ONNX. Takes attribute dictionary and attr_name as parameters.
def get_boolean_attribute_value(attrs, attr_name): return 1 if attrs.get(attr_name, 0) in ["True", "1"] else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_intbool(val_str):\n return 1 if val_str == 'Yes' else 0", "def int_from_bool_as_string(subject):\r\n return bool_from_string(subject) and 1 or 0", "def _bool_to_int(self, bool_arg):\n if bool_arg == True:\n return 1\n else:\n return 0", "def bool_attr(...
[ "0.64697516", "0.64594436", "0.62451714", "0.6019205", "0.6004195", "0.599485", "0.5975256", "0.59653413", "0.5840328", "0.5804822", "0.56859833", "0.56824034", "0.5662187", "0.5627271", "0.5594165", "0.5585451", "0.5547492", "0.5395261", "0.53894955", "0.53652155", "0.536489...
0.6708033
0
Helper function to get inputs
def get_inputs(node, kwargs, with_shapes=False): name = node["name"] proc_nodes = kwargs["proc_nodes"] index_lookup = kwargs["index_lookup"] graph_shapes = kwargs["graph_shapes"] inputs = node["inputs"] attrs = node.get("attrs", {}) input_nodes = [] input_shapes = [] for ip in input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input(inputs):\n return input(inputs)", "def _get_inputs(self):\n return self.__inputs", "def _get_inputs(self):\n return self.__inputs", "def _get_inputs(self):\n return self.__inputs", "def get_inputs(self):\r\n raise NotImplementedError", "def get_inputs(self):\r\n ra...
[ "0.8081306", "0.7936382", "0.7936382", "0.7936382", "0.7657724", "0.7657724", "0.7512949", "0.7381114", "0.7286913", "0.72554183", "0.724264", "0.72228503", "0.7211678", "0.718626", "0.718626", "0.718626", "0.718626", "0.718626", "0.718626", "0.718626", "0.7166018", "0.7065...
0.61645883
97