query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Force the response analyzer to see a food item
def force_input(self, foodItem): self.identified_food = foodItem self.has_been_checked = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkFood(self, food):\n pass", "def test_get_foods(self):\n pass", "def buy_animal_food(self):\n if self.location == \"Shop\":\n response = input(\"How many bananas do you want to buy?\")\n while response not in [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"...
[ "0.61888915", "0.5813518", "0.5767883", "0.57524073", "0.5718306", "0.57137513", "0.5671137", "0.5559772", "0.5542867", "0.55381453", "0.5503207", "0.54991305", "0.54636925", "0.5439384", "0.543128", "0.5424504", "0.5416474", "0.5389697", "0.5369161", "0.5351907", "0.5342308"...
0.6463726
0
Check if Cozmo has found food. Call this before calling get_found_food()
def has_found_food(self): self.has_been_checked = True if self.identified_food is not None: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkFood(self, food):\n pass", "def get_found_food(self):\r\n\r\n self.has_been_checked = True\r\n if self.identified_food is not None:\r\n food = self.identified_food\r\n self.identified_food = None\r\n return food\r\n else:\r\n pass\r...
[ "0.75111043", "0.7489534", "0.7032428", "0.69476", "0.66379046", "0.618052", "0.61768615", "0.6121888", "0.5946577", "0.58407557", "0.5827992", "0.58145034", "0.57803774", "0.5744369", "0.5678946", "0.5649718", "0.55860853", "0.55669844", "0.55637366", "0.5554106", "0.5504042...
0.7739004
0
Return the angle corresponding to the incrementation index.
def get_angle(self, index, model=None, var=None, deg=False): # The angle of one increment. inc_angle = pi / INC # The angle of the increment. angle = inc_angle * (index+1) # Slightly offset from zero for the first increment, to avoid artifacts in the pseudo-ellipse equations. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_to_angle(i):\n return -135.0 + (i / 1081.0) * 0.25", "def get_angle(self, range_index, range_len):\n return (range_index - (range_len/2)) * self.degrees_per_elem", "def angle(self) -> int:", "def getAngle(self):\n return self.articulateEncoder.getDistance()+self.angleOffset", "de...
[ "0.748093", "0.72034574", "0.71596324", "0.7044698", "0.67877436", "0.6713853", "0.6646742", "0.66415095", "0.66350514", "0.6608576", "0.66070217", "0.6591102", "0.6525194", "0.6525194", "0.65135294", "0.648672", "0.64864516", "0.64864516", "0.64864516", "0.6478959", "0.64749...
0.7612304
0
Initialise the storage structures.
def init_storage(self): # Create the average rotation matrix (first order). self.first_frame_order = zeros((INC+1, 3, 3), float64) # Create the frame order matrix (each element is ensemble averaged and corresponds to a different time step). self.second_frame_order = zeros((INC+1, 9, 9)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n self.population.initialize()\n self.cache.initialize()\n if self.storage:\n self.storage.initialize()", "def init_structures(self):\n self._imported_assets = {}\n self._imported_materials = {}\n self._imported_ogre_materials = {}\n\n ...
[ "0.72518444", "0.7171212", "0.68335533", "0.674247", "0.6604915", "0.6601011", "0.6586523", "0.6550822", "0.6540151", "0.6508382", "0.6500184", "0.6480404", "0.6461272", "0.64565", "0.63986415", "0.63634056", "0.63456935", "0.6328709", "0.63277686", "0.6326338", "0.6304588", ...
0.7407735
0
Construct the eigenframe for the given tag.
def setup_eigenframe(self, tag=None): # The frame order eigenframe - I. if tag == 'in_frame': self.eigenframe = eye(3) # The frame order eigenframe - rotated. elif tag == 'out_of_frame': self.eigenframe = array([[ 2, -1, 2], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tag_matrix(self):\n pass", "def CreateForTag(cls, tag):\n parent_key = cls._GetParentKeyFromTag(tag)\n return cls(parent=parent_key)", "def init_vae(img_size, latent_dim, loss_f, name):\n encoder = EncoderBurgess(img_size, latent_dim)\n decoder = DecoderBurgess(img_size, latent_dim)...
[ "0.5082272", "0.50499463", "0.49855408", "0.49262646", "0.48340616", "0.47966492", "0.47288746", "0.4657958", "0.4615", "0.46068677", "0.45949993", "0.45824423", "0.45612907", "0.45366", "0.4510511", "0.4507808", "0.44772822", "0.44754273", "0.4465599", "0.44283247", "0.44240...
0.7897641
0
A nodebased data structure where each node has a value and children property. When thic class is instantiated, an empty children collection is created.
def __init__(self, value: T): self.value = value self.children: List[Tree] = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._child_key = None\n self._child_val = None\n self._children = None\n self._element = None\n self._elements = None", "def __init__(self, value = None) :\n self.value = value\n self.childrenMap = {}", "def children(self, value):\n ...
[ "0.72893035", "0.72656655", "0.7187423", "0.7108425", "0.7075254", "0.7066956", "0.6977631", "0.69031096", "0.69031096", "0.67532724", "0.6701597", "0.6695429", "0.6660435", "0.66507006", "0.6633705", "0.6627459", "0.66169363", "0.65467525", "0.654307", "0.64765894", "0.64720...
0.73607105
0
This method is used to run a callback function on every node within this tree in a depth first manner, in order.
def depth_first_traversal(self, callback: Callable[[Tree], None]) -> None: nodes_to_visit = [] nodes_to_visit.append(self) while nodes_to_visit: temp_node = nodes_to_visit.pop() callback(temp_node) # Appending child nodes in reverse order (right to left) to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit(self, node=None, callback=None):\n\n if node is None:\n node = self.root\n\n for c in node:\n self.visit(c, callback=callback)\n if callback:\n callback(c)", "def traverse_depth_first(self, fn):\n queue = deque([self.root])\n w...
[ "0.73129284", "0.6908581", "0.6863022", "0.66908526", "0.64308876", "0.63529634", "0.6349773", "0.6345628", "0.6325941", "0.6215067", "0.6109159", "0.60967624", "0.603882", "0.60109115", "0.59826857", "0.5914083", "0.59095865", "0.58785963", "0.58615947", "0.5840124", "0.5823...
0.7009969
1
This method is used to run a callback function on every node within this tree in a breadth first manner, in order.
def breadth_first_traversal(self, callback: Callable[[Tree], None]) -> None: nodes_to_visit = [] nodes_to_visit.append(self) while nodes_to_visit: temp_node = nodes_to_visit.pop() callback(temp_node) # Enqueuing child nodes in order (left to right) in order ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse_breadth_first(self, fn):\n queue = deque([self.root])\n while len(queue) > 0:\n node = queue.popleft()\n fn(node)\n queue.extend(node.children)", "def visit(self, node=None, callback=None):\n\n if node is None:\n node = self.root\n\n ...
[ "0.7565053", "0.6804944", "0.67550534", "0.64745384", "0.62119627", "0.619241", "0.6043416", "0.60328907", "0.6030092", "0.59367", "0.5900636", "0.5894727", "0.5787934", "0.576826", "0.57213604", "0.568269", "0.5667423", "0.5664929", "0.56574744", "0.56300545", "0.5624753", ...
0.7796937
0
Names of input features of train data.
def input_features(self) -> List[str]: return self._input_features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_feature_names(self, input_features=...):\n ...", "def get_feature_names(self, input_features=None):\n if self._names is None:\n self._names = [f.name for f in self.feat_cls]\n if input_features:\n for i, input_feature in enumerate(input_features):\n ...
[ "0.82774657", "0.77361065", "0.752312", "0.736745", "0.73591125", "0.7350394", "0.7260824", "0.72477174", "0.72139597", "0.719909", "0.7160826", "0.7150138", "0.71117544", "0.70797515", "0.7076102", "0.7041631", "0.7033659", "0.7028825", "0.70256084", "0.70002925", "0.6966296...
0.7887547
1
Get datetime columns to calculate features.
def get_cols_for_datetime(train: NumpyOrPandas) -> Tuple[List[str], List[str]]: base_dates = get_columns_by_role(train, "Datetime", base_date=True) datetimes = get_columns_by_role(train, "Datetime", base_date=False) + get_columns_by_role( train, "Datetime", base_date=True, base_feats=True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_columns(df, feature):\r\n df['day'] = pd.to_datetime(df[feature]).dt.day\r\n df['month'] = pd.to_datetime(df[feature]).dt.month\r\n df['year'] = pd.to_datetime(df[feature]).dt.year\r\n return df", "def generate_features(df):\n return np.array([np.array(xi) for xi in pd.to_datetime(df)...
[ "0.783001", "0.73277444", "0.7042256", "0.69103855", "0.68558794", "0.6623331", "0.6436672", "0.62949973", "0.62762725", "0.6263622", "0.62104136", "0.6209514", "0.62015164", "0.61469334", "0.6058682", "0.6040086", "0.59839225", "0.5961928", "0.5935533", "0.59332055", "0.5891...
0.73299795
1
Difference for all datetimes with base date.
def get_datetime_diffs(self, train: NumpyOrPandas) -> Optional[LAMLTransformer]: base_dates, datetimes = self.get_cols_for_datetime(train) if len(datetimes) == 0 or len(base_dates) == 0: return dt_processing = SequentialTransformer( [ ColumnsSelector(keys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sub__(self, other):\n if not isinstance(other, datetime.timedelta):\n raise TypeError(\n \"Unsupported operand type(s) for +: {.__name__} and {.__name__}.\".format(type(self), type(other)))\n delta_years, delta_months = 0, 0\n delta_days = other.days\n to...
[ "0.5887207", "0.58813655", "0.5830267", "0.58256984", "0.57948655", "0.5766447", "0.5747977", "0.5741838", "0.5697345", "0.56706524", "0.5656103", "0.5538788", "0.5484798", "0.54665357", "0.54539776", "0.5452548", "0.5420453", "0.53833175", "0.53529626", "0.53198445", "0.5248...
0.5884061
1
Get target encoder func for dataset.
def get_target_encoder(self, train: NumpyOrPandas) -> Optional[type]: target_encoder = None if train.folds is not None: if train.task.name in ["binary", "reg"]: target_encoder = TargetEncoder else: n_classes = train.target.max() + 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_encoder(*targets: 'layout.Encoding') -> 'layout.Encoder':\n for pattern in targets:\n for codec in ENCODERS:\n if pattern.match(codec.encoding):\n return codec\n raise Encoding.Unsupported(f'No encoder for any of {targets}')", "def fit_transform(self):\n if s...
[ "0.5740328", "0.5668572", "0.56041837", "0.5568417", "0.5562393", "0.5522069", "0.55116916", "0.5486811", "0.54420495", "0.5400515", "0.5400515", "0.5362159", "0.5340695", "0.5335043", "0.5321928", "0.5263728", "0.5256098", "0.52494174", "0.5199175", "0.5181869", "0.5149598",...
0.7033993
0
Get transformer that implements categorical intersections.
def get_categorical_intersections( self, train: NumpyOrPandas, feats_to_select: Optional[List[str]] = None ) -> Optional[LAMLTransformer]: if feats_to_select is None: categories = get_columns_by_role(train, "Category") feats_to_select = categories if len(categor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categorical_raw(\n self, train: NumpyOrPandas, feats_to_select: Optional[List[str]] = None\n ) -> Optional[LAMLTransformer]:\n if feats_to_select is None:\n feats_to_select = []\n for i in [\"auto\", \"oof\", \"int\", \"ohe\"]:\n feats_to_select.extend(...
[ "0.5426551", "0.51930434", "0.5188657", "0.5052858", "0.500414", "0.49987206", "0.499071", "0.49887133", "0.49800166", "0.49664867", "0.4951718", "0.49336895", "0.48987705", "0.488561", "0.4871424", "0.4871424", "0.4871424", "0.4871424", "0.47965837", "0.4745702", "0.47048604...
0.64237744
0
Get top categories by importance. If feature importance is not defined, or feats has same importance sort it by unique values counts. In second case init param ``ascending_by_cardinality`` defines how asc or desc.
def get_top_categories(self, train: NumpyOrPandas, top_n: int = 5) -> List[str]: if self.max_intersection_depth <= 1 or self.top_intersections <= 1: return [] cats = get_columns_by_role(train, "Category") if len(cats) == 0: return [] df = DataFrame({"importance"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_feature_importance(self, features, nb_features=10):\n idxs = np.where(self.model.feature_importances_ != 0)[0]\n pred_columns = features.columns[idxs]\n feat_importances = pd.Series(self.model.feature_importances_[idxs], index=pred_columns)\n return feat_importances.nlargest(nb_...
[ "0.60114145", "0.5966931", "0.5866681", "0.5866681", "0.5788321", "0.5690669", "0.56517226", "0.55321604", "0.55102247", "0.5450231", "0.5392484", "0.53836554", "0.53741384", "0.53734016", "0.53661186", "0.5329079", "0.52934", "0.52934", "0.528548", "0.52350175", "0.51282704"...
0.65069985
0
Sorts the array a using bubblelike strategy a = [a[0], ... , a[i], a[i+1], ... , a[n1] ] |_______| | if a[i] > a[i+1] > swap(a[i],a[i+1]) 1. swap a[i] and a[i+1] if a[i] > a[i+1], until there are no more swaps. 2. if no more swaps, then array is ordered.
def bubblesort(a): while True: swap = 0 for i in range(1,len(a)): if a[i] < a[i-1]: a[i], a[i-1] = a[i-1], a[i] swap = 1 if not swap: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bubble_sort(a):\n for i in reversed(range(len(a))):\n for j in range(1, i + 1):\n if a[j-1] > a[j]:\n a[j], a[j-1] = a[j-1], a[j]\n return a", "def bubble_sort(a):\n for i in reversed(range(len(a))):\n fo...
[ "0.8080497", "0.8080497", "0.77553374", "0.7704403", "0.76422435", "0.7610144", "0.7601005", "0.75904506", "0.7573112", "0.7526947", "0.74634147", "0.74623185", "0.74404913", "0.73915756", "0.73485315", "0.7304299", "0.72658837", "0.7205", "0.7200011", "0.7192575", "0.716274"...
0.81698066
0
Insertion Sort 1. Loop through entire array 2. On each element a[i] check a[ij] a[i] then swap(a[ij],a[i]) 4. When i == n the algorithm finishes with a ordered a = [a[0], ... , a[ij], ... a[i], ... a[n1]] |__________| |
def insertion_sort(a): for i in range(1,len(a)): j = i while j: if a[j] < a[j-1]: a[j],a[j-1] = a[j-1],a[j] j-=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertion_sort(array):\n n = len(array)\n result = array.copy()\n\n # Swap each value backwards until in correct position\n for i in range(1, n):\n j = i\n while j > 0 and compare(result[j], result[j - 1]) < 0:\n result[j], result[j - 1] = result[j - 1], result[j]\n ...
[ "0.79877853", "0.7751034", "0.76963717", "0.7636322", "0.74632764", "0.7440107", "0.7423885", "0.7404616", "0.73825693", "0.73690754", "0.7318294", "0.72603047", "0.72578347", "0.7244801", "0.716855", "0.7120379", "0.7084933", "0.70756984", "0.7031635", "0.69795465", "0.69755...
0.7857487
1
Merge Sort It's a divideandconquer algorithm based on the idea of breaking down a list into several sublists until each sublists consists of a single element and merging those sublists in a manner that results into a sorted list. 1. Divide the unsorted list into N sublists. 2. Take adjacent pairs of two singleton lists...
def mergesort(a): def merge(left,right): ll = len(left) lr = len(right) result = [] i,j = 0,0 while i < ll and j< lr: if left[i] <= right[j]: result.append(left[i]) i+=1 else: result.append(right[j]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mergesort(arr):\n if type(arr) is not list:\n raise TypeError('argument must be list of integers')\n\n if len(arr) <= 1:\n return arr \n\n def recurse(arr):\n half = len(arr)//2\n left = []\n right = []\n\n for i in range(half):\n left = left + [...
[ "0.80135983", "0.80071795", "0.79954743", "0.79871607", "0.79870033", "0.79454255", "0.79447985", "0.787066", "0.78449774", "0.7831948", "0.7826752", "0.7819066", "0.7791336", "0.7767181", "0.7766505", "0.7740568", "0.77405083", "0.7736381", "0.77360785", "0.77243054", "0.771...
0.82858753
0
Upload the command file to execute remotely on each remote host.
def upload_command_file_to_remotes(connections: ThreadingGroup) -> str: remote_commands_file = '/tmp/{base_filename}.sh'.format( base_filename=str(uuid.uuid4()) ) connection: Connection for connection in connections: connection.put( '/var/local/github-actions/commands', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(self):\n cmd = mccli() + \" u f \" + self.localpath + \" -p \" + self.project.name\n \n set_cli_remote(self.project.remote)\n \n child = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n out, err = child.communicate()\n retur...
[ "0.6498886", "0.64296675", "0.6416309", "0.6376434", "0.606602", "0.6060558", "0.6029843", "0.6022648", "0.58761156", "0.5868678", "0.5839822", "0.5833962", "0.57373554", "0.572607", "0.57209706", "0.56611323", "0.5652858", "0.56452537", "0.5630913", "0.56266254", "0.56184924...
0.7448657
0
let the user create a list of 6 unique random integers from 1 to 42
def user_picks(): print ("Enter the second to last posted Fantasy 5 lotto numbers from 1 to 42:") ui = [] while len(ui) < 5: print (len(ui) + 1,) try: i = int(input("--> " )) # check if i is unique and has a value from 1 to 42 # and is an integer,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def challenge() : \n\treturn [random.randint(1,9) for i in range(5)]", "def lottery(max=49, n=6):\n\n numbers = []\n\n for _ in range(n):\n number = random.randint(1, max)\n numbers.append(number)\n\n return numbers", "def get_user_ids():\n TOTAL_USERS = 50\n return list(numpy.rand...
[ "0.6995242", "0.69013464", "0.68821484", "0.6879421", "0.6840562", "0.6794755", "0.67060995", "0.66754967", "0.65862", "0.65648323", "0.65308756", "0.6443471", "0.64369476", "0.6372896", "0.6357587", "0.6351749", "0.63378894", "0.63338614", "0.6320182", "0.62981", "0.62682265...
0.705536
0
to find the number of matching items in each list use sets
def numcheck(list1, list2): set1 = set(list1) set2 = set(list2) #set3 contains all items common to set1 and set2 set3 = set1.intersection(set2) # return number of matching items return len(set3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_lists(list1 , list2):\n set1 = set(list1)\n set2 = set(list2)\n set3 = set1.intersection(set2)\n #print '컴퓨터번호-> %s | 내 번호-> %s | 일치번호 개수 %d' % (set1,set2,len(set3))\n return len(set3)", "def k_ary_support_count(itemset, tagnamesdict):\n X = itemset[0]\n x_list = tagnamesdict[X]\n ...
[ "0.7869011", "0.6995253", "0.69298273", "0.689972", "0.68715036", "0.68698245", "0.6865972", "0.68343866", "0.6721838", "0.6574054", "0.656891", "0.65010905", "0.6476611", "0.64359355", "0.64190286", "0.6313215", "0.62904835", "0.6269989", "0.6269274", "0.6259446", "0.6216951...
0.7847926
1
Check if the dimension is dynamic
def is_dimension_dynamic(dim) -> bool: return dim is None or dim <= 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_shape_dynamic(shape: trt.Dims) -> bool:\n return any([is_dimension_dynamic(dim) for dim in shape])", "def is_dynamic(self):\n return self.t == \"Dynamic\"", "def is_dynamic(self):\r\n return self.type == \"Dynamic\"", "def is_dynamic(self):\n if self.typing == \"Dynamic\":\n ...
[ "0.7554164", "0.73295087", "0.72909844", "0.6963636", "0.6919266", "0.68727946", "0.6619582", "0.65565115", "0.6410628", "0.63226825", "0.6312713", "0.62166923", "0.6129304", "0.5998829", "0.5981094", "0.5945121", "0.5931805", "0.59269404", "0.5926063", "0.5906112", "0.590611...
0.8444339
0
Check if the shape is dynamic.
def is_shape_dynamic(shape: trt.Dims) -> bool: return any([is_dimension_dynamic(dim) for dim in shape])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dynamic(self):\r\n return self.type == \"Dynamic\"", "def is_dynamic(self):\n if self.typing == \"Dynamic\":\n return True\n else:\n return False", "def is_dynamic(self):\n return self.t == \"Dynamic\"", "def _is_dynamic(self):\n return pn_termi...
[ "0.7674806", "0.76411194", "0.761071", "0.7461237", "0.7160939", "0.68860805", "0.67196035", "0.6694817", "0.6659567", "0.6281333", "0.6178046", "0.6169215", "0.6144862", "0.6066942", "0.6066942", "0.5983836", "0.5842423", "0.5799949", "0.57326645", "0.56733185", "0.5516305",...
0.8362529
0
Run a TRT model. The model output is written in place inside the tensors provided in h_tensors['outputs'].
def run_trt_engine(context: trt.IExecutionContext, engine: trt.ICudaEngine, h_tensors: dict): # Allocate GPU memory. d_tensors = {} d_tensors['inputs'] = {k: cuda.mem_alloc(v.nbytes) for k, v in h_tensors['inputs'].items()} d_tensors['outputs'] = {k: cuda.mem_alloc(v.nbytes) for k, v in h_tensors['outputs'].ite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_model(config_file):\n config_file = os.path.join(os.getcwd(), config_file)\n result = Tethys(config_file=config_file)\n result.run_model()\n return result", "def run_task(snapshot_config, *_):\n with LocalTFRunner(snapshot_config) as runner:\n env = TfEnv(gym.make('InvertedDoublePen...
[ "0.61733675", "0.612572", "0.605591", "0.6037132", "0.60215235", "0.5980666", "0.58881503", "0.58633804", "0.5836002", "0.5751774", "0.575092", "0.57323176", "0.56898147", "0.5680785", "0.56736964", "0.5600649", "0.5595103", "0.55601126", "0.55542487", "0.55351895", "0.553267...
0.6594015
0
The path property according `DirEntry` interface.
def path(self): return self._dir_entry.path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dirpath(self) -> str:\n return self._dirpath", "def get_path(self, _property=None):\n return self._get_path(\"path\", _property)", "def path(self):\n # type: () -> string_types\n return self._path", "def __get_path(self):\n return self.path", "def path(self) -> Option...
[ "0.6925695", "0.68060863", "0.65001434", "0.6460606", "0.63999444", "0.63999444", "0.63999444", "0.6397212", "0.6385537", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355", "0.6343355"...
0.7288275
0
Get a pathlib version of this path.
def as_pathlib(self): return Path(self.absolute)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getpath(self, path):\n return self._join(path)", "def path(self) -> Path:\n return self[0]", "def base_path(self):\n return Path(self.path)", "def __get_path(self):\n return self.path", "def path(self) -> Path:\n return self._path", "def path(self):\n return ...
[ "0.70267224", "0.69238734", "0.6850933", "0.6728045", "0.67178816", "0.66968775", "0.6650851", "0.6505835", "0.64753497", "0.6461096", "0.63818663", "0.63393486", "0.63215935", "0.6294064", "0.6292999", "0.6275311", "0.6274971", "0.6274971", "0.6274971", "0.6274971", "0.62749...
0.794557
0
Post processing of each predicted mask, components with lesser number of pixels than `min_size` are ignored
def post_process( probability: np.array = None, threshold: float = 0.5, min_size: int = 10 ): # don't remember where I saw it mask = cv2.threshold(probability, threshold, 1, cv2.THRESH_BINARY)[1] num_component, component = cv2.connectedComponents(mask.astype(np.uint8)) predictions = np.zeros((350, 5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess_masks(\n self,\n masks: paddle.Tensor,\n input_size: Tuple[int, ...],\n original_size: Tuple[int, ...], ) -> paddle.Tensor:\n masks = F.interpolate(\n masks,\n (self.image_encoder.img_size, self.image_encoder.img_size),\n ...
[ "0.6923969", "0.66762614", "0.6662283", "0.66405976", "0.65936655", "0.65936655", "0.6486002", "0.64722115", "0.645727", "0.6429583", "0.6427695", "0.6346617", "0.6340748", "0.63067585", "0.6301991", "0.6271826", "0.62434494", "0.62140745", "0.6209497", "0.6205919", "0.619412...
0.6688221
1
Calculate dice of two images
def dice(img1: np.array, img2: np.array) -> float: img1 = np.asarray(img1).astype(np.bool) img2 = np.asarray(img2).astype(np.bool) intersection = np.logical_and(img1, img2) return 2.0 * intersection.sum() / (img1.sum() + img2.sum())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dice(im1, im2):\n im1 = np.asarray(im1).astype(np.bool)\n im2 = np.asarray(im2).astype(np.bool)\n\n if im1.size != im2.size:\n raise ValueError(\"Size mismatch between input arrays!!!\")\n\n im_sum = im1.sum() + im2.sum()\n if im_sum == 0:\n return 1.0\n\n # Compute Dice \n i...
[ "0.8184111", "0.7961868", "0.74755895", "0.7273459", "0.65044636", "0.6400428", "0.6223863", "0.62192774", "0.6153881", "0.6129559", "0.6116274", "0.596143", "0.59488565", "0.5935764", "0.59223676", "0.59076744", "0.5893795", "0.58617973", "0.5821765", "0.57726854", "0.576445...
0.81974256
0
checking security log report summary result
def test_get_and_check_security_log_report_summary(self, mock_send_cli_cmd): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "checking summary number is 0" response = """ <security-log-report-summary> <security-log-repor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_security_log_content(self, mock_send_cli_cmd):\n self.log.display_title(title=self.tool.get_current_function_name())\n self.log.step_num = 0\n msg = \"get in detail result is existing\"\n response = '<14>1 2017-02-22T14:15:35 cnrd-ngsrxqavm40 RT_LOG_SELF_TEST - RT_FLOW_SE...
[ "0.63301075", "0.6254012", "0.6029818", "0.6029104", "0.5952874", "0.59481287", "0.5857745", "0.58022356", "0.5794357", "0.56583303", "0.5636359", "0.5616582", "0.5604175", "0.55915546", "0.557231", "0.5552043", "0.5540321", "0.5531226", "0.55199367", "0.5508767", "0.5479371"...
0.649976
0
checking security log report in interval result
def test_get_security_log_report_in_interval(self, mock_send_cli_cmd): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "checking in interval result is existing" response = """ <security-log-report-in-interval> <security-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validity_by_time(self):\n conn = psycopg2.connect(self.conn)\n permissable_maximum_age_secs = 600 # 600s = 10mins\n query = \"SELECT time FROM steve_sense_sensor_logs ORDER BY time DESC LIMIT 1\"\n cur = conn.cursor()\n cur.execute(query)\n queryResult = cur.fetchall(...
[ "0.59379953", "0.5872102", "0.5870594", "0.58142626", "0.56833446", "0.56010324", "0.5562592", "0.55224586", "0.5503521", "0.54969937", "0.5453042", "0.54511696", "0.5383225", "0.53828925", "0.537169", "0.53611916", "0.53371114", "0.5300728", "0.5300728", "0.52993935", "0.529...
0.59607804
0
Checking compare security log report in interval result
def test_compare_security_log_report_in_interval(self, mock_send_cli_cmd): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "Compare in interval result" response = [{'security-log-report-in-interval-all': '0', 'security-log-report-in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_security_log_report_in_interval(self, mock_send_cli_cmd):\n self.log.display_title(title=self.tool.get_current_function_name())\n self.log.step_num = 0\n msg = \"checking in interval result is existing\"\n response = \"\"\"\n <security-log-report-in-interval>\n ...
[ "0.6224214", "0.6077454", "0.5977158", "0.57196146", "0.56197464", "0.5604104", "0.5596023", "0.55704623", "0.55488884", "0.5540563", "0.5518843", "0.5486448", "0.5474559", "0.5459678", "0.54135185", "0.5412911", "0.5393882", "0.5392088", "0.5376911", "0.5355326", "0.5353111"...
0.6717478
0
Get security log top result
def test_get_security_log_report_top(self, mock_send_cli_cmd, mock_sleep): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "get top result is existing" response = """ <security-log-report-top> <security-log-report-top-en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(self):", "def get_top_n_ip(log_file=default_file, top_n=20):\n \n ip_list = []\n with open(log_file) as access_log:\n for line in access_log:\n cols = [x for x in line.split()]\n ip_list.append(cols[0])\n \n# print 'RAM used: %d MB' % int(resource.g...
[ "0.656267", "0.6260873", "0.62351334", "0.6136378", "0.6127054", "0.6108576", "0.6082166", "0.60028785", "0.5973499", "0.5957672", "0.5907831", "0.59040004", "0.5874", "0.58589923", "0.582165", "0.5798988", "0.57767045", "0.5671445", "0.56598973", "0.5619603", "0.5604532", ...
0.6743538
0
Checking compare security log report top result
def test_compare_security_log_report_top(self, mock_send_cli_cmd): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "Compare top result user" response = [{'security-log-report-top-app': 'application1', 'security-log-repor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_security_log_report_top(self, mock_send_cli_cmd, mock_sleep):\n self.log.display_title(title=self.tool.get_current_function_name())\n self.log.step_num = 0\n msg = \"get top result is existing\"\n response = \"\"\"\n <security-log-report-top>\n <security-l...
[ "0.6887728", "0.5770261", "0.5768652", "0.576658", "0.56714404", "0.5604226", "0.5598673", "0.5589341", "0.5583227", "0.5545443", "0.5507747", "0.55065614", "0.5499657", "0.5482067", "0.54652476", "0.5461764", "0.54520774", "0.5446452", "0.5433687", "0.5427545", "0.5418716", ...
0.7202551
0
Checking calculate volume result
def test_calculate_volume(self, mock_send_cli_cmd): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "calculate volume with number" response = ["2000", "400", "-"] result = self.ins.calculate_volume( device=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_volume(self):", "def test_get_volume(self):\n self.assertEqual(self.cat_a.volume(), 6000)", "def calculate(self):\n\n return self._calculate_volume(self.ground_truth)", "def test_volume():\n structure = Material(input)\n assert (structure.volume == 90.725624999999965)", "def v...
[ "0.72821665", "0.6801038", "0.658001", "0.65771335", "0.65529627", "0.64993715", "0.64593333", "0.6412676", "0.6386287", "0.635891", "0.6280599", "0.6274071", "0.6262821", "0.616172", "0.6147557", "0.6140219", "0.6128707", "0.61241215", "0.6074614", "0.6061455", "0.60546744",...
0.72666365
1
Get security log report in detail result
def test_get_security_log_report_in_detail(self, mock_send_cli_cmd, mock_sleep): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "get in detail result is existing" response = """ <security-log-report-in-detail> <entry> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLogs():\n # in flux, it may be possible to provide more structured information\n # like python Failure instances", "def get_log_summary():\n # reads the session\n session = request.args.get('session', type=str)\n # reads the requested process name\n process = request.args.get('pr...
[ "0.6469863", "0.6379924", "0.6294314", "0.6294314", "0.6291546", "0.61176383", "0.61176383", "0.61176383", "0.59729666", "0.5906113", "0.5891078", "0.58768934", "0.58610713", "0.5819188", "0.5812899", "0.5744635", "0.57349855", "0.56770515", "0.565755", "0.5650731", "0.564619...
0.6645472
0
Get security log with CMD result
def test_get_security_log_with_cmd(self, mock_send_cli_cmd, mock_sleep): self.log.display_title(title=self.tool.get_current_function_name()) self.log.step_num = 0 msg = "get in detail result is existing" response = """ <security-logging-information> <show-hpl-infile> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_security_log_content(self, mock_send_cli_cmd):\n self.log.display_title(title=self.tool.get_current_function_name())\n self.log.step_num = 0\n msg = \"get in detail result is existing\"\n response = '<14>1 2017-02-22T14:15:35 cnrd-ngsrxqavm40 RT_LOG_SELF_TEST - RT_FLOW_SE...
[ "0.6373194", "0.63596994", "0.6273648", "0.6166498", "0.6104283", "0.60926396", "0.60858864", "0.60858864", "0.6040563", "0.59302497", "0.5851863", "0.57374483", "0.5686122", "0.56802356", "0.56750435", "0.5660656", "0.5595099", "0.5588123", "0.55613565", "0.55420965", "0.552...
0.6836158
0
Remove a pop from the hub, run the shutdown if needed
def remove(hub: pop.hub.Hub, subname: str): if hasattr(hub, subname): sub = getattr(hub, subname) if hasattr(sub, "init"): mod = getattr(sub, "init") if hasattr(mod, "shutdown"): mod.shutdown() hub._remove_subsystem(subname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_will_remove_from_hass(self):\r\n await self._shutdown()", "async def async_will_remove_from_hass(self):\n self._unsub_dispatcher()", "async def async_will_remove_from_hass(self) -> None:\n self._async_stop()", "def shutdown(self):\n if not self.stop_event.is_set():...
[ "0.64688575", "0.61474335", "0.60571164", "0.5975456", "0.5968157", "0.5944639", "0.5944639", "0.5906572", "0.5879488", "0.58753645", "0.58707255", "0.58186823", "0.58175516", "0.58175516", "0.58085465", "0.57986224", "0.5794105", "0.5790466", "0.5765465", "0.57604086", "0.57...
0.62520313
1
Return an iterator that will traverse just the subs. This is useful for nested subs
def iter_subs( hub: pop.hub.Hub, sub: pop.hub.Sub, recurse: bool = False ) -> Generator[pop.hub.Sub, None, None]: for name in sorted(sub._subs): ret = sub._subs[name] if ret._sub_virtual: yield ret if recurse: if hasattr(ret, "_subs"): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan(subs: typing.Iterable[type['dsl.Any']]) -> typing.Iterable[type['dsl.Any']]:\n return (s for c in subs for s in (c, *scan(c.__subclasses__())))", "def __iter__(self):\n for tree in self._tree.subTrees():\n yield self.__class__(tree)", "def IterLeafSymbols(self):\n for s...
[ "0.7023481", "0.67343533", "0.6484656", "0.62994707", "0.62980807", "0.62433183", "0.62169963", "0.62169963", "0.62169963", "0.62169963", "0.6185862", "0.61776495", "0.61445093", "0.61306304", "0.6107533", "0.61013865", "0.60796136", "0.6070531", "0.606338", "0.6052918", "0.6...
0.7103691
0
Given a sub, load all subdirectories found under the sub into a lower namespace
def load_subdirs(hub: pop.hub.Hub, sub: pop.hub.Sub, recurse: bool = False): if not sub._sub_virtual: return dirs = hub.pop.sub.get_dirs(sub) roots = {} for dir_ in dirs: for fn in os.listdir(dir_): if fn.startswith("_"): continue if fn == "contrac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, base=None, sub_files=None):\n self.categories = dict()\n self.base = base\n self.files = list()\n if not sub_files:\n sub_files = self.sub_node_paths\n for sub in sub_files:\n loaded = import_property(sub)(self)\n self.files.app...
[ "0.60271955", "0.5803136", "0.57932425", "0.57801884", "0.5599336", "0.55810684", "0.55752224", "0.5512795", "0.54248536", "0.5360543", "0.53104264", "0.52670133", "0.52658266", "0.5258381", "0.5245287", "0.52164406", "0.52009594", "0.5174135", "0.517276", "0.5166914", "0.514...
0.7538935
0
Instruct the hub to reload the modules for the given sub. This does not call the init.new function or remove sub level variables. But it does reread the directory list and reinitialize the loader causing all modules to be reevaluated when started.
def reload(hub: pop.hub.Hub, subname: str): if hasattr(hub, subname): sub = getattr(hub, subname) sub._prepare() return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_subs(verbose=True):\n if verbose:\n print('Reloading submodules')\n rrr(verbose=verbose)\n def wrap_fbrrr(mod):\n def fbrrr(*args, **kwargs):\n \"\"\" fallback reload \"\"\"\n if verbose:\n print('No fallback rel...
[ "0.687787", "0.63522756", "0.61942816", "0.6112909", "0.5855911", "0.58121055", "0.581011", "0.5783302", "0.5687831", "0.5641596", "0.5606911", "0.559561", "0.5582845", "0.5575809", "0.55634516", "0.55545276", "0.5552243", "0.5551004", "0.55136913", "0.5473193", "0.5460743", ...
0.6863212
1
returns a chunk in the file of size CHUNK_SIZE, returns None if there are no more chunks left
def get_file_chunk(self): chunk = self.infile.read(self.CHUNK_SIZE) if len(chunk) == 0: return None return chunk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_file_chunk(self, buf=1000):\n data = self.file.read(buf)\n return data, len(data)", "async def read_chunk(self, size: int = ...) -> bytes:\n ...", "def next_chunk(self):\n data = None\n if self.pos == self.data_encap.size:\n return None\n end_pos =...
[ "0.70294905", "0.6907951", "0.67071855", "0.65888083", "0.6574462", "0.6536778", "0.65013206", "0.64351344", "0.6425265", "0.640124", "0.6369112", "0.63563", "0.63563", "0.63411397", "0.6332619", "0.6321838", "0.63049865", "0.6301492", "0.62844026", "0.6264805", "0.6252253", ...
0.79554576
0
Resends a packet based on it's seqno
def resend(self, seqno, address=None): super(Sender, self).send(self.window.get(seqno), address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retire_scheduled_packet_with_seqnum(self, seqnum):\n sch_packet = self._sending_window.pop(seqnum)\n sch_packet.timeout_cb.cancel()", "def _do_send_packet(self, seqnum):\n sch_packet = self._sending_window[seqnum]\n if sch_packet.retries >= constants.MAX_RETRANSMISSIONS:\n ...
[ "0.6625028", "0.6403422", "0.6357179", "0.6178644", "0.61271757", "0.5890399", "0.57969123", "0.5730281", "0.5695372", "0.5638445", "0.5590177", "0.5586097", "0.55229086", "0.54915965", "0.5486253", "0.54267204", "0.54267204", "0.5424158", "0.5420086", "0.5368888", "0.5368408...
0.6922343
0
Reads text file as utf8 and returns it as an all lowercase string.
def read_text(filepath): text = open(filepath, encoding = "utf8").read() if text_lower: return text.lower() return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_text(path):\n with io.open(path, 'r', encoding='utf8') as f:\n return f.read().lower()", "def read_text_file(filename):\n try:\n file = open(filename, 'r')\n except:\n print('Cannot read file ' + filename + '. Please check the path', file=sys.stderr)\n ...
[ "0.70960516", "0.6695157", "0.65062815", "0.6353768", "0.6353768", "0.6349339", "0.6323226", "0.6320699", "0.6306032", "0.61704886", "0.6162809", "0.60728526", "0.60285974", "0.6007288", "0.5945725", "0.59408706", "0.59369904", "0.59152776", "0.58851576", "0.5876928", "0.5865...
0.7078837
1
Processes the input text into an array of sequences using the character maps
def process_text(text, characters, n_to_char, char_to_n, length = seq_length): char_count = len(characters) # Number of individual characters dsl = len(text)//length # Number of possible sequences X = np.zeros((dsl, length, char_count)) y = np.zeros((dsl, length, char_count)) # For each sequence ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_text(text, cmudict):\n text_seq = []\n\n # Normalize the text\n text = tokenize_text(clean_text(text))\n\n # Get the sequence of phonemes for words in the text while explicitly marking word boundaries. Incase of OOV words\n # backoff to using character sequence\n for word in text:\n ...
[ "0.68309134", "0.6512042", "0.6310441", "0.621075", "0.61783856", "0.6170546", "0.6166358", "0.6129413", "0.60537887", "0.60151726", "0.5896189", "0.5820474", "0.57984406", "0.5792014", "0.5769711", "0.5769711", "0.5769711", "0.57514864", "0.57514864", "0.5718606", "0.5718192...
0.67936975
1
Generates output text. Given a seed character, uses that character to predict the next character.
def generate_text(model, length, text, X, characters, n_to_char, char_to_n, seed_text_str = None): # Start the model with a given character or text to act as the "seed" if verbose: print("Generating text...\n") input_arr = [] output_arr = [] if seed_text: # Read from s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self, seed, length, prev_chars, temperature=1, quiet=False):\n self.model.set_mode('generate')\n text = seed\n if not quiet: print(\"#\" * 35 + \"\\n# Generated text (including seed) #\\n\" + \"#\" * 35)\n sys.stdout.write(text)\n with torch.no_grad():\n ...
[ "0.72790676", "0.71309704", "0.679408", "0.67035216", "0.63584626", "0.6316148", "0.6310888", "0.6286057", "0.6223612", "0.61643755", "0.6090402", "0.60279477", "0.59840524", "0.5982459", "0.59266937", "0.5924499", "0.58297616", "0.5829124", "0.5811328", "0.5803449", "0.57890...
0.7471189
0
Prompts user confirmation. Only accepts valid int as input.
def confirm(): end_loop = False while not end_loop: confirmation = input("""Would you like to continue with your choice? [1] No [2] Yes Enter a number please: """) if not confirmation or confirmation.isspace(): print("You have not entered anything!") try_again() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt():\r\n inpt = -1\r\n valid_choices = ['1','2','3','4','5']\r\n while inpt not in valid_choices:\r\n inpt = input(\"\\nPlease select the number of the operation you wish \"\r\n \"to complete:\\n\" +\r\n \"1. Run file mover\\n2. Add directories\"\r\n...
[ "0.66646284", "0.6519668", "0.6453404", "0.64480525", "0.6435423", "0.6401001", "0.6392201", "0.6386694", "0.636788", "0.634289", "0.62954175", "0.6290637", "0.6251117", "0.6244423", "0.6233498", "0.62104964", "0.620891", "0.62056035", "0.6203222", "0.6195723", "0.6192234", ...
0.71520096
0
Parses an integer command line argument.
def _ParseIntegerOption(cls, options, argument_name, default_value=None): argument_value = getattr(options, argument_name, None) if not argument_value: return default_value if not isinstance(argument_value, py2to3.INTEGER_TYPES): raise errors.BadConfigOption( u'Unsupported option: {0:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possible_int(arg):\n try:\n return int(arg)\n except ValueError:\n logging.info(f'failed to parse {arg} as an int, treating it as a string')\n return arg", "def parse_cmd_arguments(): # {{{\n parser = argparse.ArgumentParser(description='Process some integers.')\n parser.add...
[ "0.65652573", "0.64339966", "0.6320127", "0.6240045", "0.6225995", "0.6215957", "0.62090755", "0.62079334", "0.6146237", "0.61142725", "0.6098436", "0.6065904", "0.60143256", "0.6013739", "0.5997951", "0.5944849", "0.593269", "0.59174174", "0.5895325", "0.58767736", "0.582843...
0.6607289
0
Add command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports.
def AddArguments(cls, argument_group):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_arguments(parser):\n return", "def add_args_to_group(cls, group: \"ArgumentGroup\") -> None:\n # group.description = 'For `Architect`, you can supply...'\n # group.add_argument('--server-option', help='Lets you customize')\n return", "def add_command_line_arguments(self, par...
[ "0.7654683", "0.7641372", "0.75576967", "0.7515437", "0.74901414", "0.7480508", "0.7409682", "0.73622435", "0.73622435", "0.7316169", "0.7309505", "0.7241193", "0.7222177", "0.7220765", "0.7182025", "0.7170899", "0.71541303", "0.7138724", "0.7061666", "0.7041805", "0.70411366...
0.777963
0
Returns a normalized vector perpendicular (rotated 90 degrees) to the vector vec
def perpendicular_axis(vec): axis = vec.rotate(-math.pi / 2) # rotate vector -90 degrees axis = axis.norm() # turn axis vector into unit vector return axis
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n raise ValueError(\"zero vector\")\n else:\n return np.cross(v, [0, 1, 0])\n return np.cross(v, [1, 0, 0])", "def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([...
[ "0.81203467", "0.80106854", "0.79575646", "0.7785505", "0.732732", "0.7289606", "0.7255063", "0.72404546", "0.71814793", "0.7149743", "0.7145698", "0.7142937", "0.7038935", "0.69675374", "0.6959855", "0.68619686", "0.68529046", "0.68470615", "0.68333167", "0.6808642", "0.6779...
0.8683374
0
stores the file information in the database and returns the expenses amount permonth in a chronological order
def handle_csv_file(csvfile): reader = csv.DictReader(csvfile, delimiter=',') # A dictionnary where we are going to collect expenses per month expense_per_month = {} for row in reader: # Category check, get it or add it to the database cat = Category.objects.get_or_create(name=row['cat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount_total(path, file_type):\n final_frame = clean_kdr_data(path, file_type)\n amount_work = final_frame.groupby(\"Date\")[\"Place\"].count()\n amount_work = amount_work.to_frame()\n amount_work.columns = [\"Freq\"]\n\n # Dropping outlier data\n amount_work = amount_work.drop([\"2019-01-04\...
[ "0.56816006", "0.56279457", "0.55515", "0.538901", "0.5370304", "0.536951", "0.5294809", "0.5263012", "0.52254725", "0.52231926", "0.52098495", "0.51980436", "0.5177772", "0.51428777", "0.513873", "0.51279575", "0.5124227", "0.510052", "0.50926286", "0.50414777", "0.50408787"...
0.64195514
0
Check if server error contains error_str
def is_boto_error_contain(e, error_str): return ((e.body and e.body.find(error_str) >= 0) or (e.error_message and e.error_message.find(error_str) >= 0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_error(response: str) -> bool:\n return \"ERROR\" in response", "def error(str):\n\n Utils.send('error', str)", "def test_response_error(err_msg):\n from server import response_error\n error_text = b'HTTP/1.1 %s' % err_msg\n assert response_error(err_msg).split(b'\\r\\n')[0] == error_t...
[ "0.78062016", "0.69145817", "0.69112575", "0.6875524", "0.68552846", "0.6728566", "0.66339964", "0.6556667", "0.64911264", "0.6449612", "0.6441156", "0.64091986", "0.6369114", "0.6356904", "0.63537204", "0.6291356", "0.6269042", "0.622634", "0.6225547", "0.6185996", "0.617376...
0.6930945
1
region The region to use to manage the stack name The name of the stack to use params A `dict` stack name key/value with the value a `list` of `tuple` tmpl_args A `dict` of key/value pairs to be replaced in the templates template_path A `str` or `list` of where to find templates stack A `str` of the S3 bucket name to s...
def __init__(self, region, name=None, params=None, tmpl_args=None, template_path=None, stack=None): if not isinstance(template_path, list) and template_path: template_path = [template_path] if params is None: params = {} self.conn = boto.cloudformation.connect_to_region...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _stack(self, region, name, template, params):\n params = [(k, v) for k, v in params.items()]\n client = self._client(region)\n\n try:\n logger.debug('Describing stack %s in %s...', name, region)\n existing = client.describe_stacks(name)[0]\n except BotoServerEr...
[ "0.661453", "0.661453", "0.65117246", "0.6239013", "0.61317503", "0.6126487", "0.61093104", "0.6059344", "0.59218925", "0.5838531", "0.5833471", "0.58183753", "0.58039737", "0.5791145", "0.57705045", "0.57423794", "0.56704104", "0.55986637", "0.55466485", "0.55281967", "0.550...
0.77092695
0
Add a list of stacks to run in parallel
def add_stacks(self, stacks): if not isinstance(stacks, list): stacks = [stacks] self.stacks.extend(stacks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_stack_buster(self, in_queue, out_queue):\n while not in_queue.empty():\n task = in_queue.get()\n if task == POISON_PILL:\n out_queue.put(POISON_PILL)\n return\n\n print(\"Starting task:\", task)\n self.total_calls = 0\n ...
[ "0.6024926", "0.5953992", "0.58191454", "0.5720704", "0.5669102", "0.5669102", "0.5669102", "0.5669102", "0.5669102", "0.5655403", "0.56456506", "0.55374163", "0.55021113", "0.549279", "0.54680955", "0.54343414", "0.5415909", "0.53565407", "0.53332096", "0.5325767", "0.532391...
0.63910544
0
Validates the template before attempting to apply it.
def validate_template(self, contents): try: self.conn.validate_template(template_body=contents) return True except BotoServerError as e: print contents print e.message raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _validate_template(self, template):\n try:\n templater.Template(template, self.hass).async_render()\n return True\n except Exception as exception: # pylint: disable=broad-except\n _LOGGER.error(exception)\n pass\n return False", "def is_...
[ "0.7146133", "0.6584259", "0.65354526", "0.6507022", "0.644165", "0.6379066", "0.63467443", "0.63436615", "0.63436615", "0.6085817", "0.60343426", "0.59786195", "0.58984625", "0.58572847", "0.58375996", "0.57968557", "0.57855695", "0.5769675", "0.5735139", "0.56851226", "0.56...
0.6692494
1
Create all the stacks provided in add_stacks add_stacks
def create_stacks(self): update_stack = True stack_names = {} for stack in self.stacks: stack_name = '{0}-{1}'.format(self.stack_name, stack) stack_names.update({stack: stack_name}) try: self.conn.describe_stacks(stack_name) except...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_stack():\n\n return Stack()", "def add_stacks(self, stacks):\n if not isinstance(stacks, list):\n stacks = [stacks]\n\n self.stacks.extend(stacks)", "def create_stack(self, update=False):\n\n stack = self.current_scenes.stack(\n self.products[self.curren...
[ "0.7189646", "0.6824523", "0.6505076", "0.64707756", "0.63802177", "0.637221", "0.6357541", "0.63357", "0.6164423", "0.61425936", "0.60978055", "0.6090206", "0.6082634", "0.60139596", "0.5979457", "0.59765524", "0.59765524", "0.59765524", "0.59765524", "0.59765524", "0.597655...
0.70354164
1
Will delete a list of stacks.
def delete_stacks(self, stacks): for stack in stacks: self.conn.delete_stack(stack) print 'Attempting to delete stacks', ', '.join(stacks) while stacks: for stack in stacks: try: info = self.conn.describe_stacks(stack)[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_stack(StackId=None):\n pass", "def delete_stack(Name=None):\n pass", "def op_delete(self, args):\n stack_level = 0\n if args != None:\n stack_level = int(args[0])\n self.require_stack(stack_level+1)\n if stack_level == None:\n self.stack.pop()\...
[ "0.710907", "0.6865648", "0.6472133", "0.64586276", "0.64508307", "0.6244195", "0.62345904", "0.6213278", "0.6129832", "0.6112956", "0.6024004", "0.59343094", "0.5913135", "0.59113526", "0.58198756", "0.5810858", "0.5752034", "0.572025", "0.55922693", "0.558534", "0.55618924"...
0.82108366
0
Return the internal stream id.
def get_stream_id(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream_id(self) -> str:\n return self.id", "def stream_id(self):\n\n ts = self.f.random_int(0, 18446744073709551615)\n seq = self.f.random_int(0, 18446744073709551615)\n return str(ts) + '-' + str(seq)", "def next_stream_id(self) -> int:\n\n with self.lock:\n ...
[ "0.8736149", "0.7868844", "0.7512072", "0.6992733", "0.6757673", "0.6757673", "0.6630381", "0.6630381", "0.66028845", "0.6598322", "0.6598322", "0.6598322", "0.6598322", "0.6598322", "0.6598322", "0.65791786", "0.65041435", "0.6446265", "0.6420034", "0.637864", "0.63584065", ...
0.88276416
0
Return the internal stream alias.
def get_stream_alias(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream_alias(self) -> str:\n return self.alias", "def alias(self):\n return self._alias", "def alias(self):\n return self._alias", "def alias(self):\n\n return self._alias", "def stream_name(self):\n return self._stream_name", "def stream_name(self):\n re...
[ "0.9067213", "0.7679822", "0.7679822", "0.75973105", "0.70598644", "0.70598644", "0.70508754", "0.7012526", "0.7007442", "0.6924272", "0.68404967", "0.6803632", "0.67530227", "0.67416036", "0.65119314", "0.6436247", "0.6416575", "0.641144", "0.6309904", "0.6291704", "0.627841...
0.9130828
0
Return the internal stream type.
def get_stream_type(self) -> str:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream_type(self) -> str:\n return self.stream_type", "def event_streaming_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"event_streaming_type\")", "def get_type (self):\n return self._stype", "def stype(self):\n\n return self.__stype", "def stre...
[ "0.8624886", "0.6931497", "0.6834459", "0.6823159", "0.6731341", "0.66832525", "0.6644878", "0.6627647", "0.661268", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "0.6608839", "...
0.8810664
0
Publish the given list of messages on the stream.
def publish_list(self, messages: list) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_list(self, messages: list) -> None:\n if __debug__:\n logger.warning(\n \"WARN: Unnecessary call on publish on FileDistroStream\"\n )", "def _publish(self, messages):\n num_of_msg = len(messages)\n\n LOG.debug('Publishing %d messages', num_of_...
[ "0.77216077", "0.744859", "0.6674515", "0.65948284", "0.64489675", "0.63741934", "0.6355695", "0.63525", "0.6316008", "0.6299563", "0.6226814", "0.6147299", "0.6130879", "0.6069641", "0.60585797", "0.5991502", "0.5983676", "0.5969118", "0.5941624", "0.59397745", "0.5896925", ...
0.83988374
1
Retrieve the stream identifier.
def get_stream_id(self) -> str: return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream_id(self) -> str:", "def stream_id(self):\n\n ts = self.f.random_int(0, 18446744073709551615)\n seq = self.f.random_int(0, 18446744073709551615)\n return str(ts) + '-' + str(seq)", "def stream_name(self):\n return self._stream_name", "def stream_name(self):\n ...
[ "0.86390674", "0.7364896", "0.7277654", "0.7277654", "0.6955662", "0.6945494", "0.6631704", "0.6631704", "0.65725887", "0.65618753", "0.64586294", "0.6440992", "0.6432623", "0.6410256", "0.6394796", "0.6394796", "0.6312516", "0.62364006", "0.6217754", "0.62065583", "0.6198781...
0.8576373
1
Retrieve the stream alias.
def get_stream_alias(self) -> str: return self.alias
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream_alias(self) -> str:", "def alias(self):\n return self._alias", "def alias(self):\n return self._alias", "def alias(self):\n\n return self._alias", "def stream_name(self):\n return self._stream_name", "def stream_name(self):\n return self._stream_name", ...
[ "0.8959474", "0.7374531", "0.7374531", "0.7273853", "0.7031345", "0.7031345", "0.6843687", "0.67947763", "0.6744299", "0.6682385", "0.65575045", "0.6482374", "0.64624614", "0.6392805", "0.63864803", "0.637769", "0.6327144", "0.626468", "0.6203288", "0.61927944", "0.6184203", ...
0.90772265
0
Publish a list of messages.
def publish_list(self, messages: list) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish_list(self, messages: list) -> None:\n if __debug__:\n logger.warning(\n \"WARN: Unnecessary call on publish on FileDistroStream\"\n )", "def _publish(self, messages):\n num_of_msg = len(messages)\n\n LOG.debug('Publishing %d messages', num_of_...
[ "0.75440556", "0.7098262", "0.66022277", "0.65766954", "0.65046394", "0.6384413", "0.63506174", "0.63375187", "0.62924993", "0.62364364", "0.61997557", "0.6156743", "0.6149601", "0.61436003", "0.61410826", "0.60738134", "0.6072944", "0.60586524", "0.6036093", "0.601325", "0.5...
0.90152764
0
Check if the stream is closed.
def is_closed(self) -> bool: if __debug__: logger.debug("Checking if stream %s is closed", str(self.id)) # Ask for stream status req = StreamStatusRequest(self.id) DistroStreamClientHandler.request(req) req.wait_processed() error = req.get_error_code() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closed(self):\n return self._stream is None", "def is_closed(self) -> bool:\n return self._http_connection is None", "def closed(self):\n return not self._file.is_open()", "def is_close(self) -> bool:\n return not self.open", "def is_closed(self) -> bool:", "def stream_closed(...
[ "0.8582153", "0.7648854", "0.7512646", "0.74249023", "0.7421318", "0.7402212", "0.7340905", "0.73295283", "0.73165786", "0.7294226", "0.7279607", "0.7279607", "0.72591317", "0.7203501", "0.71747154", "0.7170055", "0.71678346", "0.71678346", "0.7166954", "0.7150844", "0.711019...
0.8053839
1
Create a new ObjectDistroStream instance.
def __init__( self, alias: typing.Optional[str] = None, access_mode: str = AT_MOST_ONCE, ) -> None: super().__init__( alias=alias, stream_type=OBJECT, internal_stream_info=[], access_mode=access_mode, ) self.kafka_topic_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_stream(self):\n pass", "def __init__(self, stream):\n self.stream = stream", "def __init__(self, stream):\n self.stream = stream", "def __init__(self, stream, device, device_ptr, sticky):\n assert stream is not None\n assert device is not None\n assert dev...
[ "0.6667618", "0.60099465", "0.60099465", "0.5831956", "0.5792443", "0.5752151", "0.56497276", "0.56266385", "0.55587393", "0.55587393", "0.55346066", "0.5519661", "0.5483249", "0.54786193", "0.54595953", "0.54348314", "0.54046535", "0.54028684", "0.5362799", "0.53491384", "0....
0.6301137
1
Request bootstrap server information.
def _request_bootstrap_server_info() -> str: if __debug__: logger.info("Requesting bootstrap server...") req = BootstrapServerRequest() DistroStreamClientHandler.request(req) # Retrieve answer req.wait_processed() error = req.get_error_code() if error...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server():\n pass", "def server_info(ctx):\n data = ctx.obj.get_server_info()\n output_json_data(data)", "def get_startupinfo() -> None:\n return None", "def test_server_info(self):\n pass", "def get_server(self):\n\n pass", "def getBootstrapInfo(self, locale):\r\n ...
[ "0.6190524", "0.6128894", "0.6078564", "0.5948742", "0.59009475", "0.5871122", "0.58066845", "0.5804181", "0.5748444", "0.57287985", "0.57166004", "0.56740767", "0.56711656", "0.56413794", "0.5594802", "0.55728275", "0.55258805", "0.55235964", "0.5511375", "0.54570174", "0.54...
0.8549588
0
Retrieve the string repr. of the RegistrationException object.
def __str__(self) -> str: message = ( f"ERROR: Registration Exception.\n" f" - Internal error code: {str(self.code)}\n" f" - Internal error message: {str(self.message)}" ) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __as_unicode(self):\n # WARNING: Do not change this string - it is used to extract error from log\n strg = WMEXCEPTION_START_STR\n strg += \"\\nException Class: %s\\n\" % self.name\n strg += \"Message: %s\\n\" % self._message\n for key, value in viewitems(self.data):\n ...
[ "0.749842", "0.72222346", "0.69906265", "0.69691235", "0.6937523", "0.691762", "0.69019145", "0.68849576", "0.6799396", "0.6784407", "0.67715347", "0.67320395", "0.6574739", "0.6517447", "0.651728", "0.6508988", "0.6488416", "0.6433797", "0.6426011", "0.64200926", "0.6339011"...
0.78266
0
Retrieve the string representation of the BackendException object.
def __str__(self) -> str: message = ( f"ERROR: Backend Exception.\n" f" - Internal error code: {str(self.code)}\n" f" - Internal error message: {str(self.message)}" ) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception(self) -> str:\n return pulumi.get(self, \"exception\")", "def __as_unicode(self):\n # WARNING: Do not change this string - it is used to extract error from log\n strg = WMEXCEPTION_START_STR\n strg += \"\\nException Class: %s\\n\" % self.name\n strg += \"Message: ...
[ "0.71852326", "0.7098264", "0.7072871", "0.7015216", "0.69805497", "0.68559676", "0.67502856", "0.6691532", "0.66701806", "0.6605151", "0.6521624", "0.6443341", "0.6442003", "0.63994706", "0.63986385", "0.6370371", "0.6358585", "0.63517904", "0.6344785", "0.6337761", "0.63357...
0.7561719
0
Soma x e y
def soma(x, y): return x + y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ED(X,Y):", "def soma(x, y):\n assert isinstance(x, (int, float)), \"x precisa ser int ou float\"\n assert isinstance(y, (int, float)), \"y precisa ser int ou float\"\n return x + y", "def y(self, x):\n return x", "def g(x, y):\n\n \"\"\" Xrhsimopoihste infix telestes(+, -, *, **, ...)...
[ "0.65808624", "0.6553004", "0.6322703", "0.6153142", "0.613511", "0.6058572", "0.60016596", "0.5983346", "0.59505665", "0.5935051", "0.5923307", "0.5896568", "0.5842657", "0.5833384", "0.58226126", "0.5812711", "0.5772121", "0.5764159", "0.5752245", "0.5705019", "0.5691357", ...
0.7549391
0
Return RS Object from given context.
def rs_object(self): if not self.need_context_computation(): logging.info(f"Stay within module {self.module.name} context.") return self.module return self.get_context()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context(self):\n symbol_chain = self.split_completion_object(self.get_word_before())\n current_rs_object = self.module\n\n for symbol in symbol_chain:\n try:\n current_rs_object = current_rs_object.get_object(symbol)\n logging.info(f\"New contex...
[ "0.6285875", "0.62768507", "0.5996745", "0.5952875", "0.59331936", "0.589747", "0.58772945", "0.58703023", "0.58377874", "0.5833168", "0.582395", "0.5808195", "0.578943", "0.57670337", "0.5763784", "0.5685238", "0.5648318", "0.5648318", "0.5648318", "0.5648318", "0.56338507",...
0.6711163
0
Return True if context matches an import completion.
def is_import_completion(self): current_line = self.get_current_line() # Seperate cases! More difficult than I thought match = re.match(r"(import)|(from)", current_line) if match: word_before = self.get_word_before() if word_before == "from" or word_before == "im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_import_from_completion(self):\n\n current_line = self.get_current_line()\n\n match = re.match(r\"from .* import\", current_line)\n if match and self.get_word() != \"import\":\n return True\n\n return False", "def need_context_computation(self):\n\n # We check ...
[ "0.828175", "0.6631313", "0.64719987", "0.6358119", "0.62624484", "0.6162657", "0.6120941", "0.6032195", "0.5994624", "0.5852749", "0.5820278", "0.578434", "0.57038784", "0.5666145", "0.56449866", "0.558835", "0.5559468", "0.553052", "0.55291283", "0.5485289", "0.54828227", ...
0.8438564
0
Return if context matches an import ... from (HERE) completion.
def is_import_from_completion(self): current_line = self.get_current_line() match = re.match(r"from .* import", current_line) if match and self.get_word() != "import": return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_import_completion(self):\n current_line = self.get_current_line()\n\n # Seperate cases! More difficult than I thought\n match = re.match(r\"(import)|(from)\", current_line)\n if match:\n word_before = self.get_word_before()\n if word_before == \"from\" or wo...
[ "0.7827001", "0.6529381", "0.6437327", "0.64157075", "0.6094217", "0.5915608", "0.58570844", "0.5812048", "0.57269055", "0.5666796", "0.5632092", "0.56017506", "0.557823", "0.5550495", "0.5514607", "0.5439952", "0.54128844", "0.54121053", "0.5399263", "0.5396895", "0.5364232"...
0.7904381
0
Return a map of CompletionType that is computed with given context.
def get_completion_types(self): # We should use an enum... if self.completion_types: return self.completion_types self.completion_types = {} if self.is_heritage_completion(): self.completion_types[CompletionType.HERITAGE_COMPLETION] = True if self.is_im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completion_times(self) -> Dict[str, datetime]:\n job_times = {}\n for job_id, job in self._jobs.items():\n if job is not None and \"COMPLETED\" in job.time_per_step():\n job_times[job_id] = job.time_per_step().get(\"COMPLETED\")\n\n return job_times", "def conte...
[ "0.5377357", "0.52248913", "0.50210726", "0.49276876", "0.4862262", "0.4807404", "0.4777825", "0.47725728", "0.47503585", "0.4741087", "0.47174406", "0.47131294", "0.4703415", "0.47008586", "0.46817926", "0.46585783", "0.46549278", "0.46499875", "0.46266842", "0.46197364", "0...
0.63396734
0
Return context for given symbol in given context. Context can be a Type or a Module.
def get_context(self): symbol_chain = self.split_completion_object(self.get_word_before()) current_rs_object = self.module for symbol in symbol_chain: try: current_rs_object = current_rs_object.get_object(symbol) logging.info(f"New context found: {cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xontrib_context(name):\n spec = find_xontrib(name)\n if spec is None:\n return None\n m = importlib.import_module(spec.name)\n pubnames = getattr(m, \"__all__\", None)\n if pubnames is not None:\n ctx = {k: getattr(m, k) for k in pubnames}\n else:\n ctx = {k: getattr(m, k...
[ "0.56694144", "0.56350875", "0.5511202", "0.5463976", "0.52992904", "0.5239713", "0.50789475", "0.50733", "0.50660646", "0.505624", "0.50214887", "0.49981603", "0.4946125", "0.49428388", "0.49310845", "0.48866642", "0.48660722", "0.48567924", "0.47925916", "0.47791374", "0.47...
0.58000124
0
Verify that is_valid_kubernetes_resource_name detects whether or
def test_is_valid_kubernetes_resource_name_invalid_input(): # test length violations assert not is_valid_kubernetes_resource_name(name=None) # Too short assert not is_valid_kubernetes_resource_name(name="") # Too short assert not is_valid_kubernetes_resource_name(name="a" * 254) # Too long # test...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_kubernetes_resource_name_valid_input():\n # test valid names\n assert is_valid_kubernetes_resource_name(name=\"l0l\")\n assert is_valid_kubernetes_resource_name(name=\"l-l\")\n assert is_valid_kubernetes_resource_name(name=\"l.l\")\n assert is_valid_kubernetes_resource_name(name=\"...
[ "0.782678", "0.72039205", "0.6412931", "0.62463856", "0.6188881", "0.5901868", "0.58663553", "0.58171284", "0.57904565", "0.56997657", "0.56519026", "0.56401294", "0.5611724", "0.56062925", "0.5596578", "0.55880165", "0.5570009", "0.5560904", "0.55561256", "0.5532952", "0.549...
0.78185195
1
Verify that is_valid_kubernetes_resource_name detects whether or
def test_is_valid_kubernetes_resource_name_valid_input(): # test valid names assert is_valid_kubernetes_resource_name(name="l0l") assert is_valid_kubernetes_resource_name(name="l-l") assert is_valid_kubernetes_resource_name(name="l.l") assert is_valid_kubernetes_resource_name(name="4-you") asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_kubernetes_resource_name_invalid_input():\n # test length violations\n assert not is_valid_kubernetes_resource_name(name=None) # Too short\n assert not is_valid_kubernetes_resource_name(name=\"\") # Too short\n assert not is_valid_kubernetes_resource_name(name=\"a\" * 254) # Too lo...
[ "0.78185195", "0.72039205", "0.6412931", "0.62463856", "0.6188881", "0.5901868", "0.58663553", "0.58171284", "0.57904565", "0.56997657", "0.56519026", "0.56401294", "0.5611724", "0.56062925", "0.5596578", "0.55880165", "0.5570009", "0.5560904", "0.55561256", "0.5532952", "0.5...
0.782678
0
Verify that is_valid_label_key detects whether or
def test_is_valid_label_key_invalid_input(): # test length violations assert not is_valid_label_key(key=None) # Too short assert not is_valid_label_key(key="") # Too short assert not is_valid_label_key(key=f"{'p' * 254}/n") # prefix too long assert not is_valid_label_key(key="/n") # prefix too s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_label_key_valid_input():\n # test valid label keys\n assert is_valid_label_key(key=\"l0l\")\n assert is_valid_label_key(key=\"l0L\")\n assert is_valid_label_key(key=\"L-l\")\n assert is_valid_label_key(key=\"L.L\")\n assert is_valid_label_key(key=\"4-you\")\n assert is_valid_...
[ "0.77414054", "0.7245882", "0.71232426", "0.702052", "0.7014777", "0.69919765", "0.6653172", "0.6511976", "0.64869434", "0.6442856", "0.64361715", "0.64332306", "0.6387192", "0.6321002", "0.63057345", "0.6299977", "0.6280979", "0.6245959", "0.6234683", "0.62338924", "0.621326...
0.775393
0
Verify that is_valid_label_key doesn't report valid input as problematic
def test_is_valid_label_key_valid_input(): # test valid label keys assert is_valid_label_key(key="l0l") assert is_valid_label_key(key="l0L") assert is_valid_label_key(key="L-l") assert is_valid_label_key(key="L.L") assert is_valid_label_key(key="4-you") assert is_valid_label_key(key="you.2")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_label_key_invalid_input():\n # test length violations\n assert not is_valid_label_key(key=None) # Too short\n assert not is_valid_label_key(key=\"\") # Too short\n assert not is_valid_label_key(key=f\"{'p' * 254}/n\") # prefix too long\n assert not is_valid_label_key(key=\"/n\")...
[ "0.84264904", "0.7299671", "0.72438085", "0.7179807", "0.70012367", "0.69538176", "0.6899516", "0.68120116", "0.6802626", "0.6638733", "0.66152763", "0.6520048", "0.65179867", "0.64924395", "0.6465102", "0.6416374", "0.63916224", "0.62936914", "0.6285949", "0.6279296", "0.625...
0.8084176
1
Verify that is_valid_label_value detects whether or
def test_is_valid_label_value_invalid_input(): # test length violations assert not is_valid_label_value(value=f"{'v' * 64}") # value too long # test first character violations (not alphanum) assert not is_valid_label_value(value="-") assert not is_valid_label_value(value="-a") assert not is_val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_label_value_valid_input():\n # test valid label values\n assert is_valid_label_value(value=None)\n assert is_valid_label_value(value=\"\")\n assert is_valid_label_value(value=\"l0L\")\n assert is_valid_label_value(value=\"L-l\")\n assert is_valid_label_value(value=\"L.L\")\n ...
[ "0.7875594", "0.7609895", "0.7058031", "0.6713812", "0.66605884", "0.6650607", "0.6648745", "0.6604554", "0.65930766", "0.6489958", "0.6427214", "0.6418023", "0.63294744", "0.6324395", "0.62871826", "0.626164", "0.62237686", "0.6219369", "0.6206296", "0.619833", "0.61796427",...
0.76566535
1
Verify that is_valid_label_value doesn't report valid input as problematic
def test_is_valid_label_value_valid_input(): # test valid label values assert is_valid_label_value(value=None) assert is_valid_label_value(value="") assert is_valid_label_value(value="l0L") assert is_valid_label_value(value="L-l") assert is_valid_label_value(value="L.L") assert is_valid_labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_label_value_invalid_input():\n # test length violations\n assert not is_valid_label_value(value=f\"{'v' * 64}\") # value too long\n # test first character violations (not alphanum)\n assert not is_valid_label_value(value=\"-\")\n assert not is_valid_label_value(value=\"-a\")\n ...
[ "0.832949", "0.79126716", "0.71241474", "0.67525923", "0.6649981", "0.6637879", "0.6514204", "0.6502501", "0.6452657", "0.6418193", "0.6412634", "0.6410425", "0.6394925", "0.63858837", "0.6374188", "0.63653326", "0.6341158", "0.63390666", "0.6292882", "0.6292882", "0.6287058"...
0.81986606
1
Verify that is_valid_annotation_key detects whether or
def test_is_valid_annotation_key_invalid_input(): # test length violations assert not is_valid_annotation_key(key=None) # Too short assert not is_valid_annotation_key(key="") # Too short assert not is_valid_annotation_key(key=f"{'p' * 254}/n") # prefix too long assert not is_valid_annotation_key(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_annotation_key_valid_input():\n # test valid label keys\n assert is_valid_annotation_key(key=\"l0l\")\n assert is_valid_annotation_key(key=\"l0L\")\n assert is_valid_annotation_key(key=\"L-l\")\n assert is_valid_annotation_key(key=\"L.L\")\n assert is_valid_annotation_key(key=\"...
[ "0.7289209", "0.67090863", "0.6609258", "0.64845437", "0.6478814", "0.62092036", "0.61714745", "0.6125743", "0.6118006", "0.61150044", "0.6042427", "0.6009149", "0.59234357", "0.59081525", "0.59038377", "0.59038377", "0.58747923", "0.5840476", "0.58371234", "0.58312154", "0.5...
0.748368
0
Verify that is_valid_annotation_value detects whether or
def test_is_valid_annotation_value_invalid_input(): # test valid label values assert not is_valid_annotation_value(value=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(value, Annotation) -> bool:\n if Annotation is None:\n return True\n elif is_of_type(Annotation, ValidatedArgument):\n validated_argument = Annotation(value)\n return validated_argument.is_valid()\n else:\n return is_of_type(value, Annotation)", "def _check_annot...
[ "0.75124335", "0.74059904", "0.7389897", "0.67709744", "0.66597253", "0.64607525", "0.64509606", "0.6443165", "0.6434896", "0.64300495", "0.6360754", "0.6342649", "0.6341858", "0.6304701", "0.6275114", "0.6275114", "0.62341434", "0.62033993", "0.619848", "0.6197242", "0.61729...
0.7643059
0
Gets all of the players that are currently in this player group. Players that were in this group and quit the match are not included in this list.
def getPlayers(self): players = [] for pgp in self.sandboxplayergroupplayer_set.filter(quit=False): players.append(pgp.player) return players
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def players(self):\n return Player.objects.filter(team=self)", "def get_all_game_players(self):\n return GamePlayer.objects.filter(game=self)", "def get_players(self):\n\n # Append the current player to the list and return it\n players_list = list(self._players.queue)\n playe...
[ "0.7724813", "0.7682585", "0.7404127", "0.7373272", "0.73355484", "0.73098814", "0.73020226", "0.72574985", "0.71847785", "0.70707357", "0.7015204", "0.69841653", "0.69249237", "0.6922409", "0.6886732", "0.68469393", "0.68238616", "0.6667654", "0.66438717", "0.66186833", "0.6...
0.82325697
0
Gets the number of players that are currently in this player group. Players that were in this group and quit the match are not included in this count.
def getPlayerCount(self): return self.sandboxplayergroupplayer_set.filter(quit=False).count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_players(self) -> int:\n return self.param.number_of_players", "def noOfPlayers(self):\n\t\tnumber = 0\n\t\tfor n in range(6):\n\t\t\tif self.playerList[n] != None:\n\t\t\t\tnumber = number + 1\n\t\treturn number", "def numberOfPlayers(self):\r\n return len(self.playerPreparers)", ...
[ "0.76186544", "0.73736197", "0.7071608", "0.7010643", "0.6939567", "0.6916994", "0.6885913", "0.6876635", "0.6861499", "0.6816068", "0.6799336", "0.6797875", "0.67515624", "0.6737161", "0.6728889", "0.6716876", "0.66770303", "0.66476125", "0.66267514", "0.6603745", "0.6598862...
0.8480948
0
Replace invalid side start characters of a string and replace it.
def replace_invalid_prefix(string, logger_=_LOGGER): string = str(string) if re.match("^[MRL]_", string): return string if not re.match("^[MRL]_", string): logger.log( level="warning", message='The string prefix "' + string + '" should specifie a side', l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_replace_badchars(text, start, end, replace='\\xef\\xbf\\xbd'):\n\t# sanity\n\tif not isinstance(text,str) or not isinstance(replace,str):\n\t\traise Exception(\"Inputs must be UTF-8\")\n\t\t\n\tout = []\n\ti = start\n\twhile i<end:\n\t\t# match next segment of valid chars\n\t\tn = match_valid_xml(text, i, ...
[ "0.6369766", "0.6139523", "0.5951898", "0.5900786", "0.5765379", "0.57592076", "0.5749978", "0.5710695", "0.56741714", "0.56464654", "0.5627995", "0.5621497", "0.55933166", "0.55745554", "0.5560933", "0.5560898", "0.5559932", "0.55456275", "0.5526259", "0.5517066", "0.5495856...
0.64393467
0
Replace numbers in the suffix with a ''. And if the suffix is lowercase it will turn it uppercase.
def normalize_suffix_0(string, logger_=_LOGGER): if re.search("_[A-Z]{1,}$", string): return string numbers = re.search("[0-9]{1,}$", string) if numbers: logger.log( level="warning", message='Suffix of string "' + string + '" should not have a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix(rem):\n if rem == 0:\n suf = ''\n else:\n if rem <= 600: #Class A suffix -- only letters.\n rem = rem - 1\n suf = base34[rem // 25]\n if rem % 25 > 0:\n suf = suf + base34[rem % 25 - 1]# second class A letter, if present.\n else:...
[ "0.7126546", "0.66985273", "0.66328514", "0.66100144", "0.6510216", "0.6392569", "0.63873357", "0.6238977", "0.6174306", "0.61630905", "0.61495143", "0.6072624", "0.60496706", "0.6030555", "0.5937885", "0.59191364", "0.59180564", "0.59006655", "0.58930933", "0.57988733", "0.5...
0.745185
0
Replace numbers in the suffix with a '' and generate the correct count and put in the right place.
def normalize_suffix_1(string, logger_=_LOGGER): numbers_end_string_regex = r"(\d+$)" count_regex = r"(_\d+_\D+)" match = re.search(numbers_end_string_regex, string) # If we find a number in the suffix of the string we delete it. And # generate the correct count and put in the correct place in the s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suffix(rem):\n if rem == 0:\n suf = ''\n else:\n if rem <= 600: #Class A suffix -- only letters.\n rem = rem - 1\n suf = base34[rem // 25]\n if rem % 25 > 0:\n suf = suf + base34[rem % 25 - 1]# second class A letter, if present.\n else:...
[ "0.6414111", "0.64021814", "0.6279612", "0.6185595", "0.61830306", "0.6145874", "0.60086614", "0.5974522", "0.59581745", "0.59356445", "0.59253126", "0.585895", "0.5815321", "0.58039665", "0.5733078", "0.5719689", "0.5697997", "0.5666063", "0.562796", "0.5605457", "0.56007373...
0.7131007
0
Check the string for numbers at all and for the valid expression.
def numbers_check(string, logger_=_LOGGER): valid_regex_0 = r"\d" valid_regex_1 = r"_\d+_\d+_" valid_regex_2 = r"_\d+_" if not re.search(valid_regex_0, string): logger.log( level="warning", message='There are no numbers in the string "' + string + '"', logger=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)", "def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))", "def no_numbers(expression):\n NUMBERS = '0123456789'\n for i in expression:\n if i in NUMBERS:\n return...
[ "0.7832595", "0.7445289", "0.7212703", "0.7162114", "0.71427345", "0.704486", "0.70382726", "0.7036991", "0.7036991", "0.702446", "0.702446", "0.6987707", "0.6987566", "0.6960815", "0.69374967", "0.6902533", "0.68822384", "0.68766296", "0.68750095", "0.6856393", "0.68079495",...
0.81350124
0
Finds valid suffix in a string. If not it throw a warning message.
def valid_suffix(string, logger_=_LOGGER): valid = ( "_CRV|_HANDLE|_JNT|_GEO|_GRP|_CON|_MPND|_DEMAND|_MUMAND|_METAND" "|_CONST|_MULDOLINND" ) suffix_pattern = re.compile(valid) if not re.search(suffix_pattern, string): logger.log( level="warning", message=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_suffix(suffix: str, word: str):\n return word.endswith(suffix)", "def check_suffix(custom_str: str) -> bool:\r\n\r\n if custom_str.startswith(\"-\"):\r\n return True\r\n if len(custom_str) < 4:\r\n custom_str = custom_str.lower()\r\n for c in ASCII_LOWER:\r\n if c ...
[ "0.69452226", "0.6832929", "0.6752534", "0.66947997", "0.6476353", "0.64630514", "0.64593303", "0.6317283", "0.62222636", "0.62189645", "0.6173262", "0.61551", "0.61456645", "0.6143674", "0.61229396", "0.6098653", "0.6087137", "0.60497266", "0.5984551", "0.5962644", "0.584120...
0.81825954
0
Finds valid separator in a string. If not it throw a warning message.
def valid_string_separator(string, logger_=_LOGGER): if not re.search("_", string): logger.log( level="warning", message='string "' + string + '" has no valid separator. Valid is "_"', logger=logger_, ) return string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_separator_unknown():\n # GIVEN a line with commas as delimiter\n line = \"one.two.three\"\n # WHEN getting the separator\n sep = samplesheet.get_separator(line)\n # THEN assert None is returned\n assert sep is None", "def _get_delimiter(item: str) -> Optional[str]:\n delimiters ...
[ "0.6464329", "0.612454", "0.60163456", "0.59026414", "0.59021854", "0.5886654", "0.57417214", "0.5678158", "0.5671954", "0.5656963", "0.55987614", "0.5502793", "0.54319966", "0.5413952", "0.5345494", "0.5328683", "0.53159136", "0.53149945", "0.5300498", "0.526305", "0.5208059...
0.7433754
0
Search for a pattern in a string
def search(pattern, string): result = [] if re.search(pattern, string): result.append(string) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_pattern_in_str(pattern, source):\n pattern = re.compile(pattern)\n for match in re.finditer(pattern,source):\n return match.groups()\n return None", "def search_pattern(self, value, pattern):\n _pattern = re.compile(pattern)\n _match = _pattern.search(value)\n return...
[ "0.7624793", "0.7388762", "0.7139477", "0.7114055", "0.7004824", "0.6988361", "0.6980681", "0.6972496", "0.69027984", "0.68797123", "0.68040305", "0.68021095", "0.6799685", "0.67022175", "0.6686591", "0.6641544", "0.6634171", "0.65950197", "0.65526205", "0.65277797", "0.65119...
0.77711433
0
Search about a regular expression and replace it.
def regex_search_and_replace(string, regex, replace): return re.sub(regex, replace, string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def REGEXREPLACE(text, regular_expression, replacement):\n return re.sub(regular_expression, replacement, text)", "def replace(text,pattern,replace=\"\"):\n\n thisFunc = inspect.currentframe().f_code.co_name\n result = re.sub(pattern,replace,text)\n return result", "def regexp_replace(\n self,...
[ "0.7051306", "0.69554996", "0.6602778", "0.6580129", "0.6491518", "0.6477533", "0.6372983", "0.6365673", "0.6234612", "0.6167674", "0.6117097", "0.61043996", "0.6094457", "0.6069955", "0.6069482", "0.60492426", "0.5934881", "0.5928888", "0.58821857", "0.5866785", "0.5861125",...
0.72033185
0
Create a worksheet (at an optional index).
def create_sheet(self, title=None, index=None): if self.read_only: raise ReadOnlyWorkbookException( 'Cannot create new sheet in a read-only workbook' ) if self.write_only: new_ws = WriteOnlyWorksheet(parent=self, title=title) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create_worksheet(sh, name):\n try:\n return sh.worksheet(name)\n except WorksheetNotFound:\n return sh.add_worksheet(title=name, rows=1, cols=1)", "def get_worksheet(spreadsheet, name, create_if_non_existant=True, creation_func=None):\n for worksheet in spreadsheet.worksheets():...
[ "0.706631", "0.6806693", "0.6561819", "0.64708805", "0.64124036", "0.6278026", "0.60483176", "0.58868474", "0.5853975", "0.56737304", "0.5669706", "0.5613417", "0.55591196", "0.554808", "0.5542361", "0.5473647", "0.5473422", "0.5461926", "0.5461865", "0.5450068", "0.54440355"...
0.7416519
0
Unzip |filename| to directory |dir|. This works with as low as python2.4 (used on win).
def UnzipFilenameToDir(filename, dir): zf = zipfile.ZipFile(filename) pushd = os.getcwd() if not os.path.isdir(dir): os.mkdir(dir) os.chdir(dir) # Extract files. for info in zf.infolist(): name = info.filename if name.endswith('/'): # dir if not os.path.isdir(name): os.makedirs(na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_unzipper(directory):\n debug.log(\"Unzipping directory (%s)...\"%directory)\n #FINDING AND UNZIPPING ZIPPED FILES\n for root, dirs, files in os.walk(directory, topdown=False):\n if root != \"\":\n orig_dir = os.getcwd()\n os.chdir(directory)\n Popen('gunzip -q -f *.gz > ...
[ "0.7273693", "0.7166455", "0.7114903", "0.7105902", "0.70718855", "0.7044079", "0.6969925", "0.69149184", "0.68934655", "0.6879597", "0.6869698", "0.68584967", "0.6848741", "0.68327314", "0.6821948", "0.68014747", "0.6697054", "0.66549414", "0.66076505", "0.6551924", "0.65476...
0.8261416
0
Get positive diagonals, going from bottomleft to topright.
def diagonalsPos(board, cols, rows): for di in ([(j, i - j) for j in range(cols)] for i in range(cols + rows - 1)): yield [board[i][j] for i, j in di if i >= 0 and j >= 0 and i < cols and j < rows]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diagonals(self):\n left_top_shifts = map(lambda i: (-(i + 1), -(i + 1)), range(min(\n self.left_distance, self.top_distance)))\n left_bottom_shifts = map(lambda i: (-(i + 1), +(i + 1)), range(min(\n self.left_distance, self.bottom_distance)))\n right_top_shifts = map(...
[ "0.75222313", "0.7026545", "0.70206344", "0.6965445", "0.6804453", "0.67697495", "0.67590415", "0.6731216", "0.6723238", "0.66716135", "0.66646826", "0.6632261", "0.66057515", "0.6602492", "0.65180683", "0.6493301", "0.64671385", "0.646315", "0.6460856", "0.64425033", "0.6393...
0.7054959
1
Insert the color in the given column.
def insert(self, column, color): c = self.board[column] if c[0] != 0: raise Exception('Column is full') i = -1 while c[i] != 0: i -= 1 c[i] = color self.checkForWin()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setColumnColor(self, column, color = \"CCCCCC\"):\n\n\t\t\t\tfillObject = openpyxl.styles.PatternFill(start_color = color, end_color = color, fill_type = \"solid\")\n\n\t\t\t\tfor i, row in enumerate(self.thing.iter_rows(), start = 1):\n\t\t\t\t\tcell = self.getCell(row = i, column = column)\n\t\t\t\t\tcell.fi...
[ "0.69155216", "0.66093147", "0.6539849", "0.6417676", "0.6267574", "0.6240908", "0.61128867", "0.6097119", "0.6070835", "0.60656697", "0.6058203", "0.604996", "0.6008967", "0.59702605", "0.5963971", "0.59610707", "0.5923179", "0.5909187", "0.5908719", "0.58989835", "0.587664"...
0.803236
0
This function tests the null hypothesis that X and Y are samples drawn from the same population of arbitrary dimension D. The permutation method (nonparametric) is used, the test statistic is E[k(X,X')] + E[k(Y,Y')] 2E[k(X,Y)]. A Gaussian kernel is used with width equal to the median distance between vectors in the agg...
def kernel_two_sample_test(X, Y, permutations=10000): if X.shape[1] != Y.shape[1]: raise ValueError('X and y should have the same dimensionality.') n = X.shape[0] # Gaussian kernel def _gauss_kernel(d, h): return np.sum(np.exp(-d**2/h**2)) def _compute_kernel_statistic(X, Y, h): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialization(n, D):\n\n samples = []\n while len(samples) < n:\n # X = np.random.randint(0, D.shape[1], 10*n)\n # Y = np.random.randint(0, D.shape[0], 10*n)\n X = np.random.uniform(0, D.shape[1], 10*n)\n Y = np.random.uniform(0, D.shape[0], 10*n)\n P = np.random.unifo...
[ "0.5744452", "0.558919", "0.5566065", "0.55568904", "0.55474883", "0.5524485", "0.5515384", "0.54778916", "0.5449621", "0.53660977", "0.5346333", "0.53459924", "0.5325391", "0.53181034", "0.53161615", "0.52901834", "0.5265913", "0.52606964", "0.5217809", "0.52135295", "0.5211...
0.6759753
0
Euclidian distance between two numpy arrays Examples >>> import numpy as np >>> a = np.array([1.2, 3.4]) >>> b = np.array([0.0, 6.8]) >>> dist(a, b) 10.270345661174213
def dist(a, b): return np.sum((a-b)**2.0)**.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eucl_dist(a, b):\n return np.sqrt( (a[0]-b[0])** 2 + (a[1]-b[1])** 2)", "def euclidian_distance(x: np.arrays, y: np.arrays):\r\n diff = x - np.mean(y, axis=0)\r\n return np.sqrt(np.dot(diff.T, diff))", "def dist(a, b):\n return math.sqrt(pow(a[0] - b[0], 2) + pow(a[1] - b[1], 2))", "def dista...
[ "0.81867015", "0.7874643", "0.7717981", "0.76727575", "0.7607771", "0.75801206", "0.75080216", "0.7501992", "0.7441717", "0.73766994", "0.7361601", "0.735215", "0.7327652", "0.7305682", "0.72867316", "0.7265571", "0.7248722", "0.7239165", "0.7235344", "0.7150888", "0.7080289"...
0.80134934
1
Returns the nth bell number. Uses approximation. Examples >>> generate bell({0,1,...,12}) >>> [bell_number(n) for n in range(13)] [1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147, 115975, 678570, 4213597]
def bell_number(n): return int((1/math.e) * sum([(k**n)/(math.factorial(k)) for k in range(ITERATIONS)])+.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def somebells():\n return random.randint(100, 500)", "def bell():\n qr = QuantumRegister(2, name='qr')\n cr = ClassicalRegister(2, name='qc')\n qc = QuantumCircuit(qr, cr, name='bell')\n qc.h(qr[0])\n qc.cx(qr[0], qr[1])\n qc.measure(qr, cr)\n\n return qc", "...
[ "0.64895433", "0.6049208", "0.59322315", "0.5624815", "0.55647814", "0.54285806", "0.5387322", "0.5327483", "0.53183746", "0.5296866", "0.5294603", "0.5262481", "0.52595633", "0.52250814", "0.5206836", "0.5205857", "0.5196771", "0.5195317", "0.51611567", "0.5158129", "0.51563...
0.7695734
0
Generates the next partition, Z, and histogram, h given the current partition and histogram given the pseudo counts, k. This function will mutate Z, k, and h.
def next_partition(Z, k, h): n = len(Z) for i in range(n-1, 0, -1): if(Z[i] <= k[i-1]): h[Z[i]] -= 1 Z[i] += 1 if Z[i] == len(h): h.append(1) else: h[Z[i]] += 1 k[i] = Z[i] if (k[i] <= Z[i]) else k[i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parition_generator(n):\n # generator\n k = np.zeros(n, dtype=np.dtype(int))\n Z = np.zeros(n, dtype=np.dtype(int))\n h = [float(n)]\n yield(Z)\n while next_partition(Z, k, h) is not None:\n yield(Z)", "def crp_gen(N, alpha):\n assert N > 0\n assert alpha > 0.0\n alpha = floa...
[ "0.58058494", "0.5637831", "0.5599531", "0.5486577", "0.5456442", "0.54059535", "0.53615105", "0.53344184", "0.5323929", "0.5317568", "0.5240298", "0.5211644", "0.5211006", "0.5174454", "0.5120818", "0.5103565", "0.51030105", "0.5102358", "0.5071498", "0.50711334", "0.5034454...
0.7305081
0
Returns the log probability under crp of the count vector Nk given concentration parameter alpha. N is the total number of entries
def lcrp(N, Nk, alpha): N = float(N) k = float(len(Nk)) # number of classes l = np.sum(gammaln(Nk))+k*log(alpha)+gammaln(alpha)-gammaln(N+alpha) return l
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_like_gamma(params, n):\n alpha, beta = params\n\n # limits:\n # alpha > 0\n # beta > 0\n if alpha <= 0 or beta <= 0:\n return -np.inf\n\n return np.sum(st.gamma.logpdf(n, alpha, scale=1/beta))", "def compute_log_K(alpha: torch.FloatTensor,\n beta: torch.Float...
[ "0.6407152", "0.6333536", "0.63102686", "0.63077545", "0.62538373", "0.61928207", "0.61840117", "0.6123619", "0.6116625", "0.6095356", "0.6011628", "0.6008223", "0.5964431", "0.59523416", "0.5921725", "0.59128004", "0.5906322", "0.5903504", "0.58885956", "0.58813334", "0.5880...
0.7737169
0