query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Load the data of the indicated table as a DataFrame. | def load_table(self, table_name):
LOGGER.info('Loading table %s', table_name)
table_meta = self.get_table_meta(table_name)
return _load_csv(self.root_path, table_meta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_data(table):\n engine = create_engine(myDB, encoding='latin1') \n conn = engine.connect()\n select = conn.execute('select * from ' + table)\n\n df = pd.DataFrame(select.fetchall()) \n df.columns = select.keys()\n\n conn.close()\n return df",
"def load_table_as_pd(conn, tablename: st... | [
"0.7611794",
"0.74878687",
"0.7388418",
"0.7288019",
"0.7241147",
"0.71715045",
"0.70901954",
"0.704221",
"0.7033023",
"0.6985092",
"0.6933346",
"0.6891327",
"0.68870693",
"0.68286896",
"0.6785773",
"0.6771751",
"0.67474866",
"0.6679523",
"0.66639715",
"0.6635452",
"0.6633521... | 0.63172114 | 53 |
Get a dictionary with data from multiple tables. If a ``tables`` list is given, only load the indicated tables. Otherwise, load all the tables from this metadata. | def load_tables(self, tables=None):
return {
table_name: self.load_table(table_name)
for table_name in tables or self.get_tables()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_data(cursor, *tables):\r\n final = []\r\n\r\n for table in tables:\r\n\r\n cursor.execute(f\"SELECT * FROM {table};\")\r\n data = cursor.fetchall()\r\n final.append(data)\r\n\r\n try:\r\n return final if len(final) > 1 else final[0]\r\n except:\r\n return []... | [
"0.6528968",
"0.6165072",
"0.6145485",
"0.61357963",
"0.60547894",
"0.59716797",
"0.58489496",
"0.58373743",
"0.58332884",
"0.5814303",
"0.58064365",
"0.57212013",
"0.56989026",
"0.56770927",
"0.56572306",
"0.5641059",
"0.5639461",
"0.5595813",
"0.5579743",
"0.5567074",
"0.55... | 0.74473447 | 0 |
Get a ``dict`` with the ``dtypes`` for each field of a given table. | def get_dtypes(self, table_name, ids=False, errors=None):
errors = [] if errors is None else errors
dtypes = dict()
table_meta = self.get_table_meta(table_name)
for name, field in table_meta['fields'].items():
field_type = field['type']
field_subtype = field.get('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_csv_dtypes(table_meta):\n dtypes = dict()\n for name, field in table_meta['fields'].items():\n field_type = field['type']\n if field_type == 'id' and field.get('subtype', 'integer') == 'string':\n dtypes[name] = str\n\n return dtypes",
"def _parse_dtypes(data, table_me... | [
"0.67987114",
"0.6779612",
"0.65333456",
"0.64418864",
"0.638998",
"0.6302129",
"0.62453437",
"0.6204387",
"0.6203673",
"0.6092654",
"0.60632783",
"0.605545",
"0.5997926",
"0.5938379",
"0.5924489",
"0.592412",
"0.58567226",
"0.58298707",
"0.58231306",
"0.5808817",
"0.5735598"... | 0.7376008 | 0 |
Create and return a new ``rdt.HyperTransformer`` instance for a table. First get the ``dtypes`` and ``pii fields`` from a given table, then use those to build a transformer dictionary to be used by the ``HyperTransformer``. | def _load_hyper_transformer(self, table_name):
dtypes = self.get_dtypes(table_name)
pii_fields = self._get_pii_fields(table_name)
transformers_dict = self._get_transformers(dtypes, pii_fields)
return HyperTransformer(field_transformers=transformers_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, table_name, data):\n hyper_transformer = self._hyper_transformers.get(table_name)\n if hyper_transformer is None:\n hyper_transformer = self._load_hyper_transformer(table_name)\n fields = list(hyper_transformer.transformers.keys())\n hyper_transfor... | [
"0.6244833",
"0.58232886",
"0.58181757",
"0.57892895",
"0.5649662",
"0.5565955",
"0.5486023",
"0.54371905",
"0.53667235",
"0.53400356",
"0.5253508",
"0.5126489",
"0.507082",
"0.5066768",
"0.5051716",
"0.504689",
"0.4984964",
"0.4981889",
"0.4979985",
"0.4939528",
"0.49351802"... | 0.76064014 | 0 |
Get a dict representation of this metadata. | def to_dict(self):
return copy.deepcopy(self._metadata) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dict(self):\n return self._data",
"def as_dict(self):\n return dict(self.as_OD())",
"def to_dict(self):\n return dict(self.__data)",
"def get_metadata(self):\n return {}",
"def as_dict(self):\n return dict(self._d)",
"def metadata(self) -> dict:\n return ... | [
"0.8048202",
"0.8043872",
"0.804037",
"0.8039867",
"0.80089813",
"0.7966518",
"0.79466915",
"0.7941678",
"0.7900131",
"0.78628224",
"0.7856073",
"0.78538454",
"0.78473145",
"0.78473145",
"0.78473145",
"0.78473145",
"0.78473145",
"0.78473145",
"0.78473145",
"0.7837404",
"0.783... | 0.83734834 | 0 |
Return a relative version of a path | def relpath(path, start=os.path.curdir):
if not path:
raise ValueError('no path specified')
start_list = os.path.abspath(start).split(os.path.sep)
path_list = os.path.abspath(path).split(os.path.sep)
# Work out how much of the filepath is shared by start and path.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative(self, path):\n return re.sub(self.path_regex, '', path).lstrip(os.sep)",
"def relativize(path: str):\n return join('.', path)",
"def relativePath(path):\n spath = pathSplit(path)\n return spath[-1]",
"def get_relative_path(path: str):\n return os.path.relpath(path, get_project... | [
"0.7916205",
"0.77834916",
"0.77383643",
"0.765349",
"0.7530642",
"0.7522436",
"0.7415771",
"0.7404095",
"0.729165",
"0.72837",
"0.7279967",
"0.723366",
"0.7217335",
"0.71864855",
"0.7178365",
"0.7105353",
"0.7092798",
"0.70900303",
"0.70873284",
"0.70858437",
"0.70681816",
... | 0.6645015 | 67 |
Determine if an instancemethod is a classmethod. | def is_classmethod(instancemethod):
# attribute = (isPython3() and ['__self__'] or ['im_self'])[0]
# if hasattr(instancemethod, attribute):
# return getattr(instancemethod, attribute) is not None
# return False
return isinstance(instancemethod, MethodTypes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_class_method(func):\n return inspect.ismethod(func) and inspect.isclass(func.__self__)",
"def isclassmethod(object):\n if isinstance(object, classmethod):\n return True\n\n # Let's not give up quite yet.\n original = _get_dict_function(object)\n return isinstance(original, classmetho... | [
"0.8289466",
"0.80914414",
"0.73406345",
"0.71501476",
"0.6694424",
"0.6512561",
"0.64570767",
"0.6446485",
"0.6407424",
"0.63292104",
"0.6198845",
"0.61335665",
"0.6073957",
"0.59742606",
"0.58597153",
"0.58566",
"0.58469933",
"0.58355445",
"0.58355445",
"0.58355445",
"0.583... | 0.8521102 | 0 |
Makes a pandas.Timestamp from separate date/time columns | def makeTimestamp(row, datecol="sampledate", timecol="sampletime", issuewarnings=False):
fallback_datetime = pandas.Timestamp("1901-01-01 00:00")
if row[datecol] is None or pandas.isnull(row[datecol]):
fb_date = True
else:
fb_date = False
try:
date = pandas.Timestamp(ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_datetime_column(df):\n df[\"datetime\"] = pd.to_datetime(df[[\"year\", \"month\", \"day\"]])\n return df.drop([\"year\", \"month\", \"day\"], axis=1)",
"def seconds_from_datetime(df, time_col):\n #TODO rename timestamp to counter for generalization\n start = pd.to_datetime(df[time_col].ilo... | [
"0.6704169",
"0.6348494",
"0.63431937",
"0.6339834",
"0.63293004",
"0.6276006",
"0.62625486",
"0.60891914",
"0.6071224",
"0.6056047",
"0.60558647",
"0.60459244",
"0.5997766",
"0.5963852",
"0.5887086",
"0.5873021",
"0.5871804",
"0.58452016",
"0.5842066",
"0.5835369",
"0.582520... | 0.68139815 | 0 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lat1, lon1, lat2, lon2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.81450045",
"0.7863265",
"0.76322985",
"0.76064754",
"0.75978696",
"0.75965863",
"0.75944835",
"0.75720793",
"0.75630087",
"0.7555095",
"0.7528691",
"0.7517629",
"0.7492963",
"0.7467739",
"0.7452678",
"0.7434477",
"0.73914117",
"0.7357736",
"0.73484355",
"0.73318124",
"0.73... | 0.0 | -1 |
Compute crossentropy loss for each meaningful tokens. Mask padded tokens. | def loss(self, labels, logits, mask=None):
losses = tf.nn.softmax_cross_entropy_with_logits(tf.one_hot(labels, depth=logits.shape[-1]), logits, axis=-1)
seq_mask = mask # logits._keras_mask# tf.sequence_mask(lengths, self.seq_len)
loss = tf.reduce_mean(tf.boolean_mask(losses, seq_mask))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_entropy(eval_token_count, training_model):\n sum_of_counts = sum(eval_token_count.values())\n cross_entropy = 0\n mis = []\n for ngram in eval_token_count:\n if training_model.score(ngram[-1], list(ngram[0:3])) == 0 or sum_of_counts == 0:\n mi = n... | [
"0.68517584",
"0.6792142",
"0.670545",
"0.6694029",
"0.6651434",
"0.66461945",
"0.6644646",
"0.6644646",
"0.6644646",
"0.66034156",
"0.6459853",
"0.6421803",
"0.6406869",
"0.63361883",
"0.62785214",
"0.62050843",
"0.6177554",
"0.61557704",
"0.6135562",
"0.60815305",
"0.604350... | 0.6068272 | 20 |
Return True iff a node is within a given region (and region is specified). | def filter_to_region(node, contig=None, coords=None):
((seq, coord), miss) = node
if contig and seq != contig:
return False
if coords and coord < coords[0]:
return False
if coords and coord > coords[1]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_region(point, plotregion):\n\n if ((point[0] >= plotregion[0]) and\n (point[0] < plotregion[1]) and\n (point[1] >= plotregion[2]) and\n (point[1] < plotregion[3])):\n return True\n else:\n return False",
"def is_in_region(location, region):\n c= count_hits_regio... | [
"0.7497887",
"0.7207402",
"0.71981275",
"0.681518",
"0.6700083",
"0.6549555",
"0.6470701",
"0.64154464",
"0.63749754",
"0.6371608",
"0.63354194",
"0.63082546",
"0.6283306",
"0.61995304",
"0.61958104",
"0.6170806",
"0.6169217",
"0.6161878",
"0.61574614",
"0.613822",
"0.6126415... | 0.69047827 | 3 |
Define the equal operator. Two records are equal if they have the same id. | def __eq__(self, other):
return int(self.id) == int(other.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self.id == other.id",
"def __eq__(self, other):\n return self.__id == other.get_id()",
"def isEqual (self, other) :\n return self.id == other.getIdent ()",
"def __eq__(self, other):\n return type(self) == type(other) and self.id == other.id",
"d... | [
"0.7627095",
"0.74276555",
"0.72621286",
"0.72477275",
"0.71944785",
"0.71252626",
"0.7114959",
"0.71076214",
"0.70485914",
"0.70191073",
"0.7006052",
"0.7000478",
"0.69906247",
"0.6954639",
"0.68877083",
"0.6800893",
"0.67967874",
"0.6789688",
"0.67714435",
"0.67189115",
"0.... | 0.75839216 | 1 |
Gets the foreign keys for the key and time provided. | def select_foreign_edges(self, transaction_id, key=None):
return [self.select(transaction_id, "foreign_edges", key)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_foreign_keys(self, parent, child):\n foreign_keys = []\n for name, field in self.get_fields(child).items():\n ref = field.get('ref')\n if ref and ref['table'] == parent:\n foreign_keys.append(name)\n\n return foreign_keys",
"def get_foreign_keys(s... | [
"0.6656787",
"0.6610269",
"0.63572264",
"0.6314893",
"0.60704213",
"0.6001471",
"0.59741664",
"0.58700275",
"0.5781416",
"0.5309382",
"0.5279823",
"0.5252607",
"0.5033911",
"0.5015082",
"0.49459943",
"0.49356586",
"0.488678",
"0.48856026",
"0.48165056",
"0.48121664",
"0.47988... | 0.5459232 | 9 |
API to get all questions for a specific task (most recent questions first) | def task_questions_collection(request, task_id):
try:
task = Task.objects.get(id=task_id)
except Task.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.method == "GET":
questions = Question.objects.filter(task=task).all().order_by("-timestamp")
seria... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n user = getAuthData()\n question_list = list_questions()\n # user_question_list = list_questions_by_username(user['username'])\n # nonuser_question_list = list_questions_by_username(user['username'], invert=True)\n\n tasks = get_tasks().values()\n\n # filte... | [
"0.68669504",
"0.6673215",
"0.66464144",
"0.6609911",
"0.6099163",
"0.6065348",
"0.60219306",
"0.6006912",
"0.60028034",
"0.5978108",
"0.5973894",
"0.5928266",
"0.59108436",
"0.58817655",
"0.58649176",
"0.58649176",
"0.5861504",
"0.5850198",
"0.5848015",
"0.58369744",
"0.5826... | 0.78517354 | 0 |
API to update a specific review | def review_element(request, review_id):
try:
review = Review.objects.get(id=review_id)
except Review.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.method == "PUT":
data = json.loads(request.body)
review.rating = data.get("rating", "")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_review(review_id):\n user_input = request.get_json()\n if user_input is None:\n abort(400, {'message': 'Not a JSON'})\n obj = storage.get(Review, review_id)\n if obj is None:\n abort(404)\n for k, v in user_input.items():\n if k not in ['id', 'user_id', 'place_id',\n ... | [
"0.79613566",
"0.7928031",
"0.79056853",
"0.7835451",
"0.77626014",
"0.72917026",
"0.7255775",
"0.7045848",
"0.6987645",
"0.6983477",
"0.696466",
"0.6771411",
"0.656052",
"0.64195645",
"0.63901234",
"0.6382885",
"0.63326174",
"0.63322145",
"0.63267905",
"0.63197744",
"0.63111... | 0.74679214 | 5 |
index page of our web app | def index():
return render_template('home.jinja2') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template('index.html'), 200",
"def index():\n\n return render_template(\"index.html\"), 200",
"def index():\n\n\treturn(render_template('index.html'))",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('... | [
"0.8523637",
"0.85071117",
"0.8495395",
"0.8494247",
"0.8449254",
"0.84243447",
"0.8403479",
"0.8383722",
"0.8383722",
"0.8346859",
"0.8346859",
"0.8284392",
"0.8277338",
"0.82252026",
"0.81853265",
"0.81853265",
"0.81853265",
"0.81853265",
"0.81853265",
"0.81853265",
"0.8185... | 0.0 | -1 |
Register a direction of optimization problem to a study. | def set_study_direction(self, study_id: int, direction: study.StudyDirection) -> None:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(self, optim):\r\n self.optim = optim",
"def register(self, optim):\r\n self.optim = optim",
"def register_problem(self, location, name):\r\n self.problems[location] = name",
"def register(self, *, model, optimizer, criterion, **kwargs):\n raise NotImplementedError()",... | [
"0.6380942",
"0.6380942",
"0.59776676",
"0.587496",
"0.54008913",
"0.538581",
"0.538358",
"0.51357985",
"0.5074247",
"0.50576466",
"0.49817315",
"0.489983",
"0.48843044",
"0.48520148",
"0.48497537",
"0.48089805",
"0.48088917",
"0.4806613",
"0.4746979",
"0.4744744",
"0.4738205... | 0.47239172 | 21 |
Read an optunainternal attributes of a specified trial. | def get_trial_system_attrs(self, trial_id: int) -> Dict[str, Any]:
return self.get_trial(trial_id).system_attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trial_user_attrs(self, trial_id: int) -> Dict[str, Any]:\n return self.get_trial(trial_id).user_attrs",
"def get_trial_params(self, trial_id: int) -> Dict[str, Any]:\n return self.get_trial(trial_id).params",
"def _itool_getattrib_ ( tool , attribute ) :\n if cpp.Gaudi.Utils.hasP... | [
"0.6030085",
"0.5411599",
"0.5397705",
"0.5393058",
"0.53124696",
"0.52919483",
"0.5285464",
"0.51552814",
"0.5152264",
"0.5136184",
"0.505921",
"0.50552475",
"0.5037601",
"0.49758515",
"0.49742138",
"0.49383375",
"0.4932983",
"0.49046662",
"0.49007452",
"0.48978448",
"0.4896... | 0.6263643 | 0 |
Get a datetime object or a int() Epoch timestamp and return a pretty string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc | def time_since_as_text(time=False):
now = datetime.now(timezone.utc)
if type(time) is int:
diff = now - datetime.fromtimestamp(time)
elif isinstance(time,datetime):
diff = now - time
elif not time:
diff = now - now
second_diff = diff.seconds
day_diff = diff.days
if d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humanize_ts(timestamp=False):\n now = datetime.now()\n diff = now - datetime.fromtimestamp(timestamp)\n second_diff = diff.seconds\n day_diff = diff.days\n\n if day_diff < 0:\n return ''\n\n if day_diff == 0:\n if second_diff < 10:\n return \"just now\"\n if se... | [
"0.78832227",
"0.77368337",
"0.7709011",
"0.7691796",
"0.76486737",
"0.75154054",
"0.71026635",
"0.6906214",
"0.68917185",
"0.6841173",
"0.6821396",
"0.6655869",
"0.6655468",
"0.6654383",
"0.6621224",
"0.65869296",
"0.65537095",
"0.65284306",
"0.6513822",
"0.6502716",
"0.6468... | 0.6811348 | 11 |
A pytest fixture that creates a dataset in a temp working dir. Deletes directory after test | def mock_dataset_with_cache_dir():
conf_file, working_dir = _create_temp_work_dir()
with patch.object(Configuration, 'find_default_config', lambda self: conf_file):
im = InventoryManager(conf_file)
ds = im.create_dataset(USERNAME, USERNAME, 'dataset-1', description="my dataset 1",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixture_project_dir(tmpdir_factory) -> Path:\n my_tmpdir = Path(tmpdir_factory.mktemp(\"data\"))\n yield my_tmpdir\n shutil.rmtree(str(my_tmpdir))",
"def setUp(self):\n self.directory = tempfile.TemporaryDirectory()\n self.dataset = self.dataset_cls(cache_root=self.directory.name)",
... | [
"0.74893934",
"0.7433642",
"0.7281445",
"0.7201816",
"0.71706927",
"0.71120745",
"0.70982593",
"0.6985421",
"0.695064",
"0.6912915",
"0.6902213",
"0.6880684",
"0.6871937",
"0.68630135",
"0.68506384",
"0.68356025",
"0.68293184",
"0.6740891",
"0.6731251",
"0.6729769",
"0.672974... | 0.7543531 | 0 |
Gets all the issues and pullrequests (GH treats PRs like issues in the api) Needs to use pagination because of 100 perrequest api limit | def getIssuesFromAPI():
issues = []
pageNumber = 1
numberOfIssuesReturned = 1
while numberOfIssuesReturned != 0:
issuesResponse = requests.get(
"https://api.github.com/repos/greenelab/covid19-review/issues?state=all&per_page=50&page=" +
str(pageNumber), headers=headers)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_issues(): # pragma: no cover\n global issue_data\n team = {\n 'stevex196x': 0,\n 'TheSchaft': 0,\n 'melxtru': 0,\n 'aylish19': 0,\n 'connormlewis': 0,\n 'tsukkisuki': 0\n }\n all_issues = 0\n while all_issues == 0:\n url = ('https://api.githu... | [
"0.75191945",
"0.70823777",
"0.69576883",
"0.6862858",
"0.68420386",
"0.68368286",
"0.6801333",
"0.6709925",
"0.66549814",
"0.66260296",
"0.6606031",
"0.6560733",
"0.65242815",
"0.6512636",
"0.64799726",
"0.6318883",
"0.6236998",
"0.62366486",
"0.623531",
"0.62190455",
"0.620... | 0.76822037 | 0 |
Adds a new column to a sourcesDF with the link to any relevant PR that has that DOI | def addPRLinks(sourcesDF, prData):
def addPRLinkToPaperRow(row):
prLinks = []
doi = str(row.doi)
if len(doi) < 1:
return
else:
for PR in prData:
# TODO: use manubot to keep all DOIs consistent so that there will be no issues with short DOIs not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_column(df_main, serie, name):\n df = serie.to_frame(name=name)\n df_main_new = df_main.merge(df, left_on='customerId2', right_index='customerId2', how='left')\n return df_main_new",
"def make_link(df, spot):\n\n strings = ['Phase', 'Deleted', 'Client ID', 'Estimating ID', 'Survey ID', 'Block... | [
"0.56533253",
"0.54130363",
"0.53972644",
"0.537795",
"0.5345844",
"0.51319844",
"0.49862748",
"0.49704045",
"0.4949029",
"0.49124697",
"0.48719484",
"0.48636305",
"0.48544875",
"0.484515",
"0.48333427",
"0.4790987",
"0.47886905",
"0.47681534",
"0.47484967",
"0.47476792",
"0.... | 0.6960343 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(point_SF, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.s_x is None:
self.s_x = 0
if self.s_y is None:
self.s_y = 0
if self.f_x is None:
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77937967",
"0.77195275",
"0.77195275",
"0.7685702",
"0.762502",
"0.7562939",
"0.74384665",
"0.7416083",
"0.73515767",
"0.73078126",
"0.7280228",
"0.723719",
"0.72265446",
"0.72230625",
"0.72230625",
"0.7218876",
"0.721051",
"0.721051",
"0.721051",
"0.721051",
"0.721051",
... | 0.0 | -1 |
Retrieve a specific document from the index | def get_document(self, doc_id, options=None):
path = urllib.quote_plus(str(doc_id))
try:
result = self.request(path, pylastica.request.Request.GET, query=options).data
except pylastica.exception.ResponseException:
raise pylastica.exception.NotFoundException("Document with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_document(obj):\n try:\n return ES.get(\n index=obj.get_index_name(), doc_type=obj.get_document_type(), id=obj.pk)\n except NotFoundError:\n raise DocumentNotFound(obj.get_index_name(), obj.pk)",
"def fetch_search_document(self, index):\n assert self.pk, \"Object must... | [
"0.7713414",
"0.7631978",
"0.75813437",
"0.72717667",
"0.7215716",
"0.7148653",
"0.7040545",
"0.7008266",
"0.69897026",
"0.6925545",
"0.6896944",
"0.6778739",
"0.6767422",
"0.6755266",
"0.6744117",
"0.6677857",
"0.6663726",
"0.6628045",
"0.6572391",
"0.6570605",
"0.6554164",
... | 0.6257833 | 34 |
class that creates new profile | def setUp(self):
self.maya = User(username="Maya", email="maya123@gmail.com")
self.maya = Profile(user=self.maya, user_id=1, bio="You're cute to think its about you", profile_photo="my.jpg")
# Testing Instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createProfile(self):\n if self.profile:\n return\n from soc.modules.gsoc.models.profile import GSoCProfile\n user = self.createUser()\n properties = {'link_id': user.link_id, 'student_info': None, 'user': user,\n 'parent': user, 'scope': self.program, 'status': 'active'}\n ... | [
"0.8224018",
"0.75450426",
"0.74577576",
"0.7404931",
"0.73734117",
"0.7317509",
"0.73055786",
"0.72973907",
"0.72822917",
"0.7279825",
"0.7274246",
"0.7245467",
"0.724498",
"0.7234686",
"0.7224593",
"0.71945584",
"0.7144791",
"0.71250415",
"0.709916",
"0.7085715",
"0.7083276... | 0.0 | -1 |
Routine to convert UTC to NZ time zone. | def to_nztimezone(t):
from dateutil import tz
utctz = tz.gettz('UTC')
nztz = tz.gettz('Pacific/Auckland')
return [ti.replace(tzinfo=utctz).astimezone(nztz) for ti in pd.to_datetime(t)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tz():\n return 'UTC'",
"def toutc(dateobj, timezone):\n fmtdate = parser.parse(dateobj) # string to datetime object\n user_tz = pytz.timezone(timezone) # getting user's timezone\n localize_date_with_tz = user_tz.localize(fmtdate) #adding user's timezone to datetime object\n utcdate = pytz... | [
"0.64015675",
"0.6337772",
"0.6237993",
"0.61282647",
"0.61282647",
"0.61227304",
"0.5949234",
"0.5947592",
"0.59453845",
"0.5945015",
"0.5883102",
"0.58338535",
"0.5796723",
"0.57557344",
"0.5744395",
"0.5728599",
"0.5710501",
"0.57091844",
"0.56924844",
"0.5685395",
"0.5676... | 0.7007069 | 0 |
Transform X to a clusterdistance space. In the new space, each dimension is the distance to the cluster centers. Note that even if X is sparse, the array returned by `transform` will typically be dense. | def transform(self, X):
check_is_fitted(self)
X = self._check_test_data(X)
return self._transform(X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _transform(self, X):\r\n return euclidean_distances(X, self.cluster_centers_)",
"def _calc_distance(self, X):\n distances = np.zeros((X.shape[0], self.n_clusters))\n print(distances.shape)\n for i, centroid in enumerate(self.centroids):\n distances[:, i] = np.linalg.nor... | [
"0.7807338",
"0.7132903",
"0.7032089",
"0.6872973",
"0.6307288",
"0.6093125",
"0.59657264",
"0.59578246",
"0.5936482",
"0.5882001",
"0.58444095",
"0.5826819",
"0.5802967",
"0.5790434",
"0.57563066",
"0.57295996",
"0.56299007",
"0.56056845",
"0.559342",
"0.5568789",
"0.5566537... | 0.0 | -1 |
Load model states from a previously saved checkpoint. | def load_model_states_from_checkpoint(model, filename, tag, from_gpu=True):
assert os.path.exists(filename)
if from_gpu:
checkpoint = torch.load(filename)
else:
checkpoint = torch.load(filename, map_location=lambda storage, loc: storage)
model.load_state_dict(checkpoint[tag]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_states(self, checkpoint):\n raise NotImplementedError()",
"def load_checkpoint(self, model):\n print(f\"load model {self.save_model_path}\")\n model.load_state_dict(torch.load(self.save_model_path))",
"def load_checkpoint(model, save_path):\n model.load_state_dict(torch.load(sa... | [
"0.8494202",
"0.8281548",
"0.81373066",
"0.7791614",
"0.77544695",
"0.773334",
"0.7692545",
"0.7673317",
"0.7671424",
"0.7585864",
"0.7570133",
"0.75642973",
"0.75380903",
"0.7462652",
"0.744102",
"0.7432889",
"0.7428681",
"0.742438",
"0.7416525",
"0.7416525",
"0.739329",
"... | 0.7659332 | 9 |
Load model states from a previously saved checkpoint. | def load_selector_classifier_states_from_checkpoint(selector, selector_filename, tag_selector, model, filename, tag, from_gpu=True):
assert os.path.exists(selector_filename)
assert os.path.exists(filename)
if from_gpu:
checkpoint = torch.load(filename)
else:
checkpoint = torch.load... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_states(self, checkpoint):\n raise NotImplementedError()",
"def load_checkpoint(self, model):\n print(f\"load model {self.save_model_path}\")\n model.load_state_dict(torch.load(self.save_model_path))",
"def load_checkpoint(model, save_path):\n model.load_state_dict(torch.load(sa... | [
"0.8494969",
"0.82812047",
"0.8136796",
"0.7792039",
"0.7754337",
"0.7732072",
"0.76922876",
"0.7672868",
"0.76710117",
"0.7660182",
"0.758522",
"0.7569757",
"0.7563508",
"0.7538504",
"0.7462623",
"0.7440334",
"0.74319917",
"0.7428191",
"0.7424297",
"0.7416124",
"0.7416124",
... | 0.0 | -1 |
Converts seconds to minutes and seconds | def convert_to_minutes(s):
m = math.floor(s / 60)
s -= m * 60
return '%dm %ds' % (m, s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_time(t):\n minutes = int(t/60)\n seconds = int(t-60*minutes)\n return minutes, seconds",
"def to_seconds(hours, minutes, seconds):\n return hours*60**2 + minutes*60 + seconds",
"def _to_minutes(seconds):\n return '%d:%d' % divmod(seconds, 60)",
"def to_seconds(hours,minutes,seconds... | [
"0.81685877",
"0.79047257",
"0.785517",
"0.7833231",
"0.7803818",
"0.7771472",
"0.7757349",
"0.7578673",
"0.75617844",
"0.7484286",
"0.7410756",
"0.7408472",
"0.73952025",
"0.73226804",
"0.73226804",
"0.72938204",
"0.726201",
"0.71847343",
"0.7180222",
"0.71647996",
"0.713650... | 0.6853293 | 37 |
Convert a sequence of words to a tensor of word indices. | def sequence_to_tensor(sequence, max_sent_length, dictionary):
sen_rep = torch.LongTensor(max_sent_length).zero_()
for i in range(len(sequence)):
if dictionary.contains(sequence[i]):
sen_rep[i] = dictionary.word2idx[sequence[i]]
return sen_rep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_to_idx(words, word_vocab):\n\n idx = []\n\n for word in words:\n idx.append(word_vocab[word])\n \n return torch.from_numpy(np.asarray(idx))",
"def words_to_tensor(words, vocab, max_word_length):\n tensor = torch.zeros(len(words), len(vocab), max_word_length)\n for i, wor... | [
"0.7419282",
"0.6858963",
"0.6628909",
"0.63809675",
"0.6306927",
"0.628214",
"0.62529355",
"0.62475055",
"0.62289304",
"0.61745054",
"0.6145104",
"0.6082612",
"0.60759807",
"0.6021381",
"0.60144186",
"0.60051095",
"0.5973791",
"0.59705955",
"0.5969561",
"0.5903706",
"0.58905... | 0.5794724 | 24 |
Create a concrete file name based on template and file number e.g. Calling the function with filename_${PBS_ARRAYID}.txt, 5 returns filename_5.txt | def create_concrete_from_template(pf_template, file_number):
return pf_template.replace("${PBS_ARRAYID}", str(file_number)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(i):\n rand_name = os.path.join(os.getcwd(), \"input-%d.txt\" % i)\n ref_name = os.path.join(os.getcwd(), \"input-%d.ref\" % i)\n return rand_name, ref_name",
"def file_name(id, title, kind=\"src\"):\n fn_template = conf.template_source_file_name\n if kind == \"tst\":\n fn_templ... | [
"0.7153712",
"0.69784194",
"0.6954508",
"0.6914099",
"0.6881896",
"0.67708176",
"0.673058",
"0.67254657",
"0.6708525",
"0.67016834",
"0.666754",
"0.6662606",
"0.66336036",
"0.6579183",
"0.65599793",
"0.65483403",
"0.65118694",
"0.6494432",
"0.6472382",
"0.64667094",
"0.646586... | 0.71496964 | 1 |
Given a document (represented as a string), return a list of all of the words in that document, in order. Process document by coverting all words to lowercase, and removing any punctuation or English stopwords. | def tokenize(document):
words = [word.lower() for word in nltk.word_tokenize(document) if word not in string.punctuation and word not in nltk.corpus.stopwords.words("english") ]
return sorted(words) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(document):\n raw_words=[word.lower() for word in nltk.word_tokenize(document) if word.isalpha()]\n raw_words=[word.lower() for word in raw_words]\n final_words=[]\n for word in raw_words:\n if word not in string.punctuation and word not in nltk.corpus.stopwords.words(\"english\"):\n... | [
"0.7945455",
"0.7920988",
"0.7755041",
"0.77347577",
"0.7725208",
"0.76664394",
"0.7387016",
"0.7339664",
"0.72888803",
"0.72275144",
"0.7075368",
"0.7041337",
"0.70225614",
"0.70190245",
"0.70190245",
"0.6992113",
"0.6973064",
"0.69688004",
"0.6964989",
"0.69493914",
"0.6945... | 0.7898004 | 2 |
Sets the learning rate to the given value | def set_learning_rate(optimizer, lr):
for param_group in optimizer.param_groups:
param_group['lr'] = lr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def assign_learning_rate(session, lr_update, lr_placeholder, new_lr):\n session.run(lr_update, feed_dict={lr_placeholder: new_lr})",
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.l... | [
"0.80450565",
"0.75777924",
"0.7369227",
"0.726456",
"0.7237269",
"0.7214468",
"0.72116584",
"0.7119267",
"0.70937777",
"0.70937777",
"0.7089664",
"0.708559",
"0.7061882",
"0.70465815",
"0.7030721",
"0.70068645",
"0.7002885",
"0.6997488",
"0.6973235",
"0.6970918",
"0.69700533... | 0.70718735 | 13 |
Appends cell manager to the end of board. | def append_cell(self, index, cell):
if index == len(self._grid):
self._grid.append([])
self._grid[index].append(cell) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, cell):\r\n self.cells.add(cell)\r\n cell.add_group(self)",
"def add_to_free_cell_list(self, cell: Cell):\r\n assert isinstance(cell, Cell)\r\n self.free_cell_list.append(cell)",
"def add_cell(self, cell):\r\n if cell not in self.cells:\r\n self.cells.... | [
"0.5738799",
"0.5701537",
"0.5656684",
"0.559196",
"0.55732447",
"0.55714214",
"0.5567353",
"0.55397666",
"0.55353886",
"0.55176216",
"0.54991436",
"0.54379004",
"0.5351723",
"0.53163594",
"0.5307111",
"0.5305361",
"0.530147",
"0.52916694",
"0.5283365",
"0.52541995",
"0.52386... | 0.60288405 | 0 |
Make y axis point right. Work on top left 3x3 subset of MV matrix. This was deduced by watching behaviour of MV matrix while manually | def rotateYRight(self):
MV = self.MV
MV[:3, 0] = 0, 1, 0 # 1st col is right vector, make it point along y axis
# set middle middle and middle right values to zero:
MV[1, 1] = 0
MV[1, 2] = 0
a = MV[0, 1] # grab top middle value
b = np.sqrt(1 - a**2) # calc new comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_y():\n plt.ylim(plt.ylim()[::-1])",
"def move_right(self):\n self.yaw_motor.step_forward()",
"def move_south(self):\n self.vertical = (self.vertical * 2)[3:7]\n self.horizontal[1] = self.vertical[0]\n self.horizontal[3] = self.vertical[2]",
"def go_right(self):\n ... | [
"0.5998346",
"0.5765761",
"0.5688608",
"0.5679647",
"0.5679647",
"0.56352144",
"0.56272876",
"0.5578424",
"0.55739796",
"0.5556038",
"0.5541406",
"0.551876",
"0.55143416",
"0.5470787",
"0.54636353",
"0.54250324",
"0.54239583",
"0.54147243",
"0.54140085",
"0.53795046",
"0.5370... | 0.7367503 | 0 |
Translate along view normal vector | def zoom(self, dr):
d = self.getDistance()
vn = self.getViewNormal()
vn *= dr*d
GL.glTranslatef(vn[0], vn[1], vn[2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normal_vector(o, p0_3d, p1_3d):\n # The vector between middle point of v1-v2 and object center location\n # is the normal vector I'm looking for\n vn = p0_3d.lerp(p1_3d, 0.5) - o.matrix_world.translation\n # normalize so I can to length computation on it\n vn.normalize()\n return vn",
"def... | [
"0.71389234",
"0.7042153",
"0.6895338",
"0.6679227",
"0.6607681",
"0.65221083",
"0.6485948",
"0.64289105",
"0.64289105",
"0.6360593",
"0.6329387",
"0.63027",
"0.6276381",
"0.6269661",
"0.6251185",
"0.6249649",
"0.62177056",
"0.6216836",
"0.6203873",
"0.62004495",
"0.61948925"... | 0.0 | -1 |
Return sid of point at window coords x, y (bottom left origin), or first or multiple sids that fall within a square 2pb+1 pix on a side, centered on x, y. pb is the pixel border to include around x, y | def pick(self, x, y, pb=2, multiple=False):
width = self.size().width()
height = self.size().height()
#print('coords: %d, %d' % (x, y))
# constrain to within border 1 pix smaller than widget, for glReadPixels call
if not (pb <= x < width-pb and pb <= y < height-pb): # cursor out ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick(self, x, y, pb=2, multiple=False):\n width = self.size().width()\n height = self.size().height()\n #print('coords: %d, %d' % (x, y))\n # constrain to within border 1 pix smaller than widget, for glReadPixels call\n if not (pb <= x < width-pb and pb <= y < height-pb): # c... | [
"0.57821745",
"0.56050575",
"0.54738986",
"0.54188204",
"0.5393474",
"0.5364883",
"0.5358464",
"0.5312711",
"0.52876115",
"0.52711827",
"0.5267454",
"0.5266561",
"0.5255795",
"0.5253673",
"0.525232",
"0.524752",
"0.52386695",
"0.52201587",
"0.51808906",
"0.5174361",
"0.516500... | 0.57821745 | 0 |
Check if a given Pandas Series has the properties of a TokenSeries. | def check_series(s: pd.Series) -> bool:
error_string = (
"There are non-token cells (every cell should be a list of words/tokens) in the given Series."
" See help(hero.HeroSeries) for more information."
)
def is_list_of_strings(cell):
return all(isinstance(x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_series_like(self):\n return len(self.columns) == 1 or len(self.index) == 1",
"def check_type(s: pd.Series) -> Tuple[bool, str]:\n\n error_string = (\n \"should be TokenSeries: there are non-token cells (every cell should be a list of words/tokens) in the given Series.\"\n ... | [
"0.6585459",
"0.653638",
"0.6217491",
"0.61690974",
"0.58898103",
"0.57296133",
"0.55298156",
"0.5490258",
"0.5399716",
"0.5363592",
"0.53476226",
"0.534685",
"0.53361505",
"0.5318767",
"0.5305161",
"0.5261447",
"0.52152485",
"0.5205616",
"0.5194034",
"0.5186024",
"0.5103313"... | 0.70799375 | 0 |
Return the amount of RAM usage, in bytes, being consumed currently. | def check_mem_usage():
mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return mem | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_ram():\n return int(convert.bytetomb(psutil.virtual_memory().total))",
"def ram_size(self) -> pulumi.Output[float]:\n return pulumi.get(self, \"ram_size\")",
"def get_usage_ram_size(self):\n\t\treturn call_sdk_function('PrlStat_GetUsageRamSize', self.handle)",
"def get_total_mem(self):\n ... | [
"0.80505025",
"0.7942834",
"0.78569037",
"0.78410417",
"0.7785429",
"0.77579015",
"0.775512",
"0.7751444",
"0.7720074",
"0.76850504",
"0.76592183",
"0.7651345",
"0.75960094",
"0.75701505",
"0.7555924",
"0.75073797",
"0.748758",
"0.7457451",
"0.7457451",
"0.7422997",
"0.741751... | 0.662287 | 72 |
Given a 2D Array's subscripts, return it's flattened index | def sub2ind(subs, dims):
ii = 0
indice = 0
for y in range(dims[1]):
for x in range(dims[0]):
if subs[0] == x and subs[1] == y:
indice = ii
ii += 1
return indice | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_to_flat_array_index(row, column, matrix):\n return row * matrix.cols + column",
"def ind2sub(index,dims):\n subs = []\n ii = 0\n for y in range(dims[1]):\n for x in range(dims[0]):\n if index==ii:\n subs = [x,y]\n ii +=1\n return subs",
"def... | [
"0.6290968",
"0.6287505",
"0.6055808",
"0.60286605",
"0.5933717",
"0.58552897",
"0.58297664",
"0.58140635",
"0.5797358",
"0.57935965",
"0.57285196",
"0.57280487",
"0.5710212",
"0.56275976",
"0.55889285",
"0.5580733",
"0.55734277",
"0.5572625",
"0.5537081",
"0.5536094",
"0.553... | 0.54326344 | 29 |
Tests if unauthenticated_user can upvote | def test_unauthenticated_user_upvote(self) -> None:
response = self.upvote_question()
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upvote(self) -> Response:\n self.force_authenticate_user()\n response = self.upvote_question()\n return response",
"def up_vote(cls, user, message):\r\n pass",
"def up_vote(cls, user, message):\n pass",
"def test_unauthenticated_user_downvote(self) -> None:\n res... | [
"0.7202969",
"0.706721",
"0.703263",
"0.6875775",
"0.66193813",
"0.66143787",
"0.6565651",
"0.6565257",
"0.6533324",
"0.65252024",
"0.628795",
"0.62317026",
"0.61636746",
"0.61328346",
"0.6118461",
"0.61105764",
"0.60780066",
"0.60585773",
"0.6050868",
"0.6025218",
"0.6022000... | 0.7876491 | 0 |
Call the fit and the transform method of this class. | def fit_transform(self, X, y=None):
X = self._prepare(X)
self.fit(X, y)
return self.transform(X, y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_transform(self, *args, **kwargs):\n self.fit(*args, **kwargs)\n return self.transform(*args, **kwargs)",
"def fit_transform(self, X, y=...):\n ...",
"def fit():\n pass",
"def fit_transform ( self, X ):\n self.fit ( X )\n return self.transform ( X )\n #... | [
"0.82714236",
"0.78433764",
"0.769472",
"0.75586903",
"0.7490966",
"0.745098",
"0.741859",
"0.73783123",
"0.7362362",
"0.7312829",
"0.7312829",
"0.7312829",
"0.7138373",
"0.7113836",
"0.7104539",
"0.7094822",
"0.70849156",
"0.70846874",
"0.70100576",
"0.7004825",
"0.7004825",... | 0.6978847 | 23 |
Download and extract kaggle competition dataset to fastai data folder and return path to files. get_kaggle_dataset(string) > Path | def get_kaggle_dataset(competition):
config = Config()
zipdest = Path(config.d['archive_path'])
zipname = Path(config.d['archive_path']+'/'+competition+'.zip')
if not zipname.exists():
print (f'${zipname} does not exist.')
try:
k.competition_download_files(competition, path=z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_kaggle_with_API(filename: str):\n if not os.path.isfile(filename + '.zip') and not os.path.isfile('test.csv'):\n os.system(\"kaggle competitions download -c \" + filename)\n\n if not os.path.isfile('test.csv') and os.path.isfile(filename + '.zip'):\n os.system('unzip ' + filen... | [
"0.7220482",
"0.63381004",
"0.6334641",
"0.6333673",
"0.6237377",
"0.62287605",
"0.6217249",
"0.6154318",
"0.6083323",
"0.60777545",
"0.6043555",
"0.6031478",
"0.6009197",
"0.5994961",
"0.59883386",
"0.5975279",
"0.59363484",
"0.5931787",
"0.59146255",
"0.59141874",
"0.588766... | 0.82616544 | 0 |
Checks if all mines have been flagged. | def won(self):
return self.mines_found == self.mines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_mines(self, cells):\r\n for cell in cells:\r\n row, col = cell\r\n self.mine_field[row][col] = 'x'\r\n self.mines_left -= 1\r\n return",
"def known_mines(self):\n self.mines",
"def all_bees_raised_flag(self):\n pos, com, success = self.perce... | [
"0.6493632",
"0.64380074",
"0.6267556",
"0.619421",
"0.5946347",
"0.5936858",
"0.5887166",
"0.5870911",
"0.5832574",
"0.5809238",
"0.57938457",
"0.5792846",
"0.5781423",
"0.576526",
"0.5747121",
"0.5709528",
"0.5687221",
"0.56182337",
"0.56159353",
"0.5607865",
"0.5598542",
... | 0.6783566 | 4 |
Returns the set of all cells in self.cells known to be mines. | def known_mines(self):
if len(self.cells) == self.count:
return self.cells | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_mines(self):\n if len(self.cells)==self.count:\n return self.cells\n return set()\n #raise NotImplementedError",
"def known_mines(self):\n if len(self.cells) <= self.count:\n return self.cells\n return set([])",
"def known_mines(self):\n ... | [
"0.8837728",
"0.87650234",
"0.82612735",
"0.7944578",
"0.7944578",
"0.76535374",
"0.76535374",
"0.7336784",
"0.71533304",
"0.6954018",
"0.68953633",
"0.67344165",
"0.6729412",
"0.671902",
"0.6691797",
"0.6594178",
"0.6469754",
"0.6462674",
"0.6419005",
"0.6399146",
"0.6356947... | 0.8293779 | 2 |
Returns the set of all cells in self.cells known to be safe. | def known_safes(self):
if self.count == 0:
return self.cells | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_safes(self):\n if self.count==0:\n return self.cells\n return set()\n #raise NotImplementedError",
"def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())",
"def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())",
"def... | [
"0.82847035",
"0.82552475",
"0.82552475",
"0.80687535",
"0.7928026",
"0.7928026",
"0.77277315",
"0.76207685",
"0.7600992",
"0.7243239",
"0.71904856",
"0.7186764",
"0.70554197",
"0.69586575",
"0.6956118",
"0.6953336",
"0.6920734",
"0.6766556",
"0.6711878",
"0.6694441",
"0.6681... | 0.7376044 | 9 |
Converts a string object to a date object. | def convert_str_to_date(date_str):
if date_str.lower() == 'tomorrow':
return datetime.date.today() + datetime.timedelta(days=1)
elif date_str.lower() == 'today':
return datetime.date.today()
elif date_str.lower() == 'yesterday':
return datetime.date.today() + datetime.timedelta(days=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_to_date(string):\n params = string.strip().split('-')\n year = int(params[0])\n month = int(params[1])\n day = int(params[2])\n d = date(year, month, day)\n return d",
"def _str_to_date(self, date):\n return datetools.date_parser(date)",
"def str_to_d... | [
"0.8153859",
"0.76520705",
"0.7423662",
"0.7314803",
"0.73024553",
"0.7272992",
"0.72690165",
"0.7264674",
"0.7260195",
"0.7246179",
"0.72405815",
"0.7222816",
"0.72051126",
"0.71863276",
"0.71771884",
"0.7163268",
"0.7141169",
"0.7138589",
"0.7084771",
"0.70825416",
"0.70739... | 0.69101864 | 29 |
Returns the replset name for a group of config server or null if it is not a replset | def mmo_config_server_replset_name(self, mmo_connection):
replset_name = None
c = mmo_connection["admin"].command("getCmdLineOpts")["parsed"]["sharding"]["configDB"]
for item in c.split(","):
if "/" in item: # cfg Replset server
replset_name = item.partition("/")[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_group_name(self) -> str:\n return pulumi.get(self, \"server_group_name\")",
"def server_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"server_group_id\")",
"def server_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"server_group_id\")",
"def subnet_g... | [
"0.6949814",
"0.6801821",
"0.6801821",
"0.6179873",
"0.6078486",
"0.6078486",
"0.6078486",
"0.6078486",
"0.6078486",
"0.60696",
"0.60595644",
"0.6050754",
"0.6042594",
"0.5979926",
"0.5935725",
"0.59197354",
"0.5893577",
"0.58763546",
"0.58763546",
"0.58763546",
"0.58763546",... | 0.72248065 | 0 |
Returns the process name for the given Mongo connection. | def mmo_what_process_am_i(self, mmo_connection):
return mmo_connection["admin"].command("serverStatus")["process"]; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connection_name\")",
"def connection_name(self) -> str:\n return pulumi.get(self, \"connection_name\")",
"def get_process_name(self):\n\n return self._args.t",
"def repo_name(conn):\n name = conn.repository.d... | [
"0.6354651",
"0.62744397",
"0.6196157",
"0.6164515",
"0.6012407",
"0.597154",
"0.59383947",
"0.59230673",
"0.58393264",
"0.5753712",
"0.5752747",
"0.5684401",
"0.5677138",
"0.56732464",
"0.56664205",
"0.56514394",
"0.5645777",
"0.5634711",
"0.56333387",
"0.5625708",
"0.561572... | 0.5916951 | 8 |
Returns the version string for the given Mongo connection. | def mmo_mongo_version(self, mmo_connection):
return mmo_connection["admin"].command("serverStatus")["version"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_string(self):\n return self.server_version",
"def sql_version(connection):\n cursor = connection.cursor()\n cursor.execute(\"SELECT ecs.versionTable.version FROM ecs.versionTable;\")\n for ver in cursor.fetchone():\n version = ver\n cursor.close()\n return version",
"de... | [
"0.6790673",
"0.6739859",
"0.65836287",
"0.65762144",
"0.64592063",
"0.6402176",
"0.63639057",
"0.63372844",
"0.62821144",
"0.6278813",
"0.6277744",
"0.6277744",
"0.6277744",
"0.6277744",
"0.62558895",
"0.62359476",
"0.623059",
"0.6147216",
"0.61463666",
"0.6141588",
"0.61415... | 0.77018017 | 0 |
Returns the number of connections for the Mongo instance. | def mmo_current_connections(self, mmo_connection):
return mmo_connection.serverStatus()["connection"]["current"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getconnectioncount(self):\n return self.proxy.getconnectioncount()",
"def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)",
"def open_connections(self):\n return len(self._connections_openned)",
"def get_count(self):\n conn... | [
"0.75481665",
"0.7079306",
"0.68598616",
"0.68336433",
"0.66936713",
"0.6681873",
"0.66771907",
"0.6621267",
"0.65562326",
"0.651766",
"0.64295316",
"0.64184225",
"0.6388331",
"0.6348741",
"0.63372165",
"0.63312435",
"0.63281775",
"0.63146085",
"0.62214524",
"0.6213115",
"0.6... | 0.0 | -1 |
If ExplicitIntegrator is not symmetric, return a symmetrized version, else return original ExplicitIntegrator | def symmetrize(self):
if self.is_symmetric:
return self
else:
return self.append(self.reverse()).squash().scale(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _symmetric(updates):\n sym_updates = updates[:-1] + [updates[-1]] + updates[:-1][::-1]\n coeff = [0.5]*(len(updates)-1) + [1.0] + [0.5]*(len(updates) - 1)\n return ExplicitIntegrator(coeff, sym_updates)",
"def renormalize(self):\n update_set, coeff_tots = self.coeff_totals()\n ... | [
"0.70425504",
"0.54611284",
"0.53737855",
"0.5328841",
"0.53064656",
"0.5274461",
"0.5245739",
"0.51810145",
"0.51406884",
"0.5112936",
"0.51113224",
"0.51077133",
"0.5064554",
"0.50553775",
"0.5008319",
"0.5005956",
"0.49735382",
"0.49044126",
"0.48550302",
"0.48476666",
"0.... | 0.5366264 | 3 |
Returns whether or not the contents scale with the widget size. | def scaledContents(self):
return self._scaled_contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resizable(self):\n return self._frame._root.resizable() == '1 1'",
"def IsResizeable(self):\r\n \r\n return self.HasFlag(self.optionResizable)",
"def scale(self, _: Application) -> bool:\n return False",
"def checkFigureSize(self, figure):\n # scale factor\n f = ... | [
"0.6982793",
"0.6705058",
"0.6661015",
"0.6605395",
"0.6408125",
"0.6339988",
"0.6288953",
"0.6257565",
"0.62486887",
"0.61337024",
"0.6064341",
"0.6057617",
"0.60505784",
"0.6047687",
"0.60130405",
"0.5972155",
"0.59524035",
"0.5949873",
"0.59490764",
"0.59288895",
"0.592868... | 0.54196966 | 63 |
Returns whether or not the image can be scaled greater than its natural size. | def allowUpscaling(self):
return self._allow_upscaling | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _image_is_large_enough(im):\n return (im.shape[0] >= MIN_DIM) and (im.shape[1] >= MIN_DIM)",
"def is_image_size_exceeded(self):\n return self._tag == 'image_size_exceeded'",
"def is_image_size_exceeded(self):\n return self._tag == 'image_size_exceeded'",
"def check_scaled_shape(orig: tor... | [
"0.7316716",
"0.687211",
"0.687211",
"0.6837902",
"0.67452604",
"0.6619837",
"0.6570156",
"0.64338475",
"0.6374968",
"0.6283305",
"0.6264557",
"0.62632304",
"0.6163545",
"0.61444837",
"0.60963696",
"0.60835826",
"0.6068221",
"0.6042492",
"0.6022507",
"0.6010536",
"0.6005554",... | 0.60856926 | 15 |
Prepare trades for the specified pair. | async def prepare_trades(self, pair: str):
if pair not in self.trades:
self.trades[pair] = {
'last_open_time': 0.0,
'rebuy_count': 0,
'open': [],
'closed': []
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def prepare_states(self, pair: str):\n\n if pair not in self.pair_states:\n self.pair_states[pair] = {\n 'enable_buy': True,\n 'enable_rebuy': True\n }",
"def trades(self, pairs):\n if isinstance(pairs, (list, tuple, set)):\n pair... | [
"0.6303787",
"0.57798696",
"0.5690601",
"0.5458961",
"0.5430335",
"0.5425993",
"0.5414648",
"0.53194153",
"0.51551205",
"0.5113173",
"0.5086814",
"0.504501",
"0.5043785",
"0.50348794",
"0.50036097",
"0.4989486",
"0.4926785",
"0.4918965",
"0.486187",
"0.48607042",
"0.48573363"... | 0.83309335 | 0 |
Register a "soft" stop for a pair. A soft stop enables a stop loss sell to occur for any open trades if the pair's value goes below the soft stop value. | async def soft_stop(self, pair: str, detection_name: str, trigger_data: dict):
params = core.Detector.get_detection_params(detection_name, {
'weight': 1.0,
'apply': None,
'ignore': None
})
current_value = self.market.adjusted_close_values[pair][-1]
m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def hard_stop(self, pair: str, detection_name: str, trigger_data: dict):\n\n params = core.Detector.get_detection_params(detection_name, {\n 'threshold': config['trade_hard_stop_threshold'],\n 'apply': None,\n 'ignore': None\n })\n\n remove_indexes = []\n... | [
"0.6125591",
"0.5801479",
"0.56289244",
"0.5435792",
"0.5297644",
"0.51102614",
"0.50352275",
"0.50145",
"0.49990484",
"0.49953175",
"0.49279547",
"0.4903554",
"0.49009603",
"0.48615938",
"0.4850873",
"0.4847711",
"0.47678837",
"0.47273237",
"0.47113404",
"0.46841943",
"0.468... | 0.66372 | 0 |
Garbage collect oldest trade to free balance if balance is low. | async def _garbage_collect_sim(self, base: str, trade_size: float, reserved: float):
if not config['trade_garbage_collect']:
return
base_mult = await self.market.get_base_mult(config['trade_base'], base)
current_balance = self.balancer.sim_balances[base] * base_mult - reserved
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _garbage_collect_live(self, base: str, trade_size: float, reserved: float):\n\n if not config['trade_garbage_collect']:\n return\n\n balance = await self.api.get_balance(base)\n if balance is None:\n self.log.error(\"Could not get available balance for {}!\", ba... | [
"0.70994496",
"0.6172251",
"0.5927842",
"0.5764728",
"0.57133806",
"0.56579185",
"0.56091815",
"0.5591629",
"0.55722916",
"0.5540825",
"0.5488939",
"0.54813707",
"0.5473631",
"0.54673237",
"0.5452898",
"0.54447883",
"0.5375532",
"0.5363624",
"0.53193355",
"0.5312982",
"0.5288... | 0.65021116 | 1 |
Submit a limit buy for the specified currency pair. | async def _submit_limit_buy(self, pair: str, trade_size: float):
adjusted_value = self.market.adjusted_close_values[pair][-1]
current_value = self.market.close_values[pair][-1]
min_trade_size = self.market.min_trade_sizes[pair] * (1.0 + config['trade_min_safe_percent'])
if min_trade_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy(self,\n currency_pair,\n rate,\n amount):\n pass",
"def marketBuy(self, currency_pair, amount):\n # calcular o rate num 'for'\n asks = self.rOrderBook(currency_pair=currency_pair, field='asks')\n list_resp = []\n for ask in asks:\n ... | [
"0.7505264",
"0.7179121",
"0.69183755",
"0.685156",
"0.6723597",
"0.65779155",
"0.6546296",
"0.6536287",
"0.6332699",
"0.6332035",
"0.61834246",
"0.6121239",
"0.60914934",
"0.6086903",
"0.6086757",
"0.60562277",
"0.604478",
"0.6044398",
"0.5998445",
"0.59902847",
"0.59807867"... | 0.7656179 | 0 |
Garbage collect oldest trade to free balance if balance is low. | async def _garbage_collect_live(self, base: str, trade_size: float, reserved: float):
if not config['trade_garbage_collect']:
return
balance = await self.api.get_balance(base)
if balance is None:
self.log.error("Could not get available balance for {}!", base)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _garbage_collect_sim(self, base: str, trade_size: float, reserved: float):\n\n if not config['trade_garbage_collect']:\n return\n\n base_mult = await self.market.get_base_mult(config['trade_base'], base)\n current_balance = self.balancer.sim_balances[base] * base_mult - re... | [
"0.65021116",
"0.6172251",
"0.5927842",
"0.5764728",
"0.57133806",
"0.56579185",
"0.56091815",
"0.5591629",
"0.55722916",
"0.5540825",
"0.5488939",
"0.54813707",
"0.5473631",
"0.54673237",
"0.5452898",
"0.54447883",
"0.5375532",
"0.5363624",
"0.53193355",
"0.5312982",
"0.5288... | 0.70994496 | 0 |
Return a string of ``inp`` random characters (if ``inp`` is an int) or ``len(inp)`` random characters (if ``inp`` is a string). | def random_str(inp):
if isinstance(inp, int):
n = inp
elif isinstance(inp, str):
n = len(inp)
else:
raise ValueError("Invalid input (must be str or int)")
chars = string.ascii_letters + string.digits + "_-"
return "".join(random.sample(chars, n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string(input: list):\n num = rand.randint(0,len(input)-1)\n return input[num]",
"def randstr(chars=string.ascii_lowercase + string.digits, len=16) -> str:\n return ''.join(random.choices(chars, k=len))",
"def rand_string():\n out = ''\n for _ in range(24):\n out += choice(ascii... | [
"0.71874756",
"0.68576896",
"0.68551457",
"0.6786324",
"0.6760722",
"0.6744315",
"0.67420435",
"0.67103565",
"0.6706592",
"0.66216844",
"0.6619481",
"0.6614052",
"0.65959305",
"0.65912175",
"0.65737206",
"0.657078",
"0.6569865",
"0.6566596",
"0.6552312",
"0.65507954",
"0.6550... | 0.8489642 | 0 |
Calculate the grouped mean, grouping the students by the 'Group' column. | def test_grouped(self):
gfile = grades.writers.GradesFile(self.fname)
gfile.table.compute_grouped_mean('Group')
gfile.table_format = 'org'
self.check_output(self.output_str2, gfile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouping(data_clust):\n data_grouped = data_clust.groupby('Clusters').mean()\n return data_grouped",
"def test_mean_div(self):\n gfile = grades.writers.GradesFile(self.fname)\n gfile.table.compute_mean()\n gfile.table_format = 'org'\n self.check_output(self.output_st... | [
"0.6498009",
"0.6410816",
"0.6310002",
"0.6235998",
"0.62062985",
"0.60804003",
"0.6075459",
"0.6045031",
"0.5973278",
"0.591921",
"0.58432835",
"0.58132386",
"0.5753136",
"0.5749456",
"0.5709212",
"0.56754595",
"0.56564426",
"0.56564426",
"0.5630145",
"0.5628637",
"0.5618211... | 0.68366724 | 0 |
Update two dicts of dicts recursively, if either mapping has leaves that are nondicts, the second's leaf overwrites the first's. | def deep_merge(d1, d2):
for k, v in d1.copy().items():
if k in d2:
if all(isinstance(e, MutableMapping) for e in (v, d2[k])):
d2[k] = ConfigManager.deep_merge(v, d2[k])
if k == "*":
for _k, _v in d2.items():
if all(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursively_update_with(a, b):\n\n for key in b:\n if key in a:\n if isinstance(a[key], dict) and isinstance(b[key], dict):\n recursively_update_with(a[key], b[key])\n else:\n a[key] = b[key]\n else:\n a[key] = b[key]",
"def recu... | [
"0.78138524",
"0.7660244",
"0.76234084",
"0.7427001",
"0.73883605",
"0.7242871",
"0.7235648",
"0.717247",
"0.71297306",
"0.7058001",
"0.70549005",
"0.70441306",
"0.7036268",
"0.70232666",
"0.6986809",
"0.69688934",
"0.6964415",
"0.69374996",
"0.6927056",
"0.6926401",
"0.69023... | 0.69621336 | 17 |
Return the version number. | def verNumber(version, versionPattern=''):
if not versionPattern:
versionPattern = os.environ.get('KOMBI_VERSION_PATTERN', DEFAULT_VERSION_PATTERN)
patternParts = __splitVersionPattern(versionPattern)
return str(version)[len(patternParts['prefix']): len(patternParts['prefix']) + len(patternParts['p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_number() -> int:\n return 0",
"def get_version(self):\r\n\r\n return self.versions[0].number",
"def getVersion(self):\n return self.get('Version', type=\"numeric\")",
"def get_version():\n return '%d.%d.%d' % version_info",
"def version(self):\n _, body = self.request... | [
"0.866707",
"0.84448445",
"0.8407531",
"0.8395337",
"0.8298357",
"0.8286713",
"0.8252668",
"0.81848735",
"0.81636876",
"0.81636876",
"0.8137443",
"0.81337935",
"0.80725837",
"0.8056344",
"0.8016573",
"0.8015949",
"0.8006926",
"0.80007255",
"0.79672366",
"0.79329914",
"0.79329... | 0.0 | -1 |
Return a resolved version string using the version pattern. | def __buildVersion(version, versionPattern):
patternParts = __splitVersionPattern(versionPattern)
return patternParts['prefix'] + str(version).zfill(len(patternParts['padding'])) + patternParts['suffix'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verNumber(version, versionPattern=''):\n if not versionPattern:\n versionPattern = os.environ.get('KOMBI_VERSION_PATTERN', DEFAULT_VERSION_PATTERN)\n\n patternParts = __splitVersionPattern(versionPattern)\n return str(version)[len(patternParts['prefix']): len(patternParts['prefix']) + len(patte... | [
"0.6638231",
"0.6628819",
"0.6587026",
"0.65764296",
"0.6532974",
"0.65056735",
"0.6479244",
"0.6379202",
"0.6378431",
"0.6360932",
"0.6311935",
"0.63044775",
"0.6275836",
"0.6259283",
"0.62442243",
"0.61885077",
"0.61834174",
"0.61818045",
"0.61490685",
"0.61287165",
"0.6127... | 0.7373739 | 0 |
Return the latest version found under the versions path. In case none version is found, it returns 0 by default. | def __queryLatest(versionsPath, versionPattern):
version = 0
patternParts = __splitVersionPattern(versionPattern)
versionRegEx = "^"+patternParts['prefix']+"[0-9]{"+str(len(patternParts['padding']))+",}"+patternParts['suffix']+"$"
# finding the latest version
if os.path.exists(versionsPath):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_latest_version(versions):\n\n highest_version = 0\n for version in versions:\n version = parse_version(version)\n\n if version > highest_version:\n highest_version = version\n\n return highest_version",
"def get_latest_vsn(self):\n # The last version in the list ... | [
"0.79425573",
"0.74380994",
"0.7402063",
"0.72433233",
"0.72161674",
"0.7153446",
"0.7126764",
"0.710236",
"0.7097837",
"0.70716316",
"0.7015666",
"0.70069826",
"0.68844354",
"0.68827003",
"0.6853726",
"0.6744041",
"0.6742762",
"0.66958433",
"0.6694762",
"0.6626284",
"0.66133... | 0.8141444 | 0 |
Returns if the word is in the trie. | def search(self, word: str) -> bool:
node = self.root
for char in word:
if char not in node:
return False
node = node[char]
return self.end_of_word in node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr... | [
"0.83865196",
"0.81508374",
"0.81230605",
"0.7856601",
"0.77940327",
"0.77934295",
"0.77646786",
"0.7753958",
"0.77473944",
"0.7710694",
"0.76809704",
"0.7676685",
"0.76646334",
"0.7651102",
"0.76339287",
"0.7628116",
"0.76110476",
"0.75783044",
"0.75697243",
"0.7559936",
"0.... | 0.7830601 | 4 |
Convert coordinates in the output image to r, theta coordinates. The r coordinate is scaled to range from 0 to 1. The theta coordinate is scaled to range from 0 to 1. A Nx2 array is returned with r being the first column and theta being the second. | def output_coord_to_r_theta(coords):
# Calculate x- and y-co-ordinate offsets from the centre:
x_offset = coords[:,0] - (output_shape[1]/2)
y_offset = coords[:,1] - (output_shape[0]/2)
# Calculate r and theta in pixels and radians:
r = np.sqrt(x_offset ** 2 + y_offset ** 2)
theta = np.arctan2(y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r_theta_to_input_coords(r_theta):\n # Extract r and theta from input\n r, theta = r_theta[:,0], r_theta[:,1]\n\n # Theta wraps at the side of the image. That is to say that theta=1.1\n # is equivalent to theta=0.1 => just extract the fractional part of\n # theta\n theta = theta - np.floor(the... | [
"0.71357757",
"0.67818785",
"0.61476976",
"0.6021302",
"0.59315306",
"0.59013677",
"0.5893568",
"0.58432734",
"0.5776385",
"0.5742603",
"0.5731501",
"0.57189953",
"0.5699567",
"0.567863",
"0.5660297",
"0.56585747",
"0.565261",
"0.5647902",
"0.56353873",
"0.5618455",
"0.559032... | 0.7289032 | 0 |
Sets the document_name of this NotaryJournal. | def document_name(self, document_name):
self._document_name = document_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_document_name_for_search(self, document_name):\n self.set_value_into_input_field(self.document_name_locator, document_name)",
"def journal_name(self, journal_name):\n\n self._journal_name = journal_name",
"def set_document_name(self, document_name_prefix):\n document_name = documen... | [
"0.74345607",
"0.7245551",
"0.7177776",
"0.7113452",
"0.63904274",
"0.61373276",
"0.60234064",
"0.60234064",
"0.59368086",
"0.5926138",
"0.58770764",
"0.5866895",
"0.5847449",
"0.58348185",
"0.58132046",
"0.5762171",
"0.575283",
"0.575283",
"0.5752074",
"0.57235503",
"0.57169... | 0.85598785 | 1 |
Sets the notary_journal_id of this NotaryJournal. | def notary_journal_id(self, notary_journal_id):
self._notary_journal_id = notary_journal_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def journal_name(self, journal_name):\n\n self._journal_name = journal_name",
"def notary_journal_meta_data(self, notary_journal_meta_data):\n\n self._notary_journal_meta_data = notary_journal_meta_data",
"def notary_journal_meta_data(self, notary_journal_meta_data):\n\n self._notary_journ... | [
"0.64491093",
"0.6056329",
"0.6056329",
"0.5594545",
"0.5405454",
"0.53299737",
"0.5299095",
"0.5299095",
"0.52465373",
"0.524495",
"0.5213453",
"0.51491153",
"0.51231474",
"0.5118757",
"0.5091269",
"0.5085468",
"0.508492",
"0.50731444",
"0.5070565",
"0.5063646",
"0.5037789",... | 0.88949263 | 0 |
Sets the notary_journal_meta_data of this NotaryJournal. | def notary_journal_meta_data(self, notary_journal_meta_data):
self._notary_journal_meta_data = notary_journal_meta_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta_data(self, meta_data):\n\n self._meta_data = meta_data",
"def set_metadata(self, data):\r\n pass",
"def set_meta(self, meta):\n self._meta['user_meta'] = meta",
"def dataset_meta(self, dataset_meta: dict) -> None:\n self._dataset_meta = dataset_meta",
"def notary_journa... | [
"0.6732024",
"0.6254736",
"0.5811493",
"0.5791844",
"0.5758129",
"0.5758129",
"0.5598925",
"0.55614704",
"0.55614704",
"0.5463859",
"0.5451853",
"0.5396242",
"0.5385939",
"0.5358754",
"0.5341978",
"0.53194445",
"0.5307141",
"0.5307141",
"0.5307141",
"0.53007",
"0.529995",
"... | 0.8900196 | 0 |
Sets the signer_name of this NotaryJournal. | def signer_name(self, signer_name):
self._signer_name = signer_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def journal_name(self, journal_name):\n\n self._journal_name = journal_name",
"def signing_group_name(self, signing_group_name):\n\n self._signing_group_name = signing_group_name",
"def signer_id_type(self, signer_id_type):\n\n self._signer_id_type = signer_id_type",
"def author_name(sel... | [
"0.6479226",
"0.6416055",
"0.5950925",
"0.5806568",
"0.5731801",
"0.57137614",
"0.5642888",
"0.56417114",
"0.56417114",
"0.56417114",
"0.55944216",
"0.5546833",
"0.5546833",
"0.55098975",
"0.5462267",
"0.53910595",
"0.5339872",
"0.52895135",
"0.52492446",
"0.52316356",
"0.520... | 0.86383694 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, NotaryJournal):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, NotaryJournal):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Create a new profile | def add_profile(profile=None): # noqa: E501
if connexion.request.is_json:
profile = Profile.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createProfile(self):\n if self.profile:\n return\n from soc.modules.gsoc.models.profile import GSoCProfile\n user = self.createUser()\n properties = {'link_id': user.link_id, 'student_info': None, 'user': user,\n 'parent': user, 'scope': self.program, 'status': 'active'}\n ... | [
"0.829592",
"0.7818982",
"0.7750451",
"0.7713064",
"0.7613785",
"0.7599893",
"0.7592686",
"0.75681376",
"0.75590235",
"0.75210714",
"0.74877286",
"0.74573743",
"0.7434772",
"0.74149257",
"0.7400479",
"0.7395094",
"0.7374155",
"0.7373311",
"0.73648304",
"0.73648304",
"0.736483... | 0.0 | -1 |
Given a num_of_paths_matrix, compute the entropy per rows. | def compute_entropy(m, nan_as_zero=True):
# normalize rows (the sum of each row must be 1)
p = m / m.sum(axis=1, keepdims=True)
# compute per row entropy (in base 2)
e = entr(p).sum(axis=1) / np.log(2)
if nan_as_zero:
e = np.nan_to_num(e)
return e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_entropy(mat):\n\n total_entropy = 0\n\n count_motifs = count_nucleotides(mat)\n p = profile(count_motifs, mat.shape[0])\n\n for i in range(len(p[0, :])):\n entropy = 0\n for j in range(len(p[:, 0])):\n if p[j, i] != 0:\n entropy = entropy + p[j, i] * ... | [
"0.6738692",
"0.64388794",
"0.6336691",
"0.61821705",
"0.6169635",
"0.61060137",
"0.6096414",
"0.6079464",
"0.60196763",
"0.5921298",
"0.59187615",
"0.5810295",
"0.57602817",
"0.5758452",
"0.57531726",
"0.5748373",
"0.5720924",
"0.57042414",
"0.56924486",
"0.5676953",
"0.5659... | 0.6351056 | 2 |
Allow multivalued fields to be initialized as a single value. | def __init__(self, **kwargs):
for f in self.list_fields:
val = kwargs.pop(f, None)
if val is not None and isinstance(val, (str, unicode, dict)):
kwargs[f] = [val]
elif isinstance(val, list):
kwargs[f] = val
super(HasMetadata, self).__in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_value(self, value, strict: bool = True):\n # noinspection PyTypeHints\n if not isinstance(value, self.field_type):\n raise ModelInitException(\n f'{value}({type(value)}) is not an instance of '\n f'{self.field_type}.')\n return value",
"def i... | [
"0.6104997",
"0.5828896",
"0.57999384",
"0.576697",
"0.56408006",
"0.56270283",
"0.55560964",
"0.5535723",
"0.54432464",
"0.54371244",
"0.5432623",
"0.5427001",
"0.53837425",
"0.537091",
"0.5354432",
"0.53519106",
"0.5348439",
"0.531508",
"0.53129977",
"0.52897644",
"0.528518... | 0.49642578 | 45 |
Given two dicts, merge them into a new dict as a shallow copy. | def merge_two_dicts(x, y):
z = x.copy()
z.update(y)
return z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergedict(x, y):\n z = x.copy()\n z.update(y)\n return z",
"def merge_dicts(dict_a, dict_b):\n dict_c = dict_a.copy()\n dict_c.update(dict_b)\n return dict_c",
"def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z",
"def merge_two_dicts(x, y):\r\... | [
"0.85014665",
"0.8446783",
"0.84402263",
"0.84310603",
"0.8428849",
"0.8349502",
"0.8349502",
"0.8349502",
"0.8208443",
"0.81880754",
"0.8187257",
"0.8187257",
"0.80822736",
"0.7989374",
"0.7988631",
"0.77436286",
"0.77140075",
"0.76660424",
"0.7635273",
"0.76309127",
"0.7613... | 0.83829623 | 9 |
Initializes a Teeko2Player object by randomly selecting red or black as its piece color. | def __init__(self):
self.my_piece = random.choice(self.pieces)
self.opp = self.pieces[0] if self.my_piece == self.pieces[1] else self.pieces[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomcolour(self):\n r = random.randrange(1, 255)\n g = random.randrange(1, 255)\n b = random.randrange(1, 255)\n self.colour((r,g,b))",
"def __init__(self, color):\n self.id = Piece.PIECE_ID\n self.crowned = False\n self.color = color\n\n Piece.PIECE_... | [
"0.63414395",
"0.63093525",
"0.62960005",
"0.62711596",
"0.6222215",
"0.6201967",
"0.6193461",
"0.61873996",
"0.6099975",
"0.6096781",
"0.60653627",
"0.60546786",
"0.59921867",
"0.5970535",
"0.59631974",
"0.59617937",
"0.59542215",
"0.59527177",
"0.59527177",
"0.59527177",
"0... | 0.62459683 | 5 |
The product on a blueprint is just the first product listed on the manufacturing activity. | def _get_product(self):
try:
return self.activities[industry.MANUFACTURING].products[0].typeID
except (KeyError, IndexError):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(self) -> str:\n return pulumi.get(self, \"product\")",
"def product(self):\n return self.__values['product_name']",
"def product(self):\n if self._data:\n return self._get_info(\"PRODUCT\")\n\n\n product_id = int(self.tracking_number[2:4])\n\n if produc... | [
"0.6572264",
"0.64572316",
"0.6409933",
"0.6221544",
"0.6221544",
"0.6221544",
"0.60468704",
"0.6000951",
"0.59866065",
"0.59861374",
"0.59861374",
"0.5980222",
"0.5937279",
"0.5930178",
"0.59035647",
"0.58646303",
"0.58501077",
"0.58127546",
"0.58064425",
"0.5770957",
"0.577... | 0.64082974 | 3 |
Convert str to a list of numbers giving the position of the letter in the alphabet (position of a = 0). str should contain only lowercase letters. | def string_to_numbers(str):
return [ord(ch) - ord("a") for ch in str] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A",
"def letter_to_index(letter):\r\n return ord(letter.lower()) - CHAR_A",
"def alphabet_position(text):\n return ' '.join(str(ord(c) - 96) for c in text.lower() if c.isalpha())\n # return ' '.join(str(string.ascii_lowercase.index(... | [
"0.68520385",
"0.68520385",
"0.6837377",
"0.6771656",
"0.6692641",
"0.64642656",
"0.63865024",
"0.63681585",
"0.63500744",
"0.63321704",
"0.6285784",
"0.62721264",
"0.62216866",
"0.6209117",
"0.6204193",
"0.61674905",
"0.61674905",
"0.61674905",
"0.61674905",
"0.6162398",
"0.... | 0.7642158 | 0 |
Add a blank between each block of five characters in str. | def chunk_string(str):
return " ".join(str[i : i + 5] for i in range(0, len(str), 5)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_padding(self, text):\n\n for word in text.split(' '):\n # 5 character blocks added straight\n if len(word) == 5:\n self.output += word + ' '\n # calling the helper method to fill the blocks\n elif len(word) < 5:\n self._helper... | [
"0.6793996",
"0.6426882",
"0.6325288",
"0.603743",
"0.5999545",
"0.58439475",
"0.5829665",
"0.57612616",
"0.5756682",
"0.5731016",
"0.5713615",
"0.5712259",
"0.568541",
"0.567318",
"0.56291085",
"0.5609772",
"0.55863875",
"0.55541086",
"0.5551049",
"0.55388266",
"0.5528439",
... | 0.7172927 | 0 |
calculates exp(E/kBT), a common factor in intensity corrections | def compute_boltzmann_dist(sample_temp, delta_e):
kBT = sample_temp * KB_MEV
return np.exp(-delta_e / kBT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Fermi(En,T):\n ev = 1.60218e-19\n kb = 1.380e-23\n return 1/(1+np.exp(En/(kb*T/ev)))",
"def f0(E, fermi, T):\n return 1. / (1. + np.exp((E - fermi) / (k_B * T)))",
"def get_BE(T_e, E, k):\n n_BE = 1./(np.exp((E[1:]-E[0])/T_e)-1)\n return n_BE",
"def energy(e: float) -> float:\n\n ret... | [
"0.6940067",
"0.68073845",
"0.6787842",
"0.6751072",
"0.6722934",
"0.6649558",
"0.64772105",
"0.6452561",
"0.64484924",
"0.63912404",
"0.6371322",
"0.6363286",
"0.6332541",
"0.62933534",
"0.62804794",
"0.62768126",
"0.62656236",
"0.62608385",
"0.6259721",
"0.6226225",
"0.6169... | 0.0 | -1 |
Throw an assertion error if the given provider type is not valid | def assert_valid_provider(provider_type: str) -> None:
valid_types = get_valid_provider_types()
if provider_type not in valid_types:
raise MephistoDBException(
f"Supplied provider {provider_type} is not in supported list of providers {valid_types}."
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assert_type(type):\n if isinstance(type, str):\n o, v, p, t = type.split('.')\n if not ontologies.is_supported(o, v, p, t):\n rt.throw(\"Type {0}.v{1}.{2} is unsupported.\".format(o, v, p, t))\n elif type not in ontologies.get_types():\n rt.throw(\"Type {0} is unsupported... | [
"0.66247",
"0.6381178",
"0.6288787",
"0.6232385",
"0.6226976",
"0.6177312",
"0.6159556",
"0.61002177",
"0.60487807",
"0.6037399",
"0.60059035",
"0.59975255",
"0.59592974",
"0.59464914",
"0.5908165",
"0.5899555",
"0.58754313",
"0.5874482",
"0.5864774",
"0.5859556",
"0.58514154... | 0.8363796 | 0 |
Try to request the row for the given table and entry, raise EntryDoesNotExistException if it isn't present | def __get_one_by_id(
self, table_name: str, id_name: str, db_id: str
) -> Mapping[str, Any]:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
f"""
SELECT * FROM {table_name}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, table, entry_name):\n data = Select('*', table, name=entry_name).one()\n if data is None:\n return {\"Error\": f\"{entry_name} not found in {table}. \"\n f\"Try this instead: {NS.search._path}/{table}/{entry_name}\"\n }, 404\n elif... | [
"0.6770762",
"0.63907266",
"0.612267",
"0.59253484",
"0.5845842",
"0.5779815",
"0.5741152",
"0.5669255",
"0.5657739",
"0.5526169",
"0.55044276",
"0.5486718",
"0.5485519",
"0.54838586",
"0.5443569",
"0.5436711",
"0.5397248",
"0.538555",
"0.5384808",
"0.5381477",
"0.53597516",
... | 0.64593613 | 1 |
Find a qualification. If no name is supplied, returns all qualifications. | def find_qualifications(
self, qualification_name: Optional[str] = None
) -> List[Qualification]:
with self.table_access_condition:
conn = self._get_connection()
c = conn.cursor()
c.execute(
"""
SELECT * from qualifications
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_name(self, name: str, qualifier: t.Any = None) -> t.Any:\n return self._find(identifier=name, qualifier=qualifier)",
"def get_qualification_mapping(self, qualification_name: str) -> Optional[sqlite3.Row]:\n with self.table_access_condition:\n conn = self._get_connection()\n ... | [
"0.70677984",
"0.6158999",
"0.6139496",
"0.58372104",
"0.5663239",
"0.5500265",
"0.549445",
"0.5425728",
"0.54181874",
"0.54097974",
"0.5396504",
"0.53424746",
"0.533946",
"0.5333732",
"0.5329291",
"0.5300621",
"0.52786326",
"0.5242392",
"0.51644176",
"0.5162079",
"0.515665",... | 0.729798 | 0 |
Computes dT2_dh(x,y) = 1 / ( x^2 + y^2 ) ( y, x) | def pder_T_2(z):
assert z.shape[-1] == 2, "Input must be 2D"
out = 1 / (torch.norm(z, dim=-1,keepdim=True)**2) * torch.stack([-z[..., 1], z[..., 0]], dim=-1)
return out.unsqueeze(-2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dK_ode_dtheta(self, target):\r\n t_ode = self._t[self._index>0]\r\n dL_dK_ode = self._dL_dK[self._index>0, :]\r\n index_ode = self._index[self._index>0]-1\r\n if self._t2 is None:\r\n if t_ode.size==0:\r\n return \r\n t2_ode = t_ode\r\n ... | [
"0.69324803",
"0.6924154",
"0.6641148",
"0.66368234",
"0.6623131",
"0.65751386",
"0.6569393",
"0.65608203",
"0.65267926",
"0.65235853",
"0.650094",
"0.6479895",
"0.64717394",
"0.6434102",
"0.64327776",
"0.6432005",
"0.6407684",
"0.6396497",
"0.6386352",
"0.63830936",
"0.63224... | 0.0 | -1 |
Restful API for getting all agent. | def RetrieveAllAgent(**argd):
flag, ret = CGateway.core.RetrieveAllAgent(argd["session"])
xFlag = CGateway._HandleExceptionAndUnauthorized(flag, ret, argd["session"])
if xFlag is not None:
return xFlag
hmBuilder = []
for hm in ret:
hmBuilder.append(hm.ToJs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self):\n response = self._client.get('scanners/1/agents')\n return AgentList.from_json(response.text)",
"def do_GET(self):\n rest_params = common.get_restful_params(self.path)\n if rest_params is None:\n common.echo_json_response(self, 405, \"Not Implemented: Use /... | [
"0.71380407",
"0.69205505",
"0.6811825",
"0.66939974",
"0.6621022",
"0.66091174",
"0.651082",
"0.6357617",
"0.6277522",
"0.62357706",
"0.6177141",
"0.6164997",
"0.6151772",
"0.6144438",
"0.6130724",
"0.6105137",
"0.60954285",
"0.5983499",
"0.5961952",
"0.59551424",
"0.5953444... | 0.7584071 | 0 |
Restful API for getting data version of COrgan, ONLY USE BY NAME SERVICE. | def RetrieveDataVersionGid(**argd):
checkSign = argd["nsid"] + "," + argd["renid"]
token = EncryptUtil.DecodeURLSafeBase64(argd["token"])
try:
tokenRet = EncryptUtil.VerifySign(checkSign, token, GlobalConfigContext.AUTH_NameService_PublicKey)
except:
tokenRet = Fa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_org_list():\r\n\r\n resp = requests.get(''.join([Kegg.BASE_URL, 'list/organism']))\r\n return resp.text",
"def organizations(self):\n return self.get('{}/orgs'.format(ApiVersion.A1.value))",
"def listOrganizations(self, name='', type=''):\n return self.get_json('/organization', ... | [
"0.62940663",
"0.6201558",
"0.6112348",
"0.5997289",
"0.59952503",
"0.5920379",
"0.5832956",
"0.5741158",
"0.562297",
"0.56199723",
"0.5588387",
"0.55853033",
"0.54916894",
"0.5484973",
"0.5483696",
"0.5462997",
"0.54570574",
"0.5420729",
"0.5394814",
"0.5379137",
"0.5376982"... | 0.0 | -1 |
Returns the number of edges of the graph | def return_num_edges(self):
return sum(map(lambda x: len(x),self.__adj)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def num_of_edge(self):\n try:\n return self.edges\n except:\n print(\"ERROR: No graph exists\")",
"def edge_count(self) -> int:\n return self._n_edges",
"def num_edges(self):\n ... | [
"0.88403726",
"0.8686454",
"0.8673907",
"0.8595362",
"0.8589456",
"0.856446",
"0.8522463",
"0.8513992",
"0.84825444",
"0.8407044",
"0.83765",
"0.8349338",
"0.8348158",
"0.83286613",
"0.83084965",
"0.82687026",
"0.82462084",
"0.8210147",
"0.81781816",
"0.8104391",
"0.8061722",... | 0.8582804 | 5 |
Plots predictions (and targets) for one model. P = number of points in border set M = number of rows in grid N = number of columns in grid | def _plot_predictions_one_model(
top_prediction_dir_name, border_latitudes_deg_n,
border_longitudes_deg_e, valid_time_string, title_string, font_size,
figure_object, axes_object, smoothing_radius_px=None):
prediction_file_name = prediction_io.find_file(
top_directory_name=top_predic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_prediction_grid (xx, yy, prediction_grid, filename):\n from matplotlib.colors import ListedColormap\n background_colormap = ListedColormap ([\"hotpink\",\"lightskyblue\", \"yellowgreen\"])\n observation_colormap = ListedColormap ([\"red\",\"blue\",\"green\"])\n plt.figure(figsize =(10,10))\n ... | [
"0.674434",
"0.6743396",
"0.6742399",
"0.66797477",
"0.65196085",
"0.65173334",
"0.64956933",
"0.64640003",
"0.64558583",
"0.64408535",
"0.63770765",
"0.63590175",
"0.6351463",
"0.6316527",
"0.6306169",
"0.6254334",
"0.6239251",
"0.6237019",
"0.62177205",
"0.6198421",
"0.6190... | 0.0 | -1 |
Connect the First layer of the model to the last layer of inbound model | def connect_first_layer_model_to_inbound_last_layer(self,
models_dict,
model, inbound_node,
module_connection_color,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_layers(self):\n if not self.check():\n msg = \"Failed to check neural network.\"\n print(msg)\n logging.error(msg)\n return\n\n # 1. set input layer\n pre_layer = self.input_layer\n for layer in self.hidden_layers:\n lay... | [
"0.6844626",
"0.6437852",
"0.64241374",
"0.6314219",
"0.62812746",
"0.61997575",
"0.6187803",
"0.6118976",
"0.6094099",
"0.6094047",
"0.6091524",
"0.60739464",
"0.60728776",
"0.60697055",
"0.6068656",
"0.60477424",
"0.6040966",
"0.6030776",
"0.6021763",
"0.6003853",
"0.600156... | 0.677614 | 1 |
Calculates recall for each users in X_true and X_top_k matrices | def recall(X_true: csr_matrix, X_top_k: np.array, R=100) -> np.array:
selected = np.take_along_axis(X_true, X_top_k[:, :R], axis=-1)
hit = selected.sum(axis=-1)
maxhit = np.minimum(X_true.getnnz(axis=1), R)
return np.squeeze(np.asarray(hit)) / maxhit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_top_k_recall(y_true, y_pred, k=10):\n assert(y_true.shape == y_pred.shape)\n k = min(k, y_pred.shape[1])\n out = np.zeros((k, y_pred.shape[0]))\n for i in range(y_pred.shape[0]):\n r1 = zip(y_pred[i], range(y_pred.shape[1]))\n r1_sorted = sorted(r1, key= lambda x: x[0], reverse=True)\n tru... | [
"0.7212895",
"0.6530639",
"0.64434695",
"0.64380735",
"0.64296013",
"0.64240104",
"0.6415736",
"0.6404322",
"0.64026916",
"0.63767636",
"0.63751096",
"0.6354689",
"0.6349323",
"0.63373804",
"0.63373804",
"0.63373804",
"0.63373804",
"0.63373804",
"0.63373804",
"0.63362116",
"0... | 0.74693286 | 0 |
Sets the succeeded of this BatchFuturesOrder. | def succeeded(self, succeeded):
self._succeeded = succeeded | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success(self):\n self.succeeded = True",
"def markSuccess(self, *args):\n self.add(True)",
"def success(self, success):\n self._success = success",
"def mark_success(self):\n LOGGER.debug('Marking current_state as: %s', self.States.SUCCEEDED)\n self.current_state = self... | [
"0.6331888",
"0.63062626",
"0.6253741",
"0.62362224",
"0.60332125",
"0.60270214",
"0.6024683",
"0.5997773",
"0.59797364",
"0.5895106",
"0.5895106",
"0.5895106",
"0.5871211",
"0.58295554",
"0.5678365",
"0.56779003",
"0.561979",
"0.55537885",
"0.5549905",
"0.554162",
"0.5509084... | 0.77922183 | 0 |
Sets the detail of this BatchFuturesOrder. | def detail(self, detail):
self._detail = detail | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details(self, details):\n\n self._details = details",
"def __set_transaction_detail(self, *args, **kwargs):\r\n customer_transaction_id = kwargs.get('customer_transaction_id', False)\r\n if customer_transaction_id:\r\n TransactionDetail = self.client.factory.create('Transactio... | [
"0.61827743",
"0.6019881",
"0.59408075",
"0.58819795",
"0.5580633",
"0.55282944",
"0.5462776",
"0.53551376",
"0.5074937",
"0.50624526",
"0.50624526",
"0.50549614",
"0.5045217",
"0.50396746",
"0.50223285",
"0.50223285",
"0.50223285",
"0.50223285",
"0.50180495",
"0.50151837",
"... | 0.6474402 | 2 |
Sets the id of this BatchFuturesOrder. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int'... | [
"0.72282934",
"0.7106809",
"0.7064588",
"0.696578",
"0.69147944",
"0.6819542",
"0.6819542",
"0.6819542",
"0.67948914",
"0.67530006",
"0.67431444",
"0.67431444",
"0.67431444",
"0.67431444",
"0.67431444",
"0.6740458",
"0.6740458",
"0.6740458",
"0.6740458",
"0.6740458",
"0.67404... | 0.6629532 | 95 |
Sets the finish_time of this BatchFuturesOrder. | def finish_time(self, finish_time):
self._finish_time = finish_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish(self, finish_time=None):\n pass",
"def time_finished(self, time_finished):\n self._time_finished = time_finished",
"def set_finish(self, t: float = 0.0) -> None:\n if not t:\n t = time()\n self.tfinish = t\n self.log.debug(\"%s %s\", self.prefix, {\"end-... | [
"0.68530947",
"0.66643214",
"0.64617664",
"0.60674816",
"0.60674816",
"0.60674816",
"0.596257",
"0.596257",
"0.5922965",
"0.57165",
"0.5706665",
"0.5627342",
"0.5605918",
"0.5520487",
"0.5491917",
"0.548116",
"0.5473948",
"0.54514694",
"0.53701746",
"0.5311066",
"0.5292391",
... | 0.81281 | 2 |
Sets the status of this BatchFuturesOrder. | def status(self, status):
allowed_values = ["open", "finished"] # noqa: E501
if self.local_vars_configuration.client_side_validation and status not in allowed_values: # noqa: E501
raise ValueError(
"Invalid value for `status` ({0}), must be one of {1}".format(status, allowe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setstatus(self, status):\n with self.lock:\n self.status = status",
"def _set_status(self, status):\n with self.status_lock:\n if (status in _ENDING_STATUSES) or (not self.status in _ENDING_STATUSES):\n self.status = status",
"def set_status(self, status):... | [
"0.7299786",
"0.72231615",
"0.7071624",
"0.7071624",
"0.7071624",
"0.7017653",
"0.6950009",
"0.6950009",
"0.6950009",
"0.6950009",
"0.6950009",
"0.6950009",
"0.6950009",
"0.6940603",
"0.6940603",
"0.6940603",
"0.6940603",
"0.6940603",
"0.6940603",
"0.6940603",
"0.6940603",
... | 0.62438446 | 61 |
Sets the price of this BatchFuturesOrder. | def price(self, price):
self._price = price | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_price(self, price):\n assert isinstance(price, float), 'Price must be a float'\n self._price = price",
"def price(self, price: float):\n\n self._price = price",
"def set_price(self, _price):\n self.price = _price\n return self.price",
"def price(self, price):\n ... | [
"0.79372585",
"0.7762809",
"0.7505031",
"0.74923337",
"0.71972334",
"0.7072692",
"0.7043395",
"0.69935024",
"0.67257816",
"0.6243482",
"0.62053895",
"0.6182245",
"0.6150448",
"0.6014066",
"0.6008549",
"0.60080636",
"0.59797204",
"0.58877796",
"0.5833254",
"0.57691526",
"0.573... | 0.7595189 | 4 |
Sets the left of this BatchFuturesOrder. | def left(self, left):
self._left = left | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_left(self, left):\n self.left = left",
"def left(self, left):\n self.ptr.left(left)",
"def left(self):\n self.move(-1, 0)",
"def left(self, left):\n # type: (float) -> None\n\n if left is not None:\n if not isinstance(left, (float, int)):\n ... | [
"0.75113064",
"0.68874043",
"0.68413764",
"0.6809709",
"0.6602753",
"0.6586361",
"0.65665114",
"0.65665114",
"0.65621006",
"0.654997",
"0.64860755",
"0.6482276",
"0.64273965",
"0.64273965",
"0.6422925",
"0.6396158",
"0.6389288",
"0.6384071",
"0.6371525",
"0.62606746",
"0.6239... | 0.7500553 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.