query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Overrides the superclass is_executable.
def is_executable(self, path): if (CGIHTTPServer.CGIHTTPRequestHandler.is_executable(self, path)): return True if self.is_python(path): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_executable(self):\n raise NotImplementedError()", "def supports_sys_executable(self):\n return bool(getattr(sys, \"executable\", None))", "def is_executable(exe):\n return os.path.isfile(exe) and os.access(exe, os.X_OK)", "def is_executable(path):\n return (os.path.exists(path)...
[ "0.8627345", "0.752851", "0.7447119", "0.73333514", "0.72728646", "0.7150464", "0.7150464", "0.7135183", "0.7128636", "0.7040618", "0.69863826", "0.6962569", "0.6943312", "0.6934778", "0.6912176", "0.6887747", "0.6695774", "0.66032755", "0.64987844", "0.64442396", "0.64369684...
0.7610795
1
Return True if the superclass thinks its true, or if the path ends with .cgi
def is_python(self, path): if (CGIHTTPServer.CGIHTTPRequestHandler.is_python(self, path)): return True if path.endswith(".cgi"): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_is_base(self, path):\n\n return path is not None and len(path) == len(self.levels)", "def _has_extension(self, path):\r\n if re.match(r'.*\\\\.*\\..*$', path):\r\n return True", "def is_executable(self, path):\n if (CGIHTTPServer.CGIHTTPRequestHandler.is_executable(self, path)):\...
[ "0.59074575", "0.5889889", "0.5860048", "0.58529234", "0.5796067", "0.57866293", "0.57298136", "0.5704744", "0.56834686", "0.5630984", "0.55862296", "0.5585162", "0.5582354", "0.5515081", "0.5491662", "0.5480578", "0.5480194", "0.5464567", "0.54597604", "0.5437157", "0.543539...
0.750505
0
test helper function for fetching local configs
def test_local_filepath_helper(): expected_local_filepath = TEST_LOCAL_CONFIG_PATH.replace('.cfg', '_local.cfg') assert wf_utils.get_local_config_filepath(TEST_LOCAL_CONFIG_PATH) == TEST_LOCAL_CONFIG_PATH assert wf_utils.get_local_config_filepath(TEST_LOCAL_CONFIG_PATH, True) == expected_local_filepath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testGetConfig():\n configs = GetConfig()\n # print(configs.host_ip)\n # print(configs.proxy_local)\n \n # print(configs.proxy_online)\n # print(configs.user_img_url)\n # print(configs.user_login_url)\n print(configs.user_start_id)\n\n # assert isinstance(configs.proxy_getter_function...
[ "0.7022754", "0.70146805", "0.6905032", "0.66916466", "0.6684307", "0.6653523", "0.6568741", "0.6543096", "0.6520464", "0.6519033", "0.6509252", "0.65080345", "0.6457225", "0.644575", "0.6426769", "0.64229554", "0.6385807", "0.63645416", "0.6356513", "0.63371557", "0.63315684...
0.67167866
3
Helper for executing logging same way for every test
def helper_log_messages( logger, log_capture_override=None, ): with LogCapture(log_capture_override) as log_tracker: logger.debug( LOG_MESSAGE + ' --DEBUG--') logger.info( LOG_MESSAGE + ' --INFO--') logger.warning( LOG_MESSAGE + ' --WARNING--') logger.error( LO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_logging(self):\n self._verify_logging()", "def test(self):\n self.info(\"LOGGING: Testing log messages\")\n self.debug(\"This is a debugging message\")\n self.info(\"This is an informational message\")\n self.warning(\"This is a warning message\")\n self.error(\"Thi...
[ "0.7609698", "0.7608522", "0.7364038", "0.7246294", "0.7151149", "0.7146603", "0.70105374", "0.6938734", "0.69043374", "0.68828154", "0.6789341", "0.6774802", "0.6653296", "0.66417444", "0.6638516", "0.66313976", "0.66088593", "0.6594909", "0.6579426", "0.65746903", "0.657339...
0.0
-1
ECHO test for GET utility
def test_GET_fetcher(): params = { 'key1':'value1', 'arg2':'value2' } ## test that request goes ok resp = wf_utils.fetch_GET_request( GET_ECHO_ENDPOINT, params=params ) ## test that response json can be parsed payload = resp.json() ## test that response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_method_get():\n return 'GET'", "def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)", "def test_two_legged_get(self):\n resp, content = self._two_legged(\"GET\")\n self.assertEqual(int(resp['status']), 200)", "def do_GET(self):\n self...
[ "0.6335031", "0.6297777", "0.61926717", "0.6133453", "0.6042478", "0.59543127", "0.59261894", "0.59216285", "0.5915813", "0.5840221", "0.5785862", "0.5777845", "0.5771906", "0.57426494", "0.5737699", "0.5737379", "0.5717399", "0.569291", "0.5655878", "0.56524754", "0.5612279"...
0.6358074
0
excercize exceptions for GET utility
def test_GET_fetcher_fail(): bad_url = GET_ECHO_ENDPOINT.replace('.com', '.comx') with pytest.raises(Exception): #TODO: specific exception? resp = wf_utils.fetch_GET_request(bad_url) #TODO: bad status code tests?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raise_http_error(self, *args, **kwargs):", "def renderHTTP_exception(request, failure):", "def _processGETErr(self, e, request):\r\n if e.check(InvalidRequest):\r\n msg = e.getErrorMessage()\r\n code = httplib.BAD_REQUEST\r\n elif e.check(UnauthorizedLogin):\r\n ...
[ "0.7084887", "0.670926", "0.66761374", "0.66172314", "0.6597244", "0.65530616", "0.65018415", "0.6414881", "0.6392359", "0.63863003", "0.63461536", "0.6288013", "0.62814754", "0.62624824", "0.62461483", "0.62334555", "0.6221849", "0.62089056", "0.6208572", "0.62047553", "0.61...
0.6589292
5
ECHO test for GET utility
def test_POST_fetcher(): params = { 'key1':'value1', 'arg2':'value2' } data = { 'data1':'value1', 'data2':'morevalues' } ## test that request goes ok resp = wf_utils.fetch_POST_request( POST_ECHO_ENDPOINT, data, params=params ) ##...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_GET_fetcher():\n params = {\n 'key1':'value1',\n 'arg2':'value2'\n }\n\n ## test that request goes ok\n resp = wf_utils.fetch_GET_request(\n GET_ECHO_ENDPOINT,\n params=params\n )\n\n ## test that response json can be parsed\n payload = resp.json()\n\n #...
[ "0.635816", "0.63344365", "0.6297723", "0.61925864", "0.6132596", "0.6042227", "0.59541154", "0.5926037", "0.59210306", "0.59149337", "0.5840348", "0.57859087", "0.57776403", "0.57710594", "0.57406265", "0.57371694", "0.57368046", "0.5716191", "0.5692497", "0.5655314", "0.565...
0.0
-1
excercize exceptions for GET utility
def test_POST_fetcher_fail(): bad_url = POST_ECHO_ENDPOINT.replace('.com', '.comx') with pytest.raises(Exception): #TODO: specific exception? resp = wf_utils.fetch_GET_request(bad_url) #TODO: bad status code tests?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raise_http_error(self, *args, **kwargs):", "def renderHTTP_exception(request, failure):", "def _processGETErr(self, e, request):\r\n if e.check(InvalidRequest):\r\n msg = e.getErrorMessage()\r\n code = httplib.BAD_REQUEST\r\n elif e.check(UnauthorizedLogin):\r\n ...
[ "0.7084606", "0.67075837", "0.6675742", "0.6616683", "0.6596937", "0.6589133", "0.65520126", "0.6501619", "0.64153564", "0.639142", "0.63846123", "0.6344829", "0.62878734", "0.62821543", "0.626283", "0.624501", "0.6233241", "0.6222646", "0.6208485", "0.6207755", "0.6203567", ...
0.59165287
59
Flag which documents are outliers based on zscore bigger than threshold.
def flag_outliers_in_col(self, df, col='paciente_idade', threshold=2): data = df[col] mean = np.mean(data) std = np.std(data) outlier = [] for i in data: z = (i-mean)/std outlier.append(z > threshold) outlier = pd.Series(outlier) print(f"Nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_outlier(points, thresh=12):\n if len(points.shape) == 1:\n points = points[:,None]\n median = np.median(points, axis=0)\n diff = np.sum((points - median)**2, axis=-1)\n diff = np.sqrt(diff)\n med_abs_deviation = np.median(diff)\n\n modified_z_score = 0.6745 * diff / med_abs_deviatio...
[ "0.7033957", "0.70032877", "0.69774777", "0.6887256", "0.67809063", "0.67686844", "0.6646577", "0.6607504", "0.634495", "0.62447006", "0.62070817", "0.61879426", "0.6169662", "0.6151862", "0.61027694", "0.6080594", "0.60602206", "0.60370225", "0.6009786", "0.5998541", "0.5987...
0.62983334
9
Filter outliers based on flag pd.Series.
def filter_outliers(self, df, outlier): return df[~outlier].reset_index(drop=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_outliers(data: pd.Series, std: int=3) -> pd.Series:\n return data[(data - data.mean()).abs() <= (std * data.std())]", "def filter_outliers(data): \n \n idx_out = find_outliers_IQR(data)\n \n cleaned = data[~idx_out].copy()\n\n # print(f'There were {idx_out.sum()} outliers.')\n ...
[ "0.72473335", "0.7129621", "0.6909567", "0.686517", "0.68358237", "0.6784017", "0.6765156", "0.66363037", "0.66167766", "0.65355045", "0.65329564", "0.6509693", "0.6402966", "0.63938296", "0.63908815", "0.6374849", "0.6361414", "0.63555086", "0.6327466", "0.63204163", "0.6289...
0.73588157
0
Returns the real part of all the converged eigenvalues from arpack
def GetEigenvalues(self): return self.Solver.GetEigenvalues().real.copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigenvalues(self) -> ndarray:\n return self._vals", "def eigenvalues(self, expand=False, factor=False, simplify=False):\n raise NotImplementedError", "def eigvals(self):\n raise NotImplementedError", "def GetEigenvalues(self, eigenvalues):\n return _hypre.HypreAME_GetEigenvalu...
[ "0.7210072", "0.6718578", "0.6628805", "0.65749586", "0.6457396", "0.6456192", "0.6427934", "0.64171183", "0.63999254", "0.63643235", "0.6360623", "0.62789065", "0.6247136", "0.6236951", "0.6201405", "0.6178681", "0.6170981", "0.61528105", "0.61432594", "0.6131972", "0.610695...
0.6741684
1
Returns all eigenvectors as a N by M matrix, where N is the number of converged eigenvalues, and M is the size of the wavefunction. The eigenvectors is normalized in the vector 2norm, and can therefore not be expected to be normalized in the grid norm. Assign it to a wavefunction and call
def GetEigenvectors(self): return self.Solver.GetEigenvectors()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_eigenvectors(self):\n return self.eigenVectors", "def get_eigenvectors(self):\n return self._eigenvectors", "def eig(self,manifold_num):\n num_sites = len(self.energies[manifold_num])\n ham = self.manifold_hamiltonian(manifold_num).toarray()\n eigvals, eigvecs = eigh(...
[ "0.7280959", "0.7014462", "0.68991834", "0.6673352", "0.66130096", "0.6587522", "0.6492255", "0.6377612", "0.63553613", "0.6307149", "0.6288552", "0.62492836", "0.6200734", "0.6196136", "0.61908334", "0.61808556", "0.6166238", "0.614508", "0.6144089", "0.6143722", "0.610234",...
0.7069983
1
Sets psi to the eigenvector specified by eigenvetorIndex if normalize == True, psi will be normalized
def SetEigenvector(self, psi, eigenvectorIndex, normalize=True): eigenvectors = self.GetEigenvectors() shape = psi.GetData().shape psi.GetData()[:] = numpy.reshape(eigenvectors[eigenvectorIndex, :], shape) if normalize: psi.Normalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eigsolve(self,**kwargs):\n return eigsolve(self,**kwargs)", "def eigensolve(self, epsilon=0.85):\n raise NotImplementedError(\"eigensolve Incomplete\")", "def eigen_vector_i(self, i):\n return self._eig_vec[:,i]", "def set_eigenvalue_problem(self, *args, ncc_cutoff=1e-10, tolerance=1...
[ "0.56931436", "0.55284667", "0.54967713", "0.54389435", "0.5401519", "0.5303515", "0.522989", "0.5135587", "0.5133062", "0.50980896", "0.5096003", "0.5075772", "0.5053383", "0.5042445", "0.50405645", "0.49959317", "0.49945125", "0.49574724", "0.49294224", "0.49113372", "0.487...
0.8005101
0
Do not return anything, modify root inplace instead.
def recoverTree(self, root: TreeNode) -> None: self.first, self.second, self.pre = None, None, None #中序遍历二叉树,找到递减的节点,如果有一个交换他们相邻的,如果有两个,交换这两个 def inorder(root: TreeNode) -> None: if root == None: return None if root.left != None: inorder(ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uproot(self):\n self.__root__ = self\n return self", "def root_replace(self,node):\r\n self.feature_index = node.feature_index\r\n self.threshold = node.threshold\r\n self.label = node.label\r\n self.left = node.left\r\n self.right = node.right\r\n self.substit...
[ "0.71675247", "0.7090078", "0.7052984", "0.69619083", "0.67892647", "0.6614594", "0.6551307", "0.65119416", "0.65119416", "0.65119416", "0.65119416", "0.64319086", "0.6413781", "0.6397017", "0.6397017", "0.6370123", "0.63613737", "0.63289756", "0.6325578", "0.630594", "0.6276...
0.0
-1
This view renders the general timeline.
def general_timeline(): return render_template('timeline.html', general=True, show_username=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_timeline():\n return render_template('timeline.html', messages=query_db('''\n select message.*, user.* from message, user\n where message.author_id = user.user_id\n order by message.pub_date desc limit ?''', [PER_PAGE]))", "def public_timeline():\n return render_template('ti...
[ "0.68146354", "0.68146354", "0.646931", "0.6225129", "0.62190664", "0.61926216", "0.61690927", "0.5976462", "0.59268796", "0.58612955", "0.5815437", "0.5813973", "0.576644", "0.57416373", "0.5709168", "0.5668732", "0.55861884", "0.5561978", "0.5561588", "0.5535532", "0.552569...
0.8364598
0
This view renders the user timeline. It also allows the user to post tweets.
def user_timeline(username=None): # pylint: disable=unused-argument form = PostTweetForm() if form.validate_on_submit(): try: current_user.post_tweet(form.tweet.data) flash('Tweet successfully posted') except ValueError as excep: flash(str(excep)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_timeline():\n return render_template('timeline.html', messages=query_db('''\n select message.*, user.* from message, user\n where message.author_id = user.user_id\n order by message.pub_date desc limit ?''', [PER_PAGE]))", "def public_timeline():\n return render_template('ti...
[ "0.7028494", "0.7028494", "0.68925434", "0.68407875", "0.666454", "0.64178663", "0.63294685", "0.6242161", "0.6237933", "0.61577386", "0.61176234", "0.61053467", "0.6042958", "0.5984481", "0.5931631", "0.5931134", "0.5919422", "0.5892258", "0.57867306", "0.57760817", "0.57731...
0.8192773
0
This view renders the user history. It will display all the tweets posted by this user; allow the loggedin user to follow/unfollow this user if they are different.
def user_history(username): follow_form = FollowForm() unfollow_form = UnfollowForm() return render_template('user_history.html', username=username, follow_form=follow_form, unfollow_form=unfollow_form)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history():\n \n user_id = session[\"user_id\"]\n history_list = hist(user_id, db)\n return render_template('history.html', history=history_list)", "def user_timeline(username):\n profile_user = query_db('select * from user where username = ?',\n [username], one=True)...
[ "0.65801525", "0.6558955", "0.65173095", "0.65121293", "0.6486155", "0.64845365", "0.643965", "0.640158", "0.6400872", "0.6372886", "0.63680434", "0.63648087", "0.6350884", "0.632362", "0.6294069", "0.62907934", "0.627852", "0.62391174", "0.62049097", "0.61988515", "0.6156545...
0.74899447
0
This view handles the follow form in the user history page.
def follow(username): follow_form = FollowForm() unfollow_form = UnfollowForm() if follow_form.validate_on_submit(): try: current_user.follow(username) flash('Followed {}'.format(username)) except ValueError as excep: flash(str(excep)) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_follow_page(request):\n user = get_user_from_username(request.user, request.GET.get(\"user\"))\n data = {\"user\": user}\n return TemplateResponse(request, \"ostatus/remote_follow.html\", data)", "def follow(request, usertofollow):\n to_follow = Member.objects.get(user__username=usertofoll...
[ "0.7149877", "0.7063604", "0.6739925", "0.6728417", "0.671004", "0.6617824", "0.6579484", "0.6551827", "0.6518894", "0.650463", "0.6486437", "0.642817", "0.64219815", "0.64128906", "0.6406436", "0.6385301", "0.6356875", "0.63392025", "0.63104033", "0.6288673", "0.62805295", ...
0.7363769
0
This view handles the unfollow form in the user history page.
def unfollow(username): follow_form = FollowForm() unfollow_form = UnfollowForm() if unfollow_form.validate_on_submit(): try: current_user.unfollow(username) flash('Unfollowed {}'.format(username)) except ValueError as excep: flash(str(excep)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_unfollow():\n data = request.get_json(force=True)\n follower = User.query.get(data['follower'])\n following = User.query.get(data['following'])\n follower.followcheck.remove(following)\n db.session.commit()\n return {'unfollowed': True}", "def unfollow(request, usertostopfollow):\n ...
[ "0.75263685", "0.7512871", "0.74527144", "0.7343735", "0.7333024", "0.7246593", "0.72271776", "0.70816875", "0.696819", "0.68924844", "0.68613744", "0.6822375", "0.67654264", "0.676503", "0.67183167", "0.6688176", "0.6617912", "0.65045625", "0.6494655", "0.6466272", "0.645384...
0.822711
0
This function injects the function object 'Tweet.get_general_timeline' into the application context so that 'get_general_timeline' can be accessed in Jinja2 templates.
def inject_general_timeline(): return dict(get_general_timeline=Tweet.get_general_timeline)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def general_timeline():\n return render_template('timeline.html', general=True, show_username=True)", "def common_context(request):\n c = {\n 'lessons': get_lesson_numbers(),\n }\n return c", "def _timeline_context(self):\n\n timeline = self.channel.get_months_active()\n if not...
[ "0.6907658", "0.55791354", "0.5368909", "0.5239636", "0.5160229", "0.5101733", "0.50975186", "0.50097936", "0.50072044", "0.49837127", "0.49837127", "0.4918119", "0.49131495", "0.49122372", "0.4868816", "0.48333994", "0.4832774", "0.48210987", "0.4787424", "0.47700545", "0.47...
0.7961719
0
Given surfaces from features files from ABC dataset, load it into geomdl object or samples points on the surfaces of primitives, depending on the case. Defines utility to sample points form the surface of splines and primitives.
def __init__(self): self.function_dict = { "Sphere": self.draw_sphere, "BSpline": self.draw_nurbspatch, "Cylinder": self.draw_cylinder, "Cone": self.draw_cone, "Torus": self.draw_torus, "Plane": self.draw_plane, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_parameters(self, data, bit_mapping=False):\n points = data[\"points\"]\n normals = data[\"normals\"]\n labels = data[\"labels\"]\n\n primitives = data[\"primitives\"]\n\n cluster_ids = data[\"seg_id\"]\n primitive_dict = data[\"primitive_dict\"]\n for k, v ...
[ "0.60803115", "0.5795981", "0.5724051", "0.569382", "0.56591415", "0.5653855", "0.5642791", "0.5605703", "0.5553292", "0.5419038", "0.5403903", "0.53917825", "0.5315353", "0.5264245", "0.5220138", "0.52184683", "0.5197713", "0.51728046", "0.5171846", "0.51695555", "0.5161669"...
0.0
-1
Takes a list containing surface in feature file format, and returns a list of sampled points on the surface of primitive/splines.
def load_shape(self, shape): Points = [] for surf in shape: function = self.function_dict[surf["type"]] points = function(surf) Points.append(points) Points = np.concatenate(Points, 0) return Points
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_random_surface_points() -> List[SurfacePoint]:\n surface_points: List[SurfacePoint] = []\n for _ in range(42):\n surface_point = SurfacePoint(\n idx=uuid.uuid4().hex,\n x=_gen_random_number(),\n y=_gen_random_number(),\n z=_gen_random_number(),\...
[ "0.6109882", "0.6036777", "0.5864705", "0.58414865", "0.5840645", "0.57714117", "0.57691383", "0.57503223", "0.5724751", "0.57103294", "0.56614566", "0.56398237", "0.56080896", "0.5605836", "0.55992913", "0.557783", "0.55328035", "0.5519913", "0.55067337", "0.54709214", "0.54...
0.5382905
23
Convert degrees, minutes, seconds to decimal degress
def dms_to_dd(degrees, minutes, seconds): fd = float(degrees) if fd < 0: return fd - float(minutes) / 60 - float(seconds) / 3600 return fd + float(minutes) / 60 + float(seconds) / 3600
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_to_degress(value):\r\n d = float(value.values[0].num) / float(value.values[0].den)\r\n m = float(value.values[1].num) / float(value.values[1].den)\r\n s = float(value.values[2].num) / float(value.values[2].den)\r\n\r\n return d + (m / 60.0) + (s / 3600.0)", "def _degrees_to_decimal(degre...
[ "0.7796841", "0.77228105", "0.7708203", "0.76262164", "0.74406266", "0.7345186", "0.7307236", "0.71681195", "0.7065902", "0.68985623", "0.67277086", "0.6585821", "0.65812045", "0.65508264", "0.6547631", "0.65216386", "0.65213", "0.64031416", "0.638162", "0.6380068", "0.635357...
0.66474026
11
Test case for api_last_tested_repo_get
def test_api_last_tested_repo_get(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.Params() path, method = default_api.api_last_tested_repo_get(params) self.assertEqual(path, '/api/last_tested_repo') self.assertEqual(method, 'GET')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_last_tested_repo_post(self):\n default_api = DefaultApi(api_client=self.api_client)\n params = dlrnapi_client.Params1()\n path, method = default_api.api_last_tested_repo_post(params)\n self.assertEqual(path, '/api/last_tested_repo')\n self.assertEqual(method, 'POST')...
[ "0.7768464", "0.72451514", "0.7038413", "0.6969715", "0.65839493", "0.6558673", "0.64816403", "0.6443256", "0.6438606", "0.6329126", "0.6317321", "0.61880976", "0.6162838", "0.6152482", "0.61490256", "0.6125279", "0.6106903", "0.61035943", "0.6100584", "0.6053026", "0.6051147...
0.88925594
0
Test case for api_last_tested_repo_post
def test_api_last_tested_repo_post(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.Params1() path, method = default_api.api_last_tested_repo_post(params) self.assertEqual(path, '/api/last_tested_repo') self.assertEqual(method, 'POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_last_tested_repo_get(self):\n default_api = DefaultApi(api_client=self.api_client)\n params = dlrnapi_client.Params()\n path, method = default_api.api_last_tested_repo_get(params)\n self.assertEqual(path, '/api/last_tested_repo')\n self.assertEqual(method, 'GET')", ...
[ "0.7607755", "0.6482869", "0.6286869", "0.62830985", "0.61684394", "0.6084323", "0.6048418", "0.60430026", "0.6034124", "0.5954312", "0.5915801", "0.58691543", "0.58313596", "0.5807549", "0.5777155", "0.57586783", "0.573755", "0.57354254", "0.57269734", "0.5724796", "0.570244...
0.8940906
0
Test case for api_promote_post
def test_api_promote_post(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.Promotion() path, method = default_api.api_promote_post(params) self.assertEqual(path, '/api/promote') self.assertEqual(method, 'POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post(self):\n pass", "def test_smoker_post(self):\n pass", "def test_post_user_post(self):\n pass", "def test_promote_goes_no_further_than_done(self):\n todo = Todo.create(title=\"Thing to do\", status=Todo.CHOICES[-1][0])\n assert todo.status == todo.CHOICES[-1][0...
[ "0.6381156", "0.62768924", "0.6186299", "0.6080127", "0.60648495", "0.59423923", "0.5903473", "0.58985007", "0.5884698", "0.58770335", "0.58684766", "0.5868241", "0.5822002", "0.57952636", "0.5735996", "0.572518", "0.5721291", "0.5715468", "0.56378376", "0.56373036", "0.56297...
0.88653123
0
Test case for api_promotions_get
def test_api_promotions_get(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.Promotion() path, method = default_api.api_promotions_get(params) self.assertEqual(path, '/api/promotions') self.assertEqual(method, 'GET')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n app.logger.info(\"Request for promotions list\")\n promotion = []\n name = request.args.get(\"name\")\n description = request.args.get(\"description\")\n promo_code = request.args.get(\"promo_code\")\n if name:\n promotion = Promotions.find_by_n...
[ "0.59409016", "0.57219326", "0.56976277", "0.5597588", "0.55282253", "0.5519187", "0.55077225", "0.5502402", "0.5457423", "0.54374766", "0.54354423", "0.5377362", "0.5357199", "0.5355699", "0.5349281", "0.5313175", "0.5301036", "0.5291509", "0.52211195", "0.5198851", "0.51665...
0.8312879
0
Test case for api_build_metrics_get
def test_api_build_metrics_get(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.MetricsRequest() path, method = default_api.api_build_metrics_get(params) self.assertEqual(path, '/api/metrics/builds') self.assertEqual(method, 'GET')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_result_fields_with_metrics(cbcsdk_mock):\n api = cbcsdk_mock.api\n result = Result(api, initial_data=GET_RUN_RESULTS_RESP_1)\n metrics = result.metrics_\n assert metrics._info == {\"cpu\": 24.3, \"memory\": 8.0}", "def test_metrics(client):\n response = client.get(\"/metrics\")\n asser...
[ "0.7185345", "0.70361453", "0.6999692", "0.6963669", "0.69537514", "0.6777485", "0.6712619", "0.6622766", "0.6521939", "0.6513031", "0.64969116", "0.6484864", "0.6482907", "0.6441199", "0.6406892", "0.63881034", "0.6368471", "0.6339531", "0.6260921", "0.6234628", "0.6190819",...
0.8813328
0
Test case for api_remote_import_post
def test_api_remote_import_post(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.ModelImport() path, method = default_api.api_remote_import_post(params) self.assertEqual(path, '/api/remote/import') self.assertEqual(method, 'POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_upload(self):\r\n self._login_admin()\r\n\r\n # verify we get the form\r\n res = self.app.get('/admin/import')\r\n self.assertTrue(\r\n '<form' in res.body,\r\n 'Should have a form in the body for submitting the upload')\r\n\r\n res = self._u...
[ "0.6340387", "0.62975264", "0.6129785", "0.6082167", "0.6075704", "0.59829533", "0.5974887", "0.5939281", "0.59220105", "0.5799908", "0.5782063", "0.5755509", "0.57277656", "0.5705541", "0.5701068", "0.5679355", "0.56710863", "0.5662004", "0.5627926", "0.5620273", "0.5619928"...
0.87363845
0
Test case for api_repo_status_get
def test_api_repo_status_get(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.Params2() path, method = default_api.api_repo_status_get(params) self.assertEqual(path, '/api/repo_status') self.assertEqual(method, 'GET')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_status(self):\n pass", "def test_get_status(self):\n pass", "def test_get_status(self):\n resp = self.build_api.getStatus().json()\n assert 'status' in resp\n assert 'message' in resp", "def test_get_status(self):\n response = self.client.open(\n ...
[ "0.76847225", "0.76847225", "0.7624905", "0.7335575", "0.7133566", "0.7124783", "0.68932515", "0.68918663", "0.6867826", "0.6845981", "0.6791606", "0.67886084", "0.67723477", "0.6749822", "0.67219496", "0.6644989", "0.6614613", "0.658524", "0.6566437", "0.6537004", "0.6474428...
0.87942904
0
Test case for api_report_result_post
def test_api_report_result_post(self): default_api = DefaultApi(api_client=self.api_client) params = dlrnapi_client.Params3() path, method = default_api.api_report_result_post(params) self.assertEqual(path, '/api/report_result') self.assertEqual(method, 'POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_successful_report(self):\n from rest_framework.test import APIClient\n client = APIClient()\n response = client.post('/api/report/epic/', self.report,\n HTTP_AUTHORIZATION='Token ' + self.token_1,\n format='json')\n...
[ "0.71547884", "0.7134954", "0.6750663", "0.6482854", "0.6443237", "0.6282149", "0.62690705", "0.6220305", "0.62106735", "0.62021273", "0.6135198", "0.6113796", "0.6112314", "0.6103845", "0.60587716", "0.60543984", "0.60537034", "0.60535234", "0.6035478", "0.5997932", "0.59572...
0.87548476
0
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_drop_worst_comp( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): mouse = mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626714", "0.61986005", "0.6093413", "0.60877055", "0.60319614", "0.60185933", "0.59652436", "0.5910634", "0.5900354", "0.5876719", "0.5846923", "0.5820176", "0.581589", "0.57660216", "0.5753341", "0.5733544", "0.57210577", "0.5715147", "0.57129216", "0.56874424", "0.56554...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): mouse = mouse.mouse p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626714", "0.61986005", "0.6093413", "0.60877055", "0.60319614", "0.60185933", "0.59652436", "0.5910634", "0.5900354", "0.5876719", "0.5846923", "0.5820176", "0.581589", "0.57660216", "0.5753341", "0.5733544", "0.57210577", "0.5715147", "0.57129216", "0.56874424", "0.56554...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_cv_train_set( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, train_test_split=0.8, rectified=True, verbo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.66271156", "0.61979055", "0.609163", "0.6088389", "0.60322195", "0.60189843", "0.59633064", "0.5909732", "0.58992445", "0.58761466", "0.58461267", "0.58211416", "0.581732", "0.57664233", "0.57548785", "0.57342", "0.57206076", "0.5714774", "0.5714627", "0.5686507", "0.56552...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_cv_test_set( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, train_test_split=0.8, rectified=True, verbos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626761", "0.61979336", "0.60904497", "0.60882133", "0.6032409", "0.60164094", "0.5964159", "0.5911293", "0.5902218", "0.587687", "0.58464044", "0.58204544", "0.5817129", "0.5768622", "0.5752992", "0.57344383", "0.57194054", "0.5714669", "0.57140064", "0.56863517", "0.5654...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_byday( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): mouse = mouse.mouse ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626714", "0.61986005", "0.6093413", "0.60877055", "0.60319614", "0.60185933", "0.59652436", "0.5910634", "0.5900354", "0.5876719", "0.5846923", "0.5820176", "0.581589", "0.57660216", "0.5753341", "0.5733544", "0.57210577", "0.5715147", "0.57129216", "0.56874424", "0.56554...
0.0
-1
Plot total dataset variance across all whole groupday TCA decomposition ensemble.
def groupday_var_byday( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): mouse = mouse.mouse ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_PCA():\n X, languages = prepare_data_matrix()\n #print(X)\n eigenvectors, eigenvalues=power_iteration_two_components(X)\n explain = explained_variance_ratio(X, eigenvectors, eigenvalues)\n X=project_to_eigenvectors(X,eigenvectors)\n\n #print(X)\n plt.title('Explained variance: %.3f' %...
[ "0.63589156", "0.5836832", "0.5827785", "0.57852423", "0.569805", "0.56924427", "0.5647534", "0.56309074", "0.5551352", "0.5546261", "0.5531009", "0.54955757", "0.5475013", "0.5473825", "0.54661816", "0.5440744", "0.54330385", "0.5412564", "0.54053146", "0.54017264", "0.53706...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_byday_bycomp( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): mouse = mouse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.66271156", "0.61979055", "0.609163", "0.6088389", "0.60322195", "0.60189843", "0.59633064", "0.5909732", "0.58992445", "0.58761466", "0.58461267", "0.58211416", "0.581732", "0.57664233", "0.57548785", "0.57342", "0.57206076", "0.5714774", "0.5714627", "0.5686507", "0.56552...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_byday_bycomp_bycell( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, rectified=True, verbose=False): mouse = mouse.mouse pars = {'tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626761", "0.61979336", "0.60904497", "0.60882133", "0.6032409", "0.60164094", "0.5964159", "0.5911293", "0.5902218", "0.587687", "0.58464044", "0.58204544", "0.5817129", "0.5768622", "0.5752992", "0.57344383", "0.57194054", "0.5714669", "0.57140064", "0.56863517", "0.5654...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_bycomp_bycell( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, rectified=True, verbose=False): mouse = mouse.mouse pars = {'trace_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626714", "0.61986005", "0.6093413", "0.60877055", "0.60319614", "0.60185933", "0.59652436", "0.5910634", "0.5900354", "0.5876719", "0.5846923", "0.5820176", "0.581589", "0.57660216", "0.5753341", "0.5733544", "0.57210577", "0.5715147", "0.57129216", "0.56874424", "0.56554...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_bycomp( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): mouse = mouse.mouse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626714", "0.61986005", "0.6093413", "0.60877055", "0.60319614", "0.60185933", "0.59652436", "0.5910634", "0.5900354", "0.5876719", "0.5846923", "0.5820176", "0.581589", "0.57660216", "0.5753341", "0.5733544", "0.57210577", "0.5715147", "0.57129216", "0.56874424", "0.56554...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_bycomp_ablated( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all3', nan_thresh=0.85, score_threshold=0.8, rectified=True, verbose=False): # save sort...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.66271156", "0.61979055", "0.609163", "0.6088389", "0.60322195", "0.60189843", "0.59633064", "0.5909732", "0.58992445", "0.58761466", "0.58461267", "0.58211416", "0.581732", "0.57664233", "0.57548785", "0.57342", "0.57206076", "0.5714774", "0.5714627", "0.5686507", "0.56552...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_byday_bycell( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all2', nan_thresh=0.85, rectified=True, verbose=False): mouse = mouse.mouse pars = {'trace_typ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626761", "0.61979336", "0.60904497", "0.60882133", "0.6032409", "0.60164094", "0.5964159", "0.5911293", "0.5902218", "0.587687", "0.58464044", "0.58204544", "0.5817129", "0.5768622", "0.5752992", "0.57344383", "0.57194054", "0.5714669", "0.57140064", "0.56863517", "0.5654...
0.0
-1
Plot reconstruction error as variance explained across all whole groupday TCA decomposition ensemble.
def groupday_varex_bycell( mouse, trace_type='zscore_day', method='ncp_hals', cs='', warp=False, word=None, group_by='all2', nan_thresh=0.85, rectified=True, verbose=False): mouse = mouse.mouse pars = {'trace_type': tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruction_errors(identifier, train_errors, vali_errors,\n generated_errors, random_errors):\n print(identifier)\n fig, axarr = plt.subplots(4, 1, sharex=True, figsize=(4, 8))\n axarr[0].hist(train_errors, normed=1, color='green', bins=50)\n axarr[0].set_title(\"train r...
[ "0.6626714", "0.61986005", "0.6093413", "0.60877055", "0.60319614", "0.60185933", "0.59652436", "0.5910634", "0.5900354", "0.5876719", "0.5846923", "0.5820176", "0.581589", "0.57660216", "0.5753341", "0.5733544", "0.57210577", "0.5715147", "0.57129216", "0.56874424", "0.56554...
0.0
-1
Create full matrix from an ablated (one factor removed) KTensor.
def _full_ablated(tt_factors, fac_num_to_remove): # turn factors into tuple, then remove factor from each mode's matrix factors = tuple(tt_factors) factors = tuple([np.delete(f, fac_num_to_remove, axis=1) for f in factors]) # create a KTensor from tensortools to speed up some math kt = KTen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_full_matrix(AB, BA, AA, BB):\n a_size, b_size = AB.shape\n\n full_mat = sparse.csc_matrix((a_size + b_size, a_size + b_size))\n full_mat[:a_size, :a_size] = AA\n full_mat[:a_size, a_size:] = AB\n full_mat[a_size:, :a_size] = BA\n full_mat[a_size:, a_size:] = BB\n\n return full_mat", ...
[ "0.62535655", "0.6194362", "0.5881765", "0.57952917", "0.56678134", "0.56190974", "0.5563654", "0.55563956", "0.5539287", "0.55289817", "0.5493376", "0.546882", "0.54683924", "0.54578173", "0.54480875", "0.544805", "0.5428051", "0.5427213", "0.5424056", "0.5413035", "0.539482...
0.63164496
0
Initializes this compiler. Default for classes is all in the given directory or expects a list or tuple, otherwise and ValueError is thrown
def __init__(self, compiler_name, src_ext, dst_ext, sources=None, directory=_os.curdir): if sources is not None and not isinstance(sources, (list, set, tuple)): raise TypeError('sources must be an iterable') self.compiler_name = compiler_name self.src_ext = src_ext self.dst_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_derived_class_folders(self):\n self.smooth_update_dir = self.opt_folder / \"SMOOTHED_UPDATES\"\n self.moment_dir = self.opt_folder / \"MOMENTS\"\n self.smoothed_model_dir = self.opt_folder / \"SMOOTHED_MODELS\"", "def __init__(self, *paths):\r\n self.paths = paths", ...
[ "0.5769025", "0.57047147", "0.56077063", "0.5606366", "0.55970603", "0.5477624", "0.54756784", "0.54678094", "0.54382044", "0.5425789", "0.54102427", "0.53504074", "0.53469247", "0.5345114", "0.5299918", "0.52958083", "0.52947456", "0.52946234", "0.52822196", "0.5268107", "0....
0.6095816
0
Sets the path of this compiler to the given directory
def set_path(self, directory): self.directory = directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetPath(self, directory):\r\n\r\n if directory is not None and exists(directory) and isdir(directory):\r\n self.directory = directory", "def set_script_dir(self, path):\n self.script_dir = path", "def set_directory_path(self, directory_path: str) -> None:\n self.directory_pa...
[ "0.7257609", "0.7105358", "0.7008451", "0.68472654", "0.6803677", "0.67048776", "0.6698584", "0.6678834", "0.66785187", "0.6646457", "0.66388613", "0.6610648", "0.65984744", "0.659206", "0.6573202", "0.65296423", "0.65239066", "0.64913666", "0.63866687", "0.63670313", "0.6328...
0.746776
0
Adds the given flag to the list of flags
def add_flag(self, flag): self.flags.append(flag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, flag):\n\n try:\n # Resolve the flag\n flag = self.eset[flag]\n except KeyError:\n raise TypeError('Unknown bit flag %r' % flag)\n\n # Save the current bitflags\n previous = self.bitflags\n\n self.bitflags |= int(flag)\n self....
[ "0.75960606", "0.7376466", "0.730766", "0.70087034", "0.68559486", "0.6774737", "0.6746336", "0.63983494", "0.6393685", "0.63705426", "0.63703865", "0.6267221", "0.59687865", "0.58709884", "0.5841526", "0.57966334", "0.5731052", "0.57130134", "0.5683149", "0.5680459", "0.5653...
0.85671544
0
Clears the list of flags
def clear_flags(self): self.flags.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resetFlags():\r\n for flag in flags:\r\n flags[flag] = False", "def clearAllCanSelectFlags(self):\n for key in self.canSelectFlags.keys():\n self.canSelectFlags[key] = 0", "def reset() -> None:\n\t_flag.clear()", "def clearAccessedFlags(self):\n pass", "def _resetFlag...
[ "0.8162865", "0.77293634", "0.7115795", "0.68962365", "0.68583477", "0.68233705", "0.6815525", "0.6761658", "0.6682103", "0.66317004", "0.6561998", "0.6549232", "0.64430094", "0.64430094", "0.64283997", "0.6389182", "0.6374279", "0.63340294", "0.63226664", "0.63033676", "0.62...
0.8602546
0
Compiles the source files in this directory with this compiler's
def compile(self, exclude=None, recurse=True, references=None, verbose=False): from clay.shell.core import lsgrep _os.chdir(self.directory) sources = self.sources if sources is None: sources = [_os.path.splitext(x)[0] for x in lsgrep(self.src_ext, self.directory, recurse=re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_dir(path):\r\n to_compile = get_pyx_files(path)\r\n print(\"De:\",path)\r\n if to_compile:\r\n print(\"Se compilaran:\", list(map(os.path.basename,to_compile)))\r\n Cythonize.main( ['-a', '-i'] + to_compile )\r\n else:\r\n print(\"Nada para compilar\")", "def compile(...
[ "0.7384383", "0.6637735", "0.6614796", "0.6554956", "0.6524108", "0.6508908", "0.6475297", "0.6471648", "0.6450059", "0.6450059", "0.6403609", "0.63995343", "0.63847154", "0.63383234", "0.6291639", "0.6264601", "0.62318736", "0.6183617", "0.6145199", "0.61386466", "0.6107049"...
0.6854204
1
Initialize each process with its own OSRM file
def init(a: str, h: str, c: str, r: bool, A: str, lock: Lock) -> None: global host, action, report, router, algorithm action = a algorithm = A if r: report = r if h: host = h if c: lock.acquire() try: router = PyOSRM(c, use_shared_memory=False, algor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_processes(rank, size, backend='gloo'):\n os.environ['MASTER_ADDR'] = '12.12.10.13'\n os.environ['MASTER_PORT'] = '29500'\n dist.init_process_group(backend, rank=rank, world_size=size)", "def __init__(self, paths):\n Process.__init__(self)\n self.paths = paths", "def __init__(sel...
[ "0.60539454", "0.60366905", "0.59817487", "0.58167285", "0.58035195", "0.5778657", "0.57217056", "0.57196563", "0.5703051", "0.56834275", "0.56599486", "0.56153727", "0.5592089", "0.5569022", "0.5486655", "0.5480387", "0.5471384", "0.547018", "0.54518867", "0.54294914", "0.54...
0.0
-1
Return the distance in meters or None (to be filtered by caller)
def work(params) -> Union[None, float]: try: # either HTTP or bindings if host: path = action if action == "route" else "sources_to_targets" params_str = delimit_tuple( tuple((delimit_tuple(x) for x in params)), delimiter=";" ) route = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance(self) -> int:\n return self.get_measurement_data().distance", "async def distance(self):\n return round(await self._rpc.distance(), 2)", "def get_distance(self):\n\n # Activate trigger\n self.trigger()\n\n # Detect rising edge of echo pin\n channel = G...
[ "0.7287641", "0.71533", "0.70847905", "0.70370567", "0.6925204", "0.68493444", "0.68152845", "0.6795716", "0.6773997", "0.6751818", "0.67329544", "0.6720923", "0.6680369", "0.66397786", "0.657678", "0.6526369", "0.65154874", "0.64958256", "0.649231", "0.6470604", "0.6454386",...
0.0
-1
Generate a series of 1D plots of the cube parameters Does special treatment for the "alpha" parameter
def do_alpha_plot(uvals,vectors,wvectors,names,tag=None, fig_exten='.png', dolevels=False,log=True,outdir='SingleFigs/', vparams_dict=None, prefix='',truth=None,latexnames=None, logspline=True, others=None): import os import math if tag is not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mlab_plt_cube(xmin, xmax, ymin, ymax, zmin, zmax):\n faces = cube_faces(xmin, xmax, ymin, ymax, zmin, zmax)\n for grid in faces:\n x, y, z = grid\n mlab.mesh(x, y, z, opacity=0.1, color=(0.1, 0.2, 0.3))", "def SH_surface_plots(n_max=6,figsize=(15,15),fs=15,saveA=True,show=False,dpi=400,vi...
[ "0.6512349", "0.6258401", "0.6198374", "0.59662074", "0.594106", "0.59283364", "0.5919015", "0.59163845", "0.5897143", "0.5843514", "0.5832862", "0.58112234", "0.5749006", "0.56579745", "0.5616748", "0.56120133", "0.56120133", "0.56094986", "0.5609242", "0.5600532", "0.559543...
0.5606482
19
for a given image name, generate a respective file name, the output should be saved as; e.g. xd.jpg > xd_features.npy can be used to find the files for the regression part
def generate_file_name(old_file_name: str) -> str: return old_file_name.split(".")[0] + '_features' + '.npy'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filename(images):\n image_file = {}\n for image in images:\n image_file[image['id']] = os.path.join('train2017', image['file_name'])\n return image_file", "def createAllImageFiles(poly, name) :\n \n for i in range(len(poly.getPaths())):\n fileName = name + \"_\" + str(i) + \"...
[ "0.6532228", "0.63980925", "0.6393354", "0.6317259", "0.6311766", "0.63059837", "0.6289537", "0.6256262", "0.62549275", "0.6253018", "0.6176286", "0.61517787", "0.6143204", "0.611888", "0.6113079", "0.6079711", "0.60362726", "0.6034775", "0.6033952", "0.6028542", "0.6015237",...
0.6681591
0
change the model, that will be used by the predictor; to get the model_names, refer to viable models at the top of this file
def select_model(model_name: str): global predictor, currently_selected_model predictor = FeatureExtractor(model_name) currently_selected_model = model_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOldModel(self,model):\n self.modelName = model\n oldModel = load_model(self.modelPath + \"/\" + model + \".hdf5\",\n custom_objects={'recall': recall,\n 'precision': precision,\n 'f1Score':f1Sc...
[ "0.70904213", "0.69119847", "0.67973185", "0.6719595", "0.6565851", "0.6494036", "0.6449818", "0.6443918", "0.6391521", "0.6389185", "0.63809407", "0.6304095", "0.6300939", "0.62952447", "0.6261975", "0.62455255", "0.6224973", "0.6174949", "0.6136979", "0.61338425", "0.607484...
0.694931
1
API function for Algonauts; for a given string, that is a path to an image file, compute a dictionary of of outputs of various layers from the encoding model
def get_features_by_image_path(path_to_image: str) -> t.Dict[str, torch.Tensor]: image_data = loader(path_to_image) with torch.no_grad(): return get_features_by_image_data(image_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(\n self, \n image: ndarray, \n adversarial_image: ndarray\n ) -> Dict[str, Union[float, int]]:\n ...", "def parse_function(filenames):\n \n img_filename, gt_filename = filenames['image'], filenames.get('segmentation_mask', None)\n \n # Reading the file and ...
[ "0.6114287", "0.5772065", "0.56981933", "0.5651094", "0.56293285", "0.56234235", "0.56135386", "0.5601471", "0.55929637", "0.55676836", "0.55646133", "0.5551584", "0.55348206", "0.55257267", "0.55229133", "0.547941", "0.54559493", "0.54455626", "0.54355234", "0.54320383", "0....
0.0
-1
API function for Algonauts; for a loaded, not yet preprocessed image, return outputs of various layers of the encoding model; image data is expected to be in RGB the layers here are provided by detectron2 itself; no IntermediateLayerGetter
def get_features_by_image_data(image_data: np.ndarray) -> t.Dict[str, torch.Tensor]: with torch.no_grad(): return _reorder_features(predictor(image_data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inference(self, image_rgb):\n s = image_rgb.get_shape().as_list()\n with tf.name_scope('image-preprocessing'):\n MEAN = [103.939, 116.779, 123.68]\n assert s[1:] == [227, 227, 3]\n red, green, blue = tf.split(image_rgb, 3, 3)\n bgr = tf.concat([\n ...
[ "0.5769102", "0.57382643", "0.57309794", "0.5680739", "0.5673918", "0.5655157", "0.5644211", "0.56367666", "0.5591521", "0.55862665", "0.5567598", "0.5562491", "0.55506796", "0.5523746", "0.5522362", "0.54794484", "0.54794043", "0.54676753", "0.54660183", "0.5465986", "0.5463...
0.0
-1
vulnarable to future updates;
def _reorder_features(outputs: t.Dict[str, torch.Tensor]) -> t.Dict[str, torch.Tensor]: results = collections.OrderedDict() keys = outputs.keys() res_keys: t.List = sorted([key for key in keys if 'res' in key]) p_keys: t.List = sorted([key for key in keys if 'p' in key], reverse=True) new_k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update( ):\r\n pass", "def update():", "def update():", "def _update(self):\n pass", "def update(self):", "def update(self):", "def update(self):", "def dummy_update( self ):\r\n pass", "def onUpdated(self):", "def update(self):\r\n pass", "def update(self) -> No...
[ "0.7782488", "0.77389413", "0.77389413", "0.7653784", "0.75854903", "0.75854903", "0.75854903", "0.7537543", "0.73864686", "0.7356516", "0.7338992", "0.72717035", "0.72717035", "0.72717035", "0.72717035", "0.72717035", "0.72717035", "0.72717035", "0.72717035", "0.72717035", "...
0.0
-1
unsafe to use, will download all models;
def _create_model_out_dictkeys(): model_names = [] result_keys = [] for model_name in model_zoo._ModelZooUrls.CONFIG_PATH_TO_URL_SUFFIX.keys(): try: print(model_name, ":") select_model(model_name) result = get_features_by_image_path("./sample.jpg") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_all_models() -> None:\n model_keys = ModelInfo.get_all_models()\n for model_key in model_keys:\n download_model(model_key)", "def download_models_and_data():\n\n for file in DATA_FILES:\n download_file(file[\"url\"], file[\"path\"])", "def _retrieve_models(local=True):\n ...
[ "0.8000574", "0.7724834", "0.74329823", "0.71786356", "0.6747603", "0.6745747", "0.6659048", "0.641336", "0.63715756", "0.6277509", "0.6269505", "0.626529", "0.61694473", "0.6133393", "0.6132167", "0.6128733", "0.612146", "0.6082238", "0.6054536", "0.6049674", "0.60273546", ...
0.0
-1
Generates AppStream metadata of a specific kind
def _generate_metadata_kind(filename, targets=None, qa_group=None): db = LvfsDatabase(os.environ) db_firmware = LvfsDatabaseFirmware(db) items = db_firmware.get_items() store = appstream.Store('lvfs') for item in items: # filter if item.target == 'private': continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_metadata_kind(filename, items, affidavit=None):\n store = appstream.Store('lvfs')\n for item in items:\n\n # add each component\n for md in item.mds:\n component = appstream.Component()\n component.id = md.cid\n component.kind = 'firmware'\n ...
[ "0.671694", "0.60573244", "0.57544136", "0.5661377", "0.56448686", "0.5619563", "0.5588338", "0.55070674", "0.5504906", "0.5472223", "0.5432367", "0.54051733", "0.5370304", "0.53210187", "0.53012925", "0.5292331", "0.5278983", "0.52679557", "0.5261438", "0.52601606", "0.52423...
0.607395
1
updates metadata for a specific qa_group
def metadata_update_qa_group(qa_group): # explicit if qa_group: filename = 'firmware-%s.xml.gz' % _qa_hash(qa_group) _generate_metadata_kind(filename, qa_group=qa_group) return [os.path.join(DOWNLOAD_DIR, filename)] # do for all db = LvfsDatabase(os.environ) db_firmware = L...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _metadata_update_group(group_id):\n\n # get all firmwares in this group\n firmwares = db.firmware.get_all()\n firmwares_filtered = []\n for f in firmwares:\n if f.target == 'private':\n continue\n if f.group_id != group_id:\n continue\n firmwares_filtered....
[ "0.62396324", "0.5877734", "0.576575", "0.57327974", "0.57194453", "0.56374407", "0.56304944", "0.54979336", "0.5483407", "0.5479937", "0.54672974", "0.5455434", "0.54246724", "0.54197586", "0.54063433", "0.5388485", "0.5379117", "0.5371604", "0.5357497", "0.5346416", "0.5345...
0.647164
0
updates metadata for a specific target
def metadata_update_targets(targets): filenames = [] for target in targets: if target == 'stable': filename = _generate_metadata_kind('firmware.xml.gz', targets=['stable']) filenames.append(filename) elif target == 'testing': filename = _generate_metadata_kind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _metadata_update_targets(targets):\n affidavit = _create_affidavit()\n firmwares = db.firmware.get_all()\n for target in targets:\n firmwares_filtered = []\n for f in firmwares:\n if f.target == 'private':\n continue\n if f.target != target:\n ...
[ "0.704391", "0.6856124", "0.680079", "0.6698067", "0.6497665", "0.643017", "0.6337812", "0.6309755", "0.61284596", "0.61040866", "0.6089916", "0.60253173", "0.5976579", "0.5934039", "0.59204215", "0.59136456", "0.5907409", "0.58857447", "0.5860491", "0.5860491", "0.58534926",...
0.56407994
40
Writes the input out to a local file
def process(self, tup): input = tup.values[0] url = input['url'] now = datetime.datetime.now() if url in self.seen: lastSeen = self.seen[url] delta = now - lastSeen if delta.total_seconds() < 3600: # seen less than an hour ago, don't...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_output_file(output: str, file_name: str):\n\tfile1 = open(file_name, 'w')\n\tfile1.write(output)\n\tfile1.close()", "def __export_file(self, filename, output):\n outfile = open(filename, \"w\")\n outfile.write(output)\n outfile.close\n print(\"Output written to file: \" + f...
[ "0.7053892", "0.67866904", "0.668285", "0.66073346", "0.6562557", "0.6537651", "0.6532199", "0.6498945", "0.64802593", "0.6445508", "0.6445508", "0.64421177", "0.64155847", "0.63887167", "0.62964857", "0.6274529", "0.6260469", "0.6249611", "0.6246505", "0.616572", "0.6132764"...
0.0
-1
Test KS test for insertion indices with a specified mode
def test_ks_test(mode): indices = np.random.randint(0, 1000, 1000) out = compute_indices_ks_test(indices, 1000, mode=mode) assert all([o > 0.0 for o in out])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ks_test_undefined_mode():\n indices = np.random.randint(0, 1000, 1000)\n with pytest.raises(RuntimeError):\n compute_indices_ks_test(indices, 1000, mode=\"two-sided\")", "def test_ks_test_empty_indices():\n out = compute_indices_ks_test([], 1000, mode=\"D+\")\n assert all(o is None fo...
[ "0.67841566", "0.57195204", "0.5679095", "0.5437452", "0.53641367", "0.53341633", "0.5320182", "0.5270428", "0.5263456", "0.52053756", "0.51995933", "0.5183746", "0.51783615", "0.51379323", "0.51002336", "0.5085314", "0.5072776", "0.50716794", "0.50716245", "0.50713897", "0.5...
0.7882716
0
Test KS test for insertion indices with undefined mode
def test_ks_test_undefined_mode(): indices = np.random.randint(0, 1000, 1000) with pytest.raises(RuntimeError): compute_indices_ks_test(indices, 1000, mode="two-sided")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ks_test(mode):\n indices = np.random.randint(0, 1000, 1000)\n out = compute_indices_ks_test(indices, 1000, mode=mode)\n assert all([o > 0.0 for o in out])", "def test_ks_test_empty_indices():\n out = compute_indices_ks_test([], 1000, mode=\"D+\")\n assert all(o is None for o in out)", "...
[ "0.8165338", "0.746027", "0.6211018", "0.61494595", "0.5980731", "0.58581066", "0.58403915", "0.58055747", "0.5776113", "0.57654226", "0.5763633", "0.57397044", "0.5628826", "0.55964756", "0.55854005", "0.55454636", "0.5536922", "0.5515122", "0.5509714", "0.5504265", "0.54790...
0.7853589
1
Test KS test for insertion indices with empty input array
def test_ks_test_empty_indices(): out = compute_indices_ks_test([], 1000, mode="D+") assert all(o is None for o in out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ks_test(mode):\n indices = np.random.randint(0, 1000, 1000)\n out = compute_indices_ks_test(indices, 1000, mode=mode)\n assert all([o > 0.0 for o in out])", "def test_ks_test_undefined_mode():\n indices = np.random.randint(0, 1000, 1000)\n with pytest.raises(RuntimeError):\n comput...
[ "0.70587337", "0.65909284", "0.6385907", "0.5999898", "0.5820923", "0.5819541", "0.57032824", "0.56986374", "0.5642348", "0.5551414", "0.55201554", "0.54983246", "0.5488126", "0.5454441", "0.54420024", "0.54296124", "0.5424802", "0.54022473", "0.53976005", "0.5383299", "0.536...
0.8038088
0
Test the Bonferroni correction for pvalues
def test_bonferroni_correction(): p_values = np.linspace(0, 0.5, 4) rejected, corrected, alpha = bonferroni_correction(p_values) np.testing.assert_array_equal(corrected, np.array([0, 2 / 3, 1, 1])) assert rejected.tolist() == [True, False, False, False] assert alpha == 0.0125
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bonferroni_correction(self):\r\n pvals = array([.1, .7, .5, .3, .9])\r\n exp = pvals * 5.\r\n obs = bonferroni_correction(pvals)\r\n self.assertFloatEqual(obs, exp)", "def bonferroni_correction(pvals):\r\n return (\r\n array(pvals, dtype=float) * len(pvals) # float...
[ "0.83021456", "0.71167046", "0.6553124", "0.6406347", "0.6259637", "0.6220493", "0.60953826", "0.602094", "0.5866166", "0.5811663", "0.58097947", "0.5803982", "0.5756479", "0.5751217", "0.57412875", "0.5739286", "0.5718708", "0.5704229", "0.5698823", "0.56808656", "0.5674409"...
0.80394477
1
Convert ID sequences into mask matrices
def idseqs_to_mask(idseqs: List[List[int]], n_seqlen: Optional[int] = None, n_vocab_sz: Optional[int] = None, ignore: Optional[List[int]] = [], dtype: Optional[torch.dtype] = torch.bool, dense: Optional[bool] = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_attention_mask(input_ids): \n attention_masks = [] \n\n # 1 for input and 0 for pad\n for seq in input_ids: \n attention_masks.append([float(i>0) for i in seq])\n\n return attention_masks", "def mask_id(self):\n m = 2 * self.mask_full()\n m[0:self.size, 0:self.size] = s...
[ "0.68125015", "0.6421516", "0.59341574", "0.59032476", "0.583509", "0.5829133", "0.5744523", "0.5729663", "0.5697411", "0.56960577", "0.5669003", "0.5659483", "0.56362015", "0.5635536", "0.5617417", "0.5606554", "0.5605875", "0.5604915", "0.5577015", "0.5563572", "0.55454534"...
0.6793221
1
Finds the solution of the cubic equation involved in the computation of the proximity operator of the
def forward(ctx,gamma_mu,xtilde,mode_training=True): # Device CPU/GPU # if device == "cuda": # dtype = torch.cuda.FloatTensor # else : dtype = torch.FloatTensor #initialize variables n,_,nx = xtilde.size() x1,x2,x3 = torch.zeros(n,1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(n=5000,C=-6*10**11,a=900,b=3):\n coeffs = np.zeros(n+2)\n coeffs[0] = a-b*n\n coeffs[1] = b*(n+1) - a\n coeffs[-3] = -C\n coeffs[-2] = 2*C - a\n coeffs[-1] = a+b-C\n mp.dps = 27\n roots = polyroots(coeffs)\n for root in roots:\n print root", "def exactsolution(x, t, u):\n if 0 <= (x - u*t) and (x -...
[ "0.6496338", "0.64271337", "0.630471", "0.6250335", "0.6233523", "0.62026256", "0.61261874", "0.60835856", "0.6069071", "0.60502964", "0.6049461", "0.60204566", "0.59923995", "0.59734356", "0.5964771", "0.595493", "0.5916189", "0.59153", "0.59113973", "0.59004", "0.58809906",...
0.0
-1
Computes the first derivatives of the proximity operator of the log barrier with respect to x and gamma_mu. This method is automatically called by the backward method of the loss function.
def backward(ctx, grad_output_var): xmin = 0 xmax = 1 grad_output = grad_output_var.data gamma_mu,kappa,uTx,x = ctx.saved_tensors n = kappa.size()[0] nx = grad_output.size()[2] u ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _forward_log_det_jacobian(self, x):\n d = self._compute_shared(x=x)\n relx = (x - d.x_k) / d.w_k\n relx = relx # tf.where(d.out_of_bounds, 0.5*tf.ones_like(x), relx)\n grad = (\n 2 * tf.math.log(d.s_k) +\n tf.math.log(d.d_kp1 * relx**2 + 2 * d.s_k * relx * (1 - relx) + # newln\n ...
[ "0.6992019", "0.66589755", "0.6592865", "0.65579003", "0.6555126", "0.64870846", "0.6481399", "0.6379075", "0.6354919", "0.6340459", "0.6330749", "0.6322805", "0.6269888", "0.6226955", "0.61627597", "0.613101", "0.61285204", "0.6118351", "0.6108239", "0.61030525", "0.6101484"...
0.0
-1
Accepts a size and text of a message to print on a shirt.
def make_shirt(size, text): print(f"\nThe size of the shirt is {size} and the printed text reads: {text}.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_shirt(size, message):\n print(\"I need a shirt, size \" + size + \", that says \" + message + \".\")", "def make_shirt(size, text):\n print('You wanted the t-shirt to be in size: ' + size)\n print('The message you wanted on the t-shirt: ' + text)", "def make_shirt(size, message):\n print(\...
[ "0.7987473", "0.7964641", "0.7890728", "0.7831767", "0.7787454", "0.7787454", "0.7602366", "0.7577227", "0.75480956", "0.7529585", "0.73977256", "0.7383219", "0.7383219", "0.7379657", "0.73002464", "0.71007955", "0.6245159", "0.61845994", "0.5964087", "0.59391963", "0.5886760...
0.76433444
6
Accepts a size and text of a message to print on a shirt. Defaults to size large.
def make_shirt(text='I love Python', size='large'): print(f"\nThe size of the shirt is {size} and the printed text reads: {text}.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_shirt(size, message):\n print(\"I need a shirt, size \" + size + \", that says \" + message + \".\")", "def make_shirt(message=\"I love Python\", size=\"L\"):\n print(\"A \" + size + \" t-shirt with the following message: \" + message)", "def make_shirt(size, message):\n print(\"My t-shirt is...
[ "0.7936069", "0.79013073", "0.78979605", "0.773878", "0.7711005", "0.7711005", "0.761596", "0.75709385", "0.7525627", "0.74698335", "0.74698335", "0.746105", "0.7382213", "0.7262654", "0.7155463", "0.70711285", "0.6359491", "0.6280973", "0.6197354", "0.6151389", "0.6046193", ...
0.72824085
13
Accepts a city and a country and prints a simple sentence with those values.
def describe_city(city, country='New Zealand'): print(f"\nThe city of {city} is in {country}.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def city_country(city, country):\n print(f'\"{city.title()}, {country.title()}\"\\n')", "def describe_city(city, country='canada'):\n print(f\"{city.title()} is in {country.title()}.\")", "def describe_city(city, country='Germany'):\n\tprint(f'{city.title()} is in {country.title()}.')", "def describe_c...
[ "0.856302", "0.81208575", "0.8088181", "0.8051179", "0.79706645", "0.79012996", "0.78986406", "0.7809852", "0.77355325", "0.7704453", "0.7686551", "0.7686551", "0.7685671", "0.7684176", "0.7679467", "0.7600646", "0.74408424", "0.7436566", "0.7406232", "0.737946", "0.73696256"...
0.81209445
1
Scaled Exponential Linear Unit. (Klambauer et al., 2017) Arguments
def selu(x): alpha = 1.6732632423543772848170429916717 scale = 1.0507009873554804934193349852946 return scale * elu(x, alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setExponent(self, *args):\n return _libsbml.Unit_setExponent(self, *args)", "def scale(inp, ab):\n\n return inp * ab[0] + ab[1]\n # pass", "def scale(inp, ab):\n\n return inp * ab[0] + ab[1]", "def scale(self):", "def calculate_exponent():\n pass", "def xscale(value):\n impl.xsc...
[ "0.62797046", "0.61946106", "0.61704326", "0.61148554", "0.59997374", "0.5996937", "0.5957179", "0.5904153", "0.5895206", "0.58881485", "0.5836805", "0.57540625", "0.57374054", "0.5706502", "0.5674149", "0.5617635", "0.5616218", "0.5604117", "0.5592343", "0.55895114", "0.5565...
0.5287071
54
Constructor for the NasBackupParams class
def __init__(self, backup_all_existing_snapshot=None, blacklisted_ip_addrs=None, continue_on_error=None, encryption_enabled=None, filtering_policy=None, fld_config=None, full_backup_snapshot_label=None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n include_cluster_scope_resources: pulumi.Input[bool],\n object_type: pulumi.Input[str],\n snapshot_volumes: pulumi.Input[bool],\n excluded_namespaces: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,\n ...
[ "0.64447784", "0.6168862", "0.61534363", "0.6098209", "0.6049831", "0.5995434", "0.5983703", "0.5983703", "0.5976207", "0.597005", "0.59328234", "0.5924585", "0.59173024", "0.5862991", "0.58594143", "0.58371496", "0.58366156", "0.58322644", "0.5827591", "0.58213955", "0.58141...
0.6467344
0
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary backup_all_existing_snapshot = dictionary.get('backupAllExistingSnapshot') blacklisted_ip_addrs = dictionary.get("blacklistedIpAddrs") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83185387", "0.81679726", "0.81679726", "0.81194353", "0.80894536", "0.79789025", "0.7949881", "0.7922983", "0.7898846", "0.7892914", "0.7888425", "0.7882915", "0.7882119", "0.78765213", "0.7858605", "0.78363335", "0.78024834", "0.78024834", "0.78024834", "0.78024834", "0.7...
0.0
-1
Catch Ctrl+C signal to termiante workers
def init_worker(): signal.signal(signal.SIGINT, signal.SIG_IGN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowCtrlC():\n signal.signal(signal.SIGINT, signal.SIG_DFL)", "def signal_handler(*unused_argvs):\n sys.stderr.write(\"\\nCtrl^C caught, bailing...\\n\")\n sys.exit(0)", "def worker_initializer():\n signal.signal(signal.SIGINT, signal.SIG_IGN)", "def _init_worker():\n signal.signal(signal.SIG...
[ "0.7222166", "0.72151893", "0.7180323", "0.71768016", "0.6984043", "0.6946091", "0.69356275", "0.6917393", "0.6899606", "0.6881529", "0.6845854", "0.6804447", "0.67696905", "0.6766118", "0.67553", "0.67504436", "0.66279745", "0.65575314", "0.6528643", "0.64279413", "0.6398735...
0.72294533
0
Wrapper used to pass params to workers
def create_mask_wrapper(args, crop=None, scale=1, flip=False, reflective=False, warm=False, reduce_red=False, saturate=False): input_filename, output_filename = args[0], args[1] try: img, mask = get_mask(input_filename, crop, scale, flip, reflective, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _worker(self, args):\n pass", "def init_worker(*shared_args_list):\n global SHARED_ARGS\n SHARED_ARGS = shared_args_list", "def job_as_parameter(f):\n f.job_as_parameter = True\n return f", "def process_task(params):\n params['task'](params)", "def set_params(self, params):", "d...
[ "0.62962055", "0.6150441", "0.60870606", "0.6063529", "0.58948", "0.5737697", "0.57151204", "0.5712164", "0.56826967", "0.56751645", "0.5674729", "0.5674717", "0.5666531", "0.5652284", "0.56272703", "0.56192535", "0.5603987", "0.559731", "0.5591001", "0.5564014", "0.5558032",...
0.0
-1
This is the toplevel function for processing data. The function is meant to be passed to the importer (in this case GuiIO). The importer will call this function after it has parsed the raw data.
def processing_function(raw): # Sort stewarded & unstewarded depts STEWARDED_DEPTS = set(stewards.keys()) & kt.ALL_DEPTS UNSTEWARDED_DEPTS = kt.ALL_DEPTS - STEWARDED_DEPTS ############################## # Filter data in all the ways ############################## actives = kt....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_data(self, data):\n if verbose(): print(\"TIParser.handle_data(self, '%s')\" % (data))\n pass", "def processInputs(self):", "def run(self, data):\n\t\t# no processing here\n\t\treturn data", "def parse_data(self):\n\t\traise NotImplementedError('%s: No parse function implemented!' % ...
[ "0.6277665", "0.6056177", "0.59779894", "0.59718275", "0.5932694", "0.59140706", "0.58592844", "0.5857117", "0.5857117", "0.5828108", "0.58244014", "0.5787937", "0.5766094", "0.5746301", "0.5732957", "0.571916", "0.57150483", "0.57103926", "0.57093644", "0.5667955", "0.566795...
0.0
-1
Parse a readme file.
def read_readme(readme: str) -> Tuple[dict, list]: metadata = { "name": "na", "provider": "na", "original name": "na", "original filename": "na", "assembly_accession": "na", "tax_id": "na", "mask": "na", "genome url": "na", "annotation url": "n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_readme():\n # Get the long description from the relevant file\n readme_path = path.join(here, 'README.md')\n with codecs.open(readme_path, encoding='utf-8') as handle:\n desc = handle.read()\n\n return desc", "def test_readme():\n readme = Path(README_PATH).read_text()\n Action...
[ "0.7862639", "0.69449455", "0.6925098", "0.6874095", "0.6678023", "0.6647286", "0.65171206", "0.64888984", "0.6395882", "0.6373797", "0.6318565", "0.6261154", "0.62290794", "0.6200871", "0.61734515", "0.61639285", "0.6114276", "0.60170484", "0.5915927", "0.5900081", "0.589507...
0.66518
5
Create a new readme file with supplied information.
def write_readme(readme: str, metadata: dict, lines: list = None): with open(readme, "w") as f: for k, v in metadata.items(): print(f"{k}: {v}", file=f) if lines: for line in lines: print(line, file=f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_readme_txt(self, args):\n with open(self.readme_txt, 'w') as writer:\n log.info(\"args=%s\\n\", args)\n writer.write(\"# Created by pbtranscript-internal-validation.ValidationRunner.make_readme_txt()\\n\")\n writer.write(\"args=%s\\n\\n\" % args)\n\n file...
[ "0.7987224", "0.782059", "0.7738895", "0.77343196", "0.76951265", "0.7692684", "0.7475079", "0.740073", "0.7256037", "0.70500207", "0.6997206", "0.69900995", "0.68761015", "0.68635523", "0.68394893", "0.6829391", "0.6792584", "0.6766892", "0.6707527", "0.6680079", "0.66443956...
0.6952783
12
Update a readme file with supplied information.
def update_readme(readme: str, updated_metadata: dict = None, extra_lines: list = None): metadata, lines = read_readme(readme) if updated_metadata: metadata = {**metadata, **updated_metadata} if extra_lines: lines = lines + extra_lines write_readme(readme, metadata, lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_readme():\n\n temp = \"\"\"<head>\n <title>Unittest Results</title>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\...
[ "0.7689971", "0.722182", "0.70508206", "0.6771436", "0.6603375", "0.65443844", "0.6535205", "0.6525045", "0.6332471", "0.6293604", "0.62730294", "0.6270745", "0.6242984", "0.6230076", "0.6186949", "0.6171401", "0.61592084", "0.61382926", "0.60904527", "0.6066599", "0.6053936"...
0.8195249
0
Context manager to work with (b)gzipped file.
def extracted_file(fname: str): new_fname = extract_gzip(fname) gzipped = True if new_fname is None: new_fname = fname gzipped = False try: yield new_fname finally: if gzipped: try: bgzip_and_name(new_fname) except Exception: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_gzip(fileobj):\r\n sio = cStringIO.StringIO()\r\n gzf = gzip.GzipFile(fileobj = sio, mode = \"wb\")\r\n while True:\r\n data = fileobj.read(buf_size)\r\n if not data:\r\n break\r\n gzf.write(data)\r\n gzf.close()\r\n return sio", "def open_gz(filename, mode):...
[ "0.6809535", "0.675466", "0.661344", "0.6587002", "0.65678066", "0.6511136", "0.6488444", "0.6413921", "0.63567406", "0.63266903", "0.62170494", "0.6216539", "0.62095344", "0.6157152", "0.606511", "0.60540587", "0.6029327", "0.60214204", "0.59915817", "0.59607774", "0.5935949...
0.66227496
2
Extract files from an archive. Archive may be a gzipped or bgzipped file (.gz), a zipped file (.zip) or a tarball (.tar.gz). Optionally, if multiple files are present they may be concatenated into one file.
def extract_archive( fname: str, outfile: Optional[str] = None, concat: bool = False ) -> Union[str, None]: if fname.endswith((".tgz", ".tar.gz")): return extract_tarball(fname, outfile=outfile) elif fname.endswith(".gz"): return extract_gzip(fname, outfile=outfile) elif fname.endswith( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract(apath, ffilter=[]):\n\n files = []\n\n def extract_recursive(curr_apath):\n \"\"\"Look into archive recursively to extract files considering ffilter\"\"\"\n\n handler = resolve_format(curr_apath)\n unpacker = HandlersFactory.get_handler(handler)\n _files = unpacker.fil...
[ "0.6960922", "0.65000236", "0.64723575", "0.64007777", "0.6359527", "0.63576806", "0.6291074", "0.6273226", "0.6227048", "0.62031776", "0.6190727", "0.6112076", "0.60922587", "0.6081641", "0.60304374", "0.60125357", "0.6003538", "0.5969804", "0.5898257", "0.58356404", "0.5832...
0.62739277
7
Convert tar of multiple FASTAs to one file.
def extract_tarball(fname, outfile=None, concat=True) -> Union[str, None]: fnames = [] # Extract files to temporary directory tmp_dir = mkdtemp(dir=os.path.dirname(outfile)) with tarfile.open(fname) as tar: tar.extractall(path=tmp_dir) for root, _, files in os.walk(tmp_dir): fnames +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tar(self):\n with tarfile.open(self.tgzfile, \"w:gz\") as tar_handle:\n for root, _, files in os.walk(self.dirname):\n for file in files:\n tar_handle.add(os.path.join(root, file))", "def combine_fasta_files(fastas_paths, out_file):\n with open(ou...
[ "0.65684086", "0.6300177", "0.62254524", "0.6161973", "0.60660845", "0.59409815", "0.58384496", "0.57276076", "0.5682935", "0.5628571", "0.55928606", "0.5521933", "0.55169624", "0.55039227", "0.54637206", "0.5451794", "0.54454917", "0.542897", "0.53728896", "0.53632414", "0.5...
0.5832278
7
Gunzips the file if gzipped. Also works on bgzipped files.
def extract_gzip(fname: str, outfile: Optional[str] = None) -> Union[str, None]: if not outfile: outfile = fname[:-3] if fname.endswith(".gz"): with gzip.open(fname, "rb") as f_in: with open(outfile, "wb") as f_out: shutil.copyfileobj(f_in, f_out) os.unlink(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gunzip_file(gzip_file, base_dir):\n full_gzip_file = os.path.join(base_dir, gzip_file)\n if not gzip_file.endswith(\".gz\"):\n return gzip_file\n gunzip_file = full_gzip_file.replace(\".gz\", \"\")\n with gzip.open(full_gzip_file, 'rb') as f_in:\n with open(gunzip_file, 'wb') as f_out...
[ "0.76103014", "0.758293", "0.7453833", "0.74080575", "0.73874843", "0.73601073", "0.7083313", "0.6650277", "0.6621982", "0.66076165", "0.6582111", "0.65322065", "0.6479576", "0.64636713", "0.64612234", "0.64612234", "0.6430386", "0.6367628", "0.6275241", "0.6251574", "0.62346...
0.6552791
11
Unzips the file if zipped.
def extract_zip( fname: str, outfile: Optional[str] = None, concat: bool = False ) -> Union[str, None]: if not outfile: outfile = fname[:-4] with ZipFile(fname, "r") as fzip, TemporaryDirectory() as tmpdir: fzip.extractall(path=tmpdir) fnames = glob(f"{tmpdir}/*") if len(fn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unzip(zip_path, output_file, data_folder):\n\n print('Unzipping file: {}'.format(zip_path))\n pyunpack.Archive(zip_path).extractall(data_folder)\n\n # Checks if unzip was successful\n if not os.path.exists(output_file):\n raise ValueError(\n 'Error in unzipping process! {} not found.'.format(outp...
[ "0.73103154", "0.72895694", "0.7225283", "0.7122829", "0.7118282", "0.6995884", "0.69455594", "0.6819211", "0.67483294", "0.67109257", "0.66977614", "0.664706", "0.66354054", "0.6634382", "0.6603002", "0.65897787", "0.6585848", "0.6585062", "0.6572348", "0.65660316", "0.65302...
0.0
-1
Gzip file if requested.
def gzip_and_name(fname, gzip_file=True) -> str: if gzip_file: with open(fname, "rb") as f_in: with gzip.open(fname + ".gz", "wb") as f_out: shutil.copyfileobj(f_in, f_out) os.unlink(fname) fname += ".gz" return fname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_file(self, path):\n\n if path:\n if not matches_patterns(path, self.gzip_patterns):\n return\n\n try:\n original_file = self.open(path, mode=\"rb\")\n except FileNotFoundError:\n pass\n else:\n ...
[ "0.7143728", "0.6788087", "0.654219", "0.6520567", "0.6455454", "0.6441658", "0.64261234", "0.6391219", "0.6348747", "0.6328026", "0.63114715", "0.6300965", "0.6233786", "0.6195819", "0.6182347", "0.61750174", "0.61693275", "0.61632836", "0.6142787", "0.61406815", "0.61263895...
0.608778
23
Bgzip file if requested.
def bgzip_and_name(fname, bgzip_file=True) -> str: if bgzip_file: ret = sp.check_call(f"bgzip {fname}", shell=True) fname += ".gz" if ret != 0: raise Exception(f"Error bgzipping genome {fname}. Is pysam installed?") return fname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compressIfNeeded(self):\n\n if self._mode == \"zip\":\n zip_folder(self._rootExportPath, self.getZipArchiveFullPath())", "def zipFasta(self):\n utils.log(\"zipping {} ...\".format(self.fastaFileName))\n cmd = \"bgzip -f {}\".format(self.fastaFileName)\n utils.runCommand...
[ "0.64540195", "0.61454713", "0.61329705", "0.6086035", "0.5977188", "0.5960336", "0.58702797", "0.5859002", "0.58266616", "0.57801116", "0.5761597", "0.575355", "0.57480204", "0.5744919", "0.573051", "0.5717974", "0.56552184", "0.5648838", "0.5563235", "0.5556836", "0.555637"...
0.6738823
0
Return a function to open a (gzipped) file.
def _open(fname: str, mode: Optional[str] = "r"): if mode not in ["r", "w"]: raise ValueError("mode must be either 'r' or 'w'.") if fname.endswith(".gz"): return gzip.open(fname, mode + "t") return open(fname, mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_gz(filename, mode):\n return gzip.open(filename, mode)", "def open_gzip(fn):\n magic = b'\\x1f\\x8b\\x08'\n l = len(magic)\n with open(fn, 'rb') as f:\n file_start = f.read(l)\n f.seek(0)\n # check if the file is compressed\n if file_start.startswith(magic):\n retu...
[ "0.82734615", "0.8186003", "0.8017077", "0.78277725", "0.7727428", "0.7643111", "0.73564893", "0.73564893", "0.732356", "0.7103141", "0.70543605", "0.70016134", "0.6944863", "0.6920207", "0.6873506", "0.66928023", "0.66770685", "0.6631664", "0.6631664", "0.6600424", "0.658002...
0.677487
15
Returns the lower case file type of a file, and if it is (g)zipped
def get_file_info(fname) -> Tuple[str, bool]: fname = fname.lower() is_compressed = False if fname.endswith((".tgz", ".tar.gz")): is_compressed = True fname = re.sub(r"\.(tgz|tar\.gz)$", "", fname) elif fname.endswith(".gz"): is_compressed = True fname = fname[:-3] el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_type(cls, filename):\n with open(filename) as f:\n file_header = f.read(cls.MAX_FILE_HEADER_LEN)\n for magic, filetype in cls.MAGIC_DICT.items():\n if file_header.startswith(magic):\n return filetype\n return \"uncompressed\"", "def is_zip(fi...
[ "0.75641257", "0.739077", "0.7374025", "0.7309392", "0.69896644", "0.6765388", "0.6685862", "0.6668622", "0.66228014", "0.6619521", "0.6540485", "0.6445927", "0.64198005", "0.641593", "0.6397573", "0.6389309", "0.63834107", "0.63234156", "0.6313959", "0.6312306", "0.63119596"...
0.69038486
5
Return (gzipped) file names in directory containing the given extension.
def glob_ext_files(dirname, ext="fa") -> list: fnames = glob(os.path.join(dirname, f"*.{ext}*")) return [f for f in fnames if f.endswith((ext, f"{ext}.gz"))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_names(path, extension='.json'):\n fn = os.listdir(path)\n l = []\n for f in fn:\n if f.endswith(extension, 4):\n l.append(f)\n l = sorted(l)\n return l", "def list_all_files_with_extension(path, extension, do_unzip=True):\n files = []\n for file in os.listdir(p...
[ "0.7269909", "0.71443665", "0.71007", "0.6931686", "0.68851805", "0.68763983", "0.6823714", "0.67866296", "0.67852724", "0.6752004", "0.6724506", "0.6646473", "0.6645157", "0.66420186", "0.6624232", "0.6605461", "0.65348715", "0.65346175", "0.6510529", "0.64909226", "0.648030...
0.77469283
0
filter a Fasta using the regex function.
def _apply_fasta_regex_func(infa, regex_func, outfa=None): # move the original file to a tmp folder out_dir = os.path.dirname(infa) tmp_dir = mkdtemp(dir=out_dir) old_fname = os.path.join(tmp_dir, "original") if outfa is None else infa new_fname = os.path.join(tmp_dir, "filtered") shutil.move(in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_fasta(\n infa: str,\n outfa: str = None,\n regex: str = \".*\",\n invert_match: Optional[bool] = False,\n) -> list:\n pattern = re.compile(regex)\n\n def keep(header):\n return bool(pattern.search(header)) is not invert_match\n\n return _apply_fasta_regex_func(infa, keep, out...
[ "0.65963423", "0.6402181", "0.6011408", "0.600255", "0.5881439", "0.57979774", "0.5762943", "0.5755297", "0.57551485", "0.57547766", "0.57397467", "0.5717947", "0.5692144", "0.5634937", "0.560354", "0.5600734", "0.5595965", "0.5553075", "0.55393845", "0.5537095", "0.55356854"...
0.676315
0
Filter fasta file based on regex.
def filter_fasta( infa: str, outfa: str = None, regex: str = ".*", invert_match: Optional[bool] = False, ) -> list: pattern = re.compile(regex) def keep(header): return bool(pattern.search(header)) is not invert_match return _apply_fasta_regex_func(infa, keep, outfa)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_fasta_regex_func(infa, regex_func, outfa=None):\n # move the original file to a tmp folder\n out_dir = os.path.dirname(infa)\n tmp_dir = mkdtemp(dir=out_dir)\n old_fname = os.path.join(tmp_dir, \"original\") if outfa is None else infa\n new_fname = os.path.join(tmp_dir, \"filtered\")\n ...
[ "0.69491684", "0.6156863", "0.60775024", "0.59450454", "0.5645844", "0.55811054", "0.5563482", "0.5525892", "0.5522686", "0.5514822", "0.55063164", "0.5468016", "0.5430675", "0.5412103", "0.5391324", "0.5378578", "0.53772795", "0.53680974", "0.5331787", "0.5308409", "0.530364...
0.6979984
0
Detects faces in images, returns a list with images that contain faces and saves these face images in the FacePhoto directory.
def detectFaces_allFiles(directory): files_list = glob.glob(directory) for file in files_list: print(file) img = cv2.imread(file) if img is not None: height, width, channel = img.shape faces = face_cascade.detectMultiScale(img, 1.3, 5) age = find_age(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_face_detections(self):\n self.detector.setInput(self.image_blob)\n self.detections = self.detector.forward()", "def detect_faces(image):\n\n face_locations = face_recognition.face_locations(image)\n return face_locations", "def get_check_folder():\r\n filelist = [file for fil...
[ "0.7326142", "0.72739726", "0.72709846", "0.72338194", "0.7221177", "0.7106792", "0.7075032", "0.6982013", "0.69769347", "0.6973032", "0.69372755", "0.6921899", "0.68639034", "0.67961735", "0.6771518", "0.67294437", "0.6728292", "0.66689503", "0.66174954", "0.661695", "0.6610...
0.72242236
4
Finds the age of the person on the photo, based on the filename
def find_age(str): regex = r"_([0-9]+).+_([0-9]+)" matches = re.search(regex, str) if matches: birth = matches.group(1) picture = matches.group(2) age = int(picture) - int(birth) return age
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_age(self, filepath):\n try:\n fileage = os.path.getmtime(filepath)\n return fileage\n except:\n return 0", "def file_info(self, f):\n ld8 = self.ld8_extract(f) # get luna_date\n sid = self.sesid(ld8) # make luna_visitnum\n age =...
[ "0.6539053", "0.63929635", "0.6130632", "0.6126099", "0.60076624", "0.59946716", "0.5988924", "0.5957687", "0.5947357", "0.5931525", "0.5921615", "0.5881921", "0.5782887", "0.57811505", "0.5766714", "0.5723021", "0.57115793", "0.5673089", "0.5648261", "0.56320405", "0.5610792...
0.68865573
0
Finds the filename in a path.
def extract_filename(str): regex = r"([0-9_-]+).jpg" matches = re.search(regex, str) if matches: return matches.group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_file(filename, search_path, pathsep=os.pathsep):\n for path in string.split(search_path, pathsep):\n candidate = os.path.join(path, filename)\n if os.path.exists(candidate): return os.path.abspath(candidate)\n return None", "def search_file(filename, search_path, pathsep=os.pathsep...
[ "0.77612054", "0.77612054", "0.7716344", "0.750982", "0.74376416", "0.74000573", "0.7346764", "0.7340276", "0.72320473", "0.7171325", "0.71397066", "0.7084991", "0.7063053", "0.6908678", "0.6906146", "0.6898922", "0.6848443", "0.6828708", "0.68076605", "0.67631036", "0.674357...
0.0
-1
Creates an array of images
def create_image_array(files_list): im_array = np.array([np.array(cv2.imread(file)) for file in files_list]) return im_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makearray(self, *args, **kwargs):\n return _image.image_makearray(self, *args, **kwargs)", "def gen_image(self, nimage):\n tmp = [0] * nimage\n for i in np.arange(nimage):\n tmp[i] = self.gen_one_image()\n \n return np.array(tmp)", "def generate_images(\n n:...
[ "0.727521", "0.7118611", "0.7073577", "0.70057833", "0.69419736", "0.689666", "0.68892497", "0.68005633", "0.6778553", "0.67391485", "0.67278343", "0.67162925", "0.6715371", "0.66987485", "0.6670579", "0.6658773", "0.6611052", "0.6609227", "0.65959245", "0.6590915", "0.654894...
0.7637464
0
Creates an array of labels
def create_label_array(files_list): lab_array = np.array([np.array(turn_age_into_vector(find_age(file))) for file in files_list]) return lab_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels_array(self):\n return _build_label_vector_rows(\n [[(label, 1)] for label in self.labels], self.training_labels)[1:].T", "def generate_labels(n_samples):\n return np.ones([n_samples, 1]), np.zeros([n_samples, 1])", "def create_label_array(el):\n num_digits = len(el) # first ...
[ "0.8269726", "0.76015544", "0.7565441", "0.7565441", "0.7460371", "0.73777056", "0.73232925", "0.7319245", "0.72369486", "0.7219482", "0.7186704", "0.716197", "0.71618766", "0.71541744", "0.7145023", "0.7082937", "0.70737344", "0.70646393", "0.70617527", "0.70523167", "0.7051...
0.74500805
5
Saves an array under the name 'filename'
def save_array(array, filename): np.save(filename, array)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_save_array(data, file_name, delimiter=',', ):\n data.tofile(file_name, sep=delimiter)", "def write_csv_file(array, filename):\n\tnp.savetxt(filename, array, delimiter=\",\")", "def save_array(self, name: str, array: np.ndarray):\r\n np.savetxt(self._path_for_csv(name), array, delimiter=\",\...
[ "0.75969416", "0.7330002", "0.7201176", "0.71752346", "0.7159063", "0.7140122", "0.71392435", "0.7069632", "0.6940411", "0.6934702", "0.69181776", "0.68739957", "0.6849441", "0.68114215", "0.67789257", "0.67586243", "0.67484975", "0.67466575", "0.6678462", "0.66758204", "0.66...
0.8585977
0