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
This method fetches the latest .dmg from Jenkins. First, it checks the id of the latest build. Next, it fetches the artifacts from that build and saves the .dmg to the workspace.
def fetch_executable_from_jenkins(): base_job_url = os.environ.get('JENKINS_JOB_URL') if not base_job_url: error('Jenkins job URL for the builder is not specified.') build_json = json.loads(requests.get('%s/api/json' % base_job_url).text) last_build = b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_exe_from_jenkins():\n base_job_url = os.environ.get(\"JENKINS_JOB_URL\")\n if not base_job_url:\n print \"Jenkins job URL for the builder is not specified.\"\n sys.exit(-1)\n\n build_json = json.loads(requests.get(\"%s/api/json\" % base_job_url).text)\n last_build = build_json['...
[ "0.686224", "0.5885177", "0.57551664", "0.54857945", "0.54756904", "0.54189986", "0.5292523", "0.5283305", "0.5274984", "0.5225317", "0.521765", "0.5216646", "0.52091974", "0.5197427", "0.51546884", "0.5133753", "0.5104077", "0.509849", "0.5095465", "0.5090588", "0.50867426",...
0.70967686
0
Takes a username and iterates over all of the animes, adding them to the csv file.
def profile(username): link = "https://myanimelist.net/animelist/{}".format(username) mal_soup = get_soup(link) table = json.loads(mal_soup.find('table').get('data-items')) print("\nRunning...\n") for dic in table: link = "https://myanimelist.net{}" res = mal_get_all_info(link.format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file_ann(self) -> None:\n with open(self.output_file_path, mode='w', newline='') as csv_file:\n tweet = ['id', 'created_time', 'text']\n writer = csv.DictWriter(csv_file, fieldnames=tweet)\n writer.writeheader()\n for tweet in self.unique_tweets:\n ...
[ "0.6231963", "0.6130325", "0.6032329", "0.58681035", "0.58271366", "0.57833856", "0.57713455", "0.5771236", "0.57581323", "0.5747821", "0.5747056", "0.5650063", "0.56407607", "0.55748767", "0.55562955", "0.54966843", "0.5489312", "0.5480623", "0.54588765", "0.54519194", "0.54...
0.70463216
0
Initialize the logger. The verbose_level should be in [0, 1, 2]. This won't return anything but will reconfigure the root logger.
def set_logger(verbose_level): if verbose_level >= 2: logging_level = logging.DEBUG elif verbose_level == 1: logging_level = logging.INFO else: logging_level = logging.ERROR logging.basicConfig(level=logging_level, stream=sys.stdout, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_logger(verbosity):\n # Register our logging handler\n handler = logging.StreamHandler(sys.stdout)\n handler.setLevel(verbosity)\n rootLogger = logging.getLogger('')\n rootLogger.addHandler(handler)\n\n # Decrease the log level of the root logger if needed\n if verbosity < rootLogger.l...
[ "0.7625532", "0.70968705", "0.7083723", "0.7014087", "0.7007587", "0.69671464", "0.6960385", "0.6925688", "0.691053", "0.685628", "0.68291914", "0.6796135", "0.67866683", "0.67789334", "0.6759883", "0.67246085", "0.66928285", "0.6676307", "0.66545886", "0.66129297", "0.659717...
0.72269374
1
Convert distributions to openTURNS. The list of distribution is converted to openTURNS objects.
def dists_to_ot(dists): try: dists = [eval('ot.' + dist, {'__builtins__': None}, {'ot': __import__('openturns')}) for dist in dists] except (TypeError, AttributeError): raise AttributeError('OpenTURNS distribution unknown.') return dists
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convertToDistr(self, ws):\n alg = self.createChildAlgorithm('ConvertToDistribution')\n alg.setProperty('Workspace', ws)\n alg.execute()", "def _iter_distributions(self) -> Iterator[\"BaseDistribution\"]:\n raise NotImplementedError()", "def as_distribution_list(dists):\n if ...
[ "0.60307014", "0.5155594", "0.49578184", "0.49229342", "0.47288564", "0.46685475", "0.46226797", "0.46183845", "0.4616375", "0.45679697", "0.45444563", "0.44968802", "0.44940984", "0.44776946", "0.44577244", "0.44557306", "0.4444763", "0.44439286", "0.44323635", "0.44319963", ...
0.6566535
0
Convert kernel to openTURNS. The kernel is converted to openTURNS objects.
def kernel_to_ot(kernel): try: kernel = eval('ot.' + kernel, {'__builtins__': None}, {'ot': __import__('openturns')}) except (TypeError, AttributeError): raise AttributeError('OpenTURNS kernel unknown.') return kernel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(context, cm_node, inputs, outputs):\n kernel_enum = {'linearKernel': 'LINEAR', 'polyKernel': 'POLY',\n 'rbfKernel': 'RBF', 'sigmoidKernel': 'SIGMOID', 'precomputedKernel': 'PRECOMPUTED'}\n kernel = cm_node.supportVectorClassifier.kernel\n kernel_val = kernel.W...
[ "0.56849927", "0.5389978", "0.5379721", "0.52513784", "0.5185308", "0.51627207", "0.5117263", "0.51141346", "0.50944746", "0.50309515", "0.5026859", "0.50176793", "0.49958104", "0.49811846", "0.49790224", "0.49762222", "0.49425617", "0.49348697", "0.49324325", "0.49317148", "...
0.72218746
0
Convert kernel to scikitlearn. The kernel is converted to scikitlearn objects.
def kernel_to_skl(kernel): try: kernel = eval('kernels.' + kernel, {'__builtins__': None}, {'kernels': __import__('sklearn.gaussian_process.kernels', fromlist=['kernels'])}) except (TypeError, AttributeError): raise AttributeErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cast(obj: 'itkLightObject') -> \"itkLabelStatisticsImageFilterISS2ISS2 *\":\n return _itkLabelStatisticsImageFilterPython.itkLabelStatisticsImageFilterISS2ISS2_cast(obj)", "def cast(obj: 'itkLightObject') -> \"itkScalarImageKmeansImageFilterISS2ISS2 *\":\n return _itkScalarImageKmeansImageFilte...
[ "0.5159945", "0.5121114", "0.5094813", "0.5053676", "0.5037607", "0.5019525", "0.49861404", "0.49394354", "0.49363768", "0.4923758", "0.4917534", "0.4887722", "0.48826864", "0.4859425", "0.48550135", "0.4851223", "0.4845716", "0.48123005", "0.48054653", "0.47690117", "0.47686...
0.59245807
0
Performs Friedman's test. G array of arrays(groups). First group is G[0] each group mus have the same number of elements!
def friedman(G, alpha = 0.05, ignoreties = False, onetailed = True, verbose = True): nclasses = len(G) # number of groups nblocks = len(G[0]) Rank = [0]* nclasses # ranks array. for j in range(nblocks): # get the rows. row = [] for i in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ford_fulkerson_algo() -> np.ndarray:\r\n res = ford_fulkerson_algorithm(np.array(ex_sample_graph), 0, 10)\r\n print(\"Result: \")\r\n print(res)\r\n return res", "def test_annular_fpm():\n\n # test some semi-random cases - is the array size as expected? \n assert masks.annular_fpm(3, 2...
[ "0.6315162", "0.55101943", "0.5471397", "0.53878236", "0.5365093", "0.5364887", "0.5359619", "0.5357744", "0.5303135", "0.529447", "0.5270481", "0.52081114", "0.5182559", "0.5176437", "0.516502", "0.5108524", "0.50582075", "0.50428694", "0.50377256", "0.503524", "0.50346583",...
0.63828975
0
Deletes old file from filesystem when corresponding `ProductImage` object is updated with new file.
def auto_delete_file_on_change(sender, instance, **kwargs): if not instance.pk: return False try: old_image = ProductImage.objects.get(pk=instance.pk).image except ProductImage.DoesNotExist: return False new_image = instance.image if not old_image == new_image: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_delete_file_on_change(sender, instance, **kwargs):\n if not instance.pk:\n return False\n try:\n old_file = Image.objects.get(pk=instance.pk).img_png\n except Image.DoesNotExist:\n return False\n new_file = instance.img_png\n if old_file and not old_file == new_file:\n ...
[ "0.6883194", "0.6871514", "0.67930377", "0.67210275", "0.67210275", "0.6711644", "0.6692425", "0.6659921", "0.66383386", "0.65901065", "0.65727085", "0.6569942", "0.6560771", "0.6389942", "0.6378528", "0.63677853", "0.634398", "0.63360244", "0.6323306", "0.6315152", "0.629470...
0.75113237
0
initiates a scan request to the scanning thread calculates the scan position based on self.num_points_done
def send_request(self): x_pos = self.x_pos_list[self.num_points_done % self.x_num] y_pos = self.y_pos_list[self.num_points_done // self.x_num] # zigzag scanning to minimize backlash if np.where(self.y_pos_list == y_pos)[0][0] % 2 == 1: # for even-numbered rows ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan(self):\n for angle in range(self.MIDPOINT-400, self.MIDPOINT+401, 100):\n self.servo(angle)\n self.scan_data[angle] = self.read_distance()\n #sort the scan data for easier analysis\n self.scan_data = OrderedDict(sorted(self.scan_data.items()))", "def process_sc...
[ "0.6134527", "0.6115277", "0.60924757", "0.602439", "0.5998884", "0.5907415", "0.5609799", "0.5566453", "0.5554528", "0.5535642", "0.5516124", "0.54980385", "0.5470819", "0.5463966", "0.5421192", "0.538856", "0.53775305", "0.5353817", "0.53472614", "0.53278494", "0.5295174", ...
0.7576418
0
Helper for netstring_read and netstring_readfd.
def _netstring_read(read_func, max_length): length_str = read_length(read_func) length = int(length_str) if max_length and length > max_length: raise ValueError("Payload is too large: %s" % length) payload = read_func(length) tag_byte = read_func(1) # dump_line can emit a newline. if tag_byte != ',' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netstring_readfd(fd, max_length=0):\n read_func = lambda length: os.read(fd, length)\n return _netstring_read(read_func, max_length)", "def netstring_read(f, max_length=0):\n read_func = f.read\n return _netstring_read(read_func, max_length)", "def readNetstring(sock):\n # First attempt to read the ...
[ "0.6789914", "0.6663811", "0.63082224", "0.60322523", "0.58078915", "0.5723228", "0.5602307", "0.557225", "0.55436134", "0.5517197", "0.5407884", "0.53974515", "0.5347857", "0.5190395", "0.51745874", "0.51651764", "0.51445425", "0.51276857", "0.51222485", "0.5116174", "0.5097...
0.6922542
0
Read a byte string from a file descriptor.
def netstring_readfd(fd, max_length=0): read_func = lambda length: os.read(fd, length) return _netstring_read(read_func, max_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_c_string(fd: BinaryIO) -> bytes:\n string = bytearray()\n while True:\n byte = fd.read(1)\n if not byte or byte == b'\\0':\n return bytes(string)\n string += byte", "def readbyte(f):\n return struct.unpack(\">B\", f.read(1))[0]", "def read_string(self):\n ...
[ "0.7474642", "0.64740103", "0.64529747", "0.6127014", "0.6118157", "0.61152637", "0.6086926", "0.60721207", "0.6066179", "0.60622627", "0.6013826", "0.6012827", "0.5981773", "0.5960392", "0.59422165", "0.59304714", "0.59214187", "0.5903875", "0.5879864", "0.58540636", "0.5853...
0.6790993
1
CCG = ColumnandConstraint Generation ColumnandConstraint Generation algorithm. Iteration between the MP and SP until convergence criteria is reached.
def ccg_algo(dir:str, tol: float, gamma: int, pv_min: np.array, pv_max: np.array, engagement: np.array, solver_param: dict, day:str, log:bool=False, printconsole:bool=False, warm_start:bool=False, M_neg:float=None): # Compute the maximal deviation between the max and min PV uncertainty set bounds max_dev = pv_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compSBM_CGP(N, Nc, M, K, lbde, burn, L_test):\n\n # comp the Adjacency matrix\n A = compSBM_A(Nc, N, lbde)\n\n # comp the polynomial coefficients\n C = compCGP_C(M)\n P = [compCoeff_CGP(i, A, C, N) for i in np.arange(2, M + 1)]\n\n # -----------------------------------------------------------...
[ "0.5832654", "0.5646996", "0.5500593", "0.54833776", "0.543777", "0.54340506", "0.539481", "0.5391305", "0.53071827", "0.53047156", "0.52895695", "0.5265945", "0.5244411", "0.52225554", "0.5215296", "0.51821274", "0.5179483", "0.5171448", "0.5150737", "0.5135097", "0.5132552"...
0.6204177
0
this method creates a jobprocess instance and all its tasks, however if the job its created as finished it will not create any task, example the time has come for start a job but a previous instance is still running and the process its configured for not overlap the new instance will be created as finished
def create(cls, process, *args, **kwargs): job = cls(process=process, *args, **kwargs) job.save() ret_tasks = [] if job.status != 'finished': tasks = Task.objects.filter(is_active=True, process=process) ret_tasks = [JobTask.create(job, t) for t in tasks] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_jobs(self, total_time):\r\n task_distribution = get_param('task_distribution')\r\n num_tasks = get_param('num_tasks')\r\n task_length = get_param('task_length')\r\n avg_arrival_delay = get_param('job_arrival_delay')\r\n job_arrival_distribution = get_param('job_arrival...
[ "0.6757296", "0.6248927", "0.609855", "0.5757851", "0.5690495", "0.5688566", "0.5634783", "0.56327575", "0.562663", "0.5616947", "0.559584", "0.5571618", "0.5568131", "0.55623615", "0.55595547", "0.55562174", "0.5551597", "0.5521749", "0.5493259", "0.5476332", "0.5460808", ...
0.7418253
0
Perform random distortions on an image.
def distort_image(image): # Randomly flip horizontally. with tf.name_scope("flip_horizontal", values=[image]): image = tf.image.random_flip_left_right(image) # Randomly distort the colors based on thread id. with tf.name_scope("distort_color", values=[image]): image = tf.image.random_brightness(image, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distort_images(self, images, seed):\n if self.mode == \"train\":\n images = image_processing.distort_image(images, seed)\n\n # Rescale to [-1,1] instead of [0, 1]\n images = tf.subtract(images, 0.5)\n images = tf.multiply(images, 2.0)\n return images", "def image_undistort():\n # read ...
[ "0.6896461", "0.67348176", "0.669944", "0.6393275", "0.6318509", "0.6064876", "0.6007593", "0.6006129", "0.5864679", "0.5803689", "0.57570237", "0.5750709", "0.57435656", "0.5728318", "0.5716929", "0.56942165", "0.5679312", "0.56645614", "0.56456125", "0.563164", "0.56153893"...
0.7043445
0
Initializes a nonfunctioning pipe.
def __init__(self): self._read_pipe_name = '' self._write_pipe_name = '' self._thread: Optional[Thread] = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._pipe = []\n self._group = None\n stages = ['on', 'off', 'color', 'transition', 'flash', 'callback',\n 'repeat', 'brightness', 'wait', 'temperature', 'white',\n 'white_up', 'white_down', 'red_up', 'red_down',\n 'gree...
[ "0.6365075", "0.6329885", "0.6310528", "0.6218899", "0.6135913", "0.61334133", "0.6073727", "0.60552454", "0.5996444", "0.5959419", "0.5923765", "0.5914634", "0.5893418", "0.5892468", "0.5878433", "0.58646625", "0.5845629", "0.5842184", "0.58149505", "0.57957757", "0.57928616...
0.66151756
0
A static method used to create a pipe between two processes. On POSIX systems, it creates a named pipe using `os.mkfifo`. On Windows platforms, it starts a backgroud thread that transfars data from the writer to the reader process it is connected to.
def create_ipc_pipe(temp_dir: str, suffix: str = '') -> 'Pipe': unique_name = str(uuid.uuid4()) + suffix pipe = Pipe() if sys.platform == 'win32': import win32pipe # type: ignore pipe_name = '-nt-shaka-' + unique_name # The read pipe is connected to a writer process. pipe._read_pip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_fifo(self):\n if os.path.exists(self.fifo_path):\n os.remove(self.fifo_path)\n os.mkfifo(self.fifo_path)", "def _pipe(self):\n if self._evdev:\n return None\n\n if not self.__pipe:\n target_function = self._get_target_function()\n ...
[ "0.6540652", "0.6175657", "0.61306775", "0.5987756", "0.580536", "0.5800549", "0.57563645", "0.5750457", "0.5711531", "0.5672833", "0.5666262", "0.5652206", "0.56253594", "0.5574714", "0.55548304", "0.55499554", "0.55309844", "0.55285764", "0.5519371", "0.551878", "0.54414266...
0.7244897
0
Returns a Pipe object whose read or write end is a path to a file.
def create_file_pipe(path: str, mode: str) -> 'Pipe': pipe = Pipe() # A process will write on the read pipe(file). if mode == 'w': pipe._read_pipe_name = path # A process will read from the write pipe(file). elif mode == 'r': pipe._write_pipe_name = path else: raise RuntimeErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def io_pipe():\n r_fd, w_fd = os.pipe()\n with io.open(r_fd, 'rb', 0) as r, \\\n \t io.open(w_fd, 'wb', 0) as w:\n \tyield r, w", "def pipe(required=True, mode='r'):\n def validate(ctx, param, value):\n if value is not None:\n return click.open_file(value, mode=mode, lazy=True), ...
[ "0.6639405", "0.63086575", "0.623345", "0.61123365", "0.6065255", "0.5675125", "0.5619844", "0.55862534", "0.53370893", "0.52485263", "0.5228577", "0.5204829", "0.52042913", "0.51842123", "0.51655436", "0.5163331", "0.5127727", "0.5091169", "0.5064754", "0.5046593", "0.503448...
0.76168203
0
Reset the value of a theano shared variable to all zeros t_S shared theano variable
def reset_shared_var(t_S): t_S.set_value(np.zeros_like(t_S.get_value()).astype('float32'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_adadelta_variables(t_A=self.t_A):\n A0 = np.zeros_like(t_A.get_value()).astype(theano.config.floatX)\n t_ada_Eg2.set_value(A0)\n t_ada_dA2.set_value(A0)\n t_A.set_value(A0)", "def build_shared_zeros(shape, name):\n return theano.shared(\n \tvalue=np.zer...
[ "0.6679739", "0.6287664", "0.61643195", "0.6138375", "0.6127964", "0.5851154", "0.58234274", "0.5742112", "0.5700925", "0.56882864", "0.56664526", "0.5655095", "0.55909204", "0.55726826", "0.5546559", "0.55088156", "0.5503559", "0.5497779", "0.5488067", "0.54708165", "0.54708...
0.811806
0
Take dot product of image with an array of gaussians t_S image variable shape (i2, i1) t_Var variances of receptive fields t_XS X coordinate for image pixels for dimension i1 t_YS Y coordinate for image pixels for dimension i2 t_XE X coordinate for receptive fields j t_YE Y coordinate for receptive fields j t_XR X coor...
def inner_products(t_S, t_Var, t_XS, t_YS, t_XE, t_YE, t_XR, t_YR): # Note in this computation, we do the indices in this form: # b, i, j, t # batch, pixel, neuron, time step # indices: b, i1, j, t t_dX = (t_XS.dimshuffle('x', 0, 'x', 'x') - t_XE.dimshuffle('x', 'x', 0, 'x') - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction_aggregation(self, xt_s,mu_s,var_s, method='PoE', weighting='uniform', power=26):\n\n nt = xt_s.shape[0]\n mu = np.zeros([nt, self.C],dtype='float64')\n var = np.zeros([nt, self.C],dtype='float64')\n\n prior_var = self.experts[0].kernel(xt_s...
[ "0.53138065", "0.5156941", "0.5128571", "0.511613", "0.50998497", "0.5030418", "0.5006108", "0.49372065", "0.49192542", "0.4917367", "0.4906383", "0.4893074", "0.48705524", "0.48512393", "0.4842089", "0.48295724", "0.4824507", "0.4812384", "0.4804426", "0.4794742", "0.4791817...
0.6263825
0
t_dIpsdA d Ips / dA indexed as b, k, j, t t_G gain constant t_IE RGC identity, j t_L0, t_L1 min, max firing rates Returns the d log FP / dA indexed b, k, j, t
def dlogfp_dA(t_dIpsdA, t_G, t_IE, t_L0, t_L1, t_SMIN, t_SMAX): t_IEr = t_IE.dimshuffle('x', 'x', 0, 'x') t_dGen_dA = (1 - 2 * t_IEr) * t_G * t_dIpsdA / (t_SMAX - t_SMIN) t_dlogFPdA = T.log(t_L1 / t_L0) * t_dGen_dA return t_dlogFPdA
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rateFcn(a0,a1,a2,a3,a4,a5,a6,T):\n return np.exp(a0+a1/T+a2/T**(1/3)+a3*T**(1/3)+a4*T+a5*T**(5/3)+a6*np.log(T))", "def get_rec_rate_H_caseA_Dr11(T):\n T4 = T*1e-4\n return 4.13e-13*T4**(-0.7131 - 0.0115*np.log(T4))", "def ETPA(omegap, E, edip, Te, g_idx=[0], e_idx=[], f_idx=[]):\n N = l...
[ "0.6032632", "0.5838996", "0.57856476", "0.5695584", "0.56228185", "0.5600415", "0.55986273", "0.55946696", "0.55773216", "0.5558041", "0.55422586", "0.55100906", "0.5491797", "0.5468888", "0.5450849", "0.5436682", "0.5423116", "0.53676325", "0.5357754", "0.5339139", "0.53333...
0.7176311
0
Resets ADA Delta auxillary variables
def reset_adadelta_variables(t_A=self.t_A): A0 = np.zeros_like(t_A.get_value()).astype(theano.config.floatX) t_ada_Eg2.set_value(A0) t_ada_dA2.set_value(A0) t_A.set_value(A0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_variables(self) -> None:\n self.attributs = {}\n self.data = []", "def reset_data_recorder(self):\n\n self.t_values = []\n self.x_values = []\n self.tau_values = []", "def reset(self):\n self.c_count = 0\n self.a_count = -1\n self.epsilon = self...
[ "0.6393441", "0.6191717", "0.6155624", "0.61232173", "0.6086047", "0.6076546", "0.5989268", "0.5978808", "0.5949876", "0.5936625", "0.5931919", "0.5930811", "0.5918655", "0.5910692", "0.590065", "0.58905596", "0.5883913", "0.58700746", "0.5862289", "0.58366185", "0.57838637",...
0.7476554
0
Reset the values of the hessian term and the bias term to zero to reset the
def reset_hessian_and_bias(self): # reset_shared_var(self.t_H) t = self.QUAD_REG if len(t.shape) == 1: self.t_H.set_value(np.diag(self.QUAD_REG)) elif len(t.shape) == 2: self.t_H.set_value(self.QUAD_REG) else: raise ValueError('Invalid quad_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_parameters(self):\n if self.W is not None:\n tanh_gain = weight_init.calculate_gain(\"tanh\")\n weight_init.xavier_normal_(self.W, tanh_gain)\n # self.W.data.uniform_(-0.001, 0.001)", "def reset(self):\n self.reset_image_estimate()\n self.init_m_aux...
[ "0.70881516", "0.708221", "0.6806984", "0.67656636", "0.6675885", "0.6660311", "0.66351706", "0.66191715", "0.6577939", "0.6569499", "0.6541274", "0.6515547", "0.65126866", "0.6502201", "0.64899135", "0.6471892", "0.6464242", "0.64477897", "0.6444937", "0.6430383", "0.6421966...
0.7808178
0
Verifies CAS 1.0 authentication ticket. Returns username on success and None on failure.
def _verify_cas1(ticket, service): params = {'ticket': ticket, 'service': service} url = (urljoin(settings.CAS_SERVER_URL, 'validate') + '?' + urlencode(params)) page = urlopen(url) try: verified = page.readline().strip() if verified == 'yes': return page.readline(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _CAS_login(self):\n import urllib\n self.ticket = current.request.vars.ticket\n if not current.request.vars.ticket:\n redirect(\"%s?service=%s\" % (self.cas_login_url,\n self.cas_my_url))\n else:\n url = \"%s?service=%s&ti...
[ "0.6621475", "0.64085776", "0.6396165", "0.6132385", "0.6075758", "0.60504854", "0.59542656", "0.5880836", "0.57991385", "0.5658998", "0.5637163", "0.55938107", "0.5570902", "0.55611295", "0.5410291", "0.5364074", "0.5364074", "0.5313934", "0.5269508", "0.52593505", "0.525525...
0.6950565
0
Verifies CAS 2.0+ XMLbased authentication ticket. Returns user's attribute on success and None on failure.
def _verify_cas2(ticket, service): try: from xml.etree import ElementTree except ImportError: from elementtree import ElementTree params = {'ticket': ticket, 'service': service} url = (urljoin(settings.CAS_SERVER_URL, 'serviceValidate') + '?' + urlencode(params)) page = u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_ticket(self, ticket, **kwargs):\n\n try:\n from xml.etree import ElementTree\n except ImportError:\n from elementtree import ElementTree\n\n page = self.fetch_saml_validation(ticket)\n\n try:\n user = None\n attributes = {}\n ...
[ "0.76262337", "0.6640478", "0.6270583", "0.616184", "0.6048709", "0.6014877", "0.5855325", "0.5819822", "0.56555504", "0.56180346", "0.55637974", "0.55475897", "0.5488287", "0.54433984", "0.537912", "0.5327678", "0.5322191", "0.53005683", "0.52785677", "0.5266824", "0.5251542...
0.7101547
1
Verifies CAS ticket and gets or creates User object
def authenticate(self, ticket, service, request): user = _verify(ticket, service) logger.debug("Verified User %s" % user) if user is None: return None return models.SSOUser(**user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self, ticket, service):\n User = get_user_model()\n\n if self.protocol == 1:\n valid = CAS1Validation(ticket, service)\n elif self.protocol == 2:\n valid = CAS2Validation(ticket, service)\n else:\n valid = None\n logger.info('Auth...
[ "0.7041426", "0.64837295", "0.6294565", "0.6078544", "0.60566604", "0.6025016", "0.6016404", "0.5997659", "0.59910583", "0.5988254", "0.59696954", "0.59639955", "0.595156", "0.59499717", "0.5919112", "0.5894354", "0.58817637", "0.5876354", "0.5868059", "0.5853921", "0.5851738...
0.71341777
0
Constructs a HMM from probability tables.
def fromtables(pi, t, e): #sanity checks nStates=len(pi) assert(nStates==len(t) and nStates==len(e) and nStates>0) nObs=len(e[0]) for i in range(nStates): assert(len(t[i])==nStates and len(e[i])==nObs) m=hmm(nStates, nObs) m.pi=deepcopy(pi) m.t=deepcopy(t) m.e=deepcopy(e) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _market_hmm_example():\n states = [\"bull\", \"bear\", \"static\"]\n symbols = [\"up\", \"down\", \"unchanged\"]\n A = np.array([[0.6, 0.2, 0.2], [0.5, 0.3, 0.2], [0.4, 0.1, 0.5]], np.float64)\n B = np.array([[0.7, 0.1, 0.2], [0.1, 0.6, 0.3], [0.3, 0.3, 0.4]], np.float64)\n pi = np.array([0.5, 0...
[ "0.61488056", "0.5965925", "0.58499694", "0.575859", "0.5749717", "0.5712239", "0.57099265", "0.56164676", "0.56137776", "0.56059283", "0.5592278", "0.55705166", "0.55137616", "0.54979444", "0.549498", "0.54608506", "0.54598826", "0.544192", "0.54352206", "0.5413207", "0.5385...
0.70774823
0
Learns from a list of observation sequences and their associated ground truth.
def learn(self, observations, ground_truths): assert(len(observations)==len(ground_truths)) self.__init__(self.nStates, self.nObs) N=len(observations) for i in range(N): o=observations[i] t=ground_truths[i] assert(len(o)==len(t)) self.pi[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_sequences(notes, n_vocab):\n sequence_length = 50\n\n # get all pitch names\n pitchnames = sorted(set(item for item in notes))\n\n # create a dictionary to map pitches to integers\n note_to_int = dict((note, number) for number, note in enumerate(pitchnames))\n\n network_input = []\n ...
[ "0.55630493", "0.55254424", "0.5501198", "0.5487197", "0.54234886", "0.53784466", "0.5335226", "0.5326911", "0.5304064", "0.5296955", "0.5287288", "0.52840465", "0.5266204", "0.5259986", "0.5259986", "0.52509177", "0.52489835", "0.5209026", "0.52064824", "0.5155642", "0.51410...
0.5635134
0
Viterbi inference of the highest likelihood hidden states sequence given the observations. Time complexity is O(|observation|nStates^2).
def viterbi(self, observation): N=len(observation) tab=[[0]*self.nStates for i in range(N)] backtrack=[[-1]*self.nStates for i in range(N)] if not self.logdomain: self.__convert_to_log() for i in range(self.nStates): tab[0][i]=self.e[i][observation[0]]+se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def viterbi(self, hmm, initial, emissions):\n probabilities = hmm.emission(emissions[0]) * initial\n stack = []\n \n for emission in emissions[5:]:\n trans_probabilities = hmm.transition_probabilities * np.row_stack(probabilities) #Matrix for transition probabilities\n ...
[ "0.6980931", "0.6643485", "0.6631735", "0.6539058", "0.6513881", "0.6479943", "0.64096594", "0.6368848", "0.6295443", "0.6259586", "0.61511296", "0.6142033", "0.6089733", "0.59984404", "0.59506834", "0.5934529", "0.59035957", "0.58897674", "0.5864158", "0.5853739", "0.5813723...
0.7409377
0
Get the restaurant json or None Use the default ones if mocks are requested
def get_restaurant(id): with current_app.app_context(): if current_app.config["USE_MOCKS"]: id -= 1 # restaurant IDs starting by 1 if 0 <= id < len(restaurants): return restaurants[id] else: return None else: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_restaurant(self, request, **kwargs):\n restaurant = Restaurant.objects.order_by(\n '?'\n ).select_related(\n 'address'\n ).prefetch_related(\n 'employees'\n ).first()\n serializer = RestaurantFullInfoSerializer(restaurant)\n ...
[ "0.6806192", "0.6267271", "0.6147111", "0.6061143", "0.58997214", "0.58851624", "0.58745176", "0.586676", "0.5860428", "0.58145684", "0.58047366", "0.57518137", "0.5727421", "0.5716943", "0.5638375", "0.5630991", "0.5625062", "0.55808204", "0.55531573", "0.55188113", "0.54964...
0.64233977
1
Get the list fo the restaurant's tables or None Use the default ones if mocks are requested
def get_tables(id): with current_app.app_context(): if current_app.config["USE_MOCKS"]: id -= 1 # restaurant IDs starting by 1 if 0 <= id < len(restaurants): return tables[id] else: return None else: return get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tables(self):\n r = self.client.query(\"show tables\")\n if r:\n tables = [tuple(reversed(x.split(','))) for x in filter(None, r.split('\\n'))][1:]\n FT.table_cache = dict(tables)\n return tables\n else:\n logging.error(\"get_tables: no respo...
[ "0.61924666", "0.6052941", "0.59938204", "0.59800273", "0.5927211", "0.58977866", "0.58351445", "0.5808453", "0.57723635", "0.57723635", "0.5734585", "0.5732754", "0.57127583", "0.5697837", "0.56965154", "0.5685882", "0.5673168", "0.5667938", "0.5657687", "0.5557201", "0.5543...
0.74126005
0
Add a new reservation Return the booking id, otherwise Return None if a db error occured
def add_booking(user_id, rest_id, number_of_people, booking_datetime, table_id, entrance_datetime=None): try: booking = Booking() booking.restaurant_id = rest_id booking.user_id = user_id booking.booking_datetime = booking_datetime booking.entrance_datetime = entrance_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_reservation(house, id, check_in_date, check_in_time, check_out_date, guest_name,\n guest_cell, guest_telegram, num_guest, comment, confirm):\n sql = \"\"\"INSERT INTO %s VALUES(%s, '%s', '%s', '%s', '%s', '%s', '%s', %s, '%s', %s) RETURNING reservation_id;\"\"\"\n conn = None...
[ "0.6992789", "0.69501656", "0.68939716", "0.67820656", "0.6615095", "0.66042477", "0.64920753", "0.62454337", "0.61765397", "0.6087743", "0.6031231", "0.60201854", "0.59403574", "0.59373236", "0.5842294", "0.5815116", "0.57967556", "0.5778315", "0.5752786", "0.5684641", "0.56...
0.71016914
0
Return a free table if it is available, otherwise Return 1 if there are no free tables Return 2 if the restaurant is closed Return None if it is impossible to connect with the restaurant microservice.
def get_a_table(restaurant_id, number_of_people, booking_datetime, excluded=-1): is_open, rest = restaurant_is_open(restaurant_id, booking_datetime) # check is the restaurant is open on that date if is_open is None: # connection error with the restaurant microservice return None if not is_open...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n free_tables = []\n tables = TableDetails.query.all()\n for table in tables:\n if table.table_status == \"Empty\":\n free_tables.append(table)\n return free_tables, 200", "def _get_or_create_table(self):\n\n table_schema = self._get_tab...
[ "0.59448147", "0.57143354", "0.56816226", "0.5603177", "0.5588787", "0.54065543", "0.5360168", "0.53469735", "0.53469735", "0.53469735", "0.5253404", "0.5236414", "0.5236414", "0.5196033", "0.5178952", "0.51766515", "0.5149163", "0.51316524", "0.5122474", "0.5119748", "0.5105...
0.657818
0
Check if a restaurant is open in a given datetime Return true if the restaurant is open (with the json of the restaurant) Return false if the restaurant is closed (with the json of the restaurant) eturn None if it is impossible to connect with the restaurant microservice.
def restaurant_is_open(restaurant_id, booking_datetime): rest = get_restaurant(restaurant_id) if rest is None: # error with the microservice return (None,None) else: if (booking_datetime.weekday()+1) in rest["closed_days"]: return (False,rest) now = datet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restaurant_opening(H):\n\n if len(H) == 0:\n return [False,False,False]\n\n # opening hours that only state that the shop open leads to unreliable\n # results. This is because the shop never close ! so will be available\n # all the time.\n if all_open(H):\n return [False,False,Fals...
[ "0.64628744", "0.64410496", "0.63645446", "0.6307019", "0.6250015", "0.59982455", "0.594884", "0.58953434", "0.5853086", "0.58084", "0.570417", "0.55151856", "0.5453661", "0.53701514", "0.53474367", "0.53282684", "0.53273594", "0.53005165", "0.53005165", "0.53005165", "0.5296...
0.82387584
0
Given a user id, get all application cases that belong to the Company where the user is in
def get_application_cases_by_uid(uid, conditions=[]): cid = employee.get_employee_by_user(userid=uid).company.id return ApplicationCase.objects.filter(job__company_id=cid, *conditions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_companies(self, obj):\n userCompanies = get_objects_for_user(\n obj, \"view_company\", klass=models.Company)\n return [x.id for x in userCompanies]", "def for_company(cls, company_id):\n return cls.objects.filter(vacancy__company__id=company_id)", "def get_all_companies_...
[ "0.6131878", "0.5925701", "0.5477436", "0.54555124", "0.54555124", "0.54555124", "0.54555124", "0.5412679", "0.5296511", "0.52784586", "0.52468145", "0.5147777", "0.5003169", "0.49420902", "0.49417678", "0.49276674", "0.49187526", "0.489076", "0.48836246", "0.4882932", "0.486...
0.72097003
0
Generate satellite body geometry
def create_sat_body(self): # Dimensions of body SAT_SIZE = self.ANI_SCALE*self.SAT_SCALE*np.asarray(self.SAT_PROPS["Size"])/2 bx = SAT_SIZE[0] by = SAT_SIZE[1] bz = SAT_SIZE[2] # Create vertices in body frame ind = 0 V = [] for x in [-1, 1]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bodies_char(self):\n # Body values, G*M_body\n mu_body = {} # km^3 kg^-1 s^-2\n mu_body[\"Sun\"] = 132712440017.99\n mu_body[\"Moon\"] = 4902.8005821478\n mu_body[\"Earth\"] = 398600.4415\n\n mu_body[\"Mars\"] = 42828.314258067 # Mars, GM\n mu_body[\"Jupiter...
[ "0.60452974", "0.59936213", "0.58286685", "0.5799699", "0.5784664", "0.57215995", "0.57152975", "0.56586725", "0.56239074", "0.55475634", "0.55233556", "0.55116284", "0.5497383", "0.5475909", "0.54728085", "0.545801", "0.5440318", "0.5348923", "0.5345914", "0.5342128", "0.529...
0.68961835
0
Create satellite solar panel geometry
def create_sat_panels(self): # Dimensions of body SAT_SIZE = self.ANI_SCALE*self.SAT_SCALE*np.asarray(self.SAT_PROPS["Size"])/2 bx = SAT_SIZE[0] by = SAT_SIZE[1] bz = SAT_SIZE[2] # Panel length L = bx # Panels theta = self.PANEL_ANGLE*pi/180 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_satellite(ax, coo_x, coo_y, coo_z):\n from mpl_toolkits.mplot3d import Axes3D\n from mpl_toolkits.mplot3d.art3d import Poly3DCollection\n\n tr = np.transpose(np.vstack((coo_x.cartesian.xyz.value, coo_y.cartesian.xyz.value, coo_z.cartesian.xyz.value)))\n\n alpha_czti = 0.5\n alpha_radiator = ...
[ "0.6237249", "0.6226212", "0.5892257", "0.5789716", "0.57470626", "0.5711296", "0.56723964", "0.5627063", "0.5626375", "0.55648106", "0.55581516", "0.5531766", "0.5512465", "0.55034286", "0.5503299", "0.54912096", "0.54896516", "0.54868186", "0.54823357", "0.54696953", "0.546...
0.67812073
0
Create FOV actor for camera
def create_cam_fov(self, name): # Vertices of FOV V = [ (0, 0, -self.SAT_PROPS["Alt"]), tuple(self.CAM_PROPS[name]["Intercepts"][:, 0]), tuple(self.CAM_PROPS[name]["Intercepts"][:, 1]), tuple(self.CAM_PROPS[name]["Intercepts"][:, 2]), tuple(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_camera_fov(args_, client_, new_fov):\n\n args_.camera_bp.set_attribute(\"fov\", \"%s\" % new_fov)\n args_.camera_depth_bp.set_attribute(\"fov\", \"%s\" % new_fov)\n\n # destroy the original actor and make a new camera object\n args_.rgb_camera.camera_actor.stop()\n args_.depth_camera.camera_actor.stop...
[ "0.67196584", "0.6497814", "0.64449346", "0.6268035", "0.6130942", "0.6108091", "0.6069316", "0.59878516", "0.5951577", "0.5824285", "0.58094376", "0.5759047", "0.5749021", "0.5749021", "0.5749021", "0.5739862", "0.5734905", "0.5704752", "0.56909734", "0.565619", "0.5634168",...
0.7520698
0
Create text actor for view labels
def create_text(self, settings, viewport): viewport = np.array(viewport) viewport[[0, 2]] = self.WIN_H_SCALE*viewport[[0, 2]] viewport[[1, 3]] = self.WIN_V_SCALE*viewport[[1, 3]] viewport = list(viewport) # Set defaults if not specified defaults = { "Size": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_label(self, x, y, text, width=50, **config):\n\n self.main_canvas.create_text(x, y, text='%6s' % text, width=width, **config)", "def create_label(self, on, text: str):\n return tk.Label(on, font=self.FONT, bg=self.BG_COLOR, text=text)", "def setupScreenText(self) :\n\t\t# Create objec...
[ "0.6539994", "0.6291919", "0.61044025", "0.6095112", "0.6014266", "0.59630674", "0.5954388", "0.594855", "0.59343463", "0.59293854", "0.5919707", "0.59102863", "0.5881727", "0.5864653", "0.5849347", "0.584334", "0.5827427", "0.5817509", "0.58104134", "0.5785886", "0.57827777"...
0.649773
1
Makes a vtkIdList from a Python iterable
def mkVtkIdList(self, it): vil = vtk.vtkIdList() for i in it: vil.InsertNextId(int(i)) return vil
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arr2vtkIdList(self):\n a = [1, 2, 3, 4, 5]\n p = array_handler.array2vtkIdList(a)\n for i, j in enumerate(a): \n self.assertEqual(p.GetId(i), j)\n p = vtk.vtkIdList()\n ident = id(p)\n p = array_handler.array2vtkIdList(numpy.array(a), p)\n ...
[ "0.6913012", "0.651734", "0.6138567", "0.6030419", "0.572271", "0.57053196", "0.56407267", "0.5620092", "0.55757225", "0.5573427", "0.55544776", "0.5554155", "0.5551495", "0.55412483", "0.5510335", "0.55083036", "0.5506482", "0.5440368", "0.5425658", "0.5404241", "0.5389161",...
0.7700176
0
Attaches another entity at a position offset from the attachment site.
def attach_offset(self, entity, offset, attach_site=None): frame = self.attach(entity, attach_site=attach_site) frame.pos = offset return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_entity(self, ent):\n self.tiles[ent.position[x]][ent.position[y]].add_entity(ent)", "def offset(self, offset):\n self._offset += offset", "def attach(self, construct, start_domain, start_index, end_domain, end_index, check_attachment_sites=False):\n if isinstance(start_domain, six....
[ "0.5485562", "0.5465371", "0.52700096", "0.52345645", "0.5217608", "0.5122235", "0.5115227", "0.5114092", "0.5091192", "0.5039015", "0.5038015", "0.5035762", "0.5021496", "0.49517542", "0.49258757", "0.4868918", "0.48621973", "0.4830751", "0.48174015", "0.48109263", "0.480009...
0.7699143
0
Returns content of URI or splited by \\n config.
def adv_get_content(URI=None, config=None): if URI != None: content = get_file(URI) elif config != None: if isinstance(config, basestring): content = config.split('\n') elif hasattr(config, '__iter__'): # iterable content = config else: raise e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_content(content, uri=False):\n # Rosette API may balk at non-Latin characters in a URI so we can get urllib\n # to %-escape the URI for us\n if uri:\n unquoted = urllib.parse.unquote(content)\n return urllib.parse.quote(unquoted, '/:')\n if content is None:\n content = sys....
[ "0.57403713", "0.56008327", "0.5137154", "0.5094208", "0.49758965", "0.49627182", "0.49498793", "0.4949379", "0.49068105", "0.48820636", "0.4856582", "0.48470175", "0.48469394", "0.48453036", "0.48230538", "0.48224425", "0.4791141", "0.47874144", "0.47825134", "0.4767716", "0...
0.6217384
0
Save several arrays into a single file in uncompressed ``.npz`` format. If arguments are passed in with no keywords, the corresponding variable names, in the ``.npz`` file, are 'arr_0', 'arr_1', etc. If keyword arguments are given, the corresponding variable names, in the ``.npz`` file will match the keyword names.
def savez(file, *args, **kwds): ary_list = [] for a in args: ary_list.append(array_create.array(a, bohrium=False)) return numpy.savez(file, *ary_list, **kwds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savez_compressed(file, *args, **kwds):\n\n ary_list = []\n for a in args:\n ary_list.append(array_create.array(a, bohrium=False))\n return numpy.savez_compressed(file, *ary_list, **kwds)", "def save_arrays_to_npz(data: Union[dict, list], file_path: str):\n arrays = list(data.values()) if i...
[ "0.73051775", "0.71861243", "0.7068409", "0.70044583", "0.6802454", "0.6675411", "0.64989364", "0.6470921", "0.64208746", "0.6399053", "0.6364537", "0.63464135", "0.6261641", "0.6238662", "0.62357056", "0.6207225", "0.6186934", "0.61552876", "0.61445135", "0.61101615", "0.610...
0.7774841
0
Save several arrays into a single file in compressed ``.npz`` format. If keyword arguments are given, then filenames are taken from the keywords. If arguments are passed in with no keywords, then stored file names are arr_0, arr_1, etc.
def savez_compressed(file, *args, **kwds): ary_list = [] for a in args: ary_list.append(array_create.array(a, bohrium=False)) return numpy.savez_compressed(file, *ary_list, **kwds)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savez(file, *args, **kwds):\n\n ary_list = []\n for a in args:\n ary_list.append(array_create.array(a, bohrium=False))\n return numpy.savez(file, *ary_list, **kwds)", "def save_arrays_to_npz(data: Union[dict, list], file_path: str):\n arrays = list(data.values()) if isinstance(data, dict) ...
[ "0.7675963", "0.6940585", "0.68568796", "0.68325424", "0.68274915", "0.6609121", "0.6530841", "0.6502681", "0.6309862", "0.62696505", "0.6235707", "0.622537", "0.62017405", "0.61851525", "0.61754113", "0.6117313", "0.60857856", "0.60235023", "0.6009357", "0.6003201", "0.59702...
0.74806476
1
Construct an array from a text file, using regular expression parsing. The returned array is always a structured array, and is constructed from all matches of the regular expression in the file. Groups in the regular expression are converted to fields of the structured array.
def fromregex(file, regexp, dtype, bohrium=True): return array_create.array(numpy.fromregex(file, regexp, dtype), bohrium=bohrium)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_txt_file(txtfile):\n array = np.genfromtxt(txtfile)\n return array", "def extract_arrays(f):\n arrays = re.findall(arrayregex,f)\n return arrays", "def _parse_txt(path, n_channels):\n f = open(path)\n lines = f.readlines()\n f.close()\n\n geom = np.zeros((0, 2))\n\n for i, ...
[ "0.7213056", "0.6166122", "0.5949893", "0.59376925", "0.5915017", "0.5867279", "0.5831664", "0.5794558", "0.57613015", "0.575809", "0.5737247", "0.5719786", "0.57041824", "0.5690172", "0.55857027", "0.5577605", "0.55612797", "0.55323094", "0.5509963", "0.5486947", "0.5471353"...
0.7399248
0
a.tofile(arr, fid, sep="", format="%s") Write array 'arr' to a file as text or binary (default). Data is always written in 'C' order, independent of the order of `a`. The data produced by this method can be recovered using the function fromfile().
def print_to_file(arr, fid, sep="", format="%s"): f = array_create.array(arr, bohrium=False) return f.tofile(fid, sep=sep, format=format)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeArray(fname,arr):\n fh = open(fname,'w')\n fh.write('%d\\n' % arr.shape[0])\n fh.write('%d\\n' % arr.shape[1])\n for x in range(arr.shape[0]):\n for y in range(arr.shape[1]):\n if arr.dtype == np.complex:\n fh.write('%.7e %.7e\\n' % (arr[x,y].real, arr[x,y].ima...
[ "0.6918701", "0.6727358", "0.6621259", "0.65976906", "0.65721756", "0.65588903", "0.6537441", "0.65140146", "0.65048033", "0.6455233", "0.64238685", "0.6413894", "0.63596934", "0.62816775", "0.6238878", "0.6104446", "0.60399896", "0.5977586", "0.59756196", "0.594799", "0.5843...
0.85623467
0
Get the hash method.
def hash_method(self): return self._hash_class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_algo(self) -> str:\n return self._hash_algo", "def get_hash(self):\n return self.__hash", "def get_hash(self):\r\n return", "def signatureHashAlgorithm(self) -> str:\n hash_algo = self['signature_algorithm'].hash_algo\n return hash_algo", "def get_hash(self) -> str:\...
[ "0.789659", "0.73221624", "0.7316154", "0.72321606", "0.71322316", "0.7026344", "0.69898903", "0.69604665", "0.69488406", "0.6935332", "0.6934777", "0.68786675", "0.68585414", "0.6856074", "0.67770886", "0.6766313", "0.6753965", "0.67056817", "0.67053574", "0.6698196", "0.669...
0.87897944
0
Get the hash cipher
def hash_cipher(self): return self._digest_cipher
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HashAlgorithm(self) -> _n_7_t_0:", "def hash(self) -> str:\r\n ...", "def hash_algo(self) -> str:\n return self._hash_algo", "def hash(self) -> bytes:", "def digest(self):\n d = MegaCrypto.str_to_a32(self.hash)\n return (d[0] ^ d[1], d[2] ^ d[3])", "def getHash(sel...
[ "0.6766753", "0.651927", "0.64724076", "0.6463382", "0.6461716", "0.6444886", "0.6433632", "0.63657993", "0.6353914", "0.6286419", "0.6285059", "0.6275059", "0.6241196", "0.6235177", "0.6227181", "0.6223782", "0.6220806", "0.6211417", "0.6205702", "0.61994827", "0.61988443", ...
0.8253679
0
Create cookie if not there already. Also deactivates language.
def process_response(self, request, response): if not request.COOKIES.get('site_language'): response.set_cookie('site_language', '') translation.deactivate() return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setlang(request):\n form = SetLanguageForm(request.POST or None)\n if form.is_valid():\n user_language = form.cleaned_data['language']\n translation.activate(user_language)\n response = HttpResponseRedirect(form.cleaned_data['next'])\n response.set_cookie(settings.LANGUAGE_COO...
[ "0.6306369", "0.597832", "0.5574768", "0.5574281", "0.55403256", "0.5460696", "0.5437387", "0.54191154", "0.54006237", "0.53784394", "0.5306191", "0.5276896", "0.5240446", "0.52366024", "0.52167886", "0.52082217", "0.51884407", "0.51844126", "0.51611924", "0.513932", "0.51298...
0.63812304
0
Verifies prediction and label shapes are equal.
def check_shape_equal(pred, labels): if pred.shape != labels.shape: raise ValueError('Prediction and labels shapes must be equal:' f'{pred.shape} vs {labels.shape}.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_label_shapes(labels, preds, shape=0):\n\n if shape == 0:\n label_shape, pred_shape = len(labels), len(preds)\n else:\n label_shape, pred_shape = labels.shape, preds.shape\n\n if label_shape != pred_shape:\n raise ValueError(\"Shape of labels {} does not match shape of \"\n ...
[ "0.7969878", "0.7264365", "0.7258978", "0.71695817", "0.6899441", "0.68151385", "0.6598533", "0.6566734", "0.6538672", "0.64354575", "0.6296917", "0.622556", "0.6192627", "0.6162538", "0.6154577", "0.6067735", "0.60317224", "0.6001732", "0.5992151", "0.5929971", "0.58998036",...
0.87678856
0
Verifies the nested dictionary dtypes are equal to target dtype.
def check_dtype_equal(input_dict, target_dtype = jnp.float32, exclude_list = ()): flat_input = traverse_util.flatten_dict(input_dict) for key, value in flat_input.items(): if key[0] in exclude_list: continue key_name = '_'.join([str(sub_key) for sub_key in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dtype_equality(self):\r\n dtypes = get_numeric_types(with_complex=True)\r\n # Perform all pairwise comparisons of dtypes, making sure comparing\r\n # their string representation yields the same result.\r\n for dtype1_idx, dtype1 in enumerate(dtypes):\r\n for dtype2 i...
[ "0.65680695", "0.6526487", "0.6405589", "0.6161182", "0.6083145", "0.60452515", "0.6042174", "0.6006597", "0.59724295", "0.59593993", "0.59462154", "0.59145516", "0.5882707", "0.5867973", "0.58577424", "0.58535045", "0.58512837", "0.583794", "0.58129144", "0.5789161", "0.5759...
0.79315984
0
Weights and reduces the loss. We convert to float32 before reducing following TF1 implementation. After weighting and reducing the losses, we convert the output back to the dtype of the input.
def compute_weighted_loss( loss, weights, dtype, loss_reduction, ): if loss_reduction == LossReductionType.RETURN_AS_IS: # Handle no loss reduction, by returning tensor as-is. return loss loss = loss.astype(jnp.float32) loss_weight = jnp.broadcast_to(weights, loss.shape).astype(jnp.float32...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loss(self, x, weights=1.0):\n input_dtype = x.dtype\n x = self.cast(x, mstype.float32)\n weights = self.cast(weights, mstype.float32)\n x = self.mul(weights, x)\n if self.reduce and self.average:\n x = self.reduce_mean(x, self.get_axis(x))\n if self.redu...
[ "0.63926", "0.6049288", "0.60120857", "0.6006793", "0.59572875", "0.59036493", "0.5870864", "0.5830311", "0.57291305", "0.5717345", "0.56763923", "0.5671253", "0.5646253", "0.56360745", "0.5630161", "0.5623673", "0.56132084", "0.560395", "0.5577375", "0.5574701", "0.5570263",...
0.642647
0
Computes a safe log. This function returns 0.0 wherever x contains any value <= 0.0.
def safe_log(x): safe_x = jnp.where(x > 0.0, x, jnp.ones_like(x)) return jnp.where(x > 0.0, jnp.log(safe_x), jnp.zeros_like(x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safelog(x):\n #return np.log(x)\n return np.log(np.clip(x,floor,np.inf))", "def smart_log(self, value: float) -> float:\n if value > 0:\n return math.log(value, self.log_scale)\n elif value == 0:\n return 0\n elif value < 0:\n return -(math.log(abs(valu...
[ "0.8466852", "0.7791398", "0.76290375", "0.75993013", "0.75740945", "0.7498413", "0.7462287", "0.7412065", "0.72859854", "0.72764105", "0.7259336", "0.723413", "0.7206518", "0.71971625", "0.7141088", "0.7078743", "0.70738405", "0.70517623", "0.6978665", "0.69375044", "0.67808...
0.8335094
1
Cosine loss. This loss computes the dot product between predictions and labels as loss. The value ranges from [0, 2.0] depending on the alignment of prediction and label vectors. This loss can be used when we want to optimize the alignment of the vectors directly.
def cosine_loss(predictions, labels, weights = 1.0, loss_reduction = LossReductionType.SUM_BY_NONZERO_WEIGHTS, **kwargs): del kwargs # Unused check_shape_equal(predictions, labels) cosine = 1.0 - jnp.sum(predictions * labels, axis=-1) return compu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward_cosine(self, data, label):\n \n assert label.requires_grad is False\n data = self.preprocess(data)\n label = self.preprocess(label)\n\n feature_tri_data, f_data, orig_feature_data = self.extract_feature(data)\n feature_tri_label, f_label, orig_feature_label = s...
[ "0.7016788", "0.6793693", "0.66546625", "0.65116197", "0.64649904", "0.64382917", "0.62884885", "0.62357163", "0.6223788", "0.6125927", "0.6124123", "0.60824096", "0.60576713", "0.60450846", "0.6016146", "0.5962783", "0.5940745", "0.5913568", "0.5892761", "0.5881885", "0.5876...
0.747866
0
A wrapper to add weight decay to underlying loss function. Use this wrapper if the weight decay in the optimizer is not suitable. For example, if you need to exclude some parameters from decay loss.
def weight_decay_loss_wrapper( loss_fn = gin.REQUIRED, factor = gin.REQUIRED, exclude = (), ): traversal = traverse_util.ModelParamTraversal( lambda path, _: all([e not in path for e in exclude])) def wrapped_loss(outputs, *args, params, **kwargs): losses = loss_fn(outputs, *args, **kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_with_decoupled_weight_decay(base_optimizer):\n\n class OptimizerWithDecoupledWeightDecay(DecoupledWeightDecayExtension,\n base_optimizer):\n \"\"\"Base_optimizer with decoupled weight decay.\n\n This class computes the update step of `base_optimizer` and\n...
[ "0.7632419", "0.76224226", "0.72987336", "0.70135576", "0.695887", "0.68777436", "0.6820775", "0.6765971", "0.67616886", "0.673294", "0.6707882", "0.6704943", "0.6666855", "0.66658753", "0.6649116", "0.6647162", "0.6631825", "0.6618139", "0.6591792", "0.6591792", "0.6585925",...
0.7627787
1
Send a LA/SP/SnapMultiplier request command to message receivers.
async def request(self, multiplier: Optional[int]=None): # TODO: validate the multiplier message = Message(self.name_path, multiplier) await self.issue_command(Command(message))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def request(self, position_difference: Optional[int]=None):\n # TODO: validate the multiplier\n message = Message(self.name_path, position_difference)\n await self.issue_command(Command(message))", "def send_rates_request(self, wtp, lvap):\n\n rates_req = Container(version=PT_VE...
[ "0.5807723", "0.55108577", "0.5509182", "0.5509182", "0.5228989", "0.51324904", "0.50371724", "0.4978056", "0.49448347", "0.49367115", "0.48951223", "0.4852278", "0.4847397", "0.48421168", "0.4836499", "0.48327184", "0.47988936", "0.47799703", "0.4773954", "0.47554228", "0.47...
0.63926464
0
Notify all receivers of received LA/SmoothedPosition response.
async def notify_response_receivers(self, position: int) -> None: await asyncio.gather(*[ receiver.on_linear_actuator_smoothed_position(position) for receiver in self.response_receivers ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _notify_handlers(self):\n\n # Notify all handlers \n for handler_callback in self._registered_handlers:\n try:\n handler_callback(self._balloon_position)\n except Exception as e:\n # A receiver failed, catch and move on\n pass", "def inform_listeners(self):\n d = s...
[ "0.6062182", "0.59106153", "0.58623815", "0.5594468", "0.55179775", "0.55153215", "0.54873025", "0.5484033", "0.54707086", "0.54130167", "0.5287817", "0.5217821", "0.5215302", "0.52003986", "0.5177278", "0.51471597", "0.5112523", "0.508691", "0.5063324", "0.50475454", "0.4994...
0.7360916
0
Return Genomic Deletion Range Classifier instance.
def classifier_instance(self): return GenomicDeletionRangeClassifier()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classifier_instance(self):\n return CodingDNADeletionClassifier()", "def validator_instance(self):\n return CodingDNADeletion(*self.params)", "def genomic_deletion():\n params = {\n \"id\": \"normalize.variation:NC_000003.12%3Ag.10146527_10146528del\",\n \"type\": \"Variation...
[ "0.7024641", "0.6220088", "0.568311", "0.5404298", "0.5216875", "0.50686204", "0.49060804", "0.48364788", "0.47991565", "0.47258618", "0.47212866", "0.4713959", "0.46968925", "0.46862343", "0.46761173", "0.46747065", "0.46739888", "0.46273258", "0.45934516", "0.45488095", "0....
0.87302405
0
Return Genomic Deletion Range fixture name.
def fixture_name(self): return "genomic_deletion_range"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_name(self):\n return \"coding_dna_deletion\"", "def fixture_name(self):\n return \"coding_dna_insertion\"", "def fixture_name(self):\n return \"genomic_silent_mutation\"", "def fixture_name(self):\n return \"coding_dna_substitution\"", "def fixture_name(self):\n ...
[ "0.76704973", "0.68228257", "0.6700993", "0.6554753", "0.6247812", "0.5513192", "0.54988897", "0.5480645", "0.5433036", "0.5414399", "0.52840185", "0.5280451", "0.5257719", "0.5250501", "0.5206071", "0.5159251", "0.5125642", "0.50086826", "0.5006948", "0.49726692", "0.4937751...
0.91267174
0
Attempt to find host with an incomplete tag (no key). Expects 400 response.
def test_get_host_with_invalid_tag_no_key(mq_create_three_specific_hosts, api_get): url = build_hosts_url(query="?tags=namespace/=Value") response_status, response_data = api_get(url) assert response_status == 400
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_host_tag_part_too_long(tag_query, part_name, mq_create_three_specific_hosts, api_get):\n\n url = build_hosts_url(query=f\"?tags={tag_query}\")\n response_status, response_data = api_get(url)\n\n assert_error_response(\n response_data, expected_status=400, expected_detail=f\"{part_name}...
[ "0.5940153", "0.5782371", "0.56358194", "0.5556439", "0.55262023", "0.5500007", "0.54433006", "0.5438519", "0.54059374", "0.5344553", "0.5337218", "0.5327904", "0.52971035", "0.526064", "0.52405095", "0.5223708", "0.52061826", "0.519632", "0.5188607", "0.51555604", "0.5137124...
0.6690849
0
send a request to find hosts with a string tag where the length of the namespace excedes the 255 character limit
def test_get_host_tag_part_too_long(tag_query, part_name, mq_create_three_specific_hosts, api_get): url = build_hosts_url(query=f"?tags={tag_query}") response_status, response_data = api_get(url) assert_error_response( response_data, expected_status=400, expected_detail=f"{part_name} is longer tha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_host_with_invalid_tag_no_key(mq_create_three_specific_hosts, api_get):\n url = build_hosts_url(query=\"?tags=namespace/=Value\")\n response_status, response_data = api_get(url)\n\n assert response_status == 400", "def getRequestHostname():", "def test_add_hostname(self):\n hostname...
[ "0.5158016", "0.5090252", "0.5040747", "0.4784739", "0.47647437", "0.47189265", "0.46949816", "0.46308947", "0.46128097", "0.45641142", "0.45574144", "0.45475337", "0.45263064", "0.45263064", "0.4514373", "0.45076632", "0.44830647", "0.4478172", "0.4459085", "0.44373482", "0....
0.60618293
0
The number of full days since last checkin. We consider the current day to start from 5AM local time. Note that this can be more than 24 hours ago!
def days_since_last_checkin(self): # TODO use local timezone checkin_date = (self.last_checkin - datetime.timedelta(hours=5)).date() today = datetime.date.today() return (today - checkin_date).days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_days(self):\r\n return 1", "def get_fine_due(self):\n fine = 0\n ndays = (dt.datetime.now() - self._checkout_date).days\n ndays_over = ndays - self.loantime\n if ndays_over > 0:\n fine += (ndays_over * self.finerate)\n return fine", "def day(s...
[ "0.6554062", "0.63184106", "0.62983453", "0.62983453", "0.62096196", "0.6207035", "0.61662465", "0.6056306", "0.6037407", "0.60328513", "0.60032517", "0.5990085", "0.59769547", "0.593517", "0.5919269", "0.5907213", "0.5886326", "0.58565485", "0.5838369", "0.583007", "0.581803...
0.76280934
0
Sets the owner of this link.
def set_owner(self, owner: Optional["STACObject_Type"]) -> "Link": self.owner = owner return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_owner(self, owner):\n self.__owner = owner", "def set_owner(self, owner):\n self.settings[\"owner\"] = owner", "def owner(self, owner: str):\n\n self._owner = owner", "def owner(self, owner):\n self._owner = owner", "def owner(self, owner):\n self._owner = owner",...
[ "0.8302126", "0.8135389", "0.8064421", "0.79439116", "0.79439116", "0.79439116", "0.79439116", "0.7895545", "0.7895545", "0.7895545", "0.7895545", "0.7442883", "0.7366591", "0.7358244", "0.72455347", "0.6930826", "0.6841902", "0.6657067", "0.6593225", "0.6468359", "0.640672",...
0.85328895
0
Optional title for this link. If not provided during instantiation, this will attempt to get the title from the STAC object that the link references.
def title(self) -> Optional[str]: if self._title is not None: return self._title if self._target_object is not None and isinstance( self._target_object, pystac.Catalog ): return self._target_object.title return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title(self) -> Optional[str]:\n return self.title", "def title(self) -> Optional[str]:\n return self.get(\"/Title\")", "def Title(self, default={}):\n return HEP.TitleObject(self.data.get('title', default))", "def short_title(self):\n if hasattr(self, \"title\"):\n ...
[ "0.69105786", "0.6895118", "0.6473908", "0.64691746", "0.64505994", "0.6439746", "0.6439746", "0.6439746", "0.6439746", "0.6439746", "0.6379838", "0.6379838", "0.6379838", "0.6379838", "0.63518524", "0.63235426", "0.63089734", "0.63060486", "0.62965906", "0.62965906", "0.6282...
0.7591315
0
Returns the HREF for this link. If the href is None, this will throw an exception. Use get_href if there may not be an href.
def href(self) -> str: result = self.get_href() if result is None: raise ValueError(f"{self} does not have an HREF set.") return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_href(self, transform_href: bool = True) -> Optional[str]:\n # get the self href\n if self._target_object:\n href = self._target_object.get_self_href()\n else:\n href = self._target_href\n\n if (\n transform_href\n and href\n ...
[ "0.68136275", "0.68054163", "0.68054163", "0.67377317", "0.66265225", "0.63145745", "0.6179258", "0.61082935", "0.60186666", "0.596101", "0.592977", "0.5924774", "0.58844876", "0.58479047", "0.580537", "0.57960415", "0.5775185", "0.5771198", "0.5771198", "0.5771198", "0.57571...
0.76138645
0
Returns the absolute HREF for this link. If the href is None, this will throw an exception. Use get_absolute_href if there may not be an href set.
def absolute_href(self) -> str: result = self.get_absolute_href() if result is None: raise ValueError(f"{self} does not have an HREF set.") return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_href(self) -> Optional[str]:\n if self._target_object:\n href = self._target_object.get_self_href()\n else:\n href = self._target_href\n\n if href is not None and self.owner is not None:\n href = make_absolute_href(href, self.owner.get_self_hre...
[ "0.775969", "0.74204093", "0.72394633", "0.6734149", "0.6734149", "0.6159152", "0.59924763", "0.58902055", "0.587239", "0.5865415", "0.5855938", "0.5798646", "0.576012", "0.5723536", "0.55905426", "0.55897635", "0.5544071", "0.55341566", "0.54994625", "0.54854596", "0.5466684...
0.82808983
0
Gets the absolute href for this link, if possible.
def get_absolute_href(self) -> Optional[str]: if self._target_object: href = self._target_object.get_self_href() else: href = self._target_href if href is not None and self.owner is not None: href = make_absolute_href(href, self.owner.get_self_href()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute_href(self) -> str:\n result = self.get_absolute_href()\n if result is None:\n raise ValueError(f\"{self} does not have an HREF set.\")\n return result", "def href(self) -> str:\n result = self.get_href()\n if result is None:\n raise ValueError...
[ "0.8552441", "0.77883655", "0.7635637", "0.7635637", "0.7434001", "0.73831236", "0.72302043", "0.6954633", "0.68366444", "0.6803096", "0.67107046", "0.6695295", "0.66920805", "0.66411704", "0.66239035", "0.66154504", "0.6570545", "0.6557817", "0.6527888", "0.65234864", "0.650...
0.79687524
1
The target of the link. If the link is unresolved, or the link is to something that is not a STACObject, the target is an HREF. If resolved, the target is a STACObject.
def target(self) -> Union[str, "STACObject_Type"]: if self._target_object: return self._target_object elif self._target_href: return self._target_href else: raise ValueError("No target defined for link.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_str(self) -> Optional[str]:\n if self._target_href:\n return self._target_href\n elif self._target_object:\n return self._target_object.get_self_href()\n else:\n return None", "def has_target_href(self) -> bool:\n return self._target_hre...
[ "0.67976296", "0.62307954", "0.6215397", "0.61617273", "0.5862698", "0.565353", "0.5597784", "0.55615544", "0.5497127", "0.54542977", "0.5454122", "0.54058546", "0.53850055", "0.5383484", "0.5362352", "0.5348752", "0.53102714", "0.53102714", "0.5302297", "0.5296698", "0.52889...
0.795444
0
Sets this link's target to a string or a STAC object.
def target(self, target: Union[str, "STACObject_Type"]) -> None: if isinstance(target, str): self._target_href = target self._target_object = None else: self._target_href = None self._target_object = target
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\t\t\traise e", "def target(self, target) :\n\t\ttry :\n\t\t\tself._target = target\n\t\texcept Exception as e:\n\t\t\traise e", "def target(self) -> Union[str, \"STACObject_Type\"]:\n if self._target_object:...
[ "0.71120214", "0.71120214", "0.71052563", "0.69285864", "0.677933", "0.6764078", "0.6680332", "0.6353015", "0.6353015", "0.6341229", "0.6152728", "0.60386664", "0.6020701", "0.60081893", "0.5942475", "0.59326124", "0.58607703", "0.5849536", "0.58451325", "0.5837806", "0.58233...
0.81399906
0
Returns this link's target as a string. If a string href was provided, returns that. If not, tries to resolve the self link of the target object.
def get_target_str(self) -> Optional[str]: if self._target_href: return self._target_href elif self._target_object: return self._target_object.get_self_href() else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self) -> Union[str, \"STACObject_Type\"]:\n if self._target_object:\n return self._target_object\n elif self._target_href:\n return self._target_href\n else:\n raise ValueError(\"No target defined for link.\")", "def href(self) -> str:\n res...
[ "0.6613602", "0.6349546", "0.6326438", "0.6221752", "0.6183839", "0.58277327", "0.5809976", "0.5801703", "0.5685269", "0.5653803", "0.561428", "0.561428", "0.546091", "0.5437358", "0.5431587", "0.540748", "0.540748", "0.540748", "0.540748", "0.540748", "0.540748", "0.540748...
0.8104228
0
Returns true if this link has a string href in its target information.
def has_target_href(self) -> bool: return self._target_href is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_href_valid(self, link):\n url = str(link['href'])\n # if it doesn't lead to a wiki page\n if not url.startswith(\"/wiki/\"):\n return False\n\n wikipedia_classes = [\"external_text\", \"mw-disambig\", \"infobox-data\"]\n # if the href has a class\n if lin...
[ "0.67790794", "0.6705688", "0.6634559", "0.65864813", "0.6529386", "0.64960945", "0.648174", "0.648174", "0.648174", "0.64595854", "0.64516133", "0.6385341", "0.6367129", "0.6193168", "0.6110131", "0.6107418", "0.60843617", "0.60497266", "0.60383934", "0.59954834", "0.5982210...
0.79885954
0
Resolves a STAC object from the HREF of this link, if the link is not already resolved.
def resolve_stac_object(self, root: Optional["Catalog_Type"] = None) -> "Link": if self._target_object: pass elif self._target_href: target_href = self._target_href # If it's a relative link, base it off the parent. if not is_absolute_href(target_href): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(s):\n # if the target graph isn't immediately available, we want to load it.\n if not s.try_to_point():\n g = s.store.graph_from_url( s.url )\n s.store.resolve_single_ref(s)", "def _resolve(self, csub, c, direction):\n\t# By default, no way to resolve\n\treturn None", ...
[ "0.559725", "0.5572399", "0.55626106", "0.55213284", "0.5492655", "0.54890937", "0.5466336", "0.5449987", "0.5390744", "0.5251315", "0.5218634", "0.5183477", "0.5123284", "0.5101816", "0.50858814", "0.5025732", "0.5021247", "0.50134563", "0.49961463", "0.49439776", "0.4925577...
0.6704159
0
Determines if the link's target is a resolved STACObject.
def is_resolved(self) -> bool: return self._target_object is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target(self) -> Union[str, \"STACObject_Type\"]:\n if self._target_object:\n return self._target_object\n elif self._target_href:\n return self._target_href\n else:\n raise ValueError(\"No target defined for link.\")", "def has_target_href(self) -> bool:\...
[ "0.62964565", "0.6135031", "0.6005933", "0.5843953", "0.58416283", "0.5790394", "0.577382", "0.5659708", "0.56222975", "0.55950385", "0.5592904", "0.5583178", "0.5562626", "0.554284", "0.5501144", "0.54868263", "0.5481935", "0.5480033", "0.5472723", "0.54365206", "0.54336035"...
0.66906935
0
Clones this link. This makes a copy of all link information, but does not clone a STACObject if one is the target of this link.
def clone(self) -> "Link": cls = self.__class__ return cls( rel=self.rel, target=self.target, media_type=self.media_type, title=self.title, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return self.__class__(\n self.kind, self.link_ids.copy(), self.included_nodes.copy(), self.mass,\n self.name, self.crossring_cleavages.copy(), self.composition.copy())", "def clone(self):\n raise NotImplementedError", "def clone(self):", "def __copy__(sel...
[ "0.6272683", "0.6001762", "0.5967772", "0.5881224", "0.58453804", "0.58337474", "0.5790788", "0.5785189", "0.5755317", "0.5731128", "0.57152885", "0.56804925", "0.56655896", "0.56652945", "0.56652945", "0.56652945", "0.56652945", "0.5663458", "0.5652629", "0.5647763", "0.5637...
0.61682236
1
Deserializes a Link from a dict.
def from_dict(cls, d: Dict[str, Any]) -> "Link": d = copy(d) rel = d.pop("rel") href = d.pop("href") media_type = d.pop("type", None) title = d.pop("title", None) extra_fields = None if any(d): extra_fields = d return cls( rel=rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, dikt: dict) -> 'Links':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt) -> 'ExtraLink':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, _dict: Dict) -> 'NextHref':\n args = {}\n if 'href' in _dict:\n args['href'] ...
[ "0.75336295", "0.7124407", "0.62645185", "0.6063125", "0.6002239", "0.5913116", "0.5884565", "0.5822485", "0.5573647", "0.556385", "0.55602205", "0.54055965", "0.5388422", "0.53881705", "0.5371569", "0.5370352", "0.53601426", "0.53588325", "0.5337932", "0.53161967", "0.530483...
0.71413106
1
Creates a link to a root Catalog or Collection.
def root(cls, c: "Catalog_Type") -> "Link": return cls(pystac.RelType.ROOT, c, media_type=pystac.MediaType.JSON)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initCatalog():\n t = \"SINGLE_LINKED\"\n catalog = model.newCatalog(t)\n return catalog", "def _get_root_record(self) -> Link:\n rel = \"root\"\n href = self.api_endpoint\n return Link(href=href, rel=rel)", "def created(event):\n root = event.object\n registry = event.re...
[ "0.638612", "0.58883375", "0.58257294", "0.5813237", "0.58120126", "0.5705625", "0.5569404", "0.5393234", "0.5327661", "0.5320878", "0.52987134", "0.52738225", "0.52723676", "0.52303886", "0.52119464", "0.52098554", "0.515138", "0.51208967", "0.51130015", "0.5111391", "0.5110...
0.69907457
0
Creates a link to a parent Catalog or Collection.
def parent(cls, c: "Catalog_Type") -> "Link": return cls(pystac.RelType.PARENT, c, media_type=pystac.MediaType.JSON)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_parent_record(self) -> Link:\n rel = \"parent\"\n href = self.api_endpoint\n return Link(href=href, rel=rel)", "def _get_absolute_url(self, parent_slug=None):\n return reverse(\n \"catalogue:category\",\n kwargs={\n \"category_slug\": self...
[ "0.67542535", "0.6109863", "0.6103144", "0.6049322", "0.6006557", "0.5838816", "0.5682152", "0.5543328", "0.5493133", "0.5490017", "0.5449701", "0.54340756", "0.54340756", "0.54340756", "0.54340756", "0.5416398", "0.541076", "0.5406102", "0.5401539", "0.5392546", "0.53919244"...
0.7330132
0
Creates a link to an item's Collection.
def collection(cls, c: "Collection_Type") -> "Link": return cls(pystac.RelType.COLLECTION, c, media_type=pystac.MediaType.JSON)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_collection_link(db_id, collection_id):\n\n # Return a link to the relevant CosmosDB Container/Document Collection\n return \"dbs/\" + db_id + \"/colls/\" + collection_id", "def _link_items(self):\n pass", "def canonical(\n cls,\n item_or_collection: Union[\"Item_Type\", \"Col...
[ "0.66433454", "0.64570546", "0.6361431", "0.61382896", "0.609448", "0.5907729", "0.587232", "0.5871424", "0.5854887", "0.57617444", "0.5746278", "0.5737202", "0.56804323", "0.5651097", "0.5628368", "0.5599761", "0.5560198", "0.55528027", "0.5549098", "0.5530474", "0.5461734",...
0.6910698
0
Creates a link to a child Catalog or Collection.
def child(cls, c: "Catalog_Type", title: Optional[str] = None) -> "Link": return cls( pystac.RelType.CHILD, c, title=title, media_type=pystac.MediaType.JSON )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent(cls, c: \"Catalog_Type\") -> \"Link\":\n return cls(pystac.RelType.PARENT, c, media_type=pystac.MediaType.JSON)", "def addlink(self, parent=None, child=None):\n parent = self.getnodenamed(parent) # verify pointer.\n child = self.getnodenamed(child) # verify pointer.\n\n #...
[ "0.62376", "0.5781384", "0.57675976", "0.57353675", "0.5678566", "0.55408216", "0.5517142", "0.54925543", "0.5476133", "0.54684025", "0.54334456", "0.5425332", "0.5413889", "0.53119826", "0.5287868", "0.52431107", "0.52239215", "0.5204206", "0.5199658", "0.5180586", "0.517726...
0.6712364
0
Creates a link to an Item.
def item(cls, item: "Item_Type", title: Optional[str] = None) -> "Link": return cls( pystac.RelType.ITEM, item, title=title, media_type=pystac.MediaType.JSON )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createItem(self, item):\r\n try:\r\n self.feed_handler.createItem(item.link, item.title, item.descr,\r\n item.source, item.channelURL)\r\n self.feed_passed = self.feed_passed + 1\r\n ...
[ "0.71673506", "0.68592036", "0.66910374", "0.6681152", "0.6672842", "0.66544336", "0.648805", "0.64858866", "0.64009356", "0.6378397", "0.6374486", "0.63420165", "0.6303804", "0.62359434", "0.6182014", "0.6174261", "0.6141716", "0.6140531", "0.6136516", "0.6130008", "0.612968...
0.72301376
0
Creates a canonical link to an Item or Collection.
def canonical( cls, item_or_collection: Union["Item_Type", "Collection_Type"], title: Optional[str] = None, ) -> "Link": return cls( pystac.RelType.CANONICAL, item_or_collection, title=title, media_type=pystac.MediaType.JSON, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _link_items(self):\n pass", "def _get_href_link(self, request, identifier, collection_name):\n prefix = self._update_masakari_link_prefix(request.application_url)\n return url_join(prefix,\n self._get_project_id(request),\n collection_name,\n...
[ "0.5986782", "0.58662117", "0.58599937", "0.58512133", "0.5758114", "0.5712557", "0.5686602", "0.5646597", "0.55707866", "0.5521616", "0.5483528", "0.5483245", "0.5466893", "0.5444288", "0.54267216", "0.5385771", "0.53692365", "0.53664565", "0.53472406", "0.532653", "0.522275...
0.81255555
0
fetch the crime data
def test_fetch_crime(self): assert isinstance(_tabular.fetch_crime_data(), pd.DataFrame)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_data(self):", "def _fetch_data(self):\n pass", "def _fetch_ucr_data_single(year, which):\n try:\n yy = str(year)[2:]\n yy_pre = str(year - 1)[2:]\n\n if which == 'index':\n filename = f'CrimeData_{yy}_{yy_pre}.xlsx'\n elif which == 'domestic':\n ...
[ "0.6204969", "0.59845346", "0.58863574", "0.5830197", "0.58131176", "0.5786138", "0.570744", "0.5705819", "0.5674465", "0.5605659", "0.55591035", "0.55420095", "0.5533729", "0.54788285", "0.54764843", "0.546429", "0.5451421", "0.544013", "0.544013", "0.5437254", "0.5436855", ...
0.61369556
1
Unsubscribes a PubgemUser from an RSSFeed.
def unsubscribe(self, *rss_feeds): [self.subscriptions.remove(feed) for feed in rss_feeds if feed in self.subscriptions] self.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe(self, feed, **args):\n args.update(feed=feed)\n return self.fetch(\"/unsubscribe\", post_args=args)", "def unsubscribe(id, userId):\n db = core.connect()\n theUser = db[userId]\n if id in theUser[\"streams\"]:\n theUser[\"streams\"].remove(id)\n db[userId] = t...
[ "0.73993146", "0.6520943", "0.64468044", "0.634923", "0.6127742", "0.6127742", "0.6127742", "0.6127742", "0.6127742", "0.61200035", "0.6014998", "0.59376156", "0.59051955", "0.58890295", "0.5878844", "0.58269995", "0.58126444", "0.579354", "0.5736344", "0.5714773", "0.5711835...
0.69304186
1
Save environment identifier to local file for defaulting.
def save_default_environment( environment=None, cwd=None ): env_file = get_local_default_file(cwd=cwd) with open(env_file, 'w') as f_out: f_out.write(f'{str(environment)}\n') return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_environment(path: Optional[str] = None):\n environment = EnvironmentProvider().environment\n serialize_environment_to_file(environment=environment,\n path=path)", "def save_to_env_file(self, envs, env_file_location):\n\n if not self.pre_initiated and envs:\n...
[ "0.6939367", "0.6756803", "0.6492533", "0.6465991", "0.6240178", "0.6202867", "0.612628", "0.6109327", "0.60026574", "0.5978912", "0.5927", "0.59054667", "0.59054285", "0.5880969", "0.5760519", "0.5732237", "0.57036567", "0.56264794", "0.562367", "0.55891657", "0.5572052", ...
0.70126224
0
Remove saved default environment file.
def clear_saved_default_environment(cwd=None): env_file = get_local_default_file(cwd=cwd) if os.path.exists(env_file): os.remove(env_file) return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_out_old_env():\n d = \"dict_racey.json\"\n if os.path.exists(d):\n print(\"Remove the old cached JSON before continuing.\")\n os.remove(d)", "def reset_default_paths():\n filename = os.path.join(os.path.expanduser('~'), '.gfail_defaults')\n if os.path.exists(filename):\n ...
[ "0.7001228", "0.6956922", "0.6956922", "0.6749785", "0.66680175", "0.6539512", "0.64257216", "0.64223576", "0.63839066", "0.6359835", "0.63121593", "0.626912", "0.6264178", "0.6244929", "0.62184757", "0.62184757", "0.62158924", "0.6210639", "0.617264", "0.61695546", "0.616095...
0.81255233
0
Validate secrets base directory by presence of a marker file. Returns False if the directory either does not exist or does not contain the expected marker file, or True otherwise.
def is_secrets_basedir(basedir=None, raise_exception=True): result = False if basedir is None: if raise_exception: raise RuntimeError("[-] no basedir was specified") basedir_path = Path(basedir) marker_path = Path(basedir) / MARKER if not basedir_path.exists(): if raise_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sanity(params):\n \n for dpath in ['input_dir','output_dir']:\n if path.isdir(params[dpath]) == False:\n print('ERROR: Cannot find directory '+params[dpath])\n exit()\n \n if path.isfile(params['star_file']) == False:\n print('ERROR: Cannot find star file '...
[ "0.5820036", "0.58147424", "0.5705744", "0.5678354", "0.5674497", "0.5647545", "0.5631452", "0.56306946", "0.5505698", "0.55015725", "0.5488795", "0.5472963", "0.54715496", "0.54707843", "0.5459883", "0.54526377", "0.54288095", "0.54050606", "0.540398", "0.534037", "0.5337100...
0.7215526
0
Return the default secrets base directory path.
def get_default_secrets_basedir(): default_basedir = Path.home() / BASEDIR_BASENAME return Path( os.getenv('D2_SECRETS_BASEDIR', default_basedir) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_local_default_file(cwd=None):\n # TODO(dittrich): May need to do this differently to support\n # Windows file systems.\n if cwd is None:\n cwd = os.getcwd()\n return Path(cwd) / '.python_secrets_environment'", "def default_path():\n return os.path.join(os.environ.get('OVERRIDE_ETC',...
[ "0.74521095", "0.7392667", "0.67659163", "0.6656529", "0.66075575", "0.6602614", "0.6575067", "0.6522957", "0.6508674", "0.64659834", "0.6442842", "0.6433506", "0.6431116", "0.6431051", "0.6407672", "0.64000154", "0.63792914", "0.6345531", "0.63445127", "0.62789977", "0.62490...
0.88887465
0
Create secrets root directory
def secrets_basedir_create( basedir=None, mode=DEFAULT_MODE, ): if basedir is None: raise RuntimeError("[-] a base directory is required") secrets_basedir = Path(basedir) secrets_basedir.mkdir( parents=True, mode=mode, exist_ok=True ) marker = secrets_basedir ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_secrets_basedir(\n secrets_basedir=None,\n allow_create=False,\n allow_prompt=False,\n verbose_level=1,\n):\n if secrets_basedir is None:\n secrets_basedir = get_default_secrets_basedir()\n homedir = str(Path.home())\n if allow_create is None:\n allow_create = str(secr...
[ "0.66333914", "0.64847565", "0.64647585", "0.6165368", "0.61403096", "0.6137444", "0.5966019", "0.58695114", "0.5848818", "0.58375996", "0.5834272", "0.5827661", "0.5826345", "0.5748656", "0.5725303", "0.57216537", "0.5718884", "0.5700134", "0.5697976", "0.5673246", "0.565792...
0.7260202
0
Ensure that the secrets basedir exists. If the path is within the user's home directory, it is OK to create the directory automatically if it does not exist. This was the original behavior. If the path does exist and contains file, but does not have the special marker, that will be considered an error the user needs to...
def ensure_secrets_basedir( secrets_basedir=None, allow_create=False, allow_prompt=False, verbose_level=1, ): if secrets_basedir is None: secrets_basedir = get_default_secrets_basedir() homedir = str(Path.home()) if allow_create is None: allow_create = str(secrets_basedir).st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_environment_path_subdir_leadingslash(self):\n self.assertRaises(\n RuntimeError,\n self.secrets_env.environment_path,\n subdir=\"/keys\"\n )", "def is_secrets_basedir(basedir=None, raise_exception=True):\n result = False\n if basedir is None:\n ...
[ "0.651136", "0.6511327", "0.64604455", "0.6436057", "0.6282728", "0.6207623", "0.61954594", "0.6180025", "0.616266", "0.61557084", "0.6141379", "0.61250085", "0.6013276", "0.601109", "0.59528375", "0.59509784", "0.59147865", "0.590804", "0.58827823", "0.5879972", "0.5847711",...
0.76771754
0
Return the default environment identifier. There are multiple ways for a user to specify the environment to use for python_secrets commands. Some of these involve explicit settings (e.g., via command line option, a saved value in the current working directory, or an environment variable) or implicitly from the name of ...
def get_default_environment(cwd=None): # NOTE(dittrich): I know this code has multiple return points # but it is simpler and easier to understand this way. # # Highest priority is inhereted environment variable. environment = os.getenv('D2_ENVIRONMENT', None) if environment is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_name(self):\n if self.options.environment:\n return self.options.environment\n elif os.environ.get(\"JUJU_ENV\"):\n return os.environ['JUJU_ENV']\n\n env_ptr = os.path.join(self.juju_home, \"current-environment\")\n if os.path.exists(env_ptr):\n ...
[ "0.71756715", "0.7117789", "0.68693656", "0.6850072", "0.68206316", "0.67635626", "0.6761713", "0.6749947", "0.6571323", "0.65223706", "0.64882225", "0.64521635", "0.64339304", "0.6418718", "0.64067113", "0.640124", "0.63758415", "0.63409525", "0.6335122", "0.6334783", "0.633...
0.74237955
0
Just copy the descriptions portion of an environment directory from src to dst.
def copydescriptions(src: Path, dst: Path): if not dst.suffix == '.d': raise InvalidDescriptionsError( msg=f"[-] destination '{dst}' is not a descriptions ('.d') directory" # noqa ) # Ensure destination directory exists. dst.mkdir(exist_ok=True) if src.suffix == '.d' and no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self, src, dest):\n\n src = os.path.join(os.path.dirname(__file__), \"collections\", \"kitchensink\", src)\n dest = os.path.join(self.checkout, dest)\n if os.path.isdir(src):\n shutil.copytree(src, dest)\n else:\n shutil.copy(src, dest)\n return des...
[ "0.598834", "0.59464955", "0.587178", "0.57934016", "0.57934016", "0.5778099", "0.5773663", "0.5771135", "0.57689947", "0.5698882", "0.5686469", "0.5679195", "0.56741464", "0.5659078", "0.5631439", "0.56296587", "0.55986625", "0.5580042", "0.5578742", "0.5528275", "0.5516777"...
0.70404476
0
Output an ASCII BEL character to ``stderr``.
def bell(): if sys.stderr.isatty(): sys.stderr.write('\a') sys.stderr.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_err(self, text): # pragma: no cover\n # type: (str) -> None\n stderr = self.stderr\n if self.stderr.closed:\n stderr = sys.stderr\n stderr.write(decode_output(u\"\\r\", target_stream=stderr))\n stderr.write(decode_output(CLEAR_LINE, target_stream=stderr))\n ...
[ "0.666913", "0.6625823", "0.6519658", "0.6480107", "0.6476801", "0.64253056", "0.63144094", "0.62877625", "0.62532157", "0.6244532", "0.62090224", "0.619707", "0.6193064", "0.6173199", "0.6130274", "0.6129684", "0.61290085", "0.6114449", "0.610679", "0.6103659", "0.60770804",...
0.7196933
0
Identifies the filesystem mount point for the partition containing ``mypath``.
def getmount(mypath): # noqa path_ = os.path.realpath(os.path.abspath(mypath)) while path_ != os.path.sep: if os.path.ismount(path_): return path_ path_ = os.path.abspath(os.path.join(path_, os.pardir)) return path_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mount_point(path):\n\n path = os.path.abspath(path)\n while path != os.path.sep:\n if os.path.ismount(path):\n return path\n path = os.path.abspath(os.path.join(path, os.pardir))\n return path", "def find_mount_point(path):\n path = os.path.abspath(path)\n while not os.pat...
[ "0.70490265", "0.68355423", "0.67501163", "0.6665986", "0.6661757", "0.63751256", "0.6372751", "0.63337064", "0.63337064", "0.6311608", "0.62759066", "0.6214388", "0.62104434", "0.6207753", "0.6144679", "0.6122681", "0.6104213", "0.6098488", "0.60473555", "0.6020198", "0.6014...
0.75168204
0
Identifies the file system type for a specific mount path.
def getmount_fstype(mypath): mountpoint = getmount(mypath) return get_fs_type(mountpoint)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fs_type(mypath):\n\n root_type = ''\n for part in psutil.disk_partitions():\n if part.mountpoint == os.path.sep:\n root_type = part.fstype\n continue\n if str(mypath).startswith(part.mountpoint):\n return part.fstype\n return root_type", "def get_ty...
[ "0.7314071", "0.7037461", "0.69199586", "0.6844241", "0.6774126", "0.653924", "0.64900947", "0.64872056", "0.6365881", "0.6356303", "0.6356303", "0.6356303", "0.6356303", "0.6336653", "0.6304011", "0.6279205", "0.6275102", "0.6231511", "0.6194144", "0.6176265", "0.6131921", ...
0.7720042
0
Identifies the file system type for a specific mount path.
def get_fs_type(mypath): root_type = '' for part in psutil.disk_partitions(): if part.mountpoint == os.path.sep: root_type = part.fstype continue if str(mypath).startswith(part.mountpoint): return part.fstype return root_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getmount_fstype(mypath):\n\n mountpoint = getmount(mypath)\n return get_fs_type(mountpoint)", "def get_type(self):\n return self.get_udev_property('ID_FS_TYPE')", "def get_fs_type(self):\n\t\treturn call_sdk_function('PrlFsInfo_GetFsType', self.handle)", "def getFsType(partitionDevice):\n i...
[ "0.77212733", "0.7039252", "0.6920957", "0.68442893", "0.67736435", "0.6541093", "0.64906096", "0.6488126", "0.6367459", "0.63570124", "0.63570124", "0.63570124", "0.63570124", "0.63378847", "0.6305549", "0.6281033", "0.6275993", "0.62332624", "0.6194302", "0.61794585", "0.61...
0.73147815
1
Gets a list of absolute paths to one or more files associated with a path. If ``path`` is a directory, the files contained in it are returned, otherwise the path to the file is the only item in the list.
def get_files_from_path(path=None): abspath = os.path.abspath(path) if os.path.isfile(abspath): files = [abspath] elif os.path.isdir(abspath): files = [ os.path.join(abspath, fname) for fname in os.listdir(abspath) ] else: raise RuntimeError(f"[-]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(path):\r\n\tfiles = []\r\n\tfor dirpath, _, filenames in os.walk(path):\r\n\t\tfor filename in [f for f in filenames]:\r\n\t\t\tfiles.append(os.path.join(dirpath, filename))\r\n\treturn files", "def get_file_list(path: str) -> list:\n\treturn [f for f in listdir(path) if isfile(join(path, f))]", ...
[ "0.7801161", "0.77511036", "0.7665156", "0.76141655", "0.73560804", "0.7337085", "0.73270375", "0.7286432", "0.7249565", "0.7235798", "0.7231294", "0.72299063", "0.7225615", "0.7196257", "0.71882355", "0.71856004", "0.7184917", "0.7183777", "0.71656454", "0.7161768", "0.71570...
0.8625542
0
Return sorted list of valid environment paths found in `basedir`.
def get_environment_paths(basedir=None): basedir = ( get_default_secrets_basedir() if basedir is None else Path(basedir) ) results = list() for item in sorted(basedir.iterdir()): if is_valid_environment(item): results.append(item) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dir_list(load):\n if \"env\" in load:\n # \"env\" is not supported; Use \"saltenv\".\n load.pop(\"env\")\n\n ret = []\n\n if \"saltenv\" not in load:\n return ret\n\n saltenv = load[\"saltenv\"]\n metadata = _init()\n\n if not metadata or saltenv not in metadata:\n ...
[ "0.69561356", "0.62635636", "0.6199789", "0.6019164", "0.5972499", "0.5962681", "0.5954401", "0.5949282", "0.59453523", "0.5911142", "0.5864499", "0.58633655", "0.58458513", "0.581863", "0.5789844", "0.5776963", "0.5722316", "0.5696323", "0.5690342", "0.56546295", "0.5612966"...
0.843912
0
Derives the CIDR netblocks for an IP via WHOIS lookup.
def get_netblock(ip=None): ip = str(ip).split('/')[0] if '/' in str(ip) else ip obj = IPWhois(ip) results = obj.lookup_whois() return results['asn_cidr']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_get_blocks():\n # start Requests session\n sc = requests.Session()\n\n # import cookies from Firefox\n sc.cookies.update(get_cookies('imhsc.imhadmin.net'))\n\n # send request\n vpx = sc.post('https://imhsc.imhadmin.net/index.php?v=IPManager')\n\n # check if login failed\n check_sc_lo...
[ "0.64359736", "0.63276446", "0.6294762", "0.5917774", "0.5865237", "0.5860904", "0.57907003", "0.5784271", "0.5784271", "0.5753149", "0.5687009", "0.56206995", "0.5578238", "0.55621284", "0.55338603", "0.55087936", "0.5494223", "0.5483299", "0.54381686", "0.543068", "0.542034...
0.76826394
0
Make all files in path ``dst`` have ``orwx`` permissions.
def remove_other_perms(dst): # File permissions on Cygwin/Windows filesystems don't work the # same way as Linux. Don't try to change them. # TODO(dittrich): Is there a Better way to handle perms on Windows? fs_type = get_fs_type(dst) if fs_type in ['NTFS', 'FAT', 'FAT32']: msg = ( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_permissions(dist):\n for root, _, files in os.walk(dist.location):\n for f in [os.path.join(root, i) for i in files]:\n if f.endswith('.py') or f.endswith('.dll') or \\\n f.endswith('.so') and not 'EGG-INFO' in f:\n mode = ((os.stat(f)[stat.ST_MODE]) | 0555...
[ "0.6326105", "0.6326105", "0.6084609", "0.60730886", "0.6067008", "0.6056444", "0.6051135", "0.5906981", "0.58243513", "0.5817262", "0.5775717", "0.5611725", "0.54822046", "0.5456822", "0.5450532", "0.54407656", "0.5432667", "0.5426817", "0.5371543", "0.53671795", "0.5362671"...
0.73388106
0
Produces the tree structure for groups and secrets in an environment. If output is specified (e.g., as sys.stdout) it will be used, otherwise a list of strings is returned.
def secrets_tree( env=None, outfile=None ): nodes = dict() env_name = str(env) nodes[env_name] = Node(env_name) root_node = nodes[env_name] for group in sorted(env.get_groups()): group_name = os.path.join(env_name, group) nodes[group_name] = Node(group, parent=root_node) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_envgroup_output(envgroup_id: Optional[pulumi.Input[str]] = None,\n organization_id: Optional[pulumi.Input[str]] = None,\n opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetEnvgroupResult]:\n ...", "def output_groups(self) -> List[str]:\n ...
[ "0.55058384", "0.5480403", "0.53334093", "0.53122777", "0.5256857", "0.508922", "0.5059336", "0.5053877", "0.50406545", "0.5032602", "0.49581128", "0.4936249", "0.4936249", "0.49264872", "0.48918167", "0.48805633", "0.48752487", "0.48623678", "0.4862295", "0.4845437", "0.4826...
0.7626051
0
Prettyprint environment variable (if set).
def show_current_value(variable=None): value = os.getenv(variable, None) return f" ('{value}')" if value is not None else ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_formatted_env_vars() -> str:\n res = \"\"\n for k, v in os.environ.items():\n res += '{0}={1}\\n'.format(k, v)\n return res", "def set_pretty_print(value):\n global _with_colors\n _with_colors = True if value else False", "def print_set_env_command(name, value):\n shell_type = ...
[ "0.6456226", "0.6314747", "0.6197535", "0.61365336", "0.6113619", "0.610046", "0.59816974", "0.5979248", "0.5904684", "0.57186013", "0.5705967", "0.56352997", "0.5547639", "0.5538115", "0.54955536", "0.54795843", "0.54790395", "0.5462383", "0.544286", "0.54425323", "0.5411556...
0.63266575
1