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
Reverse the operation of `transpose_qkv`
def transpose_output(X, num_heads): X = X.reshape(-1, num_heads, X.shape[1], X.shape[2]) X = X.permute(0, 2, 1, 3) return X.reshape(X.shape[0], X.shape[1], -1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose():", "def transpose(self) -> None:\n ...", "def transpose(m):\n\n pass", "def transpose(self):\n pass", "def T(self):\n return Op('transpose', self)", "def _eval_transpose(self):\n coeff, matrices = self.as_coeff_matrices()\n return MatMul(\n ...
[ "0.7393964", "0.69957614", "0.686754", "0.6823257", "0.6534252", "0.64103836", "0.63540304", "0.6345616", "0.630997", "0.6224688", "0.61660904", "0.61399806", "0.6122066", "0.61144435", "0.60711795", "0.604488", "0.59790456", "0.59713537", "0.5940951", "0.5907807", "0.589541"...
0.0
-1
Define goal state and initialize a problem
def __init__(self, initial, goal=(1, 2, 3, 4, 5, 6, 7, 8, 0)): self.goal = goal Problem.__init__(self, initial, goal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, initial, goal=(3, 3, 0, 0, 0)):\n\n self.goal = goal\n Problem.__init__(self, initial, goal)", "def __init__(self, initial, goals, allowed):\n self.initial = initial # initial state\n self.goals = goals # list of goals that can be achieved\n self.allowed ...
[ "0.8060619", "0.7432653", "0.7410824", "0.7404942", "0.7381347", "0.7264645", "0.7256425", "0.71958256", "0.71548873", "0.7120094", "0.6995081", "0.68768936", "0.6699627", "0.66938275", "0.6609153", "0.6580541", "0.6498478", "0.648909", "0.64279306", "0.6414963", "0.64082795"...
0.7851905
1
Return the index of the blank square in a given state
def find_blank_square(self, state): return state.index(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty_space(self, state):\r\n for i in range(3):\r\n for j in range(3):\r\n if state[i][j] == 0:\r\n return (i, j)", "def _state_index(state):\n delta_y, delta_x, bird_lmh, pipe_lmh, is_flapping = state\n actions, height, width, _, _, _ =...
[ "0.7701521", "0.72728777", "0.66417044", "0.6527599", "0.6459278", "0.64067525", "0.63600284", "0.6277902", "0.6268305", "0.62539375", "0.6250342", "0.6234354", "0.62124133", "0.6211223", "0.61981434", "0.61808527", "0.6180443", "0.61688066", "0.6149172", "0.61204535", "0.610...
0.8688786
0
Return the actions that can be executed in the given state. The result would be a list, since there are only four possible actions in any given state of the environment
def actions(self, state): possible_actions = ['UP', 'DOWN', 'LEFT', 'RIGHT'] index_blank_square = self.find_blank_square(state) # implement actions here return possible_actions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_possible_actions(self, state):\n return [LEFT, DOWN, RIGHT, UP]", "def get_available_actions(self, state):\n pass", "def getActions(self, state): \n util.raiseNotDefined()", "def get_possible_actions(self, state):\n return tuple(self._transition_probs.get(state, {}).key...
[ "0.78872573", "0.78745097", "0.77522534", "0.76543", "0.7567038", "0.7548644", "0.74940634", "0.7396644", "0.73959446", "0.73852193", "0.73528546", "0.73049533", "0.72129864", "0.7174859", "0.71130687", "0.708524", "0.70638615", "0.7028664", "0.7003584", "0.6954917", "0.69549...
0.7084505
16
Given state and action, return a new state that is the result of the action. Action is assumed to be a valid action in the state
def result(self, state, action): # blank is the index of the blank square blank = self.find_blank_square(state) new_state = list(state) delta = {'UP': -3, 'DOWN': 3, 'LEFT': -1, 'RIGHT': 1} neighbor = blank + delta[action] new_state[blank], new_state[neighbor] = new_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextState(self, state, action):\n return state + action", "def transition(state, action):\n state_cpy = state.clone()\n assert(-1 in state_cpy)\n pos = tuple((state_cpy == -1).nonzero()[0])\n\n state_cpy[pos] = float(action)\n return state_cpy", "def result(self, state, action):\n ...
[ "0.74269354", "0.72450435", "0.71506226", "0.7145935", "0.7035117", "0.70255154", "0.7006767", "0.6955754", "0.6930009", "0.6876356", "0.68599147", "0.68222857", "0.6780302", "0.67607677", "0.67576426", "0.67311037", "0.66870946", "0.6636043", "0.6628191", "0.66189146", "0.66...
0.6611583
20
Given a state, return True if state is a goal state or False, otherwise
def goal_test(self, state): return state == self.goal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isGoalState(self, state):\n x,y = state\n if x == self.goal[0] and y == self.goal[1]:\n return True\n else:\n return False\n util.raiseNotDefined()", "def goal_test(self, state):\n return state == self.goal", "def goal_test(self, state):\n ret...
[ "0.8540674", "0.84288615", "0.84288615", "0.83114535", "0.8306778", "0.8299784", "0.82933503", "0.82845676", "0.8280234", "0.8255044", "0.8244088", "0.82223487", "0.82094103", "0.8198091", "0.81140107", "0.81140107", "0.8027372", "0.8012982", "0.79968953", "0.79938304", "0.79...
0.8368468
4
Checks if the given state is solvable
def check_solvability(self, state): inversion = 0 for i in range(len(state)): for j in range(i, len(state)): if state[i] > state[j] != 0: inversion += 1 return inversion % 2 == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSolvable(state):\n\n invCount = 0\n size = len(state)\n for i in range(0, size-1):\n for j in range(i+1, size):\n if (int(state[j]) and int(state[i]) and state[i] > state[j]):\n invCount += 1\n # return (invCount%2 == 0)\n return 1", "def is_solvable(self) -...
[ "0.7522494", "0.715745", "0.68387645", "0.6805594", "0.67630696", "0.67143357", "0.6700113", "0.6698942", "0.66616726", "0.6648123", "0.6633694", "0.6591579", "0.65673345", "0.6559208", "0.6537487", "0.6532127", "0.6532127", "0.6532127", "0.65045977", "0.6482605", "0.6474818"...
0.69447094
2
Return the heuristic value for a given state. Default heuristic function used is h(n) = number of misplaced tiles
def h(self, node): return sum(s != g for (s, g) in zip(node.state, self.goal))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(state, puzzle):\n h = 0\n for i in range(puzzle.dimension):\n for j in range(puzzle.dimension):\n # (0, 0) -> 1 as value, (0, 2) -> 3 as value, etc\n value = i * puzzle.dimension + j + 1\n if value == puzzle.dimension ** 2: # value is ' '\n ...
[ "0.77346325", "0.7654883", "0.74284846", "0.73011035", "0.7242607", "0.7046602", "0.7026075", "0.697503", "0.68184316", "0.6818057", "0.674383", "0.6740973", "0.6732053", "0.6711918", "0.66688246", "0.66471696", "0.6638178", "0.6495556", "0.64928424", "0.64860433", "0.646674"...
0.0
-1
Check that start is before finish.
def validate(self, data): flight_planes = Flight.objects.filter(planes__id=data['planes'].id) if data['to'] == data['airports'].city: raise serializers.ValidationError("El vuelo no puede ir hacia el mismo aeropuerto") elif len(flight_planes) and flight_planes[len(flight_plane...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isstarted():", "def is_started(self):\n return self.currIndex >= 0", "def _should_start(self, setlink):\n return setlink.step_record.should_start()", "def should_start(self):\n raise NotImplementedError()", "def isStart(self):\n return self.start", "def can_run(self):\n\t\...
[ "0.6886065", "0.657077", "0.6506529", "0.6396289", "0.63106453", "0.62809676", "0.6266607", "0.6215886", "0.6208456", "0.6196549", "0.61952096", "0.6169127", "0.61644727", "0.61644727", "0.61644727", "0.61637276", "0.61245006", "0.61098516", "0.6103857", "0.60965717", "0.6060...
0.0
-1
Construct a new CPU.
def __init__(self): self.ram = [0x0] * 256 # 256b of ram self.reg = [0x0] * 8 # 8 registers self.reg[7] = 0xF4 # Stack pointer # R5 is reserved as the interrupt mask (IM) # R6 is reserved as the int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cpu():\n return CPU()", "def __new__(cls, cpu):\n assert CpuMap.len() > cpu\n if not CpuMap.arr:\n CpuMap.arr = CpuMap._cpus()\n return CpuMap.arr[cpu]", "def __init__(__self__, *,\n cpu: Optional[pulumi.Input[str]] = None,\n memory:...
[ "0.8731919", "0.6451253", "0.6190836", "0.6190836", "0.6189993", "0.5998105", "0.5969071", "0.5961957", "0.593079", "0.59214157", "0.5899172", "0.5899172", "0.588635", "0.58153635", "0.5809251", "0.57824373", "0.57761335", "0.57144094", "0.5672549", "0.56323063", "0.5601474",...
0.0
-1
Handy function to print out the CPU state. You might want to call this from run() if you need help debugging.
def trace(self): print(f"TRACE: %02X | %02X %02X %02X |" % ( self.pc, #self.fl, #self.ie, self.ram_read(self.pc), self.ram_read(self.pc + 1), self.ram_read(self.pc + 2) ), end='') for i in range(8): print(" %02...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_cpu_state(self):\n print(\"PC:\", hex(self.pc))\n print(\"SP:\", hex(self.sp))\n print(\"A:\", hex(self.a))\n print(\"X:\", hex(self.x))\n print(\"Y:\", hex(self.y))\n print(\"P:\", bin(self.p))", "def print_state(self):\n print('\\nthe current state is:...
[ "0.83511186", "0.6878294", "0.6799062", "0.67697847", "0.6622226", "0.63369095", "0.62946814", "0.62762684", "0.6188839", "0.61495024", "0.60724777", "0.5984764", "0.59528726", "0.5936731", "0.59294415", "0.5928595", "0.5903786", "0.58882797", "0.5857715", "0.5805078", "0.578...
0.55663055
56
Servicio que simula el SignIn de usuario y que cumpla el email y password en el if
async def sing_in( email: str = Body( embed=True, title="Email", description="Email user", example="admin@email.com", min_length=10, max_length=100, ), password: str = Body( embed=True, title="Password", description="Password user", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_in_existing_user(self, email, password):\r\n signin_url = \"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=\" + self.wak\r\n signin_payload = {\"email\": email, \"password\": password, \"returnSecureToken\": True}\r\n signin_request = requests.post(signi...
[ "0.6919058", "0.67909396", "0.6777787", "0.67508465", "0.67449445", "0.67307746", "0.6728279", "0.67102814", "0.6705919", "0.66222376", "0.6616866", "0.6609022", "0.660117", "0.6597637", "0.6570714", "0.6570714", "0.6564064", "0.6500685", "0.6496326", "0.6490845", "0.6469441"...
0.7124016
0
process from yaml info
def print_host_info(info_dict): import string host_objlist = [] HEADER = "ip,host,packages,security,sudo" LINE = string.Template("$IP,$HOST,$PKGS,$SECPKGS,$SUDO") print HEADER for h in info_dict: printDict = {'PKGS': 'fail', 'SECPKGS': 'fail'} Hinfo = HostInfo(info_dict[h]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_ansible_yml_path(yml_path, ctx):\n for filepath in os_walk(yml_path):\n process_ansible_file(filepath, ctx)", "def process_info(info, site):\n # Urubu doesn't split the 'tags' into multiple strings\n if \"tags\" in info:\n if isinstance(info[\"tags\"], str):\n info[\...
[ "0.5775932", "0.5745858", "0.5663466", "0.55368435", "0.54998213", "0.54619634", "0.5422737", "0.54048735", "0.5359437", "0.53408664", "0.52446145", "0.5240475", "0.5240365", "0.51894724", "0.51787114", "0.517485", "0.51512736", "0.5121478", "0.509593", "0.50578076", "0.50364...
0.0
-1
Script to fit the models and perfom predictions and then save the resulls . Arguments
def get_report(X_train, y_train, X_test, y_test, model, output): os = SMOTE(random_state=0) os_data_X, os_data_y = os.fit_sample(X_train, y_train) os_data_X = pd.DataFrame(data=os_data_X, columns=X_train.columns) # tune hyper parameters and fit model hyperparameters = { 'C': np.logspace(-4,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n \n parser = argparse.ArgumentParser()\n parser.add_argument('inputfile', nargs = 1, default = None,\n help = 'path to pickle file')\n parser.add_argument('outputfile', nargs = 1,\n default = None,\n help = 'outputFile f...
[ "0.71588296", "0.7066643", "0.70455945", "0.7018827", "0.6977945", "0.6822107", "0.6809477", "0.67959404", "0.6700322", "0.6692647", "0.6670074", "0.66519094", "0.66412675", "0.66372985", "0.6636472", "0.6632195", "0.66286707", "0.66087234", "0.66061175", "0.65970695", "0.653...
0.0
-1
Script to read the data, perform wrangling and output the accuracy as a dataframe . Arguments
def main(input, output): # turn csv to dataframe df = pd.read_csv(f"./data/{input}", index_col=0) # split training and test X = df.drop(columns=['DEFAULT_NEXT_MONTH']) y = df['DEFAULT_NEXT_MONTH'] X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.25, random_state=12...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args):\n try:\n rec_path = project_path + \"/\" + args.rec\n test_data_path = project_path + \"/\" + args.test\n output_data_path = project_path + \"/\" + args.output\n\n rec = read_csv(rec_path)\n test = read_csv(test_data_path)\n\n accuracy = accuracy_calcula...
[ "0.64925885", "0.63390154", "0.6288286", "0.62137735", "0.6206472", "0.618382", "0.6180317", "0.6156981", "0.6147984", "0.6147142", "0.6110526", "0.6107427", "0.6048028", "0.6045448", "0.60216385", "0.60207754", "0.59969443", "0.5996845", "0.59589565", "0.59353304", "0.593423...
0.0
-1
Load a list of objects from a json file. This function loads a list of objects from a json file. The objects
def json_load_list(file, serializable_class=None): read_list = json.load(file) if serializable_class: try: read_list = [serializable_class.json_deserialize(o) \ for o in read_list] except AttributeError: raise TypeError('non JsonSerializable class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_file(cls):\n filename = cls.__name__ + \".json\"\n result = []\n try:\n with open(filename, encoding=\"utf-8\") as file:\n obj_list = cls.from_json_string(file.read())\n for dictionary in obj_list:\n result.append(cls.cr...
[ "0.74882907", "0.74707836", "0.7465024", "0.74177116", "0.7412078", "0.73615396", "0.73556143", "0.7299399", "0.7246625", "0.7072885", "0.70635444", "0.6968334", "0.69293827", "0.6927855", "0.6851605", "0.68484855", "0.68403345", "0.675718", "0.6711192", "0.670548", "0.670248...
0.7035352
11
Load a dictionary of objects from a json file. This function loads a dictionary of objects from a json file. The
def json_load_dict(file, serializable_class=None): read_dict = json.load(file) if serializable_class: try: read_dict = dict([(k, serializable_class.json_deserialize(o)) \ for (k, o) in read_dict.items()]) except AttributeError: raise TypeError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n with io.open(self.filename, encoding='utf-8') as f:\n self.load_from_dict(json.loads(f.read()))", "def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_file.read())\n\n return dictio...
[ "0.7506544", "0.74715936", "0.7309802", "0.72842115", "0.7261859", "0.719322", "0.71890604", "0.71666133", "0.7100827", "0.7082036", "0.7029916", "0.70243615", "0.7017344", "0.6971616", "0.6960963", "0.69577605", "0.69365466", "0.69328463", "0.69187915", "0.6917001", "0.68741...
0.66113627
70
Return a serializable version of current object.
def json_serialize(self): raise NotImplementedError('json_serialize must be overriden')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self, obj):\n return obj", "def serialize_forstorage(cls, obj):\n return misc.serialize_forstorage(obj)", "def serialize(self) -> typing.Any:\n return self._serialize(self.__dict__)", "def serialize(obj):\n return serialization_manager.serialize(obj)", "def serialize(o...
[ "0.7578542", "0.7420825", "0.7416291", "0.7336307", "0.7121086", "0.71167004", "0.70481807", "0.70443165", "0.7041955", "0.69899845", "0.6926779", "0.6841724", "0.67845005", "0.67742974", "0.6736352", "0.6723895", "0.67163336", "0.6712493", "0.6707341", "0.6691325", "0.667803...
0.0
-1
Load object from a deserialized json object. This method should load object from data returned by
def json_deserialize(json_object): raise NotImplementedError('json_deserialize must be overriden')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json(self):\n\n self.load_json_str(self.get_json_str())", "def test_load_an_object_json_file(self):\n from test.resources import object_json\n self.assertEqual(object_json._data, {'answer': 42})\n self.assertEqual(len(object_json), 1)\n self.assertEqual(object_json['an...
[ "0.68574446", "0.68526304", "0.67517924", "0.6714143", "0.6706278", "0.6699001", "0.6689056", "0.6678043", "0.6648171", "0.65466624", "0.6534616", "0.6517503", "0.6515564", "0.6510992", "0.64804906", "0.64561087", "0.64272976", "0.6400208", "0.63936055", "0.6375655", "0.63674...
0.6943058
0
Request a new token for PetFinder API
def request_pet_finder_token(): resp = HTTP_request.post('https://api.petfinder.com/v2/oauth2/token', data={ "grant_type": 'client_credentials', "client_id": PET_FINDER_API_KEY, "client_secret": PET_FINDER_SECRET }) return resp.json()["access_token"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _request_token(self):\n response = requests.post(\n \"%s/generateToken\" % self.root_uri.rstrip(\"/\"), {\n \"username\": self.username,\n \"password\": self.password,\n \"expiration\": '60',\n \"referer\": 'https://wsdot.maps.arcgis...
[ "0.6843756", "0.6813091", "0.6628807", "0.63735133", "0.62889975", "0.62889975", "0.62868845", "0.61614156", "0.61422414", "0.61389273", "0.61245733", "0.6062223", "0.60407823", "0.60340023", "0.5962483", "0.5954784", "0.59334654", "0.591421", "0.5892296", "0.5873533", "0.585...
0.8112312
0
Get a random pet from PetFinder API
def get_random_pet(): resp = HTTP_request.get(' https://api.petfinder.com/v2/animals', params={ "limit": 100, }, headers={"Authorization": f"Bearer {pet_finder_token}"}) pets = resp.json()["animals"] random_pet = random.choice(pets) return {"name": random_pet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_pet_by_id(self):\n response = self.client.open(\n '/pet/{petId}'.format(pet_id=789),\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))", "def test_get_pets(self):\n response = self.clie...
[ "0.665234", "0.6399835", "0.6327834", "0.621665", "0.6184601", "0.60294116", "0.5959023", "0.5830671", "0.57961977", "0.57881856", "0.5752887", "0.575186", "0.57448804", "0.57315195", "0.5722689", "0.5674243", "0.5652184", "0.5650352", "0.56280303", "0.5588803", "0.55646455",...
0.8701281
0
Returns an asynchronous iterator that yields chunks of size n. Python3.5 available for Python 3.5+ only
def iter_chunked(self, n: int) -> AsyncStreamIterator[bytes]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(l, n): # noqa: E741\n for i in range(0, len(l), n):\n yield l[i : i + n] # noqa: E203", "def chunks(seq: Sequence[T], n: int) -> Iterator[Sequence[T]]:\n for i in range(0, len(seq), n):\n yield seq[i:i + n]", "def chunks(iterable: Iterable, n: int = 1000, cls: T...
[ "0.71770084", "0.714404", "0.7130353", "0.7025188", "0.70212555", "0.70097613", "0.70097613", "0.700124", "0.6995675", "0.6995675", "0.6995675", "0.6995675", "0.6995675", "0.69865084", "0.6983201", "0.69800216", "0.6975258", "0.69691044", "0.69691044", "0.6964514", "0.6963392...
0.8406365
0
Returns an asynchronous iterator that yields all the available data as soon as it is received Python3.5 available for Python 3.5+ only
def iter_any(self) -> AsyncStreamIterator[bytes]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readAsync(self, max=None, min=1):\r\n try:\r\n while len(self._readBuffer)<min and not self.closed:\r\n try:\r\n for result in self._getMsg(ContentType.application_data):\r\n if result in (0,1):\r\n yield resu...
[ "0.66087055", "0.64680886", "0.63674414", "0.6350678", "0.6168364", "0.6115683", "0.6043215", "0.5992283", "0.59830487", "0.594967", "0.5933006", "0.59271944", "0.5820667", "0.58150715", "0.5796493", "0.57852286", "0.577836", "0.5772231", "0.5758018", "0.57552457", "0.573344"...
0.6463672
2
Returns an asynchronous iterator that yields chunks of data as they are received by the server. The yielded objects are tuples of (bytes, bool) as returned by the StreamReader.readchunk method. Python3.5 available for Python 3.5+ only
def iter_chunks(self) -> ChunkTupleAsyncStreamIterator: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_chunked(self, n: int) -> AsyncStreamIterator[bytes]:\n ...", "async def async_readchunks(self, size: int):\n while True:\n data = await self.read(size)\n if data:\n await yield_(data)\n else:\n return", "async def get_iter(se...
[ "0.7574755", "0.7112138", "0.70420086", "0.6923918", "0.69095445", "0.6827394", "0.670596", "0.6689491", "0.66344255", "0.66081893", "0.6588614", "0.6588614", "0.6527863", "0.64880586", "0.64834654", "0.6474624", "0.6474624", "0.6470948", "0.6421383", "0.64128095", "0.6348733...
0.74723756
1
Return True if 'feed_eof' was called.
def is_eof(self) -> bool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_eof(self) -> bool:\n ...", "def at_eof(self) -> bool:\n ...", "def at_eof(self) -> bool:\n ...", "def at_eof(self) -> bool:\n ...", "def at_eof(self):\n return self._eof and not self._buffer", "def at_eof(self):\n return self.tell() == len(self)", "def i...
[ "0.7941098", "0.7941098", "0.7941098", "0.7941098", "0.7604682", "0.7468522", "0.74371207", "0.7281283", "0.72065914", "0.7084489", "0.7082132", "0.70359766", "0.69510895", "0.6911862", "0.6854813", "0.6824716", "0.6824716", "0.6824716", "0.6818868", "0.67933214", "0.6642566"...
0.8087004
0
Return True if the buffer is empty and 'feed_eof' was called.
def at_eof(self) -> bool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_eof(self):\n return self._eof and not self._buffer", "def at_eof(self):\n return self.tell() == len(self)", "def is_eof(self) -> bool:\n ...", "def bufferIsFull(self):\n return len(self.buffer) == self.bufferSize", "def eof(self):\r\n\t\treturn self.index == len(self.data...
[ "0.82792693", "0.7674004", "0.76508296", "0.7451886", "0.74165154", "0.7392412", "0.7295936", "0.7251209", "0.7235744", "0.71775085", "0.71049416", "0.7035588", "0.69945824", "0.6968972", "0.69163615", "0.68859214", "0.67802644", "0.6769111", "0.6769111", "0.6769111", "0.6769...
0.7508969
3
rollback reading some data from stream, inserting it to buffer head.
def unread_data(self, data: bytes) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback(self):\n self.stream.seek(0)", "def undo(self):\n if self._snapshot_index >= 0:\n snapshot = self._snapshots[self._snapshot_index]\n for chunk_location in snapshot:\n dimension, cx, cz = chunk_location\n chunk = self._unserialise_chun...
[ "0.76515955", "0.59714264", "0.57705593", "0.57341117", "0.55319744", "0.55318165", "0.54295063", "0.54177076", "0.53553", "0.53445596", "0.53358424", "0.5291767", "0.52874243", "0.52706206", "0.5246848", "0.5233261", "0.5207455", "0.51773417", "0.51701665", "0.51367366", "0....
0.0
-1
Returns a tuple of (data, end_of_http_chunk). When chunked transfer encoding is used, end_of_http_chunk is a boolean indicating if the end of the data corresponds to the end of a HTTP chunk , otherwise it is always False.
async def readchunk(self) -> Tuple[bytes, bool]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ischunked() :", "def ischunked() :", "def _get_chunk_end(self) -> models.ChunkEndToken:\n if self._chunk_state is None or self._chunk_state.next_read != 0:\n raise exceptions.StreamStateError(\n \"Incorrect chunk state for ending data\"\n )\n\n [declared_c...
[ "0.7019051", "0.7019051", "0.6703816", "0.6444258", "0.6338747", "0.62595886", "0.59569204", "0.59381384", "0.5909526", "0.59015244", "0.583296", "0.58259416", "0.58063614", "0.5717903", "0.5684656", "0.56838894", "0.5647232", "0.56234306", "0.55998677", "0.5518052", "0.54933...
0.7023059
0
Read not more than n bytes, or whole buffer is n == 1
def _read_nowait(self, n: int) -> bytes: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readbuf(self, n):\n if n == 0:\n return ''\n try:\n msg = self.sock.recv(n)\n except BaseException:\n msg = ''\n n2 = min(n - len(msg), n / 2)\n return msg + self.readbuf(n2)", "def read(self, n=1):\n return 0", "def read(self, num_...
[ "0.7050284", "0.699852", "0.69457513", "0.6936237", "0.69106805", "0.68357754", "0.68036777", "0.6793966", "0.67530906", "0.6733723", "0.6707528", "0.6705573", "0.6696056", "0.6691096", "0.6689671", "0.66148907", "0.66075283", "0.6464589", "0.64105463", "0.6400899", "0.640089...
0.72378725
0
Send data to Process parent class.
def __init__(self, shared, subbed, G, solver, istart, cutoff): # Extract the data and save to self self.shared = shared self.bool_list, self.north, self.east, self.up = subbed[:4] self.wn, self.we, self.wu = subbed[4:7] self.penn, self.pene, self.penu = subbed[7:] self.G...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_data(self):\n pass", "def on_data(self, data):\n if data is not None:\n # Send the data to the parent process\n logging.debug('Received raw data : ' + str(data))\n self.mp_queue.put(data)", "def send(self, data):\n\n if self.subpro...
[ "0.6787182", "0.6717345", "0.6668514", "0.6645568", "0.6453489", "0.64331806", "0.641502", "0.641348", "0.64026433", "0.62406677", "0.60759443", "0.6067954", "0.6058337", "0.6058337", "0.6058337", "0.60392034", "0.60202116", "0.5992445", "0.5962833", "0.5962165", "0.5945796",...
0.0
-1
Overload the Process.start() method.
def run(self): # Cache parameters and arrays nstat = self.north.shape[1] ind = self.istart solver = self.solver cutoff = self.cutoff shared = self.shared # Check if penalties are arrays arrflag = [isinstance(arr, np.ndarray) for arr in [self.penn,self.pen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Start(self):\n\n\n\n assert not self._process, 'Start() can only be called once'\n self._process = subprocess.Popen(self._args)", "def run(self):\n self.process.start()", "def start(self):\n self._proc = self._get_subprocess()\n self._pid = self._proc.pid\n self._return_co...
[ "0.83447766", "0.7483925", "0.74621856", "0.7380068", "0.7200347", "0.7139319", "0.69860667", "0.6852426", "0.6794568", "0.66343176", "0.6588879", "0.65681094", "0.65447754", "0.6531985", "0.64845073", "0.6468249", "0.6414161", "0.6409754", "0.6367552", "0.63114864", "0.63077...
0.0
-1
Overload the start() method.
def run(self): # Cache paremeters and arrays allWeights = self.allWeights spenn, spene, spenu = self.shared.penn, self.shared.pene, self.shared.penu ind = self.istart nstat = allWeights.shape[0] npar = self.penn.shape[1] combineHorizontal = self.combineHorizontal ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n raise NotImplementedError", "def start(self):\n raise NotImplementedError", "def start(self):\n raise NotImplementedError", "def start(self) -> None:\n ...", "def start(self) -> None:\n ...", "def start(self):\n raise NotImplementedError()", ...
[ "0.8590722", "0.8590722", "0.8590722", "0.8527257", "0.8527257", "0.85173905", "0.85173905", "0.85173905", "0.85173905", "0.8496921", "0.8496921", "0.8496921", "0.8496921", "0.8450977", "0.84380203", "0.843205", "0.843205", "0.84145516", "0.84145516", "0.8371412", "0.83611774...
0.0
-1
Loops through a sequence of shapes and generates a shared memory Array for each shape.
def makeSharedArrays(shapeList): out_arrays = [] for shape in shapeList: nx,ny = shape arr = Array('d', nx*ny) out_arrays.append(np.frombuffer(arr.get_obj()).reshape(shape)) return out_arrays
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_shared_array(shape, typecode='d', ismatrix=False):\n typecode = np.dtype(typecode).char\n return multiprocessing.Array(typecode, int(np.prod(shape)), lock=False), tuple(shape), typecode, ismatrix", "def allocate_arrays(self):\n self.prng_state = np.random.get_state()\n # Generate arrays...
[ "0.6974446", "0.6151557", "0.60600364", "0.59885585", "0.5957987", "0.58317196", "0.57852036", "0.56716233", "0.5649931", "0.5629448", "0.5613902", "0.5540696", "0.54901224", "0.546313", "0.5420574", "0.54119426", "0.5402118", "0.539324", "0.53709704", "0.5364535", "0.5354734...
0.7683628
0
Respond to incoming calls with a simple text message.
def sms_reply(): # Fetch the message msg = request.form.get('Body') sender=request.form.get('From') mongo_client=MongoClient("mongodb+srv://mybotdatabase:mybotdatabase@cluster0-uuaih.mongodb.net/test?retryWrites=true&w=majority") db=mongo_client.get_database('mybotdatabase') records=db.myb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hello_monkey():\n# import pdb\n# pdb.set_trace()\n body = request.values['Body']\n print body\n resp = twilio.twiml.Response()\n# makePhoneCall()\n resp.message(\"You said, \" + body)\n return str(resp)", "def hello_monkey():\n resp = twilio.twiml.Response()\n resp.say(\"Hello C...
[ "0.7145472", "0.6821747", "0.6676375", "0.6671785", "0.6527455", "0.6507148", "0.64358586", "0.6419435", "0.6375795", "0.6355792", "0.6327004", "0.6308632", "0.6308487", "0.6308487", "0.6294154", "0.6280349", "0.6279057", "0.6270728", "0.6254323", "0.6246847", "0.62156624", ...
0.0
-1
Negate summon type (overwritten is SummonCrest).
def is_summon(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turtle(self,turtleType):\n if self.turtleType == turtleType:\n return\n if self.turtleType and self.turtleType != PLAYER:\n self.mc.removeEntity(self.turtleId)\n self.turtleType = turtleType\n if turtleType == PLAYER:\n self.turtleId = None\n ...
[ "0.55268496", "0.51017374", "0.5099685", "0.49892312", "0.49763012", "0.48441723", "0.48257315", "0.4814364", "0.48057917", "0.48044848", "0.4800181", "0.4788909", "0.47760472", "0.47716922", "0.47664163", "0.47546786", "0.4745969", "0.4726265", "0.47103164", "0.469006", "0.4...
0.5931461
0
Returns a string version of object.
def stringify(self): return self.char
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_(object_):\n return str(object_)", "def get_str(self, obj):\n if self.pretty:\n return pprint.pformat(obj)\n else:\n return str(obj)", "def objectToString(obj):\n if (hasattr(obj, \"__iter__\")):\n # matrix or vector\n if len(obj) == 0:\n ...
[ "0.81336117", "0.78381944", "0.7728992", "0.7689238", "0.76885116", "0.7657198", "0.75597316", "0.7508391", "0.74794096", "0.7453235", "0.74042314", "0.74042314", "0.7396886", "0.73296225", "0.732042", "0.732042", "0.732042", "0.7304214", "0.7252145", "0.7252145", "0.7250831"...
0.0
-1
Download the raw dataset. Download the dataset with the given url and unpack the file.
def download(self): if not self.url: raise RuntimeError(self.tips) download_file_name = os.path.join( self.raw_path, os.path.splitext(os.path.basename(self.url))[0] ) file_format = self.url.split(".")[-1] if "amazon" in self.url: raw_file_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_dataset(url=DATASET_URL):\n # disable insecure https warning\n urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)\n\n c = urllib3.PoolManager()\n with c.request(\"GET\", url, preload_content=False) as res, open(\n LOCAL_FILE_NAME, \"wb\"\n ) as out_file:\n ...
[ "0.75170743", "0.74800885", "0.73090076", "0.7289415", "0.7089676", "0.700721", "0.6959272", "0.69371325", "0.69280714", "0.6901324", "0.6900851", "0.68974", "0.6890962", "0.6863921", "0.6831888", "0.6831116", "0.6821003", "0.6796688", "0.6792401", "0.67825687", "0.67250055",...
0.798512
0
Preprocess the raw file. A virtual function that needs to be implement in the derived class. Preprocess the file downloaded via the url, convert it to a dataframe consist of the useritem interaction and save in the processed directory.
def preprocess(self): raise RuntimeError("please implement this function!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self):\r\n file_name = os.path.join(self.raw_path, \"amazon-amazon-instant-video.json.gz\")\r\n print(f\"file_name: {file_name}\")\r\n if not os.path.exists(file_name):\r\n self.download()\r\n\r\n # parse json data\r\n data = self.get_data_frame_from_gzi...
[ "0.6534041", "0.574542", "0.5633257", "0.55913997", "0.5578668", "0.5497119", "0.5454433", "0.54388577", "0.542878", "0.5417637", "0.5415108", "0.5394642", "0.5380492", "0.5368576", "0.5363467", "0.53499514", "0.5349911", "0.53368586", "0.5333087", "0.5307242", "0.5303758", ...
0.0
-1
Load the useritem interaction. And filter users, items or orders.
def load_interaction(self): processed_file_path = os.path.join( self.processed_path, f"{self.dataset_name}_interaction.npz" ) if not os.path.exists(os.path.join(processed_file_path)): try: self.preprocess() except FileNotFoundError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_item(\n db: Session = Depends(deps.get_db),\n item: models.Item = Depends(deps.get_owned_item_by_id),\n current_user: schemas.UserInDB = Depends(deps.get_current_active_user),\n) -> Any:\n return item", "def load(self, request, item, linked_item, extra):\n\t\textra['buttons_update'] = True\n...
[ "0.5721067", "0.5665929", "0.5598896", "0.555258", "0.5498032", "0.5409534", "0.54046136", "0.5331515", "0.5309727", "0.5291337", "0.5275244", "0.52524257", "0.52349734", "0.52277434", "0.5215646", "0.5212678", "0.52095574", "0.5192472", "0.5175886", "0.51436263", "0.5138405"...
0.53785694
7
Generate split data with leave_one_out. Generate split data with leave_one_out method.
def make_leave_one_out(self, data=None, random=False, n_negative=100, n_test=10): if data is None: data = self.load_interaction() if not isinstance(data, pd.DataFrame): raise RuntimeError("data is not a type of DataFrame") if DEFAULT_TIMESTAMP_COL not in data.columns: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_leave_one_out(\n self, random=False, n_negative=100, n_test=10, download=False, force_redo=False\n ):\n processed_leave_one_out_path = os.path.join(\n self.processed_path, \"leave_one_out\"\n )\n if not os.path.exists(processed_leave_one_out_path):\n os...
[ "0.64006853", "0.59879076", "0.55763435", "0.55317277", "0.55303913", "0.55164915", "0.55009717", "0.55009717", "0.5481186", "0.54715973", "0.5434519", "0.5372575", "0.5353859", "0.5349409", "0.5344193", "0.52889025", "0.5278374", "0.5241997", "0.5180314", "0.517385", "0.5162...
0.7407321
0
Generate split data with leave_one_basket. Generate split data with leave_one_basket method.
def make_leave_one_basket(self, data=None, random=False, n_negative=100, n_test=10): if data is None: data = self.load_interaction() if not isinstance(data, pd.DataFrame): raise RuntimeError("data is not a type of DataFrame") if DEFAULT_TIMESTAMP_COL not in data.columns...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_leave_one_basket(\n self, random=False, n_negative=100, n_test=10, download=False, force_redo=False\n ):\n processed_leave_one_basket_path = os.path.join(\n self.processed_path, \"leave_one_basket\"\n )\n if not os.path.exists(processed_leave_one_basket_path):\n ...
[ "0.6579837", "0.62223613", "0.6121086", "0.59291023", "0.5739245", "0.561187", "0.5533664", "0.53815806", "0.53546727", "0.53101796", "0.529657", "0.51890284", "0.5146162", "0.5141018", "0.5119683", "0.51053584", "0.5073628", "0.50700915", "0.5049382", "0.50471044", "0.503579...
0.75788254
0
Generate split data with random_split. Generate split data with random_split method
def make_random_split( self, data=None, test_rate=0.1, n_negative=100, by_user=False, n_test=10 ): if data is None: data = self.load_interaction() data = filter_user_item(data, min_u_c=3, min_i_c=3) if not isinstance(data, pd.DataFrame): raise RuntimeErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self):\n\n ratio_c = 1 - self.ratio\n self.train, self.test = self.df.randomSplit([self.ratio, ratio_c], seed=12345)", "def split_data(self):\r\n print('split data')\r\n np.random.shuffle(self.dataList)\r\n l = len(self.dataList)/self.fold\r\n self.dataList = [...
[ "0.7779674", "0.7524568", "0.7381414", "0.72343975", "0.7233255", "0.71878064", "0.70911026", "0.7021842", "0.699563", "0.6978065", "0.6977863", "0.69686615", "0.69661087", "0.6941657", "0.6923736", "0.6920699", "0.687267", "0.68609744", "0.6848516", "0.68411326", "0.68392575...
0.6885499
16
Generate split data with random_basket_split. Generate split data with random_basket_split method.
def make_random_basket_split( self, data=None, test_rate=0.1, n_negative=100, by_user=False, n_test=10 ): if data is None: data = self.load_interaction() if not isinstance(data, pd.DataFrame): raise RuntimeError("data is not a type of DataFrame") if DEFAULT_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_random_basket_split(\n self,\n test_rate=0.1,\n random=False,\n n_negative=100,\n by_user=False,\n n_test=10,\n download=False,\n force_redo=False,\n ):\n processed_random_basket_split_path = os.path.join(\n self.processed_path, ...
[ "0.7371782", "0.6609472", "0.6541531", "0.65034246", "0.64922196", "0.6460526", "0.63798183", "0.63664126", "0.6362491", "0.634936", "0.6297788", "0.62018615", "0.6158879", "0.6157614", "0.6139064", "0.60892487", "0.6087271", "0.6073939", "0.60007095", "0.59683096", "0.595200...
0.79342616
0
Generate split data with temporal_split. Generate split data with temporal_split method.
def make_temporal_split( self, data=None, test_rate=0.1, n_negative=100, by_user=False, n_test=10 ): if data is None: data = self.load_interaction() data = filter_user_item(data, min_u_c=3, min_i_c=3) if not isinstance(data, pd.DataFrame): raise RuntimeEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataset(self, split):\n trunk_pos_size = math.ceil((1 - split) * len(self.Pos))\n trunk_neg_size = math.ceil((1 - split) * len(self.Neg))\n trunk_num = int(1 / (1 - split))\n pos_temp = list()\n neg_temp = list()\n for index in range(trunk_num):\n pos_...
[ "0.5986634", "0.59638226", "0.5879246", "0.58753526", "0.5766725", "0.569158", "0.56897795", "0.5687967", "0.5669114", "0.5665528", "0.56597334", "0.56530446", "0.56510305", "0.5649782", "0.5641684", "0.56264055", "0.5589121", "0.55755794", "0.5567358", "0.5552202", "0.554621...
0.63622004
0
Generate split data with temporal_basket_split. Generate split data with temporal_basket_split method.
def make_temporal_basket_split( self, data=None, test_rate=0.1, n_negative=100, by_user=False, n_test=10 ): if data is None: data = self.load_interaction() if not isinstance(data, pd.DataFrame): raise RuntimeError("data is not a type of DataFrame") if DEFAUL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_temporal_basket_split(\n self,\n test_rate=0.1,\n n_negative=100,\n by_user=False,\n n_test=10,\n download=False,\n force_redo=False,\n ):\n processed_temporal_basket_split_path = os.path.join(\n self.processed_path, \"temporal_basket\"...
[ "0.6783587", "0.6612773", "0.6102922", "0.58242923", "0.5757818", "0.5713793", "0.5695739", "0.5482762", "0.5446944", "0.53853124", "0.5376321", "0.5373172", "0.53675795", "0.535025", "0.53106225", "0.5301982", "0.5292067", "0.5278453", "0.5264799", "0.5236665", "0.52323955",...
0.7527967
0
Load split data generated by leave_out_out without random select. Load split data generated by leave_out_out without random select from Onedrive.
def load_leave_one_out( self, random=False, n_negative=100, n_test=10, download=False, force_redo=False ): processed_leave_one_out_path = os.path.join( self.processed_path, "leave_one_out" ) if not os.path.exists(processed_leave_one_out_path): os.mkdir(process...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_only_random_dropout(self,percent_dropout,num_dropout_corruptions_per_point):\n\n\t\t\"\"\"Select the corrupted data if applicable, and otherwise the original training data\"\"\"\n\t\treturn self.__get_data__(percent_dropout,num_dropout_corruptions_per_point,bool_targetted_dropout=False)", "def make_...
[ "0.5854814", "0.57915556", "0.5778407", "0.5751435", "0.55685467", "0.5522115", "0.55144066", "0.5487392", "0.5400487", "0.53999", "0.53798616", "0.5371129", "0.5307081", "0.52967733", "0.5280792", "0.52670646", "0.52210736", "0.521755", "0.5212928", "0.5209411", "0.52048373"...
0.62081474
0
Load split date generated by leave_one_basket without random select. Load split data generated by leave_one_basket without random select from Onedrive.
def load_leave_one_basket( self, random=False, n_negative=100, n_test=10, download=False, force_redo=False ): processed_leave_one_basket_path = os.path.join( self.processed_path, "leave_one_basket" ) if not os.path.exists(processed_leave_one_basket_path): os.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_leave_one_basket(self, data=None, random=False, n_negative=100, n_test=10):\n if data is None:\n data = self.load_interaction()\n\n if not isinstance(data, pd.DataFrame):\n raise RuntimeError(\"data is not a type of DataFrame\")\n\n if DEFAULT_TIMESTAMP_COL not i...
[ "0.57733977", "0.5694952", "0.56449836", "0.5586114", "0.54595995", "0.5450965", "0.5364161", "0.5355674", "0.53516454", "0.53437084", "0.53119224", "0.5305406", "0.5303688", "0.53019094", "0.52891207", "0.5239679", "0.52088445", "0.5207115", "0.5167527", "0.51418114", "0.513...
0.60015935
0
Load split date generated by random_split. Load split data generated by random_split from Onedrive, with test_rate = 0.1 and by_user = False.
def load_random_split( self, test_rate=0.1, random=False, n_negative=100, by_user=False, n_test=10, download=False, force_redo=False, ): processed_random_split_path = os.path.join(self.processed_path, "random") if not os.path.exists(pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_temporal_split(\n self,\n test_rate=0.1,\n n_negative=100,\n by_user=False,\n n_test=10,\n download=False,\n force_redo=False,\n ):\n processed_temporal_split_path = os.path.join(self.processed_path, \"temporal\")\n\n if not os.path.exists(...
[ "0.6656853", "0.6258939", "0.615008", "0.6109969", "0.6095196", "0.6078402", "0.59671676", "0.5953242", "0.5912213", "0.58471966", "0.58057946", "0.5735395", "0.5720418", "0.5713826", "0.5688395", "0.5623368", "0.5623305", "0.56144655", "0.56078005", "0.5600086", "0.55549717"...
0.69366384
0
Load split date generated by random_basket_split. Load split data generated by random_basket_split from Onedrive, with test_rate = 0.1 and by_user = False.
def load_random_basket_split( self, test_rate=0.1, random=False, n_negative=100, by_user=False, n_test=10, download=False, force_redo=False, ): processed_random_basket_split_path = os.path.join( self.processed_path, "random_basket" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_temporal_basket_split(\n self,\n test_rate=0.1,\n n_negative=100,\n by_user=False,\n n_test=10,\n download=False,\n force_redo=False,\n ):\n processed_temporal_basket_split_path = os.path.join(\n self.processed_path, \"temporal_basket\"...
[ "0.7133687", "0.6738833", "0.6610602", "0.6159445", "0.6154813", "0.60758346", "0.60122156", "0.5912948", "0.5853551", "0.58316445", "0.5824674", "0.57067055", "0.5702897", "0.56952745", "0.5664727", "0.5542511", "0.55377877", "0.55364096", "0.5526718", "0.5458896", "0.544800...
0.7202106
0
Load split date generated by temporal_split. Load split data generated by temporal_split from Onedrive, with test_rate = 0.1 and by_user = False.
def load_temporal_split( self, test_rate=0.1, n_negative=100, by_user=False, n_test=10, download=False, force_redo=False, ): processed_temporal_split_path = os.path.join(self.processed_path, "temporal") if not os.path.exists(processed_temporal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_temporal_basket_split(\n self,\n test_rate=0.1,\n n_negative=100,\n by_user=False,\n n_test=10,\n download=False,\n force_redo=False,\n ):\n processed_temporal_basket_split_path = os.path.join(\n self.processed_path, \"temporal_basket\"...
[ "0.61022234", "0.5993563", "0.5898714", "0.5798527", "0.5767174", "0.57360524", "0.57025963", "0.5627453", "0.5621393", "0.55719185", "0.55060846", "0.54760337", "0.542432", "0.53775305", "0.5343805", "0.5313419", "0.5296359", "0.52889276", "0.52823937", "0.5257456", "0.52428...
0.70669204
0
Load split date generated by temporal_basket_split. Load split data generated by temporal_basket_split from Onedrive, with test_rate = 0.1 and by_user = False.
def load_temporal_basket_split( self, test_rate=0.1, n_negative=100, by_user=False, n_test=10, download=False, force_redo=False, ): processed_temporal_basket_split_path = os.path.join( self.processed_path, "temporal_basket" ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_temporal_split(\n self,\n test_rate=0.1,\n n_negative=100,\n by_user=False,\n n_test=10,\n download=False,\n force_redo=False,\n ):\n processed_temporal_split_path = os.path.join(self.processed_path, \"temporal\")\n\n if not os.path.exists(...
[ "0.6929598", "0.6464343", "0.6333801", "0.59288585", "0.5863091", "0.57801324", "0.57486594", "0.57221323", "0.5668923", "0.5663037", "0.5595724", "0.55237585", "0.5407653", "0.539132", "0.5381109", "0.5299281", "0.52730423", "0.5249947", "0.5209016", "0.51939607", "0.5168936...
0.7343281
0
Load split data by config dict.
def load_split(self, config): data_split_str = config["data_split"] split_paras = {} split_paras["test_rate"] = config["test_rate"] if "test_rate" in config else 0.1 split_paras["random"] = config["random"] if "random" in config else False split_paras["download"] = config["downlo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_data(self, cfg):\r\n\r\n if self._split == \"train\":\r\n self._annotations = self._load_lists(cfg.EGO4D_STA.TRAIN_LISTS)\r\n elif self._split == \"val\":\r\n self._annotations = self._load_lists(cfg.EGO4D_STA.VAL_LISTS)\r\n else:\r\n self._annotation...
[ "0.7136112", "0.6749958", "0.6747291", "0.64401364", "0.63209045", "0.61296487", "0.60909754", "0.6089914", "0.60346705", "0.60188866", "0.59833723", "0.59761685", "0.59455794", "0.5926599", "0.58674985", "0.58601004", "0.5841006", "0.58348364", "0.58224136", "0.57684314", "0...
0.79225177
0
Return a real proxy using the fake manager.
def proxy(self, modelcls): return ModelProxy(self, modelcls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, proxy):\n return LocalProxy(self, proxy)", "def __call__(self, proxy):\n return LocalProxy(self, proxy)", "def get_proxy(self):\n return self.proxy()", "def getProxyManager(address=None):\n return __mgr_cache__[address]", "def proxy(self):\n\t\tif self.__proxy is ...
[ "0.72752416", "0.72752416", "0.6797138", "0.6622182", "0.6536741", "0.6475449", "0.6355707", "0.63234043", "0.6289949", "0.62654823", "0.6104115", "0.60968864", "0.6044259", "0.6035459", "0.5993729", "0.5949819", "0.593285", "0.592931", "0.5895296", "0.58852774", "0.5831652",...
0.52532136
69
Return a fake bucket object for the given model class.
def bucket_for_modelcls(self, modelcls): bucket_name = self.bucket_name(modelcls) return FakeRiakBucket(self._state, bucket_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def riak_object(self, modelcls, key):\n bucket_name = self.bucket_name(modelcls)\n riak_object = FakeRiakObject(self._state, bucket_name, key)\n riak_object.set_content_type(\"application/json\")\n riak_object.set_data({'$VERSION': modelcls.VERSION})\n return riak_object", "def...
[ "0.66789925", "0.6196018", "0.6026476", "0.5923624", "0.5913924", "0.59030366", "0.5856308", "0.5819066", "0.58131045", "0.57993364", "0.57706445", "0.5769229", "0.5739091", "0.5715317", "0.56394327", "0.5605846", "0.55638534", "0.55497086", "0.5537596", "0.53611326", "0.5357...
0.8668611
0
Create and return a fake RiakObject.
def riak_object(self, modelcls, key): bucket_name = self.bucket_name(modelcls) riak_object = FakeRiakObject(self._state, bucket_name, key) riak_object.set_content_type("application/json") riak_object.set_data({'$VERSION': modelcls.VERSION}) return riak_object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_object():\n return object()", "def construct_fake(self, name: str) -> ResponsibleFake:\n fake: NaiveFake = getattr(self.faker, name)\n return lru_cache(maxsize=None)(lambda _: fake())", "def _mkObject(self):\n return ImmutableObject(\n store=self.store,\n ...
[ "0.6498993", "0.6185029", "0.6068252", "0.5993571", "0.59780276", "0.5866788", "0.58306056", "0.5774978", "0.57056415", "0.566206", "0.5632154", "0.5630083", "0.56242526", "0.55080545", "0.55028653", "0.54455763", "0.5429836", "0.54195917", "0.54066926", "0.5395255", "0.53947...
0.71742576
0
This method gets wrapped in a sync or async decorator in __init__().
def _internal_store(self, modelobj): riak_object = modelobj._riak_object modelcls = type(modelobj) model_name = "%s.%s" % (modelcls.__module__, modelcls.__name__) store_version = self.store_versions.get(model_name, modelcls.VERSION) # Run reverse migrators until we have the corre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _init(self, **kwargs):", "async def init(self) -> None:", "async def init(self) -> None:", "def asyncinit(cls):\r\n __new__ = cls.__new__\r\n\r\n async def init(obj, *arg, **kwarg):\r\n await obj.__init__(*arg, **kwarg)\r\n return obj\r\n\r\n def new(cls, *arg, **kwarg):\r\n ...
[ "0.8006137", "0.76090944", "0.76090944", "0.7438312", "0.740925", "0.7292255", "0.7031035", "0.69837546", "0.6941324", "0.6842028", "0.68320733", "0.67985046", "0.67985046", "0.67748123", "0.65421194", "0.64603657", "0.6431204", "0.6408666", "0.63595897", "0.6324704", "0.6299...
0.0
-1
This method gets wrapped in a sync or async decorator in __init__().
def _internal_load(self, modelcls, key, result=None): assert result is None riak_object = self.riak_object(modelcls, key) yield riak_object.reload() was_migrated = False # Run migrators until we have the correct version of the data. while riak_object.get_data() is not No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _init(self, **kwargs):", "async def init(self) -> None:", "async def init(self) -> None:", "def asyncinit(cls):\r\n __new__ = cls.__new__\r\n\r\n async def init(obj, *arg, **kwarg):\r\n await obj.__init__(*arg, **kwarg)\r\n return obj\r\n\r\n def new(cls, *arg, **kwarg):\r\n ...
[ "0.8005705", "0.7608271", "0.7608271", "0.7438416", "0.7408347", "0.7292691", "0.7031337", "0.6983339", "0.69409025", "0.68420506", "0.6832", "0.6799524", "0.6799524", "0.67752844", "0.6542425", "0.6459675", "0.64325684", "0.64084333", "0.6358968", "0.6324686", "0.6298399", ...
0.0
-1
If in async mode, add some delay to catch code that doesn't properly wait for the deferred to fire.
def _with_async_delay(self, func, *args, **kw): if self._is_sync: return func(*args, **kw) # Add some latency to catch things that don't wait on deferreds. We # can't use deferLater() here because we want to keep track of the # delayed call object. d = Deferred() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_deferred(self):\n self.deferred_executor.process()", "def execute_deferred(fn):\n\n pass", "async def _timeToRun(self) -> None:\n d: Deferred[None] = Deferred()\n self._waiting.append(d)\n await d", "def wait_for_defered(defered, timeout=5.0):\n @wait_for(timeout=...
[ "0.6407433", "0.6054961", "0.5931694", "0.59257764", "0.586519", "0.5810578", "0.58012944", "0.5783409", "0.5758944", "0.5752723", "0.5665321", "0.56585205", "0.5654886", "0.5620103", "0.5618915", "0.5618915", "0.5594411", "0.5590306", "0.55107504", "0.550138", "0.5490843", ...
0.61031705
1
Get the data for a bucket.
def _get_bucket(self, bucket_name): return self._buckets.setdefault(bucket_name, { "objects": {}, "indexes": {}, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bucket(self, bucket):\n msg = \"get_bucket not implemented\"\n raise NotImplementedError(msg)", "def get(self, bucket: str, object_name: str) -> bytes:\n raise NotImplementedError()", "def get_object(self, bucket_name, key, stream=False, extra_get_args={}):\n url = self.__ke...
[ "0.71905565", "0.7109311", "0.70022655", "0.6954286", "0.6915819", "0.6901619", "0.68624103", "0.6703636", "0.6644464", "0.6631513", "0.66204536", "0.6584078", "0.65596014", "0.65596014", "0.65346587", "0.646162", "0.6411715", "0.6383617", "0.6353845", "0.6338499", "0.6306698...
0.6617809
11
Clears any existing indexes for the object and adds the new indexes.
def _rebuild_bucket_indexes(self, fake_object, bucket_indexes): new_bucket_indexes = {} for index_name, index_values in bucket_indexes.iteritems(): new_index_values = [(value, key) for value, key in index_values if key != fake_object.key] if new_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_indexes(self) -> None:\n raise NotImplementedError", "def clear_indexes(self):\n for keypoints in self:\n keypoints.clear_index()", "def reset_indexes(self) -> None:\n assert self.indexes is not None, 'Cannot reset indexes because they have not been enabled.'\n ...
[ "0.7962811", "0.77199477", "0.74439174", "0.7208084", "0.69414335", "0.687996", "0.6828578", "0.6679138", "0.66232806", "0.65230024", "0.64893895", "0.6396236", "0.6369008", "0.6369008", "0.63655037", "0.6339188", "0.63141656", "0.63088566", "0.627068", "0.62614197", "0.62272...
0.54878813
94
Set an object's data from stored state.
def _reload_object_state(self, fake_object): bucket = self._get_bucket(fake_object._bucket_name) obj_state = bucket["objects"].get(fake_object.key) if obj_state is None: fake_object._current_data["data"] = None return fake_object._current_data["data"] = json.loads...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setstate__(self, state):\n # compatibility with data from previous versions\n self._name = \"\"\n self._user_data = dict()\n self.__loaded_from = None\n # Restore state. This overrides the above if contained in the data.\n self.__dict__.update(restore_dict(state))", ...
[ "0.71133906", "0.697515", "0.6929407", "0.67960244", "0.66473466", "0.6579738", "0.6579738", "0.6570009", "0.65426505", "0.65261996", "0.64733386", "0.64467406", "0.6441846", "0.64327496", "0.64145625", "0.6390083", "0.63830626", "0.6369311", "0.6369311", "0.6365251", "0.6363...
0.60808206
44
Perform an index query.
def get_index_page(self, bucket_name, index_name, start_value, end_value, return_terms=False, max_results=None, continuation=None): # Get all matching results index = self._get_bucket(bucket_name)["indexes"].get(index_name, []) if end_value is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executeQuery(es_client, index_name, query):\n try:\n result = es_client.search(index=index_name, body=query)\n except:\n etype, evalue, etb = sys.exc_info()\n logger.error('The query %s failed. Exception: %s, Error: %s.' % (query, etype, evalue))\n sys.exit(255)\n return re...
[ "0.67725027", "0.63458204", "0.62913054", "0.6221859", "0.61977863", "0.6139194", "0.613868", "0.610162", "0.6077222", "0.6066747", "0.6046824", "0.5995622", "0.5973254", "0.5963332", "0.596024", "0.5931736", "0.5911588", "0.59082806", "0.5874511", "0.5863403", "0.5849677", ...
0.0
-1
Construct and return an index page object.
def _return_index_page(self, bucket_name, index_name, start_value, end_value, return_terms, max_results, results, continuation): if not return_terms: results = [key for _, key in results] return FakeMemoryIndexPage(self, continuation, res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n\n return {\n 'page': 'index',\n }", "def get_index():\n return render_template('index.html')", "def index():\n return render_template('pages/index.html', isNav=True)", "def index_page(data):\n main_index = [html.H1(\"INDEX\"),\n html.Div([html.A(\"Charact...
[ "0.71548754", "0.64618194", "0.6436049", "0.6369808", "0.6298626", "0.6282117", "0.6282117", "0.6282117", "0.62155414", "0.6210448", "0.6186697", "0.61463696", "0.60686356", "0.606648", "0.6062112", "0.60497737", "0.60472274", "0.60227215", "0.6021287", "0.6020807", "0.600525...
0.67040664
1
Test to verify we can successfully create a new NPC object
def test_NPC_post_successful(self): client = APIClient() class_lookup = { 1: "Rogue", 2: "Paladin", 3: "Cleric", 4: "Barbarian", 5: "Warlock" } race_lookup = { 1: "Human", 2: "Dragonborn", 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new(self):\n obj = Game.new(self._creator, self._ds)\n self.assertIsInstance(obj, Game, \"Game instance not initialized.\")\n self.assertHasAttribute(obj, 'uid', \"Game has no unique ID.\")\n self.assertHasAttributes(obj, [\n 'players', 'spectators', 'state', 'points...
[ "0.6854737", "0.6848042", "0.68137944", "0.67878354", "0.67403334", "0.6688225", "0.66370744", "0.6625862", "0.66257757", "0.66257757", "0.6584136", "0.6575232", "0.6548104", "0.6523475", "0.65218157", "0.6479944", "0.6471372", "0.64576745", "0.64287883", "0.63746697", "0.635...
0.74615973
0
Yields back segments of the given size.
def read(self, size=None): if size is None: size = self._size content = self._buffer() if not content: yield '' else: running = True while running: finished = False while len(content) < size and not finished:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_seq(seq,size):\n for i in range(0,len(seq),size):\n if i+size<len(seq) and seq[i+size] - seq[i] == size:\n yield seq[i:i+size]", "def _chunker(self, seq, size):\n return (seq[pos:pos + size] for pos in range(0, len(seq), size))", "def chunker(seq, size):\n\n return (seq...
[ "0.6381796", "0.6354107", "0.63341737", "0.6215879", "0.6193881", "0.5877543", "0.5856534", "0.5856534", "0.5856534", "0.57852167", "0.57440567", "0.5740479", "0.5725823", "0.56952685", "0.5686917", "0.56858265", "0.5647168", "0.56457704", "0.5622612", "0.55972713", "0.558421...
0.0
-1
It will render either the last 10 news items or all of them, depending on the keyword archive.
def index(request, archive=False): context = {'archive':archive} posts = Post.objects.all() if not archive: posts = posts[:10] context['posts'] = posts if request.user.is_authenticated(): #These are the new news items the logged in user has context['new_posts'] = NewBlog.obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_archives():\n if not session.get('logged_in'): \n latest = Post.query.filter_by(visible=True)\n else:\n latest = Post.query\n latest = latest.order_by(Post.id.desc()).limit(10)\n months = Post.query.get_months()\n tags = Tag.query.order_by(Tag.name).all()\n #: Needed for ca...
[ "0.66486454", "0.66125673", "0.64189005", "0.62656194", "0.61706954", "0.6150045", "0.60625744", "0.6050601", "0.5968591", "0.59586847", "0.5903161", "0.5878132", "0.58350307", "0.5815076", "0.5810166", "0.5732592", "0.5732581", "0.57017016", "0.5642253", "0.56308407", "0.562...
0.68119586
0
Will mark as read the new news items of the logged in user.
def forget_new_blogs(request): try: user = request.user except: user = None if user: NewBlog.objects.filter(user=user).delete() return ok_response(request)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_read(self):\n params = {\"ffauth_device_id\": self._DiscretelyAuthenticatedObject__device_id,\n \"ffauth_secret\": self._DiscretelyAuthenticatedObject__device_token}\n data = {\"data\": str({\"recipient\": {\"guid\": self._DiscretelyAuthenticatedObject__guid, \"type\": \"...
[ "0.6871701", "0.66225696", "0.6592108", "0.6584183", "0.65390974", "0.63864577", "0.63664514", "0.6313001", "0.6280187", "0.61863893", "0.6144048", "0.6069112", "0.6025668", "0.6004558", "0.60045063", "0.59875894", "0.598631", "0.59470224", "0.5861718", "0.58603185", "0.58442...
0.0
-1
Returns the NewBlog object for a user and a news item.
def is_new_for(post, user): return NewBlog.objects.filter(user=user, post=post)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(\n\t\trequest: schemas.Blog, db: Session = Depends(get_db),\n\t\tcurrent_user: schemas.User = Depends(oauth2.get_current_user)\n):\n\treturn blog.create(request, db)", "def createNewBlogEntry(self): #$NON-NLS-1$\r\n atomdoc = self._createNewEntryDocument()\r\n self._initNewEntryDocument(...
[ "0.6471879", "0.5887635", "0.58390415", "0.57672644", "0.5741339", "0.5694804", "0.56010824", "0.55979586", "0.55269563", "0.55218256", "0.5507781", "0.54772604", "0.54137325", "0.54113686", "0.5404327", "0.53444135", "0.5311899", "0.5304364", "0.5258207", "0.5232787", "0.521...
0.58459365
2
Property for returning execution result of single ansible module on ansible hosts. The result is a dict keyed by hostname. Value is the ansible module execution result on that host.
def results(self): return self._results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n # the AnsibleModule object will be our abstraction for working with Ansible.\n # This includes instantiation, a couple of common attr that will be the\n # args/params passed to the execution, as well as if the module\n # supports check mode\n module = AnsibleModule(\n argument...
[ "0.59007776", "0.5834799", "0.57574385", "0.57225394", "0.56056947", "0.5601673", "0.5594303", "0.5588349", "0.5442448", "0.54202944", "0.5390923", "0.5377198", "0.5361084", "0.53224784", "0.53020597", "0.529538", "0.52949655", "0.5276182", "0.5259565", "0.5231396", "0.522687...
0.0
-1
Property for returning multiple ansible module execution results of multiple ansible hosts. The result is a dict keyed by hostname. Value is list of the ansible module execution results on that host.
def results(self): return self._results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host_list(self):\n try:\n scode, hosts = Rest.get('Host')\n except Exception as e:\n Console.error(e.message)\n return\n if len(hosts) == 0:\n print(\"No hosts exist\")\n return\n\n n = 1\n e = {}\n for host in hos...
[ "0.6408961", "0.6160457", "0.60470617", "0.59150434", "0.58874756", "0.5856276", "0.5828853", "0.57795507", "0.5771532", "0.5744824", "0.56972754", "0.5654867", "0.56531096", "0.56412333", "0.5589523", "0.55734855", "0.55727243", "0.5563947", "0.5528741", "0.55194587", "0.551...
0.0
-1
Build a dict represents a task in ansible playbook.
def build_task(module_name, args=[], kwargs={}, module_attrs={}): kwargs = copy.deepcopy(kwargs) # Copy to avoid argument passed by reference issue if args: kwargs["_raw_params"] = " ".join(args) task_data = { "action": { "module": module_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_task_item(self) -> Dict[str, Any]:\n return {}", "def task_to_dict(task):\n if not isinstance(task, Task):\n return None\n d = {}\n for a in vars(task):\n d[a] = getattr(task, a)\n return d", "def generate_tasks(self, task):", "def get_task_inf...
[ "0.70797366", "0.7010024", "0.65229166", "0.6351259", "0.62007153", "0.61170655", "0.6086994", "0.60298854", "0.6015298", "0.60117143", "0.59859717", "0.5968896", "0.5959138", "0.5947667", "0.5906058", "0.5828567", "0.5814489", "0.58071464", "0.5780729", "0.57621115", "0.5742...
0.60517347
7
Use ansible's TaskQueueManager to run tasks on hosts. Defined this method as a static method on purpose so that scripts may use this method to run ansible tasks without initializing instances of AnsibleHosts or AnsibleHost.
def run_tasks( hosts, loader, inventory_manager, variable_manager, options={ "forks": 6, "connection": "smart", "verbosity": 2, "become_method": "sudo" }, passwords={"vault...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, host_list, module_name, module_args):\n # create play with tasks\n play_source = dict(\n name=\"Ansible Play\",\n hosts=host_list,\n gather_facts='no',\n tasks=[dict(action=dict(module=module_name, args=module_args))]\n )\n play ...
[ "0.71461415", "0.7090448", "0.64184934", "0.61296886", "0.6108584", "0.6062001", "0.6039702", "0.5981033", "0.5961828", "0.59389055", "0.5914672", "0.58420664", "0.58240324", "0.57676196", "0.564648", "0.56343764", "0.56221795", "0.55787176", "0.55706334", "0.54865986", "0.54...
0.70941687
1
Log ansible modules to be executed.
def _log_modules(self, caller_info, module_info, verbosity): if verbosity <= 0: # Do not log anything return filename, line_number, function_name, lines, index = caller_info if isinstance(self, AnsibleHosts): hosts_str = json.dumps(self.hostnames) elif isin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, msg):\n self.ansible.log(msg)", "def test_03_module_logger(self):\n module_logger = get_module_logger(self.__module__)\n module_logger.info('Info in Module {}'.format(self.__module__))", "def _run_ansible_module(self, *args, **kwargs):\n caller_info = kwargs.pop(\"call...
[ "0.7009652", "0.64670175", "0.6137437", "0.6028057", "0.5934864", "0.5867709", "0.58524936", "0.5779044", "0.55871576", "0.5526636", "0.5510478", "0.5477527", "0.54404324", "0.54341674", "0.54166883", "0.5373122", "0.53594613", "0.5356248", "0.5343266", "0.5331971", "0.530893...
0.663032
1
Log ansible module results.
def _log_results(self, caller_info, module_info, results, verbosity): if verbosity <= 0: # Do not log anything return if isinstance(self, AnsibleHosts): hosts_str = json.dumps(self.hostnames) elif isinstance(self, AnsibleHost): hosts_str = json.dumps(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, msg):\n self.ansible.log(msg)", "def _log_modules(self, caller_info, module_info, verbosity):\n if verbosity <= 0: # Do not log anything\n return\n\n filename, line_number, function_name, lines, index = caller_info\n\n if isinstance(self, AnsibleHosts):\n...
[ "0.6625791", "0.6181472", "0.61071557", "0.6099287", "0.6000015", "0.59062815", "0.58921254", "0.5707888", "0.5687938", "0.5610681", "0.5593121", "0.550199", "0.5477372", "0.5452468", "0.5418416", "0.54073703", "0.53965336", "0.53927475", "0.5379991", "0.5375399", "0.53749096...
0.653757
1
Check ansible module results.
def _check_results(self, caller_info, module_info, results, module_ignore_errors, verbosity): if module_ignore_errors: return filename, line_number, function_name, lines, index = caller_info caller_str = "{}::{}#{}".format(filename, function_name, line_number) if isinstance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n # the AnsibleModule object will be our abstraction for working with Ansible.\n # This includes instantiation, a couple of common attr that will be the\n # args/params passed to the execution, as well as if the module\n # supports check mode\n module = AnsibleModule(\n argument...
[ "0.7035868", "0.65649945", "0.63886446", "0.63381404", "0.6333369", "0.6272333", "0.61568916", "0.61397576", "0.6133934", "0.6107778", "0.6067837", "0.601987", "0.60109967", "0.5993061", "0.5962051", "0.5924178", "0.59025234", "0.58850336", "0.5859732", "0.58180624", "0.57735...
0.6653182
1
Run ansible module. DO NOT call this function directly. Use instance_name.() instead. This class has "__getattr__" defined. This function will be called when an attribute is not found in the instance. This function will parse the attribute name and consider the attribute name as an Ansible module name. Then it will cal...
def _run_ansible_module(self, *args, **kwargs): caller_info = kwargs.pop("caller_info", None) if not caller_info: previous_frame = inspect.currentframe().f_back caller_info = inspect.getframeinfo(previous_frame) module_args = copy.deepcopy(args) module_kwargs = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, attr):\n if not module_loader.has_plugin(attr):\n raise UnsupportedAnsibleModule(\"Unsupported ansible module \\\"{}\\\"\".format(attr))\n self.module_name = attr\n\n return self._run_ansible_module", "def run_module(self, module_name, args=[], kwargs={}):\n ...
[ "0.77540916", "0.6646788", "0.5633474", "0.5528462", "0.5466303", "0.5463101", "0.5456096", "0.5366184", "0.53633046", "0.53427565", "0.53082246", "0.53075224", "0.5284655", "0.5284655", "0.52691853", "0.5227956", "0.52182996", "0.5189134", "0.51711935", "0.516153", "0.514621...
0.6936579
1
For finding ansible module and return a function for running that ansible module.
def __getattr__(self, attr): if not module_loader.has_plugin(attr): raise UnsupportedAnsibleModule("Unsupported ansible module \"{}\"".format(attr)) self.module_name = attr return self._run_ansible_module
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_ansible_module(self, *args, **kwargs):\n caller_info = kwargs.pop(\"caller_info\", None)\n if not caller_info:\n previous_frame = inspect.currentframe().f_back\n caller_info = inspect.getframeinfo(previous_frame)\n\n module_args = copy.deepcopy(args)\n mod...
[ "0.6882392", "0.6543431", "0.5891296", "0.5775769", "0.5677727", "0.5671551", "0.5597713", "0.55873144", "0.5577404", "0.5470049", "0.54405326", "0.5424336", "0.5307048", "0.5293202", "0.52648234", "0.5262223", "0.5221401", "0.5211496", "0.5185633", "0.51850367", "0.517339", ...
0.6465781
2
Run ansible module specified by `module_name`.
def run_module(self, module_name, args=[], kwargs={}): if not module_loader.has_plugin(module_name): raise UnsupportedAnsibleModule("Unsupported ansible module \"{}\"".format(module_name)) self.module_name = module_name previous_frame = inspect.currentframe().f_back caller_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_ansible_module(self, *args, **kwargs):\n caller_info = kwargs.pop(\"caller_info\", None)\n if not caller_info:\n previous_frame = inspect.currentframe().f_back\n caller_info = inspect.getframeinfo(previous_frame)\n\n module_args = copy.deepcopy(args)\n mod...
[ "0.75557333", "0.6654302", "0.66351384", "0.64992267", "0.6433729", "0.6184073", "0.6183975", "0.6131884", "0.611866", "0.60535264", "0.6025238", "0.58155006", "0.57438225", "0.5732917", "0.57273674", "0.57205576", "0.57085866", "0.56579196", "0.5643088", "0.5642193", "0.5628...
0.7977094
0
Load a module with arguments into a list. This method load a module with arguments into a list. Method `self.run_loaded_modules` can run the loaded modules in a single play. Comparing with `self.run_module` or `self._run_ansible_module`, special keyword arguments are not supported in `kwargs` of `self.load_module`. The...
def load_module(self, module_name, args=[], kwargs={}, module_attrs={}): self._loaded_modules.append( { "module_name": module_name, "args": args, "kwargs": kwargs, "module_attrs": module_attrs } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadModule(*args, allModules: bool=True, load: AnyStr=\"\", scan: bool=True,\n **kwargs)->List[AnyStr]:\n pass", "def load_module(cls, *args, **kwargs): # real signature unknown\n pass", "def load_module(cls, *args, **kwargs): # real signature unknown\n pass", "def load_mod...
[ "0.7526992", "0.6800753", "0.6800753", "0.6800753", "0.6727341", "0.659455", "0.6575501", "0.64525557", "0.6025746", "0.5977205", "0.5977205", "0.5885488", "0.58690804", "0.5834087", "0.58114254", "0.5699735", "0.5674411", "0.5667683", "0.5610617", "0.5578631", "0.5534352", ...
0.7061555
1
Clear the list of loaded ansible modules.
def clear_loaded_modules(self): self._loaded_modules = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_modules(self) -> None:\n self.modules = {}\n self.update_modules()\n self.parse_modules()", "def clearList(self):\r\n self.addons.clear()", "def unload_all():\n module_utils.unload_package_modules(__name__)", "def clear(self):\r\n with PluginStore.mutex:\r\n ...
[ "0.68010104", "0.6701567", "0.66162837", "0.65335584", "0.63375634", "0.6336604", "0.6234657", "0.6062446", "0.605322", "0.60396117", "0.596826", "0.5857965", "0.58533", "0.5817778", "0.57520074", "0.574207", "0.56880206", "0.5674843", "0.567305", "0.5635878", "0.5623788", ...
0.7931102
0
Run the list of loaded ansible modules.
def run_loaded_modules(self, module_ignore_errors=False, verbosity=2): if len(self._loaded_modules) == 0: logger.info("No loaded task.") return {} previous_frame = inspect.currentframe().f_back caller_info = inspect.getframeinfo(previous_frame) loaded_modules = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_list(args):\n\n module_root = Path(\"modules/\")\n modules = load_modules(module_root)\n\n print(\"Available modules:\")\n for module in modules:\n print(f\"- {module}\")", "def process_module_list(self, modules):", "def _run_ansible_module(self, *args, **kwargs):\n caller_...
[ "0.6764746", "0.6730516", "0.66336393", "0.6508082", "0.64971834", "0.64125997", "0.63433975", "0.6334704", "0.6331045", "0.59814155", "0.59674734", "0.59120435", "0.5884212", "0.5880246", "0.5850442", "0.58236545", "0.5804997", "0.5785883", "0.57668686", "0.5751414", "0.5747...
0.62764215
9
Tool for getting ansible.inventory.host.Host object from self.inventories using ansible inventory manager.
def get_inv_host(self, hostname, strict=False): if strict: # Only get host with hostname from self.ans_inv_hosts for _host in self.ans_inv_hosts: if _host.name == hostname: return _host else: return None else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ansible_inventory(self):\n path_inventory = u'%s/inventories/%s' % (self.ansible_path, self.environment)\n path_lib = u'%s/library/beehive/' % (self.ansible_path)\n runner = Runner(inventory=path_inventory, verbosity=self.verbosity, \n module=path_lib)\n res =...
[ "0.7104992", "0.6289332", "0.6042384", "0.5963869", "0.5929493", "0.590701", "0.5815771", "0.5768301", "0.5764911", "0.5737428", "0.57358813", "0.5725008", "0.5690255", "0.56714857", "0.5659333", "0.5652734", "0.564978", "0.56496686", "0.5606734", "0.5598386", "0.559378", "...
0.6820544
1
Tool for getting list of ansible.inventory.host.Host objects from self.inventories using ansible inventory manager. Ansible inventory manager is used under the hood.
def get_inv_hosts(self, host_pattern): return self.im.get_hosts(host_pattern)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ansible_inventory(self):\n path_inventory = u'%s/inventories/%s' % (self.ansible_path, self.environment)\n path_lib = u'%s/library/beehive/' % (self.ansible_path)\n runner = Runner(inventory=path_inventory, verbosity=self.verbosity, \n module=path_lib)\n res =...
[ "0.7244197", "0.67974895", "0.67888147", "0.67421174", "0.67420954", "0.6721885", "0.6618341", "0.6567638", "0.6554392", "0.6490805", "0.6473363", "0.64663595", "0.6424194", "0.6418004", "0.64066315", "0.6402103", "0.63243127", "0.6319093", "0.6318828", "0.629498", "0.6249203...
0.63022584
19
Tool for getting variables of specified host from self.inventories. Variables defined in group_vars and host_vars are not included. Only ansible inventory manager is used under the hood.
def get_host_vars(self, hostname, strict=False): _host = self.get_inv_host(hostname, strict=strict) if not _host: return {} return _host.get_vars()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_vars(self, host, vault_password=None):\n use_keychain = host.get_variables().get(\"use_keychain\")\n hostname = host.get_variables().get('inventory_hostname')\n if '-l' in sys.argv:\n # Check if only limited set of hosts is required for this run and get password only fo...
[ "0.7220978", "0.68925476", "0.6842155", "0.6664228", "0.6387157", "0.6262908", "0.6128174", "0.6075817", "0.60249466", "0.6018801", "0.5955026", "0.57117116", "0.56880534", "0.5647863", "0.5549508", "0.5478009", "0.54719985", "0.5459887", "0.5457841", "0.54416996", "0.5439592...
0.6688021
3
Tool for getting variable value of specified host from self.inventories. Variables defined in group_vars and host_vars are not included. Only ansible inventory manager is used under the hood.
def get_host_var(self, hostname, var, strict=False): return self.get_host_vars(hostname, strict).get(var, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_vars(self, host, vault_password=None):\n use_keychain = host.get_variables().get(\"use_keychain\")\n hostname = host.get_variables().get('inventory_hostname')\n if '-l' in sys.argv:\n # Check if only limited set of hosts is required for this run and get password only fo...
[ "0.65954727", "0.64108", "0.60760945", "0.60310954", "0.5951888", "0.59479284", "0.5883837", "0.5869463", "0.5840042", "0.569863", "0.56864315", "0.5640068", "0.55682135", "0.5563997", "0.5554389", "0.5437301", "0.5323696", "0.5245826", "0.5237913", "0.52344644", "0.52193266"...
0.6318063
2
Tool for getting visible variables of specified host. Variables may be defined in inventory files, any group_vars and host_vars files. Both ansible inventory manager and variable managers are used under the hood.
def get_host_visible_vars(self, hostname, strict=False): _host = self.get_inv_host(hostname, strict=strict) if not _host: return {} return self.vm.get_vars(host=_host)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_vars(self, host, vault_password=None):\n use_keychain = host.get_variables().get(\"use_keychain\")\n hostname = host.get_variables().get('inventory_hostname')\n if '-l' in sys.argv:\n # Check if only limited set of hosts is required for this run and get password only fo...
[ "0.69271773", "0.6585922", "0.64885944", "0.623751", "0.62139", "0.6080665", "0.5962397", "0.57060534", "0.5664389", "0.5655992", "0.55767846", "0.53442526", "0.53242475", "0.5320545", "0.5307548", "0.5286596", "0.5281534", "0.52441394", "0.51855075", "0.51800096", "0.5178212...
0.74784786
0
Tool for getting visible variable value of specified host. Variable may be defined in inventory files, any group_vars and host_vars files. Both ansible inventory manager and variable managers are used under the hood.
def get_host_visible_var(self, hostname, var, strict=False): return self.get_host_visible_vars(hostname, strict=strict).get(var, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_var(self, hostname, var, strict=False):\n return self.get_host_vars(hostname, strict).get(var, None)", "def get_host_visible_vars(self, hostname, strict=False):\n _host = self.get_inv_host(hostname, strict=strict)\n if not _host:\n return {}\n return self.vm.ge...
[ "0.6701593", "0.6527898", "0.6228895", "0.6226399", "0.60589486", "0.6026758", "0.5883179", "0.5808856", "0.5720936", "0.5681497", "0.5645566", "0.5620774", "0.55991036", "0.5584286", "0.5564279", "0.5540426", "0.5439333", "0.5398093", "0.5271716", "0.52648276", "0.52448946",...
0.7208586
0
Test parsing single subcategory
def test_parse_single_entry(self): entry = dedent( """ Main topic text # SUBTOPICS ## creating extra stuff Help on creating extra stuff. """, indent=0, ) expected = { None: "Main topic text", "creating extra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_categories():\n pass", "def test_add_child_category(self):\n self.add_success(self.test_data['pants'])\n rv = self.get('pants')\n assert in_response(rv, 'This category is empty.')\n self.add_success(self.test_data['jeans'])\n rv = self.get('pants')\n ...
[ "0.684854", "0.6316532", "0.6271284", "0.6258647", "0.618775", "0.61750966", "0.6107724", "0.6096469", "0.6048929", "0.601986", "0.59748644", "0.59086543", "0.5866881", "0.58603185", "0.58043706", "0.5776574", "0.57665586", "0.57611483", "0.57332945", "0.57319903", "0.5727717...
0.691666
0
calculate the average value
def plot_mean_and_std_of_anomalous_imgs(imgs, angles): avg_img = mean_of_imgs(imgs) """calculate the standard deviation (std)""" std = std_of_imgs(imgs) """ it's time to plot a figure""" opacity = 0.2 plt.plot(angles, avg_img, label='(With Eve) Average of anomalous curves', l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(self):\n return self.summation() / self.count()", "def average(values):\n\treturn sum(values)/len(values)", "def avg(values):\n return sum(values) / float(len(values))", "def average(values):\n return sum(values) / len(values)", "def average(values):\n return sum(values) / len(v...
[ "0.82521933", "0.80974203", "0.80155724", "0.80081517", "0.80081517", "0.787258", "0.77935857", "0.77315706", "0.7683663", "0.765744", "0.76276344", "0.7600795", "0.75850433", "0.75799537", "0.7544391", "0.75406134", "0.75406134", "0.75406134", "0.7524444", "0.74926955", "0.7...
0.0
-1
calculate the average value
def plot_mean_and_std_of_normal_imgs(imgs, angles): avg_img = mean_of_imgs(imgs) """calculate the standard deviation (std)""" std = std_of_imgs(imgs) """ it's time to plot a figure""" opacity = 0.2 plt.plot(angles, avg_img, label='(Without Eve) Average of normal curves', line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(self):\n return self.summation() / self.count()", "def average(values):\n\treturn sum(values)/len(values)", "def avg(values):\n return sum(values) / float(len(values))", "def average(values):\n return sum(values) / len(values)", "def average(values):\n return sum(values) / len(v...
[ "0.82521933", "0.80974203", "0.80155724", "0.80081517", "0.80081517", "0.787258", "0.77935857", "0.77315706", "0.7683663", "0.765744", "0.76276344", "0.7600795", "0.75850433", "0.75799537", "0.7544391", "0.75406134", "0.75406134", "0.75406134", "0.7524444", "0.74926955", "0.7...
0.0
-1
Open network connection to projector and perform handshake
def connect(self): self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: if self.print_send: print(' - connecting...') self.socket.settimeout(1) self.socket.connect(self.host_port) if self.print_send: print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self):\n hostport = self.getHost()\n channelOpenData = forwarding.packOpen_direct_tcpip((self.host, self.port), (hostport.host, hostport.port))\n self.connector.connection.openChannel(self, channelOpenData)", "def connect():", "def start(self):\n self.protocol.makeConne...
[ "0.7299446", "0.6917918", "0.6790771", "0.6790771", "0.6779495", "0.67675763", "0.67099863", "0.6703264", "0.6702018", "0.66886103", "0.6676126", "0.6648941", "0.66488427", "0.6629851", "0.66179246", "0.6616294", "0.66152376", "0.6598392", "0.6581775", "0.6581488", "0.6579761...
0.7252354
1
Send data with optional data dump
def send(self, data): if self.print_send: dumpdata.dumpdata(' > Send: ', '{:02x}', data) try: self.socket.send(data) except ConnectionAbortedError as err: raise Closed(err)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_data(self, data: dict):\n pass", "def _send_data(self):\n pass", "def send_data(self, **kwargs):", "def send_data(self):\n data = self.datastore.use(self.data_name)\n if data is None:\n self.dbg(\"sockets_warning\", \"Data is none for {}\", [self.data_name])\n ...
[ "0.7680446", "0.7596416", "0.7460327", "0.74104613", "0.7399094", "0.73120916", "0.7297959", "0.7222169", "0.7070456", "0.70499504", "0.69698864", "0.6809962", "0.679085", "0.6752967", "0.67031723", "0.66884613", "0.6684419", "0.6680592", "0.66585773", "0.66195494", "0.661354...
0.6247879
48
Receive data with optional timeout and data dump
def recv(self, limit=1024, timeout=0): if timeout: ready = select.select([self.socket], [], [], timeout) if not ready[0]: raise Timeout('{} second timeout expired'.format(timeout)) data = self.socket.recv(limit) if not len(data): raise Closed('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, timeout=None) -> bytes:", "def recv_timeout(s, timeout=2):\n print 'Receive data in timeout mode'\n s.setblocking(0) # Non-blocking\n\n total_data = []\n data = ''\n\n begin = time.time()\n\n while 1:\n if total_data and time.time() - begin > timeout:\n break...
[ "0.708597", "0.6934325", "0.6764579", "0.6697349", "0.66607934", "0.653501", "0.653501", "0.65333515", "0.6501398", "0.64833266", "0.6480536", "0.6397755", "0.63110083", "0.63054603", "0.6172464", "0.6159378", "0.6128785", "0.6116076", "0.6064291", "0.6049287", "0.60485685", ...
0.58122694
36
Receive data and compare it against expected data
def expect(self, res, timeout=1): data = self.recv(len(res), timeout) if data != res: raise Error('Expected', res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func_data(self, data, get_recv, get_data):\n if get_data:\n checking = bytes(data).decode().encode('ascii', 'ignore').decode().lower().rstrip()\n else:\n checking = bytes(data).decode().encode('ascii', 'ignore').decode().splitlines()[1].lower().rstrip()\n if checking ...
[ "0.6630988", "0.6564704", "0.65067065", "0.64932907", "0.6408196", "0.6406156", "0.6342655", "0.63290375", "0.62507683", "0.6242974", "0.62363094", "0.6224891", "0.6204821", "0.61717105", "0.6160598", "0.6158608", "0.61321485", "0.6127049", "0.61169267", "0.6112865", "0.60945...
0.5548761
93
Take a string and return a valid filename constructed from it.
def format_filename(s): valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits) filename = ''.join(c for c in s if c in valid_chars) filename = filename.replace(' ', '_') # I don't like spaces in filenames. return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_filename(s: str):\n # from: https://gist.github.com/seanh/93666\n\n valid_chars = \"-_.() %s%s\" % (string.ascii_letters, string.digits)\n filename = ''.join(c for c in s if c in valid_chars)\n filename = filename.replace(' ', '_') # I don't like spaces in filenames.\n return filename", ...
[ "0.79578626", "0.7950373", "0.78903204", "0.7826596", "0.7820293", "0.76784", "0.7637565", "0.7621958", "0.7454506", "0.7445902", "0.74298054", "0.74010444", "0.7303567", "0.72452104", "0.71115357", "0.70342577", "0.6890423", "0.6883135", "0.68203956", "0.67677194", "0.674243...
0.7780477
7
Input of altitude in m
def VenusAtmosphere30latitude(h): h=h/1000. # Data for Venus atmosphere with latitude 0-30 deg from 0 to 72 km altitude from 1995 source data072 = """0 735.3 92.10 64.79 1.0100 8.06 8.869 1 727.7 86.45 61.56 1.0083 8.09 8.867 2 720.2 81.09 58.45 1.0065 8.10 8.864 3 712.4 76.01 55.47 1.0050...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitude(self):\n if self.__altitude:\n return sum(self.__altitude) / len(self.__altitude)\n else:\n return -9999", "def set_altitude(self):\n self.altitude = self.Calculations.convert_to_altitude( self.declination, self.right_ascension, self.Latitude, self.LHA)\n ...
[ "0.7383083", "0.7336377", "0.7291433", "0.7200939", "0.6891138", "0.68497926", "0.68255097", "0.6603867", "0.65608597", "0.6432345", "0.6416043", "0.63701373", "0.6360695", "0.6360695", "0.6337671", "0.62920725", "0.62920725", "0.6250954", "0.6242926", "0.6224109", "0.6167270...
0.0
-1
Constructs a Configuration, validating the values in `dictionary`, expecting paths to be within `location`.
def load_from_dict( cls, dictionary: Dict[str, Any], *, location: Path ) -> "Configuration": schema = { "type": "object", "additionalProperties": False, "required": ["destination", "namespace", "requirements"], "properties": { "destina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_config(location):\n if not os.path.exists(location):\n full_path = os.path.abspath(location)\n logging.fatal('Config not found - expected a configfile at: [{loc}] - exiting.'.format(loc=full_path))\n sys.exit(1)", "def __init__(self, location=None, parent=None, **kwargs):\n ...
[ "0.5855621", "0.5390428", "0.5295843", "0.52190936", "0.51966506", "0.51655555", "0.513441", "0.5131885", "0.5109062", "0.5101511", "0.5075852", "0.50618964", "0.49730387", "0.49712208", "0.4969562", "0.49658695", "0.49602363", "0.4941562", "0.49261326", "0.4875033", "0.48718...
0.74685436
0
Merge prior included and prior excluded.
def _merge_prior_knowledge(included, excluded, return_labels=True): prior_indices = np.array(np.append(included, excluded), dtype=np.int) if return_labels: prior_included_labels = np.ones((len(included),), dtype=int) prior_excluded_labels = np.zeros((len(excluded),), dtype=int) labels...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergeWith(self, others):", "def get_includes_and_excludes(self):\n # Get set of all targeting objects\n all_targets = set(self.flatten())\n # Get set of all included objects\n includes = set(self._get_includes())\n # Get the items from all_targets which are not in includes\...
[ "0.57685333", "0.56419486", "0.5227683", "0.52121437", "0.5194166", "0.5123063", "0.50769234", "0.5051112", "0.5050305", "0.50063145", "0.499131", "0.4983844", "0.49534607", "0.49036402", "0.4899939", "0.48961824", "0.48901093", "0.48372585", "0.48168328", "0.47843125", "0.47...
0.57996094
0
Classify the provided indices.
def _get_labels(self, ind): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class_names_from_indices(self, indices: List) -> List[str]:\n return [self.idx2classname[idx] for idx in indices]", "def inverse_transform_labels(self, indices):\n classes = self.classes_()\n return [classes[ind] for ind in indices]", "def create_class_indices(self) -> None:\n\n ...
[ "0.6810705", "0.6527461", "0.6481845", "0.61892253", "0.6170477", "0.6143554", "0.6080583", "0.6059782", "0.5992687", "0.5979189", "0.59296477", "0.5914667", "0.5877504", "0.5877504", "0.5877504", "0.5877504", "0.5768869", "0.5740853", "0.5726291", "0.5669022", "0.5648851", ...
0.0
-1
Function called before training model.
def _prior_teach(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _training_before_hook(self):\n pass", "def pre_train(self, dataset, **kwargs):\n\n pass", "def _set_train(self):\n\n if not self.model.__dict__['training']:\n self.model.train()", "def _pre_fit(self):\n pass", "def before_fit(self):\n self.run = not hasattr...
[ "0.8650287", "0.77567923", "0.7700606", "0.76711816", "0.7595198", "0.7460462", "0.7399239", "0.73845947", "0.7328522", "0.7328522", "0.7328522", "0.7328522", "0.7328522", "0.7264252", "0.7227195", "0.71908504", "0.7152614", "0.71077657", "0.71065706", "0.70992464", "0.708402...
0.0
-1