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
Performs the KolmogorovSmirnov 1or2sided tests modified for right censored timetodeath data, based on residues calculated from functions KSm_2samples or KSm_gof. The test statistic is based on a timetransformed Brownian bridge, more precisely, the sumprema of a Brownian bridge restricted to (0, maxcdf). Asymptotic dist...
def KSm_test(residues, maxcdf, alternative='two-sided', alpha=0.05): Ystats = residues R_MaxCDF = maxcdf R_func = np.sqrt(R_MaxCDF-R_MaxCDF*R_MaxCDF) if alternative=='two-sided': A_MaxAbsY = np.max(np.abs(Ystats)) prob_BrownianBridge = 1-norm.cdf(A_MaxAbsY/R_func)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ks2x(self):\n D, Pval = ks_test(self.x1, self.x2)\n assert_allclose((D, Pval), (0.46, 3.801e-05), rtol=1e-4)\n D, Pval = ks_test(self.x1, self.x2, exact=False)\n assert_allclose((D, Pval), (0.46, 5.084e-05), rtol=1e-4)\n D, Pval = ks_test(self.x1, self.x2[:20])\n ...
[ "0.65256953", "0.63897914", "0.6337468", "0.61477834", "0.6146518", "0.614462", "0.612953", "0.6116342", "0.60985845", "0.59907585", "0.5973902", "0.59544104", "0.59449357", "0.59340596", "0.58936447", "0.5890429", "0.58695716", "0.58615464", "0.58401906", "0.5830212", "0.578...
0.6872264
0
Precreate N partitions ahead of time according to the specified interval unit and interval.
def postgres_auto_partition( model: PostgresPartitionedModel, count: int, interval_unit: PostgresAutoPartitioningIntervalUnit, interval: int, start_from: Optional[date] = None, using="default", ): connection = connections[using] with connection.cursor() as cursor: table = conne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createPartitions(config, logger):\n databaseConnection, databaseCursor = connectToDatabase(config, logger)\n try:\n for aDatabaseObjectClass in databaseObjectClassListForWeeklyPartitions:\n weekIterator = mondayPairsIteratorFactory(config.startDate, config.endDate)\n aDatabaseObject = aDatabaseO...
[ "0.593766", "0.5498116", "0.54152864", "0.53877294", "0.53830886", "0.53789216", "0.5308101", "0.52501756", "0.52337325", "0.5225058", "0.52231616", "0.51973605", "0.51917195", "0.5139701", "0.5094759", "0.50867045", "0.508078", "0.5067348", "0.5050254", "0.50363874", "0.5024...
0.65793604
0
\ This is the function for computing the area of a circle
def compute_area(radius): radius = int(input("What is the radius of the circle? \n> ")) while radius <=0: radius = int(input("Sorry, must give a number greater than 0. \n> ")) area = (pi * pow(radius, 2)) #t.circle(radius) return area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circle_area(circle):\n return pi * circle.radius * circle.radius", "def area_of_circle(radius):\n return radius", "def area(self):\n\t\t#print (self.radius*self.radius*math.pi)\n\t\tcircle_area = (self.radius*self.radius*math.pi)\n\t\treturn circle_area", "def area_circle(r):\n return (r ** 2) *...
[ "0.86200374", "0.85152984", "0.8369336", "0.83354485", "0.8260032", "0.81955415", "0.8193006", "0.81832135", "0.81832135", "0.8163046", "0.7994789", "0.79173636", "0.7911044", "0.7905919", "0.7892326", "0.7857771", "0.7857771", "0.7857082", "0.78449863", "0.78233093", "0.7783...
0.76754487
24
This is the main function
def main(): a = compute_area(20) #t.done() print(a)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main(...
[ "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196", "0.92793196"...
0.0
-1
Algebraic Normal Form Transformation Function to transform TruthFalse Table(TFT) to AlgebraicNormal Form Table(AFT)
def ANFT(TFT, n_bit): mask = [0x5555555555555555, 0x3333333333333333, 0x0F0F0F0F0F0F0F0F, 0x00FF00FF00FF00FF, 0x0000FFFF0000FFFF, 0x00000000FFFFFFFF] if n_bit > 6: # mask size up for x in range(6,n_bit): mask = [ ( k << (1<<x) ) | k for k in mask] mask.append( ( 1 << (1<<x) ) - 1 ) ANF = TFT fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oracle(t):\n for entry in t.table:\n model = {e.v: e.b for e in entry}\n t.table[entry] = getTruthVal(t.formula, model)", "def tt_true(alpha):\n return tt_entails(TRUE, expr(alpha))", "def _forward_aftf(self, model_tf, model_af, teacher_forcing_ratio, src, tgt=None, hidden=None):\n\n\t\...
[ "0.5500303", "0.54892623", "0.5412878", "0.5393198", "0.535414", "0.5342857", "0.5339971", "0.52146155", "0.51947224", "0.51599306", "0.5148058", "0.5147754", "0.51472366", "0.513558", "0.5117326", "0.5074601", "0.5074434", "0.5061124", "0.5060087", "0.5040763", "0.5008108", ...
0.5289173
7
Render Hebrew in a dataframe.
def pretty_hebrew(val): return 'font-size:20px; font-family: Times New Roman; text-align: right; max-width: 500px'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp(df):\n display(HTML(df.to_html(index=False)))", "def df_to_html(df, percentage_columns=None): # pragma: no cover\n big_dataframe_setup()\n try:\n res = \"<br><h2> {} </h2>\".format(df.name)\n except AttributeError:\n res = \"\"\n df.style.set_properties(**{\"text-align\": \...
[ "0.6045315", "0.55508834", "0.53905046", "0.53869677", "0.5380068", "0.53508544", "0.53235275", "0.5310591", "0.53040236", "0.52949053", "0.5287557", "0.5267061", "0.52548164", "0.51928174", "0.5151537", "0.51386535", "0.5135061", "0.5115769", "0.50743735", "0.5065344", "0.50...
0.5721064
1
Retrieve an even spread of indices for an array/Series. This allows us to access representative samples from across the corpus.
def get_spread(array, n): end = len(array) - 1 spread = np.ceil(np.linspace(0, end, n)).astype(int) indices = np.unique(spread) try: return array[indices] except KeyError: return array.iloc[indices]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_ndindex(self): # itermaster_indices(self):\n return itertools_product(\n *[range(*r) for r in self.location]\n ) # TODO check", "def get_odd_indices(items):\n\n result = []\n\n for i in range(len(items)):\n if i % 2 != 0:\n result.append(items[i])\n ...
[ "0.5990912", "0.586502", "0.57603425", "0.5759859", "0.5582475", "0.54895645", "0.54612243", "0.54612243", "0.5399744", "0.5368337", "0.5368337", "0.5365263", "0.5364654", "0.53515476", "0.53500444", "0.53310245", "0.5315511", "0.5313844", "0.53134716", "0.5305348", "0.528973...
0.56984794
4
Initialize a TS object. Objects can be set up in advance to handle showing text examples in various ways.
def __init__( self, default=['ref', 'sentence', 'text_full'], stylize=['sentence', 'text_full'] ): self.default = default self.stylize = stylize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, text=None, settings=None, style='General', language='en'):\n\n self._text = None\n self._settings = None\n self._style = None\n self._language = None\n\n self.text = text\n self.settings = settings\n self.style = style\n self.language = lan...
[ "0.6632662", "0.6520892", "0.6444959", "0.64377004", "0.6428854", "0.6423109", "0.6410798", "0.6398391", "0.63672596", "0.6342846", "0.6342076", "0.6310354", "0.6302436", "0.62743425", "0.62743425", "0.6247263", "0.6247249", "0.6237559", "0.62373495", "0.62357384", "0.6230348...
0.0
-1
Display text from pandas dataframe in a readable way.
def show(self, df, extra=[], spread=25): original_shape = df.shape df = df[self.default + extra] if spread > 0: spread_i = get_spread(df.index, spread) df = df.loc[spread_i] print(f'showing {df.shape[0]} of {original_shape[0]}') return df.style.applymap(pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp(df):\n display(HTML(df.to_html(index=False)))", "def dataframe_displayer(df):\n\n #On paramètre les options d'affichage du module pandas\n pd.set_option('display.max_rows', None)\n pd.set_option('display.max_columns', None)\n pd.set_option('display.width', None)\n pd.set_option('displa...
[ "0.75395435", "0.72688955", "0.70835507", "0.7035714", "0.68449616", "0.67619646", "0.67254525", "0.66482043", "0.66439724", "0.66122115", "0.6609695", "0.6605969", "0.64827514", "0.64722687", "0.64579034", "0.6407661", "0.6396057", "0.63540727", "0.63226455", "0.6304139", "0...
0.61459875
24
Highlight max value in a df column.
def highlight_max(s): is_max = s == s.max() return ['color: red' if v else '' for v in is_max]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxi():\r\n st.dataframe(Data.style.highlight_max(axis=0))", "def cap_max_value(df: pd.DataFrame, column_to_inspect: str, max_value: int):\n df[column_to_inspect] = df[column_to_inspect].apply(\n lambda e: max_value if e > max_value else e\n )\n return df", "def get_max(self):\n max_v...
[ "0.82482255", "0.6967719", "0.6817424", "0.6588132", "0.6160784", "0.61431545", "0.6142863", "0.61231637", "0.6037209", "0.59772366", "0.5962047", "0.5901562", "0.58320314", "0.5809634", "0.5805705", "0.5800764", "0.577911", "0.5759357", "0.57381505", "0.57301617", "0.5671461...
0.6596062
3
Highlights values of significance (Fishers > or < 1.3)
def highlight_sig(s, sig_up=1.3, sig_down=-1.3): if s > sig_up: color = 'red' elif sig_down and s < sig_down: color = 'blue' else: color = '' return f'color: {color}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_asterisks_for_pvalues(p_value: float) -> str:\n if p_value > 0.05:\n p_text = 'ns' # above threshold => not significant\n elif p_value < 1e-4:\n p_text = '****'\n elif p_value < 1e-3:\n p_text = '***'\n elif p_value < 1e-2:\n p_text = '**'\n else:\n p_text...
[ "0.6147681", "0.60268", "0.5935397", "0.57792556", "0.56955093", "0.56858623", "0.56256944", "0.55794066", "0.55333316", "0.5410458", "0.5373016", "0.5372324", "0.535689", "0.5330833", "0.53244615", "0.5291927", "0.5291292", "0.5285873", "0.5270331", "0.52608687", "0.5260068"...
0.6011563
2
Show proportion dataframe with highlighting.
def df_highlighter(pr_df, rule='max'): if rule == 'max': return pr_df.style.apply(highlight_max, 1) elif rule == 'fishers': return pr_df.style.applymap(highlight_sig) else: return pr_df.style
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self, df, extra=[], spread=25):\n original_shape = df.shape\n df = df[self.default + extra]\n if spread > 0:\n spread_i = get_spread(df.index, spread)\n df = df.loc[spread_i]\n print(f'showing {df.shape[0]} of {original_shape[0]}')\n return df.style...
[ "0.61285084", "0.58342224", "0.58050156", "0.5471041", "0.53932345", "0.5360068", "0.53036433", "0.52993584", "0.5256975", "0.52450204", "0.51859456", "0.51738006", "0.5134529", "0.51012987", "0.50567937", "0.5041237", "0.5036244", "0.5028948", "0.49912107", "0.49670103", "0....
0.58691823
1
Check that the format of ``X`` is a column vector of single nonnegative values, representing each observation of performance. For example ``[[0]; [0]; [1]; [1]]``.
def _check_input(self, X): symbols = np.concatenate(X) if len(symbols) == 1: # not enough data raise ValueError("expected at least 1 observation " "but none found.") elif (symbols < 0).any(): # contains negative integers raise ValueErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_data_type_column_data(X):\n if type(X) is not numpy.ndarray:\n raise TypeError(\"X should be type numpy.ndarray\")\n\n if len(X.shape) == 2 and X.shape[1] > 1:\n raise TypeError(\"X should have a single column.\")", "def _validate_X(X):\n return X if not isinstance(X, pd.DataFram...
[ "0.68836063", "0.66894436", "0.6302034", "0.6250377", "0.61786705", "0.61228245", "0.60884136", "0.6060105", "0.6032114", "0.60302985", "0.6027103", "0.60228115", "0.602003", "0.60032636", "0.58549327", "0.5782543", "0.57701117", "0.57576823", "0.57034236", "0.5665207", "0.56...
0.6482836
2
Contract a url to appear with ...
def contract_url(full_url: str) -> str: url_lst = list(urlparse(full_url)) # delete params, query and fragment for i in [3, 4, 5]: url_lst[i] = '' # reduce url : path parts path_parts = url_lst[2].split('/') url_lst[2] = '/'.join((path_parts[0], '...', path_parts[-2], path_parts[-1])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url():\n ...", "def Url(self) -> str:", "def getURLForThing(thing):", "def url(self):\n ...", "def _get_url(self, absolute):", "def _make_url(self):\n ...", "def barbican_url(self):", "def getUrl(self): #$NON-NLS-1$\r", "def getUrl(self): #$NON-NLS-1$\r", "def url(value: Any)...
[ "0.7167087", "0.68935114", "0.6864655", "0.676524", "0.6762277", "0.6743901", "0.6731575", "0.6582797", "0.6582797", "0.6387894", "0.63856906", "0.6275019", "0.6207124", "0.6204853", "0.618647", "0.6157551", "0.61370784", "0.6119102", "0.608851", "0.60628134", "0.6057733", ...
0.65377325
9
Validate if the passed argument looks like a valid url.
def is_valid_url(url: str) -> bool: try: result = urlparse(url) return all([result.scheme, result.netloc]) except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_url(value):\n\n valid = validators.url(value)\n if valid != True:\n return False", "def check_url(value):\n\n valid = validators.url(value)\n if valid is not True:\n return False", "def validate_url(self):\n pass", "def validate_url(ctx, param, value):\n try:\n ...
[ "0.8343673", "0.8324227", "0.83120877", "0.8292005", "0.8033375", "0.7874858", "0.78653574", "0.78576237", "0.78355736", "0.77103376", "0.766898", "0.7654561", "0.76491636", "0.76035684", "0.75911057", "0.755884", "0.7558228", "0.75480825", "0.7546638", "0.7536757", "0.752520...
0.6924069
64
Guess proper extension to use, even if charset is present in content_type and return correct content_type and encoding
def get_file_properties(content_type: str) -> Tuple[Optional[str], str, Union[str, None]]: mimetype = content_type split_content = content_type.split(';') for kind_of_mimetype in MimeTypes().types_map_inv: for key in kind_of_mimetype: if content_type.startswith(key): mime...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_content_type(filename):\n return mimetypes.guess_type(filename)[0]", "def get_content_type(filename):\n return mimetypes.guess_type(filename)[0] or 'application/octet-stream'", "def mime_type(filename):\n mtype, encoding = guess_type(filename, False)\n if encoding is None:\n re...
[ "0.7467614", "0.7455589", "0.74175483", "0.74045914", "0.73745525", "0.7344425", "0.7320522", "0.72870165", "0.72122365", "0.72029465", "0.7169633", "0.7083688", "0.7048419", "0.7022877", "0.6990958", "0.6981873", "0.6943346", "0.69113547", "0.69075614", "0.68120575", "0.6799...
0.6245146
57
read the employed filters form mongodb
def search_filter(run, database_url): # there was a change of Mongo DB data names on 5/12/2022 NEW_DB_NAMES_DATE = Time("2022-12-04T00:00:00") filters = None try: myclient = pymongo.MongoClient(database_url) mydb = myclient["CACO"] mycol = mydb["RUN_INFORMATION"] mydo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filters(self):", "def show(collection, filter = {}):\n # creates a connection with database\n result = []\n myclient = pymongo.MongoClient(\"mongodb://localhost:27017/\")\n db = myclient[\"techstart\"]\n col = db[collection]\n for x in col.find(filter):\n result.append(x)\n re...
[ "0.64909655", "0.6436426", "0.6325038", "0.6300973", "0.6111088", "0.6040708", "0.59931797", "0.59482014", "0.58845925", "0.5862643", "0.58581936", "0.5748898", "0.574504", "0.5711672", "0.5710288", "0.5703471", "0.5653795", "0.5636129", "0.5635836", "0.5629959", "0.5624123",...
0.6242448
4
return the range of charges to select the FF events
def define_FF_selection_range(filters): try: if filters is None: raise ValueError("Filters are not defined") # give standard values if standard filters if filters == '52': min_ff = 3000 max_ff = 12000 else: # ... recuperate transmiss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frame_range(self):\n #self._root = self.get_root_node()\n #startFrame = int(self._root.knob('first_frame').value())\n #endFrame = int(self._root.knob('last_frame').value())\n start_frame = self.comp.GetAttrs()['COMPN_GlobalStart']\n end_frame = self.comp.GetAttrs()['COMPN...
[ "0.62861806", "0.6117578", "0.6042798", "0.5835499", "0.582951", "0.5815776", "0.5805924", "0.5783285", "0.5773193", "0.57697636", "0.5713394", "0.57039326", "0.5681363", "0.56797296", "0.5673457", "0.56675774", "0.5662138", "0.5642486", "0.5599165", "0.55884147", "0.5559053"...
0.5883961
3
Gets a client item from pypodio, from the app_id given to the podioApi object when it was created. Optionally it receives an app_token; in that case it doesn't need to fetch it from the database
def _getClient(self, app_token=None): if app_token is None: from . import models app_token = models.Aplicacion.objects.get(app_id=self.app_id).app_token return api.OAuthAppClient(settings.CLIENT_ID, settings.CLIENT_SECRET, self.app_id, app_token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app(self, app_id):\n return req(self.logger, self.access_token, 'GET', '/apps/'+app_id, {})", "def client(app=None):\n fs_client = _utils.get_app_service(app, _FIRESTORE_ATTRIBUTE, _FirestoreClient.from_app)\n return fs_client.get()", "async def getAppProduct(self, item_id=None):\n ...
[ "0.60084134", "0.59242415", "0.5678864", "0.56198317", "0.55885607", "0.5561114", "0.55412453", "0.5527581", "0.54644537", "0.5451878", "0.54084194", "0.5390055", "0.52960443", "0.52796483", "0.5270817", "0.52567786", "0.52563524", "0.5234272", "0.5232072", "0.52201605", "0.5...
0.6530229
0
Gets a client item from pypodio, from the app_id given to the podioApi object when it was created. Optionally it receives an app_token; in that case it doesn't need to fetch it from the database
def _get_user_client(self): return api.OAuthClient(settings.CLIENT_ID, settings.CLIENT_SECRET, settings.USER, settings.PASSWORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getClient(self, app_token=None):\n if app_token is None:\n from . import models\n app_token = models.Aplicacion.objects.get(app_id=self.app_id).app_token\n return api.OAuthAppClient(settings.CLIENT_ID, settings.CLIENT_SECRET, self.app_id, app_token)", "def get_app(self, a...
[ "0.65294015", "0.6007599", "0.59230196", "0.567923", "0.56193274", "0.558811", "0.55612177", "0.55416614", "0.5526898", "0.54644465", "0.5450976", "0.5407792", "0.53885126", "0.5295762", "0.52805233", "0.5270884", "0.525668", "0.52552396", "0.5234798", "0.52323115", "0.522073...
0.0
-1
Returns raw information of the api object's application, as a Python dictionary.
def getAppInfo(self): data = self._client.Application.find(self.app_id) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n return {\n 'app_id': self.id,\n 'name': self.name,\n 'app_info': [item.serialize for item in self.appinfo.all()]\n }", "def get_app_details(self, app_id):\n app_data = AppData.objects.get(uid=app_id)\n return model_to_dict(app_da...
[ "0.7094638", "0.694228", "0.6678645", "0.6611751", "0.65245116", "0.6498092", "0.64952576", "0.64924556", "0.64852405", "0.6457486", "0.6449787", "0.64373326", "0.64291966", "0.64280385", "0.6368658", "0.6310357", "0.6304767", "0.629864", "0.6292921", "0.6239421", "0.6216532"...
0.74249846
0
Returns up to 500 items from the application of the api object
def getAllItems(self): data = self._client.Item.filter( int(self.app_id), { 'limit': 500, # 'filters':[{ # "key":"96943879", #En este pedazo se está filtrando sobre un campo, se quiere coger sólo a los # "values":[1], # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items(id_name, request, client):\n result = client.quick_search(request)\n \n items_pages = []\n limit_to_x_pages = None\n for page in result.iter(limit_to_x_pages):\n items_pages.append(page.get())\n\n items = [item for page in items_pages for item in page['features']]\n \n \n ...
[ "0.67508894", "0.664367", "0.64673984", "0.63955134", "0.6317725", "0.6256077", "0.6217763", "0.61812997", "0.61738914", "0.61431915", "0.6109311", "0.6094736", "0.60822", "0.6079041", "0.6057293", "0.60489136", "0.59897757", "0.5980726", "0.59784055", "0.5967311", "0.596088"...
0.6402587
3
Returns all items belonging to a certain view, given by its ID. As all new methods, it automatically asks for the external ID
def get_items_by_view(self, view_id, depth=1): data = self.filter_by_view( int(self.app_id), int(view_id),{ 'limit': 500, }, )["items"] fields = [self.make_dict(item, external_id=False, depth=depth, optimize=True) for item in data] return fields
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self, item_id):\n pass", "def view(self, view_id):\r\n return resources.View(self, view_id)", "def get_user_items(self, id):\n return self.execute(TABELLE['items']['select']['by_id'], (id,))", "def __getView(self, raw_view_id):\n if iDevice.dump_view:\n self.__...
[ "0.6050449", "0.60087174", "0.58421457", "0.5774646", "0.57450885", "0.5733086", "0.5725173", "0.5718675", "0.5693349", "0.56803656", "0.56435144", "0.5628805", "0.5583422", "0.5583316", "0.5546081", "0.5523566", "0.55118436", "0.5508082", "0.5507996", "0.5435928", "0.5392885...
0.65132153
0
Returns a dictionary with a PODIO item's values
def getItem(self, itemID, no_html=False): data = self._client.Item.find(int(itemID)) item = self.makeDict(data, no_html=no_html) return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dict(self):\n return {\n \"type\": self.item_type,\n \"size\": self.size,\n \"toppings\": self.toppings,\n \"price\": self.get_price()\n }", "def getItemDict(self, item):\n newDict = {}\n itemDict = item.__dict__\n newDict['en...
[ "0.71687436", "0.6938036", "0.68361694", "0.6801557", "0.67747205", "0.6739883", "0.65186024", "0.6483458", "0.6469224", "0.63237864", "0.6301813", "0.6299168", "0.6295328", "0.6295136", "0.6280812", "0.6270648", "0.62659365", "0.62576574", "0.6193457", "0.6158187", "0.612844...
0.0
-1
Returns a dictionary with a PODIO item's type, and all its values
def get_item(self, itemID, no_html=False, external_id=False, depth=1): data = self._client.Item.find(int(itemID)) item = self.make_dict(data, no_html=no_html, external_id=external_id, depth=depth) return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dict(self):\n return {\n \"type\": self.item_type,\n \"size\": self.size,\n \"toppings\": self.toppings,\n \"price\": self.get_price()\n }", "def _item_to_dict(self, raw_response):\n\n if 'Item' not in raw_response:\n return {}\n...
[ "0.6959421", "0.68979734", "0.67472816", "0.6516262", "0.65128547", "0.63956493", "0.6355327", "0.63416785", "0.6290631", "0.6220397", "0.6180295", "0.61372596", "0.6122777", "0.61094767", "0.6106699", "0.60883003", "0.60635006", "0.60043234", "0.59833074", "0.5959798", "0.59...
0.0
-1
Returns the raw dictionary data of a PODIO API request for an item
def getRawItem(self, itemID): data = self._client.Item.find(int(itemID)) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item_data(item):\n\n return OnedriveItem(\n id=item.get('id'),\n name=item.get('name'),\n web_url=item.get('webUrl'),\n created_by=item.get('createdBy')\n ).__dict__", "def getItemData(itemId):\n return Gw2Spidy._request('item', str(itemId)...
[ "0.6920951", "0.6703889", "0.63673556", "0.6256671", "0.6234398", "0.62308675", "0.61181307", "0.61075073", "0.6006882", "0.59521264", "0.5939555", "0.59324753", "0.5909517", "0.5863737", "0.57638574", "0.5731633", "0.5724982", "0.5708845", "0.57056165", "0.5700618", "0.56990...
0.6562992
2
Creates a dictionary with the external_id of the item's fields ad keys, and their values as the dictionary values.
def makeDict(self, item, nested=False, no_html=False): dictionary = dict([(field["external_id"], self.getFieldValue(field, nested, no_html)) for field in item["fields"]]) return {'item': item["item_id"], 'values':dictionary}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dict(self, item, external_id=True, no_html=False, depth=1, optimize=False):\n if external_id:\n key_type = \"external_id\"\n else:\n key_type = \"field_id\"\n\n dictionary = dict([(field[key_type], {\"label\":field[\"label\"], \"type\": field[\"type\"], \"value\"...
[ "0.7522956", "0.6268185", "0.6242335", "0.61984485", "0.5945112", "0.59421134", "0.59377867", "0.58974934", "0.5887909", "0.58877665", "0.5864283", "0.58118176", "0.5773755", "0.57677674", "0.57671314", "0.57475454", "0.57330495", "0.5711399", "0.5707601", "0.56359065", "0.55...
0.7668655
0
Creates a dictionary with the external_id of the item's fields ad keys, and their values as the dictionary values. This second versions allows to choose between the field_id or the external_id for the dictionary's key, and adds the field type to the generated dictionary.
def make_dict(self, item, external_id=True, no_html=False, depth=1, optimize=False): if external_id: key_type = "external_id" else: key_type = "field_id" dictionary = dict([(field[key_type], {"label":field["label"], "type": field["type"], "value": self.getFieldValue(fiel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeDict(self, item, nested=False, no_html=False):\n dictionary = dict([(field[\"external_id\"], self.getFieldValue(field, nested, no_html)) for field in item[\"fields\"]])\n return {'item': item[\"item_id\"], 'values':dictionary}", "def _item_to_dict(self, raw_response):\n\n if 'Item' n...
[ "0.71578294", "0.6062752", "0.5871339", "0.58003277", "0.5790452", "0.5784216", "0.5772315", "0.5709299", "0.56147534", "0.55840975", "0.5571692", "0.5539155", "0.5517967", "0.5512531", "0.5494441", "0.54721624", "0.5455877", "0.5452799", "0.544782", "0.54249597", "0.54240185...
0.7510255
0
Gets the value of a field from its raw JSON data
def getFieldValue(self, field, no_html=False, external_id=True, depth=1, optimize=False): if field["type"] == "category": if field["config"]["settings"]["multiple"]: values = [] for category in field["values"]: values.append(category["value"]["text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getValue(self, field):\n if self._contents.has_key(field):\n return self._contents[field]\n else:\n return None", "def get_json_field(json_data, field_names):\n field_value = None\n if isinstance(field_names, str):\n field_value = json_data.get(field_names)\n...
[ "0.6900681", "0.68503773", "0.68385494", "0.6758268", "0.6650948", "0.66257554", "0.64872926", "0.6480228", "0.6368584", "0.6366463", "0.6309073", "0.6272095", "0.62616026", "0.6252014", "0.6238251", "0.6209142", "0.6209142", "0.61597204", "0.61334413", "0.6108801", "0.607892...
0.0
-1
Mini Wrapper sobre la API de PODIO
def updateItem(self, item, values): print ('Updating item: ' + unicode(item)) item = int(item) #Importante: Para evitar que se caiga la api de PODIO más adelante message = self._client.Item.update(item, {'fields':values}) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api(self) -> str:", "def api():\n\treturn \"The API call\"", "def maya_useNewAPI():\r\n\r\n pass", "def maya_useNewAPI():\n\n pass", "def prepare_api(self):\n return None", "def maya_useNewAPI():\n pass", "def maya_useNewAPI():\n pass", "def maya_useNewAPI():\n pass", "def...
[ "0.69554204", "0.63999933", "0.629019", "0.61893016", "0.6093434", "0.6083475", "0.6083475", "0.6083475", "0.6083475", "0.6083475", "0.6058177", "0.60373265", "0.60373265", "0.59906673", "0.5949104", "0.59378177", "0.5919744", "0.58709735", "0.5832327", "0.58265775", "0.58219...
0.0
-1
Creates a copy of a file
def copy_file(self, file_id): return self._client.Files.copy(file_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_file(file, destination):\n with open(file, 'rb') as infile, open(destination, 'wb') as outfile:\n outfile.write(infile.read())", "def _copy_file ( self, source, dest ):\n return", "def copyfile(self, source, outputfile):\n shutil.copyfileobj(source, outputfile)", "def copyfile(...
[ "0.75532544", "0.75361425", "0.7515933", "0.7515933", "0.7515933", "0.74197024", "0.7371027", "0.732345", "0.7283948", "0.718722", "0.716877", "0.70954466", "0.7067867", "0.7055726", "0.7052006", "0.7050571", "0.69794565", "0.6937365", "0.69331384", "0.6919525", "0.6917158", ...
0.619425
60
This method takes an item's values and copies them to a new item in the target app.
def copy_item(self, origin_item_id, target_app_id, field_conversor, extra_data = None, silent=False, hook=True): source_item = self.get_item(origin_item_id, external_id=False) if extra_data is None: destination_dict = {} else: destination_dict = extra_data try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Copy(self, items):\r\n \r\n self.Clear()\r\n\r\n for item in items._items:\r\n self._items.append(item)\r\n \r\n self._selection = items._selection\r\n self._rowCount = items._rowCount\r\n self._columnCount = items._columnCount\r\n\r\n self._ba...
[ "0.6275045", "0.6155121", "0.60563624", "0.59427583", "0.58470327", "0.5806149", "0.5760919", "0.5711546", "0.5645925", "0.5640575", "0.56116366", "0.5557648", "0.5505642", "0.54528534", "0.54519296", "0.54476357", "0.54476357", "0.54476357", "0.5418839", "0.5403946", "0.5396...
0.68416226
0
Used to find possible items for a given application field.It searches the relevant apps for items matching the given text
def find_referenceable_items(self, field_id, **kwargs): return self._client.transport.GET(url="/item/field/%s/find" % field_id, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items_to_find(self):\n self.items_to_find = ['sole', 'farina', 'innaffiatoio']", "def findItems(self, QString, Qt_MatchFlags): # real signature unknown; restored from __doc__\r\n pass", "def search_items(self, filter_text, type_filter=None):\n output = []\n\n for item in sel...
[ "0.60159785", "0.5973214", "0.5912032", "0.59093744", "0.58590174", "0.5700601", "0.56919837", "0.55964214", "0.55567706", "0.5556644", "0.55330944", "0.5465112", "0.54303765", "0.5428175", "0.53825617", "0.53668326", "0.530895", "0.5301623", "0.52902335", "0.5282277", "0.520...
0.0
-1
Comments an item. This one is made to be similar to the methods in the official API, but as they don't have a comment Area it is here instead
def comment(self, commentable_type, commentable_id, attributes): attributes = json.dumps(attributes) return self._client.transport.POST(url="/comment/%s/%s/" % (commentable_type, commentable_id), body = attributes, type='application/json')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment(self, commentable, comment_text, oneshot=False, commentid=None):\r\n \r\n response = utils.comment(commentable, comment_text, self, oneshot, commentid)\r\n return response", "def comment(self, body, incident_id):\n payload = {\"comment\":{\"body\":body, \"is_private\":\"fa...
[ "0.6826038", "0.6633439", "0.6525263", "0.6455125", "0.63550156", "0.63332283", "0.63261795", "0.63261294", "0.62601733", "0.62183535", "0.6209049", "0.61842626", "0.61842626", "0.61602426", "0.6159475", "0.6159475", "0.61495006", "0.6102226", "0.6087609", "0.60688955", "0.60...
0.62981033
8
Suggest a new configuration.
def get_config(self, **kwargs) -> Optional[Dict[str, Any]]: if self.current_individual >= len(self.current_population): raise Exception( "It seems that some configurations are sill pending, while querying a new configuration. " "Note that NSGA-2 does not support asyn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggest_config(parameters, trial):\n config = {}\n for c_name, c_type, c_vals in parameters:\n if c_type == \"choice\":\n config[c_name] = trial.suggest_categorical(c_name, c_vals)\n elif c_type == \"int\":\n config[c_name] = trial.suggest_int(c_name, c_vals[0], c_vals...
[ "0.58921176", "0.5606324", "0.5534189", "0.55006146", "0.5446565", "0.5440246", "0.54179734", "0.5391896", "0.5388759", "0.5381994", "0.5381994", "0.5369319", "0.53307545", "0.5330552", "0.53151995", "0.53044623", "0.5284971", "0.5268889", "0.5268418", "0.5253923", "0.5242361...
0.0
-1
Move the fist based on mouse position.
def update(self): pos = pygame.mouse.get_pos() self.rect.midtop = pos if self.punching: self.rect.move_ip(5, 10) # move fist position in place
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow_mouse(self, mouse):\n half_width = self.width() / 2\n self.left = mouse.get_x() - half_width\n self.right = mouse.get_x() + half_width", "def follow(self):\n\t\tpos = pygame.mouse.get_pos()\n\t\tself.x = pos[0]\n\t\tself.y = pos[1]\n\t\tself.draw()", "def mousePosition(self):", ...
[ "0.71755165", "0.7101349", "0.7000044", "0.6952539", "0.6935647", "0.6929391", "0.68467486", "0.68411225", "0.6729126", "0.6657786", "0.66523236", "0.66523236", "0.6651963", "0.66329193", "0.6623596", "0.6551806", "0.6551806", "0.65431446", "0.6522208", "0.65183115", "0.64927...
0.71138275
1
Return true if the fist puch the target.
def punch(self, target): if not self.punching: self.punching = 1 hitbox = self.rect.inflate(-5, 5) return hitbox.colliderect(target.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_target(self):\n return self.target is not None", "def has_target(self):\n return self._has_target", "def at_target(self):\n return self.location == self.target_location", "def is_gentarget(self, target):\r\n raise NotImplementedError", "async def is_target_reached(self) -> b...
[ "0.69520533", "0.67619824", "0.6655814", "0.65197814", "0.64459985", "0.63813573", "0.6369632", "0.63250804", "0.6314041", "0.6247709", "0.61930215", "0.61333776", "0.61055756", "0.59864825", "0.5981503", "0.5981503", "0.5960915", "0.5945673", "0.5939604", "0.5932188", "0.591...
0.54833555
97
Walk or spin, depending on the state of the monkey.
def update(self): if self.dizzy: self._spin() # shrink the monkey when it has been punched every 5 times if Chimp.count_punch % 5 == 0: self.image = pygame.transform.scale(self.image, (self.rect.width - 5, self.rect.height - 5)) else: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n memory.speech.say('Spinning!')\n ball = memory.world_objects.getObjPtr(core.WO_BALL)\n if ball.seen:\n self.finish()\n \n commands.setWalkVelocity(0, 0, -0.25)", "def update(self):\n if self.dizzy:\n self._spin()\n else:\n self._walk()", ...
[ "0.6594108", "0.6580616", "0.6026369", "0.60068417", "0.5992778", "0.5916725", "0.59090185", "0.5890624", "0.5876923", "0.5809275", "0.5790469", "0.5790469", "0.5732059", "0.5707859", "0.569453", "0.55759734", "0.5574101", "0.5472217", "0.54465014", "0.54256546", "0.54200894"...
0.4983951
87
Spin the monkey when it is punched.
def _spin(self): center = self.rect.center self.dizzy += 12 # rotate 12 degree clockwise if self.dizzy >= 360: self.dizzy = 0 self.image = self.original # reset the image to its original ones after rotated else: self.image = pygame.transform.rotate(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\r\n autostartup()", "def startSpawing(self):\n self.girderManager.startSpawing()", "def pulley_activate(self):\n self.pulley(\"up\")\n time.sleep(5 * 0.7)\n self.pulley(\"stop\")\n time.sleep(2)\n self.pulley(\"down\")\n time.sleep(2.85)\n s...
[ "0.6571718", "0.6313852", "0.6298468", "0.62581044", "0.62537414", "0.6229416", "0.61824983", "0.6110794", "0.6099366", "0.6098586", "0.608114", "0.60767174", "0.60506225", "0.6033881", "0.5973775", "0.594029", "0.59379596", "0.59212846", "0.5893502", "0.58599186", "0.5846938...
0.0
-1
Move the monkey across the scree, turnaround when it reaches the end.
def _walk(self): new_pos = self.rect.move((self.move, 0)) # move 9 pixel to the right per frame if self.rect.left < self.area.left or self.rect.right > self.area.right: self.move = -self.move # move to the opposite direction when the chimp position exceeds the screen new_pos = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n move()\n move()\n pick_beeper()\n move()\n turn_left()\n for i in range(2):\n move()\n put_beeper()\n turn_around()\n move_to_wall()\n turn_right()\n move_to_wall()\n turn_around()", "def foward_shimmey(self):\n for x in range(6):\n self....
[ "0.6293175", "0.6188732", "0.61269486", "0.6100515", "0.60992014", "0.6092559", "0.60872597", "0.60869735", "0.60626805", "0.60558814", "0.6001239", "0.59711635", "0.59577036", "0.594625", "0.5932024", "0.5930882", "0.5926476", "0.5900304", "0.58895755", "0.5858425", "0.58563...
0.6345669
0
Cause the monkey to start spinning.
def punched(self): if not self.dizzy: self.dizzy = 1 self.original = self.image Chimp.count_punch += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n memory.speech.say('Spinning!')\n ball = memory.world_objects.getObjPtr(core.WO_BALL)\n if ball.seen:\n self.finish()\n \n commands.setWalkVelocity(0, 0, -0.25)", "def run(self):\n \n rospy.spin()", "def start(self):\n self._is_waiting = False", "def...
[ "0.6779649", "0.67442936", "0.67158985", "0.6705807", "0.66715825", "0.66565794", "0.65831786", "0.6576873", "0.65761757", "0.648674", "0.6435378", "0.6363891", "0.6334501", "0.6311846", "0.6306127", "0.628594", "0.6276363", "0.6262448", "0.6207815", "0.6205474", "0.61803347"...
0.0
-1
Test that two candidates with the same name is considered equal.
def test_equal(self): candidate1 = pyrankvote.Candidate("Per") candidate2 = pyrankvote.Candidate("Per") candidate3 = pyrankvote.Candidate("Aase") self.assertEqual(candidate1, candidate2, "These candidates should be equal/the same candidate.") self.assertNotEqual(candidate1, can...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self.name == other.name", "def __eq__(self, name):\n return self.name == name", "def __eq__(self, other):\n return self.getName() == other.getName()", "def __eq__(self, other: 'Pair') -> bool:\n return self.names == other.names", "def __eq__(sel...
[ "0.7137341", "0.6986297", "0.69103146", "0.6893109", "0.68889", "0.6812805", "0.6812805", "0.67275023", "0.6676643", "0.66710836", "0.662369", "0.662369", "0.6585671", "0.6563278", "0.6547755", "0.651176", "0.64836264", "0.6444751", "0.6440682", "0.64404285", "0.6353767", "...
0.7321387
0
Test that voting with two equal candidates raises DuplicateCandidateError
def test_create_object(self): candidate1 = pyrankvote.Candidate("Per") candidate2 = pyrankvote.Candidate("Maria") candidate3 = pyrankvote.Candidate("Aase") ranked_candidates=(candidate1, candidate2, candidate3) ballot = pyrankvote.Ballot(ranked_candidates) self.assertT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raise_duplicate_candidate_error(self):\n\n candidate1 = pyrankvote.Candidate(\"Per\")\n candidate2 = pyrankvote.Candidate(\"Per\")\n candidate3 = pyrankvote.Candidate(\"Aase\")\n\n def tester(_):\n pyrankvote.Ballot(ranked_candidates=[candidate1, candidate2, candidat...
[ "0.78791624", "0.71919906", "0.6704815", "0.63650274", "0.62811035", "0.61194694", "0.60525644", "0.59962946", "0.5977833", "0.59066284", "0.5900545", "0.58612376", "0.58283204", "0.58060116", "0.57938457", "0.5791393", "0.5754909", "0.5684807", "0.567", "0.566157", "0.562691...
0.5379292
71
Test that voting with two equal candidates raises DuplicateCandidateError
def test_raise_duplicate_candidate_error(self): candidate1 = pyrankvote.Candidate("Per") candidate2 = pyrankvote.Candidate("Per") candidate3 = pyrankvote.Candidate("Aase") def tester(_): pyrankvote.Ballot(ranked_candidates=[candidate1, candidate2, candidate3]) msg ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equal(self):\n\n candidate1 = pyrankvote.Candidate(\"Per\")\n candidate2 = pyrankvote.Candidate(\"Per\")\n candidate3 = pyrankvote.Candidate(\"Aase\")\n\n self.assertEqual(candidate1, candidate2, \"These candidates should be equal/the same candidate.\")\n self.assertNotE...
[ "0.7190982", "0.67039883", "0.63653916", "0.62804335", "0.61187637", "0.60533804", "0.59969497", "0.59777725", "0.5905661", "0.58996975", "0.586041", "0.58293116", "0.58067715", "0.57936454", "0.57888746", "0.5755017", "0.5683631", "0.5670919", "0.5661115", "0.5626121", "0.56...
0.7878966
0
Test that if one of the candidate that are voted for are not a cadidate, that a TypeError is raised
def test_new_candidate_objects(self): class NewCandidate: def __init__(self, name): self.name = "New "+name def __hash__(self): return hash(self.name) candidate1 = NewCandidate("Per") candidate2 = NewCandidate("Aase") # This shou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_raise_error_if_not_all_obj_are_candidate_objects(self):\n\n candidate1 = pyrankvote.Candidate(\"Per\")\n candidate2 = \"Aase\"\n\n def tester(_):\n pyrankvote.Ballot(ranked_candidates=[candidate1, candidate2])\n\n msg = \"Candidate 2 is a string, not a Candidate, and...
[ "0.70255953", "0.6854806", "0.6601995", "0.64686733", "0.6000193", "0.59728014", "0.582607", "0.5737803", "0.56441694", "0.5517193", "0.5480731", "0.54463804", "0.53207767", "0.5301124", "0.528783", "0.52818805", "0.5281604", "0.5274655", "0.5263258", "0.5261205", "0.5253641"...
0.5083468
38
Test that if one of the candidate that are voted for are not a cadidate, that a TypeError is raised
def test_raise_error_if_not_all_obj_are_candidate_objects(self): candidate1 = pyrankvote.Candidate("Per") candidate2 = "Aase" def tester(_): pyrankvote.Ballot(ranked_candidates=[candidate1, candidate2]) msg = "Candidate 2 is a string, not a Candidate, and should raise a Ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tally_no_candidates(self):\n self.init_elect_types()\n\n userA = models.User(\n name = \"UserA\",\n email = \"userA@eLect.com\",\n password = \"asdf\")\n\n session.add(userA)\n session.commit()\n\n electionA = models.Election(\n ...
[ "0.68555146", "0.6602259", "0.6469301", "0.60011166", "0.59726834", "0.58263236", "0.5738305", "0.5644295", "0.5516878", "0.548198", "0.5445231", "0.5321506", "0.53020644", "0.52884585", "0.5283049", "0.5281973", "0.52745837", "0.52628803", "0.52594995", "0.52544856", "0.5249...
0.70258445
0
Make a sum of integrals CpT for calculate dST and dHT
def CpT(dict_, T_react): # T_column - name of the column in of Cp temperature in Data T = T_react if not dict_['T(Cp)']: return 0, 0 else: CpT_S_ = dict_['a']*(math.log(T/298)) + dict_['b']*math.pow(10,-3)*(T-298) - 0.5*dict_['c']*math.pow(10,6)*(math.pow(T, -2) - math.pow(298,-2)) + dict_['d']*(0.5*math.pow(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dCdt(t,C,params_unknown, params_known, i):\r\n q_co2_interp,P0,C0,a,b,c,P = params_known\r\n d,M0 = params_unknown\r\n return (1-C)*q_co2_interp[i]/M0 -b/a/M0*(P[i]-P0)*(carbon_prime(C,P[i],P0)-C)-d*(C-C0)", "def integrate(self, t):", "def Cintegrate(phi,\n HC, \n dt):\...
[ "0.6367222", "0.62956077", "0.61352813", "0.59738237", "0.5969108", "0.5945719", "0.5938884", "0.5851866", "0.581811", "0.5812156", "0.5800408", "0.5785194", "0.5775465", "0.5771758", "0.57488585", "0.56765854", "0.5642424", "0.56408626", "0.56318754", "0.56190896", "0.561747...
0.7117006
0
'Accepted a dictionary of thermodynamic data and return Gibbs Free Energy of compound'
def gibbs_(dict_, T): dST = dict_['S298'] + CpT(dict_, T)[0] dHT = dict_['dH298'] + CpT(dict_, T)[1]/1000 return (dHT - T*dST/1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_free_g(energies, temperatures):\n pass", "def BraggEnergy(ID,hkl,twotheta):\n ID=goodID(ID)\n d=dSpace(ID,hkl)\n l=2*d*sind(twotheta/2.0)\n E=lam2E(l)\n return E", "def get_internal_energy(filename):\n # --------------- helper functions --------------- #\n def parse_data(block)...
[ "0.650521", "0.64380336", "0.6039046", "0.59228855", "0.5849885", "0.5758292", "0.5723967", "0.5673121", "0.5652979", "0.5629196", "0.5627507", "0.5578335", "0.55377835", "0.5457064", "0.5428888", "0.54141587", "0.53989697", "0.5396005", "0.5381766", "0.53807193", "0.53804505...
0.6666221
0
Action on one light by light_id.
def action_on_light_by_id(bridge, light_id, action): if action == 'on': bridge.set_light(light_id, 'on', True) elif action == 'off': bridge.set_light(light_id, 'on', False) elif action == 'toggle': current_state = bridge.get_light(light_id, 'on') bridge.set_light(light_id, 'o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def Turn_On_Light(\n light_id: int = Path(..., title=\"Numeric light identifier\", ge=0),\n) -> Dict[str, Any]:\n busylightapi.manager.light_on(light_id)\n return {\n \"action\": \"on\",\n \"light_id\": light_id,\n \"color\": \"green\",\n }", "def addLight(self, id):\r\n\t\...
[ "0.72733927", "0.6812936", "0.6758126", "0.6477925", "0.63752294", "0.624486", "0.62303555", "0.61155444", "0.6082006", "0.5978591", "0.59443074", "0.58976763", "0.58453494", "0.5826358", "0.58137035", "0.5706582", "0.56572086", "0.5648138", "0.56393903", "0.56304437", "0.562...
0.7258166
1
Actions to control hue lights
def lights(id, all, connect, info, action, bri): try: bridge = phue.Bridge(BRIDGE_IP) except Exception: click.secho( "Press the bridge buttom and call the connect again", fg='red') if connect: # If the app is not registered and the button is not pressed, # press ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n # connect to the hue bridge\n bridge = phue.Bridge()\n bridge.connect() # throw an exception if connection was not established\n\n tracker = beat_tracker.BeatTracker()\n tracker.start()\n try:\n\n # obtain a list of lights to control\n lights = get_lights(bridge)\n\...
[ "0.65424037", "0.64071625", "0.627456", "0.621581", "0.62085545", "0.6187222", "0.61785835", "0.61728567", "0.61096853", "0.60578203", "0.6044929", "0.6041697", "0.5997034", "0.5966091", "0.59594786", "0.5944837", "0.593923", "0.59139866", "0.5900136", "0.58874536", "0.585087...
0.56227
39
A worker function for wrapping prepare_and_run() with CPU affinity assignment.
def worker(lconf): try: prepare_and_run(lconf) with OUTPUT_LOCK: print '[SUCCEEDED]', lconf except Exception as e: exc_buffer = StringIO() traceback.print_exc(file=exc_buffer) logging.error('Uncaught exception in worker process:\n%s', exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_cpu(ops, model):\n ...", "def cpu(self, *args, **kwargs):\n self._tensor = self._tensor.cpu(*args, **kwargs)\n return self", "def system_affinity():\n return CPUSet((0,))", "def run_worker(self):\n # TODO(xiejw): To allow execution framework to add train hooks.\n return sel...
[ "0.6180122", "0.6069481", "0.58082306", "0.5754303", "0.57396305", "0.5703408", "0.56822705", "0.56044805", "0.55917233", "0.55335", "0.5532036", "0.55229217", "0.55215144", "0.55207145", "0.5468159", "0.54518175", "0.54380834", "0.54069316", "0.5392665", "0.5392301", "0.5342...
0.0
-1
Running the list of conf in a multiprocess pool
def pooling(lconf, poolsize=10): pool = Pool(poolsize) pool.map(worker, lconf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forqs_parallel(configs):\n pool = Pool(21)\n pool.map(forqs_sim, configs)\n pool.close()\n pool.join()", "def run(self):\n self.logger.info(\"Starting execution loop...\")\n with ThreadPoolExecutor(\n max_workers=len(self.config) + 10 - (len(self.config) % 10)\n ) ...
[ "0.65946066", "0.63634336", "0.6124032", "0.59440327", "0.5874448", "0.5866036", "0.5825758", "0.5822465", "0.5777083", "0.5734233", "0.57098234", "0.56977147", "0.5667062", "0.5592518", "0.55613124", "0.5558571", "0.5541053", "0.55395705", "0.5511079", "0.55040234", "0.54911...
0.7368655
0
Prepare the configuration and run experiments
def prepare_and_run(deltaconf): conf = Configuration() conf.update(deltaconf) if conf['expr.city.id'] is None: conf['expr.city.id'] = CITY[conf['expr.city.name']] experiment(conf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config():\n experiment_dir = './experiments'\n simulation_steps = 1000\n device = 'cpu'\n path_to_molecules = os.path.join(experiment_dir, 'data/ethanol.xyz')\n simulation_dir = os.path.join(experiment_dir, 'simulation')\n training_dir = os.path.join(experiment_dir, 'training')\n model_pat...
[ "0.7167488", "0.7069046", "0.69259727", "0.67820805", "0.66920924", "0.6687919", "0.66606116", "0.6646322", "0.663162", "0.65980875", "0.6594076", "0.65635496", "0.65348023", "0.6526331", "0.6514692", "0.6487945", "0.647666", "0.64762723", "0.6455509", "0.64519733", "0.640889...
0.6519538
14
Extract error code from pymysql.Error
def _errno(err): return err.args[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_error(err):\n try:\n print('MySQL error [%d]: %s' % (err.args[0], err.args[1]))\n except IndexError:\n print('MySQL error: %s' % err)\n sys.exit(-1)", "def sql_error(err):\n try:\n logger.critical('MySQL error [%d]: %s', err.args[0], err.args[1])\n except IndexError:\n...
[ "0.71468306", "0.70563066", "0.70563066", "0.69076747", "0.66681695", "0.66134655", "0.65896267", "0.65759575", "0.6573206", "0.6520969", "0.6484275", "0.64670706", "0.6445506", "0.64426017", "0.6432816", "0.6307751", "0.6263097", "0.6183135", "0.6167236", "0.61537015", "0.61...
0.5748079
41
Extract error code from mysql.connector.Error
def _errno(err): return err.errno
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_error(err):\n try:\n print('MySQL error [%d]: %s' % (err.args[0], err.args[1]))\n except IndexError:\n print('MySQL error: %s' % err)\n sys.exit(-1)", "def sql_error(err):\n try:\n logger.critical('MySQL error [%d]: %s', err.args[0], err.args[1])\n except IndexError:\n...
[ "0.7226551", "0.7061242", "0.7061242", "0.6856443", "0.64681053", "0.6462851", "0.64363503", "0.64312184", "0.64200145", "0.6391581", "0.63766897", "0.6348016", "0.634649", "0.6344522", "0.6226208", "0.62205833", "0.61792403", "0.60931605", "0.60705966", "0.6013536", "0.59782...
0.5715901
33
Loop through each of the requested metrics and collect the data.
def collect_stats(self, cursor): metrics = self.config.get('metrics', DEFAULT_METRICS) if isinstance(metrics, str): if metrics == "all": # puffer_pool_status is only for 5.5, so we ignore that by default metrics = CATEGORIES.keys() metrics.remo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect(self): # pylint: disable=no-self-use\n start = time.time()\n for metric in metric_rq():\n yield metric\n\n gauge = GaugeMetricFamily(\n \"nautobot_rq_metrics_processing_ms\", \"Time in ms to generate the app metrics endpoint\"\n )\n duration = t...
[ "0.698782", "0.6843584", "0.6843398", "0.6831427", "0.6692487", "0.6682604", "0.6662703", "0.66577345", "0.66119224", "0.65584683", "0.6533807", "0.6505639", "0.6482279", "0.6463036", "0.6430907", "0.64065206", "0.639844", "0.6362565", "0.6361143", "0.63562185", "0.6353364", ...
0.6709662
4
Collect all of the stats for this metric based on it's SQL query. This updates the raw_metrics with any results.
def add_category_stats(self, category, cursor): conf = CATEGORIES[category] if 'SQL' not in conf: return self.logger.debug("Collecting stats for %s" % category) cursor.execute(conf['SQL']) # call the self.parse_"parser"_stats" function for each one to get the raw k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_stats(self, cursor):\n metrics = self.config.get('metrics', DEFAULT_METRICS)\n if isinstance(metrics, str):\n if metrics == \"all\":\n # puffer_pool_status is only for 5.5, so we ignore that by default\n metrics = CATEGORIES.keys()\n ...
[ "0.64333254", "0.6127107", "0.6120151", "0.59696305", "0.5853804", "0.580062", "0.57948494", "0.57506037", "0.57455593", "0.5698882", "0.5667496", "0.5627314", "0.56214106", "0.5610352", "0.5597505", "0.55741715", "0.5522619", "0.55127054", "0.5495267", "0.54928535", "0.54559...
0.55391866
16
Walk the raw_metrics and pass them over to the agent as a counter or gauge type and with the correct units defined
def add_stats(self): units = self.get_unit_map() for metric in self.raw_metrics: unit, metric_type = units.get(metric, (DEFAULT_UNIT, DEFAULT_TYPE)) if metric_type == "counter": # Unit/Second unit = "/".join((unit, "Second")) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_metric(self):\r\n if self.units != 'metric':\r\n self.units = 'metric'\r\n for statement in self.statements:\r\n statement.to_metric()\r\n for tool in iter(self.tools.values()):\r\n tool.to_metric()\r\n for primitive in self.pr...
[ "0.6258945", "0.61666566", "0.60249275", "0.6001037", "0.5927554", "0.592675", "0.57163465", "0.57082105", "0.56740946", "0.5633948", "0.56112427", "0.5591662", "0.5533326", "0.5493495", "0.54703236", "0.54512477", "0.54392433", "0.5438802", "0.54218864", "0.54157937", "0.540...
0.682586
0
Walk the META dict and build a category/metric => [unit, type] map
def get_unit_map(self): units = dict() for t in META: for c in META[t]: for i in META[t][c]: unit = DEFAULT_UNIT if (isinstance(i, (tuple, list))): val, unit = i else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metric(self, slug):\n results = OrderedDict()\n granularities = self._granularities()\n keys = self._build_keys(slug)\n for granularity, key in zip(granularities, keys):\n results[granularity] = self.r.get(key)\n return results", "def to_metric(self):\r\n ...
[ "0.5816675", "0.57289094", "0.5644376", "0.56161416", "0.5572126", "0.5567753", "0.5550242", "0.5526054", "0.53678817", "0.5350343", "0.5344897", "0.53356266", "0.53257257", "0.5325444", "0.52578825", "0.52578384", "0.5251907", "0.5248301", "0.52464676", "0.5242211", "0.52412...
0.78846425
0
Given a list of names, return the values collected for those names as a list. If any are missing, then return None.
def get_values(self, names): r = [] for n in names: if n in self.raw_metrics: r.append(self.raw_metrics[n]) else: return None return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(names, location, field = 0):\n table = read_properties(location)\n result = []\n for name in names:\n result.append(table[name][field])\n return result", "def get_name_value(self):\n name, value = self.get()\n if not isinstance(name, list):\n name = [name]\n...
[ "0.62341124", "0.61295545", "0.6060184", "0.58670735", "0.58584267", "0.5791712", "0.5745358", "0.56358737", "0.5626649", "0.5603033", "0.55910695", "0.5588045", "0.55808705", "0.5564574", "0.5495613", "0.5486652", "0.5477916", "0.54763335", "0.54682344", "0.546777", "0.54158...
0.75494033
0
Given a list of metric names, return the sum of their values if all of them exist in the raw metrics, otherwise return None.
def sum_of(self, names): vals = self.get_values(names) if vals is None: return None return sum(vals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_values(self, names):\n r = []\n for n in names:\n if n in self.raw_metrics:\n r.append(self.raw_metrics[n])\n else:\n return None\n return r", "def merge_measurements(measurements_list: List[Measurements]) -> \\\n Tuple[Measu...
[ "0.63208723", "0.58659804", "0.57584655", "0.5594722", "0.5587642", "0.5583846", "0.54215026", "0.53978634", "0.5388517", "0.53796774", "0.5361299", "0.5329915", "0.5302537", "0.5300705", "0.5294816", "0.5272846", "0.52468646", "0.5246003", "0.52124965", "0.5141806", "0.51274...
0.7123606
0
Given a list of metric names, return the result of the first subtracted by all others (a b c d ...). If any metric names do not exist, return None.
def diff_of(self, names): vals = self.get_values(names) if vals is None: return None return vals[0] - (sum(vals[1:]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(*args):\n return args[0] - reduce(lambda x, y: x + y, args[1:])", "def subtract(*args):\n #convert args to floats so we can do the maths\n values = list(args)\n for x in range(len(values)):\n values[x] = float(values[x])\n \n difference = str(ft.reduce(oper.sub,values))\...
[ "0.5903671", "0.5564674", "0.5434356", "0.53246856", "0.5131955", "0.50864434", "0.5047729", "0.5025216", "0.5021303", "0.49535123", "0.49406168", "0.49197245", "0.48909643", "0.48661345", "0.48607007", "0.48527187", "0.4794334", "0.4729753", "0.47213003", "0.471478", "0.4704...
0.5787716
1
Update the raw metrics for a particular metric name if the value is a number.
def update_metric(self, metric, value): if self.is_number(value): self.logger.debug("Collected raw metric: %s = %s" % (metric, value)) self.raw_metrics[metric] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_metric(self, metric_name: str, metric_value: Union[float, int]):\n self._metrics.append(Metric(metric_name, metric_value))", "def apply_filter_metrics(self, pack_nr, filter_metrics):\n current_pack_metrics = ast.literal_eval(self.list_pack[pack_nr]['metrics'])\n\n for i in filter_m...
[ "0.5767613", "0.56614435", "0.56110084", "0.5580715", "0.55691767", "0.544993", "0.53968453", "0.5386266", "0.5385655", "0.53586227", "0.5325535", "0.5323981", "0.52706116", "0.5256082", "0.525114", "0.5226717", "0.5223895", "0.5173679", "0.51539004", "0.51441383", "0.5132418...
0.8006188
0
Derive all of the custom newrelic metric data from what we've collected.
def derive_newrelic_stats(self): self.logger.debug("Collecting stats for newrelic") self.derive_newrelic_volume() self.derive_newrelic_throughput() self.derive_newrelic_innodb() self.derive_newrelic_qcache() self.derive_newrelic_slaves()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_newrelic_innodb(self):\n # InnoDB Metrics\n vals = self.get_values([\"status/innodb_pages_created\", \"status/innodb_pages_read\",\n \"status/innodb_pages_written\", \"status/innodb_buffer_pool_read_requests\",\n \"status/innodb...
[ "0.6022074", "0.59213793", "0.5731898", "0.56916195", "0.56569976", "0.56055313", "0.5598628", "0.5564767", "0.55601907", "0.55311126", "0.5521709", "0.5505745", "0.5444377", "0.5430692", "0.54174036", "0.5376228", "0.5355599", "0.53036517", "0.5295715", "0.5289679", "0.52818...
0.7011071
0
Derive the newrelic read/write volume metrics
def derive_newrelic_volume(self): # read and write volume self.update_metric("newrelic/volume_reads", self.sum_of(["status/com_select", "status/qcache_hits"])) self.update_metric("newrelic/volume_writes", self.sum_of(["status/com_insert", "status/com_insert_select", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()", "def derive_newre...
[ "0.6909179", "0.6324424", "0.587309", "0.58164966", "0.57896197", "0.5775137", "0.5725627", "0.56265193", "0.5589847", "0.55038005", "0.5489829", "0.54812914", "0.5480851", "0.54732245", "0.5446111", "0.54351324", "0.5425124", "0.53942096", "0.53008056", "0.5265735", "0.52520...
0.8065374
0
Derive the newrelic throughput metrics
def derive_newrelic_throughput(self): # read and write throughput self.update_metric("newrelic/bytes_reads", self.sum_of(["status/bytes_sent"])) self.update_metric("newrelic/bytes_writes", self.sum_of(["status/bytes_received"])) # Connection management vals = self.get_values(["s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()", "def compute_metr...
[ "0.69189394", "0.61661357", "0.5897504", "0.58614343", "0.5855015", "0.58358943", "0.58298737", "0.5791972", "0.5702153", "0.56862736", "0.56187415", "0.5615706", "0.56001467", "0.55977714", "0.5567835", "0.5560966", "0.5535466", "0.5501375", "0.54764473", "0.54760295", "0.54...
0.7748093
0
Derive the newrelic innodb metrics
def derive_newrelic_innodb(self): # InnoDB Metrics vals = self.get_values(["status/innodb_pages_created", "status/innodb_pages_read", "status/innodb_pages_written", "status/innodb_buffer_pool_read_requests", "status/innodb_buffer_pool_reads...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()", "def mysql_status...
[ "0.622359", "0.6214452", "0.6004368", "0.5830676", "0.58252716", "0.5782086", "0.57635754", "0.56960446", "0.5643359", "0.56161225", "0.5613598", "0.55897206", "0.55739963", "0.5533932", "0.5531093", "0.5449568", "0.54442644", "0.5439991", "0.54288715", "0.5375634", "0.536858...
0.72587854
0
Derive the newrelic qcache metrics
def derive_newrelic_qcache(self): # Query Cache vals = self.get_values(["status/qcache_hits", "status/com_select", "status/qcache_free_blocks", "status/qcache_total_blocks", "status/qcache_inserts", "status/qcache_not_cached"]) if vals: qc_hits, reads,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derive_newrelic_stats(self):\n self.logger.debug(\"Collecting stats for newrelic\")\n self.derive_newrelic_volume()\n self.derive_newrelic_throughput()\n self.derive_newrelic_innodb()\n self.derive_newrelic_qcache()\n self.derive_newrelic_slaves()", "def test_get_der...
[ "0.66529113", "0.6139272", "0.6087995", "0.60597914", "0.5858092", "0.58465123", "0.58407485", "0.5827561", "0.5758349", "0.574827", "0.5718123", "0.57102144", "0.56753933", "0.56337994", "0.5624577", "0.56002194", "0.5561739", "0.5540792", "0.55359334", "0.54992205", "0.5476...
0.809507
0
Derive newrelic status metrics about slaves
def derive_newrelic_slaves(self): if self.has_slave_data is True: self.update_metric("newrelic/replication_lag", self.sum_of(["slave/seconds_behind_master"])) # both need to be YES, which is 1 running = self.sum_of(["slave/slave_io_running", "slave/slave_sql_running"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slave_status():\n run_mysql_command(\"SHOW SLAVE STATUS\\G;\")", "def __init__(self, is_master, track_processes, write_profile,\n verbose_cluster_stats):\n my_ip = appscale_info.get_private_ip()\n lb_ips = appscale_info.get_load_balancer_ips()\n\n self._is_lb = my_ip in lb_ips\n ...
[ "0.7028809", "0.5855735", "0.5841473", "0.5718452", "0.57006025", "0.560662", "0.55952454", "0.5494366", "0.548229", "0.543067", "0.5367218", "0.5296817", "0.5293506", "0.52714247", "0.527107", "0.52170867", "0.5173371", "0.51723516", "0.5159897", "0.5144632", "0.5134972", ...
0.71810716
0
Parse the values from mysql, converting them to floats when necessary on|yes|true => 1 off|no|false => 0 null => 1
def parse_metric_value(self, value): if isinstance(value, str): if value == "": return None # yes|true|on if self.is_true.match(value): return 1 # no|false|off if self.is_false.match(value): return 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertToFloat(boolean: bool) -> float:\n ...", "def parse_value(self, value):\n\t\t\n\t\tif goodies.is_float(value):\n\t\t\treturn float(value)\n\t\telif goodies.is_int(value):\n\t\t\treturn int(value)\n\t\telif goodies.is_bool(value):\n\t\t\treturn bool(value.capitalize())\n\t\telse:\n\t\t\treturn v...
[ "0.5576609", "0.5521588", "0.5519995", "0.53601056", "0.5292483", "0.52703524", "0.52464485", "0.5240127", "0.5214614", "0.5169053", "0.51640624", "0.51472664", "0.51410556", "0.5130782", "0.5097779", "0.50775486", "0.506641", "0.5049185", "0.5041503", "0.5037315", "0.5005407...
0.5565192
1
Check if something is a number.
def is_number(self, value): if isinstance(value, (int, float, long, complex)): # noqa return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(value):\n try:\n int(value)\n return True\n except (ValueError, TypeError):\n return False", "def is_number(value):\n\n return isinstance(value, (int, long, float))", "def is_number(x):\n if isinstance(x, (int, float)):\n return True\n else:\n ret...
[ "0.8506787", "0.8456218", "0.8422793", "0.83873326", "0.8358748", "0.83370656", "0.82467264", "0.82390046", "0.8229421", "0.8208039", "0.8206844", "0.81979483", "0.8139895", "0.8139886", "0.8118837", "0.81185615", "0.8117525", "0.8107428", "0.8083411", "0.8040513", "0.8029077...
0.78709996
30
Parse the SQL results with a single row of values, keyed by their column name.
def parse_row_stats(self, cursor): rows = list(cursor) if len(rows) > 0: column_names = [desc[0] for desc in cursor.description] # assumed to be a single row returned # convert the column names to lowercase return dict(zip(column_names, rows[0])) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Result(row, schema):\r\n return dict(zip(schema.fields(), row))", "def fetch_row(self, sql):\n curs = self.q(sql, True)\n cols = curs.column_names\n row = curs.fetchone()\n if curs._have_unread_result():\n curs.fetchall()\n curs.close()\n\n if row:\n ...
[ "0.6224609", "0.603524", "0.6031358", "0.5842335", "0.578239", "0.5738487", "0.5737131", "0.57013655", "0.56893873", "0.56696564", "0.5658667", "0.56289047", "0.56289047", "0.56200516", "0.5619521", "0.5587704", "0.54900855", "0.5455064", "0.5422064", "0.54044473", "0.5387323...
0.60076684
3
Parse a set of SQL results where the first column is the name and the second column is the value.
def parse_set_stats(self, cursor): rows = list(cursor) if len(rows) > 0 and len(rows[0]) == 2: return dict(rows) return dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_results_from_list(retrieved_l):\n for l in retrieved_l:\n #fields = l.split()\n query_name = l[0]\n ranks = [int(rank) for rank in l[1::2]]\n yield (query_name, list(zip(ranks, l[2::2])) )", "def parse_query_results(self):\n # TODO: nicely parsed needs defining; ma...
[ "0.59940416", "0.5895918", "0.5722077", "0.57139164", "0.5607733", "0.5537553", "0.54621685", "0.5451593", "0.5408769", "0.5396635", "0.5394514", "0.5393091", "0.53283066", "0.528281", "0.5279902", "0.5261499", "0.52474076", "0.5239414", "0.52366096", "0.52233773", "0.5221562...
0.47682917
79
Parse the innodb status results and pull interesting metrics from it.
def parse_innodb_status_stats(self, cursor): rows = list(cursor) metrics = { "history_list_length": "^History list length\s+(\d+)", "log_sequence_number": "^Log sequence number\s+(\d+)", "last_checkpoint": "^Last checkpoint at\s+(\d+)", "queries_inside_inn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mysql_status(self):\n stamp = int(time.time())\n\n # get data\n conn = self.object.connect()\n result = {}\n try:\n with conn.cursor() as cursor:\n for key in REQUIRED_STATUS_FIELDS:\n cursor.execute('SHOW GLOBAL STATUS LIKE \"%s\"...
[ "0.6954353", "0.62820905", "0.6002656", "0.58837825", "0.5661363", "0.56151706", "0.555977", "0.5538942", "0.55202043", "0.5509902", "0.548991", "0.54785293", "0.5459194", "0.5427737", "0.5423125", "0.5409682", "0.5383005", "0.53386635", "0.5331502", "0.5330284", "0.53202844"...
0.778952
0
Connect to MySQL, returning the connection object.
def connect(self): self.logger.debug("creating DB connection") conn = sql.connect(**self.connection_arguments) self.logger.debug("DB connection ready: %r", conn.get_host_info()) return conn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\r\n\r\n db_config = read_db_config()\r\n\r\n try:\r\n print('Connecting to MySQL database...')\r\n conn = MySQLConnection(**db_config)\r\n\r\n if conn.is_connected():\r\n print('connection established.')\r\n return conn...
[ "0.8353565", "0.81709605", "0.79934335", "0.7938875", "0.78635293", "0.77296746", "0.7721312", "0.7587678", "0.7578141", "0.75574535", "0.74836797", "0.7430886", "0.7361621", "0.7361061", "0.7340896", "0.7318626", "0.7192282", "0.71860486", "0.7184344", "0.7164469", "0.713124...
0.73182267
16
Create connection parameter dictionary for mysql.connect
def connection_arguments(self): filtered_args = ['name', 'metrics'] # make sure we make a copy of this global so it is thread-safe args = dict(DEFAULT_CONNECT_ARGS) for key in set(self.config) - set(filtered_args): if key == 'dbname': args['database'] = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mysql_connection_kwargs(_id: str) -> dict:\n return get_connection_kwargs(_id, credentials_mapping=MYSQL_CONNECTION_KWARG_MAP)", "def get_connection_params (self, kwargs = {}):\n\n config = configparser.ConfigParser ()\n\n if 'MYSQL_CONF' in kwargs:\n config.read (('/etc/my.cn...
[ "0.78055197", "0.7115755", "0.6927417", "0.6926815", "0.6814152", "0.6795048", "0.67644185", "0.67513794", "0.67265683", "0.6604886", "0.65688044", "0.65548515", "0.6483495", "0.6480376", "0.6472867", "0.6471669", "0.64648205", "0.6414291", "0.6281026", "0.6255766", "0.624283...
0.6732199
8
Note the end of the stat collection run and let the user know of any errors.
def finish(self): sev = 'info' desc = 'successful' col = 0 if not self.derive_values and not self.gauge_values: sev = 'error' desc = 'unsuccessful' else: col = len(self.derive_values) + len(self.gauge_values) dur = time.time() - self.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onFinish(self):\n self.finalizeStats()", "def finished(self):\n\t\telog(\"finished\")", "def end(self):\n ...", "def RunEnd(ss):\n ss.LogRun(ss.RunLog)", "def end(self):\n pass", "def end(self):\n pass", "def end(self):\n pass", "def on_end(self, ctx):\n ...
[ "0.6491455", "0.6087686", "0.60369563", "0.5962675", "0.5950929", "0.5950929", "0.5950929", "0.5914236", "0.59125185", "0.59045875", "0.5830125", "0.5785236", "0.57419574", "0.57309645", "0.5713284", "0.57049686", "0.57049686", "0.56925553", "0.56714326", "0.5663864", "0.5657...
0.60418195
2
Check that you cannot logout before logging in
def test_r1t1(capsys): helper( capsys=capsys, terminal_input=['logout', 'login', 'atm', 'logout', ' '], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output_transactions=['EOS 0000000 000 0000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out(self):\n self.__is_logged_in = False", "def test_not_logged_in(event_member):\n admin, member, event_id = event_member\n log_out(member.username)\n expect_error(edit, AuthError, member.username, event_id, True, None, None)", "def logout():", "def test_logout_un_logged_in_user_fals...
[ "0.7507315", "0.70255494", "0.7009955", "0.692506", "0.6921855", "0.68452936", "0.68452936", "0.68240535", "0.6820881", "0.6777236", "0.67714787", "0.6749821", "0.67011935", "0.6694495", "0.6673493", "0.6672871", "0.6670478", "0.6648674", "0.6628728", "0.662673", "0.6622642",...
0.0
-1
Check that you cannot create an account before logging in
def test_r1t2(capsys): helper( capsys=capsys, terminal_input=['createacct', 'login', 'atm', 'logout', 'n'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=["Please enter 'yes'/'y' if you would like to start another session or 'no'/'n' if not: Thank you for using ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_08_create_user_not_exists(self):\n\n _, user = self.get_random_item(models.User)\n utils.create_user(user, session=self.session)\n success, error = utils.create_user(user, session=self.session)\n self.assertFalse(success)\n self.assertTrue(error)", "def test_non_user_l...
[ "0.66036856", "0.65916365", "0.6547449", "0.6483825", "0.64822", "0.63924927", "0.6347524", "0.63450634", "0.63087523", "0.6299381", "0.62935346", "0.62697744", "0.62583005", "0.6256256", "0.62475437", "0.62229", "0.62204856", "0.62141657", "0.6197099", "0.6189928", "0.617699...
0.0
-1
Check that you cannot delete an existing account before logging in
def test_r1t3(capsys): helper( capsys=capsys, terminal_input=['deleteacct', 'login', 'atm', 'logout', 'no'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=["Please enter 'yes'/'y' if you would like to start another session or 'no'/'n' if not: Thank you for using...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account(self):\n print('-=' * 12 + \" Delete Account \" + '-=' * 12)\n mob_num, password = self._input_mob_num('Mobile Number :'), input(\"Password: \")\n delete_flag = self.auth.delete_account(mob_num, password)\n if delete_flag:\n print(\"The account is permently...
[ "0.68948424", "0.6682471", "0.66079223", "0.6537173", "0.64638823", "0.6437064", "0.6412041", "0.640563", "0.63824666", "0.6329964", "0.6297531", "0.6276316", "0.6266683", "0.6263857", "0.6190512", "0.6150756", "0.6133566", "0.6129107", "0.61231357", "0.61206627", "0.6110635"...
0.0
-1
Check that you cannot deposit into an account before logging in
def test_r1t4(capsys): helper( capsys=capsys, terminal_input=['deposit', 'login', 'atm', 'logout', 'no'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=["Please enter 'yes'/'y' if you would like to start another session or 'no'/'n' if not: Thank you for using Qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_token(self):\n if not self.token:\n self.login()\n if not self.token:\n # TODO: create exception for this\n # Access is denied!!\n raise Exception(\"AccessDenied\")", "def validate_login(self, request):\n\n if 'id' not in request.sess...
[ "0.64917743", "0.64304584", "0.62787217", "0.62511796", "0.62192965", "0.62111753", "0.61903924", "0.61892515", "0.618391", "0.61685294", "0.61648923", "0.6127679", "0.6120711", "0.6077806", "0.6077806", "0.6070828", "0.6049326", "0.6043617", "0.6017668", "0.6000648", "0.6000...
0.0
-1
Check that you cannot withdraw from an account before logging in
def test_r1t5(capsys): helper( capsys=capsys, terminal_input=['withdraw', 'login', 'atm', 'logout', 'NO'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output_transactions=['EOS 0000000 000 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def withdrawal(cls, amount):\n if amount >= 0 and cls.is_logged_in():\n cls.__current_acct.__transaction(-amount)\n else:\n print('withdrawal error')", "def test_without_login_balance_view(self):\n response = self.client.get(reverse('account_balance', args=[self.acc.id]...
[ "0.66574186", "0.62400573", "0.6177407", "0.61391455", "0.61258495", "0.60537714", "0.60326004", "0.60089386", "0.5993609", "0.59922457", "0.59839606", "0.596331", "0.596331", "0.596331", "0.596331", "0.596331", "0.5962774", "0.5945475", "0.5855539", "0.5827988", "0.58090943"...
0.0
-1
Check that you cannot transfer between accounts before logging in
def test_r1t6(capsys): helper( capsys=capsys, terminal_input=['transfer', 'login', 'atm', 'logout', 'No'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output_transactions=['EOS 0000000 000 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def the_user_should_not_be_able_to_connect_to_another_device():\n print(\"Trying to connect 2 devices at once\")\n bln_result = web_app.connect_to_device2()\n assert(bln_result, False)", "def validate_login(self, request):\n\n if 'id' not in request.session or 'steam_id' not in request.session:\n...
[ "0.59764665", "0.59599173", "0.5897446", "0.5881796", "0.58623135", "0.58552885", "0.5799595", "0.57928836", "0.5739913", "0.5737106", "0.5698676", "0.5698449", "0.5698405", "0.56917655", "0.5685262", "0.56848454", "0.56256676", "0.5604318", "0.5600593", "0.5591732", "0.55876...
0.0
-1
Check that you cannot login before logging out of previous session
def test_r1t7(capsys): helper( capsys=capsys, terminal_input=['login', 'login', 'atm', 'logout', 'NO'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output_transactions=['EOS 0000000 000 0000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out(self):\n self.__is_logged_in = False", "def validate_login(self, request):\n\n if 'id' not in request.session or 'steam_id' not in request.session:\n raise PermissionDenied('You need to login')\n\n # if self.mode9:\n # if 'team' not in PlayerList[request.ses...
[ "0.73351437", "0.6847854", "0.6767177", "0.6674618", "0.66534585", "0.66534585", "0.66534585", "0.66534585", "0.66531533", "0.6645437", "0.6636743", "0.66349894", "0.66269964", "0.65786284", "0.6571962", "0.6568798", "0.6565536", "0.65361357", "0.6500001", "0.6499039", "0.648...
0.0
-1
Check that you cannot create an account with unprivileged access
def test_r1t8(capsys): helper( capsys=capsys, terminal_input=['login', 'atm', 'createacct', 'logout', 'no'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output_transactions=['EOS 0000000 000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_info_does_not_exist(self):\n fake_user = User(username='Fake', password='')\n self.assertFalse(send_rotate_to_can(fake_user, self.BIN_NUM))", "def test_not_owner(self):\n creating_user = create_user()\n creating_user.save()\n festival = create_festival('test', crea...
[ "0.6871413", "0.64861256", "0.64553064", "0.6436106", "0.6384113", "0.6376568", "0.6231922", "0.62236583", "0.62236583", "0.6218315", "0.6197201", "0.61903113", "0.6111435", "0.6098324", "0.6056143", "0.6035311", "0.60224736", "0.6010865", "0.60105795", "0.5986995", "0.593455...
0.0
-1
Check that you cannot delete an account with unprivileged access
def test_r1t9(capsys): helper( capsys=capsys, terminal_input=['login', 'atm', 'deleteacct', 'logout', 'no'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=["Please enter 'yes'/'y' if you would like to start another session or 'no'/'n' if not: Thank you for using...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDeleteUserIsDenied(self):\n [(objectID, username)] = UserAPI().create(\n [(u'user', u'secret', u'User', u'user@example.com')])\n self.store.commit()\n with login(u'user', objectID, self.transact) as session:\n deferred = self.facade.deleteUser(session, u'doomed')\...
[ "0.6867281", "0.6841884", "0.68205106", "0.6758197", "0.6611111", "0.66093475", "0.65578413", "0.651361", "0.651361", "0.6490377", "0.64859253", "0.64744294", "0.6473548", "0.6458293", "0.64556444", "0.64309424", "0.6418086", "0.6364561", "0.63590115", "0.63328", "0.63223594"...
0.0
-1
Check that creating an account works with privileged access
def test_r1t10(capsys): helper( capsys=capsys, terminal_input=['login', 'agent', 'createacct', '1234567', 'accountName1', 'logout', 'no'], intput_valid_accounts=['1234568'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_if_not_created_authenticated_permissions(self):\r\n payload = {\r\n \"email\": \"t@t.pl\",\r\n \"password\": \"password\",\r\n \"name\": \"asdasd\",\r\n \"is_superuser\": False,\r\n }\r\n\r\n res = self.client_authenticated.post(reverse(CREA...
[ "0.69334227", "0.657401", "0.653778", "0.65368503", "0.6505535", "0.6459696", "0.63727415", "0.63524723", "0.6324572", "0.6307633", "0.6254503", "0.62484324", "0.6223447", "0.6181628", "0.6158007", "0.61456215", "0.61443484", "0.6139977", "0.613374", "0.61093897", "0.60702944...
0.0
-1
Check that deleting an account works with privileged access
def test_r1t11(capsys): helper( capsys=capsys, terminal_input=['login', 'agent', 'deleteacct', '1234567', 'accountName2', 'logout','no'], intput_valid_accounts=['1234567'], expected_tail_of_terminal_output=['Thank you for using Quinterac, have a nice day!'], expected_output_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duo_account_delete(self):\n pass", "def testDeleteIsAllowed(self):\n UserAPI().create([(u'user', u'secret', u'User', u'user@example.com')])\n namespaces = SecureNamespaceAPI(self.system.users['fluiddb'])\n namespaces.delete([u'user/private'])\n self.users.delete([u'use...
[ "0.70686805", "0.69906634", "0.69712806", "0.6882439", "0.6880139", "0.6775254", "0.674023", "0.66097003", "0.6594812", "0.658659", "0.658659", "0.658644", "0.6527412", "0.65224856", "0.65056777", "0.65015936", "0.6495758", "0.64641714", "0.6448921", "0.64455", "0.6443459", ...
0.0
-1
Helper function for testing
def helper( capsys, terminal_input, expected_tail_of_terminal_output, intput_valid_accounts, expected_output_transactions ): # cleanup package reload(app) # create a temporary file in the system to store output transactions temp_fd, temp_file = tempfile.mkstemp(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def unitary_test():", "def test_4_4_1_1(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def test_get(self):\n ...
[ "0.7013601", "0.7013601", "0.7013601", "0.7013601", "0.7013601", "0.67847806", "0.6658206", "0.663902", "0.663902", "0.663902", "0.6583615", "0.6556746", "0.6556746", "0.65566105", "0.65137947", "0.6491459", "0.64061224", "0.6383541", "0.6383541", "0.6382606", "0.6370714", ...
0.0
-1
Update the QTable based on the last action and state
def act(self, current_state, setpoint): s = self.last_s # Refers only to theta a = self.last_a # Refers only the last action taken s_p = self.map_state( current_state['theta'], current_state['theta_dot']) # Update the q-table based on the Bellman Equation r = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateQTable( self, reward, current_state ):", "def update_Qtable(self, r, action, next_state):\n if self.learning:\n # 8. When learning, update the q table according\n # to the given rules\n\n # The reward the turkey get after doing the action\n reward_t1 ...
[ "0.7745995", "0.7196582", "0.7083119", "0.67310244", "0.6661113", "0.66017634", "0.6546034", "0.6514146", "0.6481924", "0.6191806", "0.61677134", "0.6135177", "0.6116605", "0.60574716", "0.60557526", "0.60248256", "0.6014129", "0.59878457", "0.59849346", "0.59818447", "0.5970...
0.0
-1
This method returns the reward of a particular state
def reward_func(self, state): if abs(state['theta']) < 1: return 2.0 elif abs(state['theta']) < 3: return 0.0 elif abs(state['theta']) > 30: return -100.0 return -2.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reward(self,\n state: float) -> float:\n raise NotImplementedError", "def get_reward(self, state, action, next_state):\n assert action in self.get_possible_actions(\n state), \"cannot do action %s from state %s\" % (action, state)\n x, y = self.__state_to_xy(next...
[ "0.8314272", "0.8240575", "0.82223743", "0.8161263", "0.8149699", "0.8095069", "0.8067136", "0.8055836", "0.7923237", "0.7907485", "0.7823275", "0.78065765", "0.77908105", "0.77655923", "0.7738718", "0.77146447", "0.7702389", "0.76473874", "0.7635467", "0.7619942", "0.7616541...
0.7740652
14
Whether a file/directory exists
def path_exists(path): return os.path.exists(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exists(path):\n return os.path.exists(path)", "def _check_file_exists(filename):\n filename = os.path.abspath(filename)\n return os.path.exists(filename) and not os.path.isdir(filename)", "def file_exist() -> bool:\n pass", "def file_exists(path: str) -> bool:\n\treturn os.path.isfil...
[ "0.8345081", "0.83220977", "0.83213353", "0.8316009", "0.83002365", "0.82759225", "0.8262142", "0.82428247", "0.8232843", "0.81893575", "0.8180444", "0.81084704", "0.8093849", "0.8086073", "0.8069549", "0.8069549", "0.8042128", "0.8037413", "0.8036439", "0.8010656", "0.799968...
0.8151251
11
Returns a list of filenames found in a directory
def files_in_dir(path): return os.listdir(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_in_dir(dir: str):\n\n file_list = [f\"{dir}/{file}\" for file in listdir(dir) if isfile(join(dir, file))]\n\n return file_list", "def GetFilesInDirectory(dir_path):\n\treturn [f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path,f))]", "def list_files_into_directory(direc...
[ "0.8131805", "0.8108138", "0.8034345", "0.79521066", "0.7903706", "0.7899298", "0.7884386", "0.7879142", "0.78716534", "0.78543764", "0.7830999", "0.77942765", "0.7782874", "0.77438194", "0.7679967", "0.7658643", "0.76420903", "0.7634723", "0.7630502", "0.7629579", "0.7621057...
0.7984331
3
Opens a text file
def txt_file_reader(path): return open(path, encoding=cfg.ENCODING)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_txt(filename, mode, **kwargs):\n return sys_open(filename, mode, **kwargs)", "def os_open_txt_file( cls, txt_file ):\n cls.file_text_editor.os_call( txt_file )", "def open_file(self):\n files = [('Text Document', '*.txt'), ('PDF Document', '*.pdf'), ('Word Document', '*.docx')]\n ...
[ "0.77757466", "0.7589521", "0.73213387", "0.73170185", "0.72094905", "0.70254", "0.7010347", "0.70039314", "0.69586754", "0.69442713", "0.68548983", "0.68177813", "0.6797586", "0.673871", "0.67235", "0.6685664", "0.66772765", "0.6616197", "0.66110617", "0.6581541", "0.6578079...
0.67573357
13
Writes a text file
def txt_file_writer(path): return open(path, 'w', encoding=cfg.ENCODING)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(file, text):\n with open(file, 'w') as f:\n f.write(text)", "def writeFile(self, name, text):\n\t\ttry:\n\t\t\tf = open(name, 'w')\n\t\t\tf.write (text)\n\t\t\tf.close()\n\t\texcept IOError:\n\t\t\tprint \"Error writing file %s\" % name", "def write_text(file, text):\n\n with ope...
[ "0.82224035", "0.8141151", "0.80904305", "0.8078969", "0.80643934", "0.8063719", "0.80425274", "0.8013203", "0.8001203", "0.7977192", "0.77359587", "0.7735278", "0.7700556", "0.7676746", "0.76451916", "0.7598415", "0.7594608", "0.75632524", "0.75486135", "0.7547663", "0.75381...
0.7621443
15
Opens compressed file .bz2
def bz2_file_reader(path): return bz2.open(path, 'rt')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress_bz2(filename):\n bz2_filename = filename + '.bz2'\n\n with open(filename, 'rb') as og_file, bz2.BZ2File(bz2_filename, 'wb') as bz2_file:\n for data in iter(lambda : og_file.read(100 * 1024), b''):\n bz2_file.write(data)\n\n return bz2_filename", "def compress_bz2(filename)...
[ "0.69785935", "0.69785935", "0.69372684", "0.69372684", "0.6839064", "0.6691569", "0.6567918", "0.6491263", "0.6439713", "0.63826275", "0.6346191", "0.6245385", "0.6123849", "0.59531605", "0.5905753", "0.5889792", "0.5867345", "0.5854815", "0.5793635", "0.5793635", "0.5776847...
0.7192209
0
Opens compressed file .bz2 in bytes mode
def bz2_file_bytes_reader(path): return bz2.open(path, 'rb')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress_bz2(filename):\n bz2_filename = filename + '.bz2'\n\n with open(filename, 'rb') as og_file, bz2.BZ2File(bz2_filename, 'wb') as bz2_file:\n for data in iter(lambda : og_file.read(100 * 1024), b''):\n bz2_file.write(data)\n\n return bz2_filename", "def compress_bz2(filename)...
[ "0.7045241", "0.7045241", "0.69642025", "0.68728", "0.68728", "0.64734644", "0.62642217", "0.6183835", "0.61643773", "0.5998363", "0.59920585", "0.59511447", "0.5924625", "0.59138536", "0.5905901", "0.5905238", "0.5795446", "0.57917845", "0.5782833", "0.5713188", "0.56975424"...
0.72273827
0
Loads pkl file & returns python object
def load_pkl_file(path): with open(path, 'rb') as pkl_file: return pickle.load(pkl_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pkl_file(p):\n pkl_file = open(p, 'rb')\n obj = pickle.load(pkl_file)\n pkl_file.close()\n return obj", "def load_pkl(file_name):\n with open(file_name) as fp:\n data = pkl.load(fp)\n return data", "def pklload(path:str):\n pkl = pickle.load(open(path, 'rb'))\n return pk...
[ "0.82132095", "0.8132303", "0.796527", "0.7954674", "0.7921012", "0.7305059", "0.7282723", "0.72798735", "0.7206416", "0.7190132", "0.7016784", "0.7009667", "0.69017506", "0.68326926", "0.67414117", "0.6735015", "0.6724562", "0.6724562", "0.67084146", "0.66186106", "0.660616"...
0.7682848
5
Opens a txt file & loads each line into a set
def load_set_from_txt_file(path, value_type=str): with txt_file_reader(path) as txt_file: return {value_type(line.strip()) for line in txt_file}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_set_from_file(filename):\n collection = set()\n with open(filename, \"r\", encoding=\"utf-8\") as file_:\n for line in file_:\n collection.add(line.rstrip())\n return collection", "def read_gzip_file_lines_into_set(filename):\n with gzip.open(filename, 'r') as file:\n ...
[ "0.77329177", "0.7196545", "0.6965826", "0.67090535", "0.66853553", "0.66482943", "0.652496", "0.65170485", "0.6455998", "0.6452199", "0.6434522", "0.64226323", "0.64059776", "0.6388877", "0.6376491", "0.63378996", "0.6300295", "0.6294202", "0.6245464", "0.6227784", "0.621768...
0.70667094
2
Opens a txt file and loads tabseparated columns into a dictionary
def load_dict_from_txt_file(path, key_type=str, value_type=str): with txt_file_reader(path) as txt_file: return {key_type(key): value_type(value) for key, value in [line.strip().split('\t') for line in txt_file]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadtwocol(infile):\n kvdict = {}\n with open(infile) as f:\n for nline, line in enumerate(f):\n line = line.strip()\n if line: # to exclude blank line\n k, v = line.split('\\t')\n kvdict[k] = v\n return kvdict", "def open_txt_table(txt_file...
[ "0.7027454", "0.69427824", "0.6827322", "0.63295215", "0.63261515", "0.6240552", "0.623014", "0.62298214", "0.6190121", "0.6161519", "0.6150538", "0.61352277", "0.612601", "0.60427094", "0.60386354", "0.6011791", "0.60058546", "0.5992848", "0.5989369", "0.5974285", "0.5972237...
0.7086704
0