query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Shows a table of user tests. | def Index(request):
output = request.GET.get('o')
if output == 'gviz_table_data':
return http.HttpResponse(FormatUserTestsAsGviz(request))
else:
params = {
'height': '400px',
'width': 'auto',
'page_size': 20
}
return util.Render(request, 'user_tests_index.html', params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Table(request, key):\n test = models.user_test.Test.get_mem(key)\n if not test:\n msg = 'No test was found with test_key %s.' % key\n return http.HttpResponseServerError(msg)\n\n params = {\n 'hide_nav': True,\n 'hide_footer': True,\n 'test': test,\n }\n\n return util.GetResults(request, 'u... | [
"0.80550736",
"0.68134075",
"0.65610844",
"0.653583",
"0.65127206",
"0.64837927",
"0.6434516",
"0.6418729",
"0.63465595",
"0.6317583",
"0.6233405",
"0.62315404",
"0.6187078",
"0.61481196",
"0.6106531",
"0.60995424",
"0.6074437",
"0.6015064",
"0.6000204",
"0.59634566",
"0.5962... | 0.7154061 | 1 |
Sends an API request to run one's test page on WebPagetest.org. | def WebPagetest(request, key):
test = models.user_test.Test.get_mem(key)
if not test:
msg = 'No test was found with test_key %s.' % key
return http.HttpResponseServerError(msg)
current_user = users.get_current_user()
if (test.user.key().name() != current_user.user_id() and not
users.is_current_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_doGet(self) -> None:\n\n status_code = apicall.doGet(URL, self._browserheader)\n print(\"in do get:\", status_code)\n assert status_code == API_SUCCESS",
"def test(base_url='http://localhost:8000/'):\n with env.cd(settings.PROJECT_PATH):\n # env.run('python rnacentral/apiv... | [
"0.6589668",
"0.6506418",
"0.63798094",
"0.62275237",
"0.61125684",
"0.61125684",
"0.60818094",
"0.60572374",
"0.5959362",
"0.5956013",
"0.5955665",
"0.59321207",
"0.59309137",
"0.5920353",
"0.5911625",
"0.59028727",
"0.5895274",
"0.589447",
"0.5891544",
"0.58683366",
"0.5864... | 0.6819468 | 0 |
Sync all foreign models in instance to data using their class object and manager name. More info | def _sync_foreign_model(self, instance, data, cls, manager_name):
# Remove all foreign instances that are not featured in data
data_ids = [item["id"] for item in data if "id" in item]
for existing_foreigns in getattr(instance, manager_name).all():
if existing_foreigns.id not in data_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_reverse_relations(self, related_objects, instance):\n for field, related_field, data, kwargs in related_objects:\n # inject the PK from the instance\n if isinstance(field, serializers.ListSerializer):\n for obj in data:\n obj[related_field.na... | [
"0.59193707",
"0.5779825",
"0.5765561",
"0.57606983",
"0.5748647",
"0.5728996",
"0.57228345",
"0.5692319",
"0.5648922",
"0.56440777",
"0.5624399",
"0.5589713",
"0.55817914",
"0.5570557",
"0.5563866",
"0.55505055",
"0.5546178",
"0.55017614",
"0.54824173",
"0.5429872",
"0.54124... | 0.7405185 | 0 |
Method has to check if any of `modules` contains `callable` object with name `method_name` and return list of such objects | def methods_importer(
method_name: str, modules: List[Union[str, ModuleType]]
) -> List[Callable]:
result = []
for module in modules:
try:
if isinstance(module, ModuleType):
mod = module
elif isinstance(module, str):
mod = importlib.import_modu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_function_list_from_modlist(self):\n function_list = []\n function_name_list = []\n for module in self.module_list:\n for name, obj in inspect.getmembers(module, inspect.isfunction):\n if inspect.getmodule(obj) == module:\n function_list.appe... | [
"0.6745168",
"0.6412298",
"0.6275962",
"0.61267555",
"0.6027407",
"0.5975847",
"0.5927226",
"0.58631086",
"0.5823784",
"0.58145356",
"0.58093834",
"0.5742289",
"0.57135206",
"0.56821996",
"0.565382",
"0.5643577",
"0.56351846",
"0.5629629",
"0.56272805",
"0.5621702",
"0.554427... | 0.72288847 | 0 |
on change event of survey_id field, if note is available in selected survey then display this note in note fields. | def on_change_survey(self, cr, uid, ids, survey_id, context=None):
if not survey_id:
return {}
notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note']
return {'value': {'note': notes}} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _on_clip_notes_changed(self):\n if liveobj_valid(self._sequencer_clip) and self._can_edit():\n time_start, time_length = self._get_clip_notes_time_range()\n self._clip_notes = self._get_notes_handler(self._sequencer_clip, time_start, self._pitches, time_length)\n else:\n ... | [
"0.54103535",
"0.5384617",
"0.5342676",
"0.531327",
"0.52878267",
"0.52672136",
"0.5042082",
"0.49997288",
"0.49391526",
"0.49161386",
"0.49144882",
"0.49064714",
"0.48971125",
"0.4877697",
"0.48331854",
"0.47828805",
"0.4776097",
"0.47532988",
"0.47387284",
"0.46859652",
"0.... | 0.7571935 | 0 |
Parses the given string in infix notation. | def parse_infix(input: str) -> Node:
parsed = ParsedString(input).tokenize()
ans = parse_e(parsed)
return ans | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_infix(string):\n return postfix(infix_to_postfix(string))",
"def calculate_infix_expression(cls, expression):\n\t\tlogger.info(f\"in the calculate infix expression {expression}\")\n\t\telements = expression.split()\n\t\tstack = []\n\t\ttry:\n\t\t\tfor e in elements:\n\t\t\t\tif not e.isdigit() an... | [
"0.7397211",
"0.6478074",
"0.6168341",
"0.61475885",
"0.6107287",
"0.60420674",
"0.60419923",
"0.6025316",
"0.60142255",
"0.5998835",
"0.5970454",
"0.5955664",
"0.5921972",
"0.5825912",
"0.5818483",
"0.576102",
"0.5759942",
"0.57156307",
"0.56969327",
"0.56241494",
"0.5590105... | 0.81860536 | 0 |
Normalize time in arbitrary timezone to UTC naive object. | def normalize_time(timestamp):
offset = timestamp.utcoffset()
if offset is None:
return timestamp
return timestamp.replace(tzinfo=None) - offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_to_utc(date, timezone):\n local_tz = pytz.timezone(timezone)\n new_date = date.replace(tzinfo = local_tz)\n utc_tz = pytz.timezone('UTC')\n new_date = new_date.astimezone(utc_tz)\n return new_date",
"def normalize_time(timestamp):\r\n offset = timestamp.utcoffset()\r\n if offse... | [
"0.7121004",
"0.70751613",
"0.68719333",
"0.6638765",
"0.6492223",
"0.6492223",
"0.64689595",
"0.6383807",
"0.63305354",
"0.6259214",
"0.6201917",
"0.61943454",
"0.6189186",
"0.61438674",
"0.6071864",
"0.6052293",
"0.6044807",
"0.6037905",
"0.60008335",
"0.60007656",
"0.59903... | 0.7118167 | 1 |
Determines if time is going to happen in the next window seconds. | def is_soon(dt, window):
soon = (utcnow() + datetime.timedelta(seconds=window))
return normalize_time(dt) <= soon | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_soon(dt, window):\r\n soon = (utcnow() + datetime.timedelta(seconds=window))\r\n return normalize_time(dt) <= soon",
"def is_time(self) -> bool:\n return self.times > 1",
"def check_timer(self, wanted_time):\n if time.time() - self.start_time >= wanted_time:\n return True\... | [
"0.6944493",
"0.6809295",
"0.6770309",
"0.66791123",
"0.6604746",
"0.6575241",
"0.65720016",
"0.6527601",
"0.64802086",
"0.6467284",
"0.6399745",
"0.63648057",
"0.6287537",
"0.62048924",
"0.6202289",
"0.61881906",
"0.6164102",
"0.6113024",
"0.6048458",
"0.60255253",
"0.599680... | 0.6890391 | 1 |
sent message to line when BTC price change | def line_sent(price):
now = datetime.datetime.now()
LINE_ACCESS_TOKEN = " " # Line Token
url = "https://notify-api.line.me/api/notify"
print("[%02i:%02i:%02i] Price Change : Send Message" % (now.hour, now.minute, now.second))
message = "[%02i:%02i:%02i] Now BTC Price : %s" % (now.hour, now.minute, n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_ts_OrderUpdated(self, sender, e):\r\n print(\"Order was updated with price of {0}.\".format(e.NewOrder.LimitPrice))",
"def price(temp):\n now = datetime.datetime.now()\n r = requests.get(\"https://bitcoin.co.th/\")\n soup = BeautifulSoup(r.content, \"html.parser\")\n data = soup.find_all... | [
"0.6816411",
"0.6801577",
"0.65582",
"0.6458763",
"0.640456",
"0.63957596",
"0.63561404",
"0.6308241",
"0.6267959",
"0.60562086",
"0.6038898",
"0.6030322",
"0.6026573",
"0.6005116",
"0.5988077",
"0.5987116",
"0.59702915",
"0.5927759",
"0.5876349",
"0.5855136",
"0.5835843",
... | 0.72373915 | 0 |
Creates vocab tables for src_vocab_file and tgt_vocab_file | def create_vocab_tables(src_vocab_file, tgt_vocab_file, share_vocab):
src_vocab_table = lookup_ops.index_table_from_file(
src_vocab_file, default_value=UNK_ID)
if share_vocab:
tgt_vocab_table = src_vocab_table
else:
tgt_vocab_table = lookup_ops.index_table_from_file(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vocab_tables(source_file, tags_file):\n pass",
"def create_vocab_tables(vocab_file):\n vocab_table = lookup_ops.index_table_from_file(\n vocab_file, default_value=0)\n return vocab_table",
"def create_vocab(data_files, vocab_fname):\n chars = set()\n for data_fname in data_files:\n w... | [
"0.7955603",
"0.7308529",
"0.7184133",
"0.68010455",
"0.6748521",
"0.6647768",
"0.64361453",
"0.64343816",
"0.642107",
"0.637317",
"0.63398",
"0.62193406",
"0.60044277",
"0.59781426",
"0.58856463",
"0.5873985",
"0.5845134",
"0.58191055",
"0.5818881",
"0.58034873",
"0.5802334"... | 0.8489429 | 0 |
Load embed text into python dictionary | def load_embed_text(embed_file):
emb_dict = dict()
emb_size = None
with codecs.getreader("utf-8")(tf.gfile.GFile(embed_file, "rb")) as f:
for line in f:
tokens = line.strip().split(" ")
word = tokens[0]
vec = list(map(float, tokens[1:]))
emb_dict[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_embedding_file(self):\n if self.language == 'en':\n embed_file_dir = self.embedding_path\n wv = KeyedVectors.load_word2vec_format(embed_file_dir, binary=True)\n self.pretrained_embedding = {}\n for word in wv.vocab.keys():\n normalized_word... | [
"0.6251451",
"0.59665245",
"0.5931526",
"0.5864249",
"0.5857385",
"0.585637",
"0.5768584",
"0.56255275",
"0.55851597",
"0.5561361",
"0.55584276",
"0.55403835",
"0.5534576",
"0.551691",
"0.5507314",
"0.5474913",
"0.5453954",
"0.5416933",
"0.5389678",
"0.5383825",
"0.53736913",... | 0.7389193 | 0 |
Test Jacobi symbol function. Test data by clux .com Copyright (c) 2015 Eirik Albrigtsen. | def test_jacobi_symbol():
assert jacobi_symbol.jacobi_symbol(-1, 5) == 1
assert jacobi_symbol.jacobi_symbol(-1, 13) == 1
assert jacobi_symbol.jacobi_symbol(-1, 3) == -1
assert jacobi_symbol.jacobi_symbol(-1, 7) == -1
assert jacobi_symbol.jacobi_symbol(2, 3) == -1
assert jacobi_symbol.jacob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_jacobian(self):\n\n gT1 = Pose2(1, 2, np.pi/2)\n gT2 = Pose2(-1, 4, np.pi)\n\n expected = Pose2(2, 2, np.pi/2)\n\n def error_func(this: CustomFactor, v: gtsam.Values, H: List[np.ndarray]):\n # print(f\"{this = },\\n{v = },\\n{len(H) = }\")\n\n key0 = this.... | [
"0.6263861",
"0.60016906",
"0.5993425",
"0.59792936",
"0.59679013",
"0.5947442",
"0.58563167",
"0.5767559",
"0.57407844",
"0.56984955",
"0.5689885",
"0.56845725",
"0.5673471",
"0.56505066",
"0.56440735",
"0.5604703",
"0.5593576",
"0.55914634",
"0.5581195",
"0.557651",
"0.5572... | 0.82948303 | 0 |
set up some polynomials | def setUp(self):
self.f1 = uniutil.polynomial(enumerate([3, 6, 81, 1]), Z)
self.f2 = uniutil.polynomial(enumerate([1, 81, 6, 3]), Z)
self.f3 = uniutil.polynomial(enumerate([37, 6, 18, 1]), Z)
self.f4 = uniutil.polynomial(enumerate([91, 7, 14, 1]), Z)
# f5 = (x - 6)(x - 5)...x(x +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test():\n assert str(Polynomial(0, 1, 0, -1, 4, -2, 0, 1, 3, 0)) == \"3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x\"\n assert str(Polynomial([-5, 1, 0, -1, 4, -2, 0, 1, 3, 0])) == \"3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x - 5\"\n assert str(Polynomial(x7=1, x4=4, x8=3, x9=0, x0=0, x5=-2, x3=-1, x1=1)) == \"3x^8 + x^... | [
"0.678141",
"0.67440933",
"0.6514138",
"0.65139806",
"0.64966166",
"0.6434011",
"0.62719",
"0.6235043",
"0.62243843",
"0.62179774",
"0.6173415",
"0.61612695",
"0.60989493",
"0.6082673",
"0.60799944",
"0.6079461",
"0.6062244",
"0.60604817",
"0.6048867",
"0.60426575",
"0.603064... | 0.70385593 | 0 |
return the size and line number of all the files end with file_format in file_path | def get_files_size_and_line_number(file_path, file_format):
logging.info("[get_file_size_and_line_number] file_path: %s, file_format: %s", file_path, file_format)
size = 0
lines = 0
for root, dirs, files in os.walk(file_path):
for file in files:
for one_format in file_format:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(path):",
"def file_stat(self, file_path):",
"def get_file_size(file_path):\n with open(file_path, 'rb') as infile:\n infile.seek(0, 2)\n return infile.tell()",
"def fileLineCount(fPath):\n\twith open(fPath) as f:\n\t\tfor i, li in enumerate(f):\n\t\t\tpass\n\treturn (i + 1)",
"def read_file... | [
"0.63892037",
"0.6363271",
"0.60669774",
"0.60568386",
"0.60216236",
"0.59628934",
"0.5924917",
"0.5862097",
"0.5836959",
"0.581429",
"0.5798193",
"0.5783594",
"0.57677364",
"0.5739231",
"0.57310176",
"0.572738",
"0.57239795",
"0.57239795",
"0.57225364",
"0.5717134",
"0.57096... | 0.8117311 | 0 |
Save updates to this user. Updates will be made column by column based on the result of self.what_changed(). | def save(self, context=None):
updates = self.obj_get_changes()
self.dbapi.update_user(context, self.id, updates)
self.obj_reset_changes() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_users(self):\n Data.add_data(self.user_data())",
"def update(self):\n db.session.commit()",
"def update(self):\n db.session.commit()",
"def save(self):\n self.__db.commit()",
"def save(self):\n self.db.commit()",
"def save(self):\n db.session.commit()... | [
"0.6838319",
"0.6649925",
"0.6649925",
"0.66234463",
"0.65625477",
"0.64974636",
"0.6454244",
"0.63921773",
"0.63921773",
"0.63760066",
"0.63760066",
"0.63760066",
"0.63760066",
"0.63760066",
"0.63760066",
"0.63760066",
"0.63760066",
"0.6369375",
"0.6336045",
"0.63228583",
"0... | 0.6958138 | 0 |
Return the name of the appliance | def name(self):
return self.appliance_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_appliance_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"storage_appliance_name\")",
"def getApplicationName(self) -> unicode:\n ...",
"def get_name(self, name):\n return self.apps[name]['name']",
"def name(self):\n return self.application_tree[... | [
"0.728623",
"0.670762",
"0.6638334",
"0.66285485",
"0.6624678",
"0.6546256",
"0.6457588",
"0.6457588",
"0.64034915",
"0.6325202",
"0.62845224",
"0.6272063",
"0.62540203",
"0.62129927",
"0.6174521",
"0.61575866",
"0.6152049",
"0.610121",
"0.6100212",
"0.6099339",
"0.60911846",... | 0.90326834 | 0 |
Inject an extend method in obj that will used append method. | def define_extend_as_seq_of_appends(obj):
assert hasattr(
obj, 'append'
), f'Your object needs to have an append method! Object was: {obj}'
def extend(self, items):
for item in items:
self.append(item)
if isinstance(obj, type):
obj = type(obj.__name__, (obj,), {})
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend(self, *args, **kwargs): # real signature unknown\n pass",
"def extend(self, x) -> None:\n pass",
"def append(self, obj):\r\n raise NotImplementedError",
"def extend(self, other):\n # YOUR CODE HERE\n raise NotImplementedError()",
"def append(self, *args, **kwargs):... | [
"0.7326428",
"0.6949307",
"0.6912196",
"0.6708326",
"0.6557307",
"0.6522524",
"0.6451939",
"0.64439166",
"0.63893723",
"0.6349176",
"0.62845767",
"0.60959977",
"0.60721445",
"0.60629874",
"0.5988625",
"0.5980781",
"0.5946136",
"0.5893937",
"0.58636904",
"0.5830696",
"0.582557... | 0.72547257 | 1 |
Make item2kv from a item2key function (the value will be the item itself). | def item_to_key(item2key):
def item2kv(item):
return item2key(item), item
return item2kv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_to_key_params_and_val(item_to_key_params_and_val, key_str_format):\n\n def item2kv(item):\n key_params, val = item_to_key_params_and_val(item)\n if isinstance(key_params, dict):\n return key_str_format.format(**key_params), val\n else:\n ... | [
"0.718581",
"0.5973326",
"0.59086525",
"0.59082144",
"0.5864925",
"0.5777844",
"0.5666772",
"0.56512356",
"0.5644327",
"0.56334215",
"0.5619753",
"0.54938334",
"0.54744387",
"0.54451644",
"0.53108513",
"0.5293976",
"0.52673554",
"0.522438",
"0.519466",
"0.5186249",
"0.5139293... | 0.8628558 | 0 |
Make an item2kv function that uses the current time as the key, and the unchanged item as a value. The offset_s, which is added to the output key, can be used, for example, to align to another system's clock, or to get a more accurate timestamp of an event. | def utc_key(offset_s=0.0):
if offset_s == 0.0: # splitting for extra speed (important in real time apps)
def item2kv(item):
return time.time(), item
else:
def item2kv(item):
return time.time() + offset_s, item
return item2kv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_to_key(item2key):\n\n def item2kv(item):\n return item2key(item), item\n\n return item2kv",
"def item_to_key_params_and_val(item_to_key_params_and_val, key_str_format):\n\n def item2kv(item):\n key_params, val = item_to_key_params_and_val(item)\n if ... | [
"0.599946",
"0.57572216",
"0.5707284",
"0.56803143",
"0.5570548",
"0.5564531",
"0.54696536",
"0.5291604",
"0.5251823",
"0.52447885",
"0.5214924",
"0.51746917",
"0.51510656",
"0.51070833",
"0.5074654",
"0.5035714",
"0.5030335",
"0.50250804",
"0.5017685",
"0.5007017",
"0.495430... | 0.7907506 | 0 |
Make item2kv from a function that produces key_params and val, and a key_template that will produce a string key from the key_params | def item_to_key_params_and_val(item_to_key_params_and_val, key_str_format):
def item2kv(item):
key_params, val = item_to_key_params_and_val(item)
if isinstance(key_params, dict):
return key_str_format.format(**key_params), val
else:
return key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_to_key(item2key):\n\n def item2kv(item):\n return item2key(item), item\n\n return item2kv",
"def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]:\n my_tuple = (k, v*v)\n\n return my_tuple",
"def to_kv(k: str, v: typing.Union[int, float]) -> typing.Tuple[str, flo... | [
"0.6950581",
"0.60080147",
"0.59396696",
"0.5878557",
"0.58238006",
"0.58238006",
"0.57599187",
"0.5747728",
"0.57112104",
"0.5701399",
"0.56740856",
"0.5659779",
"0.56510776",
"0.5546873",
"0.54509264",
"0.53719",
"0.5371222",
"0.5350639",
"0.5309715",
"0.52902204",
"0.52765... | 0.77231133 | 0 |
the function print a data from dict 'new_dict' according to the number(picked_n) the user choosed. | def pickedFromDict(picked_num, new_dict):
#1-printing mariah's last name
#2-printing mariah's birth date
#3-printing mariah's hobbies
#4-printing mariah's last hobbie
#5-adds "coocking" to mariah's hobbies and printing mariah's updated hobbies
#6-printing mariah's birth date into tuple of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_five_gram_dict(n_gram_dict):\n n_gram = dict()\n\n for line_idx, line_val in enumerate(n_gram_dict):\n if n_gram.get(line_val[0], None) == None:\n n_gram[line_val[0]] = [line_val[1]+\" \"+line_val[2], int(line_val[3])]\n\n if DEBUGGING_MODE:\n print(\"\\n========== check ... | [
"0.62824196",
"0.6082546",
"0.5780949",
"0.5698525",
"0.5650637",
"0.5601323",
"0.55702174",
"0.5543086",
"0.5519851",
"0.5518044",
"0.5468941",
"0.54135096",
"0.53970253",
"0.53740084",
"0.53520656",
"0.5302337",
"0.52912074",
"0.52847147",
"0.5274072",
"0.52664304",
"0.5217... | 0.74096864 | 0 |
Iterator for page links | def iter_page_links(self) -> Iterable[str]:
base_url = 'https://www.med.navy.mil'
r = requests.get(self.starting_url, verify=CERTIFICATE_DIR + '/cat3.pem')
soup = bs4.BeautifulSoup(r.content, features="html.parser")
# get target column of list items
issuance_list = soup.find('di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_links(self):",
"def iter_page_links(self) -> Iterable[str]:\n base_url = 'https://health.mil/About-MHS/OASDHA/Defense-Health-Agency/Resources-and-Management/DHA-Publications'\n yield base_url",
"def links(cls, page):\r\n for match in cls.HREF_RE.finditer(page):\r\n yield cls.href... | [
"0.80651504",
"0.750158",
"0.7370286",
"0.73280376",
"0.69186187",
"0.69141686",
"0.6908116",
"0.6793799",
"0.67863417",
"0.6741017",
"0.66748494",
"0.6670355",
"0.66565365",
"0.6593838",
"0.65873545",
"0.65807104",
"0.6502916",
"0.6478992",
"0.64505965",
"0.64059603",
"0.639... | 0.75957644 | 1 |
Parse document objects from page of text | def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]:
# parse html response
url = "https://www.med.navy.mil/directives/Pages/Publications.aspx"
base_url = 'https://www.med.navy.mil'
parsed_docs = []
doc_name_list = []
if (page_url.find("Publ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_docs_from_page(self, page_url: str, page_text: str) -> Iterable[Document]:\n # get the data\n data = requests.get(page_url)\n\n # load data into bs4\n soup = BeautifulSoup(data.text, 'html.parser')\n # links = []\n pdf_dis = []\n dates = []\n table ... | [
"0.71913856",
"0.69207364",
"0.6807848",
"0.6564104",
"0.6440653",
"0.6434585",
"0.6419085",
"0.6406201",
"0.63876253",
"0.6367041",
"0.6246994",
"0.62138414",
"0.6203199",
"0.6178067",
"0.6176524",
"0.61475307",
"0.6122435",
"0.6108919",
"0.60970265",
"0.6094376",
"0.6085055... | 0.6943239 | 1 |
Provide an API call to Pushover for mobile notifications of events in the script. "message" is a string that will display on the Pushover notification. "app_token" is a string for the app token provided by Pushover. | def pushover(message, app_token):
import urllib, httplib
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": app_token,
"user": "uU95W9hYqeW3b24uyPaT1skT1SG35N",
"message": message,
}), { "Content-type": "application/x-www... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tell_sophie(message):\n \n d = {'token': cf.get('pushover', 'apikey'),\n 'user': cf.get('pushover', 'userkey'),\n 'message': message }\n requests.post('https://api.pushover.net/1/messages.json', json=d)",
"def send_push(message: Dict[Any, Any]) -> None:\n notification_url = settin... | [
"0.6193292",
"0.6061524",
"0.5765204",
"0.5674728",
"0.54582673",
"0.5439559",
"0.5439116",
"0.5438104",
"0.54364663",
"0.5409798",
"0.5393484",
"0.53734607",
"0.5351594",
"0.5273738",
"0.5259695",
"0.5203758",
"0.51804733",
"0.51779073",
"0.51729697",
"0.51518786",
"0.508690... | 0.79063237 | 0 |
Install our virtual environment; removing the old one if it exists | def install_environment(root):
sys.stdout.write('Installing virtualenv into %s \n' % root)
try:
import virtualenv
except ImportError:
sys.stdout.write('Installing virtualenv into global interpreter \n')
subprocess.call([VE_GLOBAL_SCRIPT, PROJECT_ROOT])
import virtualenv
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_virtualenv(ctx):\n if not path.isfile(\"./pyenv/bin/pip\"):\n ctx.run(\"virtualenv --no-site-packages --python=/usr/bin/python2.7 pyenv\")\n ctx.run(\"PIP_DOWNLOAD_CACHE=/var/tmp/ ./pyenv/bin/pip install -r requirements.txt\")\n print(\"\"\"\n Installation completed. Please check any er... | [
"0.70328605",
"0.66779727",
"0.66118217",
"0.656353",
"0.65248436",
"0.65089977",
"0.6502636",
"0.6473916",
"0.6418527",
"0.6363957",
"0.63546306",
"0.63459617",
"0.63441616",
"0.62826",
"0.62428427",
"0.6232576",
"0.6230184",
"0.6230184",
"0.62095016",
"0.62049896",
"0.61960... | 0.692725 | 1 |
Decorator validates if the app parameter is registered in the process_context | def valid_process_name(function):
def _wrapper(options, *args, **kwargs):
from synergy.conf.process_context import ProcessContext
if options.app not in ProcessContext.CONTEXT:
msg = 'Aborting: application <%r> defined by --app option is unknown. \n' % options.app
sys.stdout.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_context(f):\n @wraps(f)\n def wrapper(*args, **kwargs):\n if not is_admin_context(args[0]) and not is_user_context(args[0]):\n raise exception.NotAuthorized()\n return f(*args, **kwargs)\n return wrapper",
"def __call__(self, app: App, **kwargs: Any) -> bool:\n ... | [
"0.60219806",
"0.5993461",
"0.58701164",
"0.5856209",
"0.5856209",
"0.58344436",
"0.58344436",
"0.5770378",
"0.568177",
"0.568177",
"0.5681647",
"0.56343865",
"0.56343865",
"0.5310002",
"0.5292798",
"0.52796423",
"0.5245052",
"0.52111816",
"0.520173",
"0.5142669",
"0.512641",... | 0.647955 | 0 |
Convert an adjacency graph in scipy sparse matrix format into an iGraph format. | def convert_sparse_to_igraph(indices, matrix):
# sources, targets = matrix.nonzero()
# weights = matrix[sources, targets]
# weights = np.array(weights)[0]
# print(dir(louvain))
# ig = igraph.Graph(zip(sources, targets), directed=True,
# edge_attrs={'weight': weights})
# return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_nxgraph(G):\n return nx.to_scipy_sparse_matrix(G).astype('float32')",
"def create_adjacency_matrix(graph):\n index_1 = [edge[0] for edge in graph.edges()]\n index_2 = [edge[1] for edge in graph.edges()]\n values = [1 for edge in graph.edges()]\n node_count = max(max(index_1)+1,max(index_2... | [
"0.7428788",
"0.698894",
"0.6937286",
"0.6890723",
"0.6840507",
"0.6761767",
"0.6671198",
"0.6508733",
"0.64971626",
"0.6486387",
"0.64698505",
"0.6466938",
"0.6412773",
"0.6366936",
"0.6302056",
"0.61876756",
"0.615492",
"0.6137109",
"0.61366796",
"0.60860234",
"0.6081462",
... | 0.79616356 | 0 |
Returns a value K which scales logarithmically to the number of cells in a sample. | def get_k(df):
return int(np.log(len(df.columns))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_kl(self, lvl):\n kl = [] # kernal length\n for n in range(lvl):\n fct = self.scaling**n # up-sampling factor\n kl.append(fct*(self.nfreq-1)+1)\n kl.append(kl[-1]) # repeat the value of the coarsest scale for the approximation coefficient\n return kl... | [
"0.62024623",
"0.6159338",
"0.6130816",
"0.60664135",
"0.6045936",
"0.6011657",
"0.5971239",
"0.59182364",
"0.58902717",
"0.5853251",
"0.5848989",
"0.58119035",
"0.58073115",
"0.5798724",
"0.5790387",
"0.5779547",
"0.5767433",
"0.5755783",
"0.575504",
"0.57255423",
"0.5699927... | 0.70775306 | 0 |
Authorize with Spotify API and fetch bearer token. | def authorize(self):
try:
auth_url = 'https://accounts.spotify.com/api/token'
headers={}
data={}
data_string = f"{self.client_id}:{self.client_secret}"
data_bytes = data_string.encode("ascii")
base_bytes = base64.b64encode(data_bytes)
base_message = base_bytes.decode("ascii")
headers['Autho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize():\n encoded_auth = base64.b64encode(\n (os.environ[\"SPOTIFY_CLIENT_ID\"] + ':' + os.environ[\"SPOTIFY_CLIENT_SECRET\"]).encode())\n headers = {\n 'Authorization': 'Basic {}'.format(encoded_auth.decode(\"utf-8\"))\n }\n\n response = requests.post(os.environ['SPOTIFY_AUTH_UR... | [
"0.7426291",
"0.71426195",
"0.71205246",
"0.70915276",
"0.7082394",
"0.69950104",
"0.6989322",
"0.69705796",
"0.67263836",
"0.67155063",
"0.6676822",
"0.6665931",
"0.66071135",
"0.656264",
"0.65159553",
"0.65093845",
"0.6490198",
"0.6468989",
"0.64642835",
"0.6463644",
"0.645... | 0.81158495 | 0 |
Convert milliseconds to seconds | def millisec_to_sec(self, millisec):
return millisec / 1000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MillisToSec(self):\n self.Millis = [item / 1000 for item in self.Millis]\n return self.Millis",
"def _ms_to_time(self, milliseconds):\n \n ms = milliseconds\n \n # Get the last 3 digits of the milliseconds\n trunc_ms = ms % 1000\n seconds = (ms / 1000)\n minutes = (seconds ... | [
"0.76566106",
"0.7349378",
"0.7331618",
"0.7264953",
"0.7230861",
"0.7129717",
"0.7029283",
"0.6987922",
"0.69484216",
"0.68863964",
"0.68600786",
"0.6857339",
"0.68361413",
"0.6827519",
"0.68191534",
"0.6809082",
"0.67981195",
"0.6795517",
"0.6790688",
"0.6744001",
"0.672427... | 0.7594132 | 1 |
Wait for the polling interval, then do the real message check. | def __check_for_messages(self):
# Wait for at least poll_interval sec
polling_interval = self.conf.messaging_server.polling_interval
time.sleep(polling_interval)
if self.conf.messaging_server.debug:
LOG.debug("Topic {}: Checking for new messages".format(
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll(self):\n self.poll_function(self.connection)",
"def poll(self):\n while self.running and reactor._started and not reactor._stopped:\n self.check_response_queue()\n sleep(0.5)",
"async def check():\r\n while True:\r\n if rss.check_new():\r\n item... | [
"0.6918109",
"0.6909268",
"0.66404",
"0.6634429",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6591415",
"0.6586251",
"0.650955",
"0.6... | 0.74402225 | 0 |
Gracefully stop working on things | def _gracefully_stop(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_check(self):\n pass",
"def aborting(self):\n \n pass",
"def stopclean(self):\n raise Exception(\"Not implemented\")",
"def stop() -> None:",
"def force_stop(self):\n #cancel any current request:\n self._cancel_current_request()",
"def _prepare_to_stop(self):\n ... | [
"0.74943763",
"0.7360043",
"0.7337609",
"0.72221744",
"0.7203809",
"0.7203615",
"0.7172144",
"0.7161631",
"0.7161631",
"0.7149348",
"0.7134612",
"0.713363",
"0.70896405",
"0.7084329",
"0.7068823",
"0.7068823",
"0.7068823",
"0.7068823",
"0.7068823",
"0.7068823",
"0.7068823",
... | 0.81977755 | 0 |
Prepare to restart the RPC Server | def _restart(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _RestartServer( self ):\n with self._gocode_lock:\n self._StopServer()\n self._StartServer()",
"def restart(self):",
"def restart(self) -> None:",
"def restart(self):\n pass",
"def request_shutdown(self, restart=False):",
"def restart(self):\r\n pass",
"def restart(self):... | [
"0.7340876",
"0.7222521",
"0.7215268",
"0.7143786",
"0.7116937",
"0.70833296",
"0.6916681",
"0.6875465",
"0.67941314",
"0.6769875",
"0.67550653",
"0.6754594",
"0.67220056",
"0.6678545",
"0.6672805",
"0.66473347",
"0.66432434",
"0.66391295",
"0.66269875",
"0.6593943",
"0.65930... | 0.77630264 | 0 |
Sets environment variables for a nox session object. | def set_environment_variables(env_dict, session):
for key, value in env_dict.items():
session.env[key] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_env_var(self):\n\n list_env_vars = self.config.items('environment_variables')\n for env_var in list_env_vars:\n os.environ[env_var[0].upper()] = env_var[1]",
"def set_envvars(self):\n # self.logger.trace(\"update os.environ with %s\", self.environ)\n for key in os.e... | [
"0.7283772",
"0.7195755",
"0.7000887",
"0.6998755",
"0.6786736",
"0.6786736",
"0.6722491",
"0.6713368",
"0.67089427",
"0.66470826",
"0.65927714",
"0.6552898",
"0.6529187",
"0.6479471",
"0.64337885",
"0.6416746",
"0.64166296",
"0.64166296",
"0.6415311",
"0.64110196",
"0.635323... | 0.7486853 | 0 |
Check all files against the defined precommit hooks. | def lint(session):
session.install("pre-commit")
session.run("pre-commit", "run", "--all-files") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precommit(exit=True):\n tmpdir = tempfile.mkdtemp()\n\n try:\n copy_index(tmpdir)\n\n modified = check_output(['git', 'diff', '--cached', '--name-only',\n '--diff-filter=ACMRT'])\n modified = [name.strip() for name in modified.splitlines()]\n pa... | [
"0.6876963",
"0.68466324",
"0.67995423",
"0.6654954",
"0.6572371",
"0.6481038",
"0.64283687",
"0.63959146",
"0.6318683",
"0.63177663",
"0.6232557",
"0.6230077",
"0.6152871",
"0.6043679",
"0.60293245",
"0.6020104",
"0.6003532",
"0.59991527",
"0.5969695",
"0.59456915",
"0.58171... | 0.70069766 | 0 |
Fetch the large training and test data set. | def _fetch_large():
# Large training data:
resource(
target=data_path("eeg", "SMNI_CMI_TRAIN.tar.gz"),
url="https://kdd.ics.uci.edu/databases/eeg/SMNI_CMI_TRAIN.tar.gz",
)
dependency(
target=data_path("eeg", "train"),
source=data_path("eeg", "SMNI_CMI_TRAIN.tar.gz"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_training_and_test_sets(normalize):\n class_labels = []\n test_labels = []\n norm = None\n if normalize == True:\n norm = loading.get_normalize_vector()\n\n for i in range(0, 10):\n [training, test] = loading.load_number_set(i, 0.7, norm_vector=norm)\n labels = [str(i)]... | [
"0.6598382",
"0.6573951",
"0.6541831",
"0.6520022",
"0.64941293",
"0.6416177",
"0.6404021",
"0.64026076",
"0.63473725",
"0.6340111",
"0.6321149",
"0.6319699",
"0.63178426",
"0.6309703",
"0.6307903",
"0.6301534",
"0.6286118",
"0.62821674",
"0.6274003",
"0.6271432",
"0.62667745... | 0.7176988 | 0 |
This function is used to create the container in Phantom using finding data. | def _create_container(self, finding):
container_dict = {}
container_dict['name'] = finding['Title']
container_dict['source_data_identifier'] = finding['Id']
container_dict['description'] = finding['Description']
container_creation_status, container_creation_msg, container_id = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_container(self):\n pass",
"def createContainer(tag, data={}): #@NoSelf",
"def container_factory(self, name):",
"def container_factory(self, name):",
"def container_factory(self, name):",
"def container_factory(self, name):",
"def container_factory(self, name):",
"def __create_... | [
"0.5875233",
"0.58578813",
"0.5711849",
"0.5711849",
"0.5711849",
"0.5711849",
"0.5711849",
"0.5676269",
"0.5545769",
"0.5408113",
"0.53612626",
"0.5329194",
"0.5291496",
"0.5263945",
"0.5263945",
"0.51851237",
"0.5161798",
"0.5128938",
"0.5122123",
"0.51019007",
"0.50853336"... | 0.65444756 | 0 |
This function is used to create artifacts in given container using finding data. | def _create_artifacts(self, finding, container_id):
artifacts = []
for resource in finding.pop('Resources'):
resource_artifact = {}
resource_artifact['name'] = '{} Resource Artifact'.format(resource['Type'])
resource_artifact['container_id'] = container_id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_container(self, finding):\n\n container_dict = {}\n container_dict['name'] = finding['Title']\n container_dict['source_data_identifier'] = finding['Id']\n container_dict['description'] = finding['Description']\n\n container_creation_status, container_creation_msg, con... | [
"0.62061214",
"0.57416934",
"0.573482",
"0.573116",
"0.56448776",
"0.5568765",
"0.55421925",
"0.55335236",
"0.54728556",
"0.5449445",
"0.54188776",
"0.53918684",
"0.53792435",
"0.5363252",
"0.5348222",
"0.5341792",
"0.52852637",
"0.52717286",
"0.5253826",
"0.52310616",
"0.523... | 0.73780525 | 0 |
Return collected metadata of a dataproduct. | def dataproduct(self, identity, dataproduct_id):
metadata = {}
permissions = self.permission.dataproduct_permissions(
dataproduct_id, identity
) or {}
session = self.config_models.session()
# find Group or Data layer object
OWSLayer = self.config_models.mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_metadata(self):\n return self.client._perform_json(\n \"GET\", \"/projects/%s/recipes/%s/metadata\" % (self.project_key, self.recipe_name))",
"def summarize_metadata(self):\n meta_dict = {}\n for comp in self.dataset.data_vars:\n for mkey, mvalue in self.dat... | [
"0.6686516",
"0.6594631",
"0.65593004",
"0.6541971",
"0.6431339",
"0.6426287",
"0.6409416",
"0.63947934",
"0.638867",
"0.6377498",
"0.63504374",
"0.6335236",
"0.63153744",
"0.6300704",
"0.627984",
"0.6277133",
"0.62743515",
"0.62743515",
"0.62743515",
"0.62743515",
"0.6274351... | 0.75031686 | 0 |
Collect metadata of a basic DataSet dataproduct. | def basic_dataset_metadata(self, data_set_view, session):
metadata = {}
contacts = self.basic_dataset_contacts(data_set_view, session)
metadata = {
'identifier': data_set_view.name,
'display': data_set_view.data_set.data_set_name,
'type': 'datasetview',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataproduct(self, identity, dataproduct_id):\n metadata = {}\n\n permissions = self.permission.dataproduct_permissions(\n dataproduct_id, identity\n ) or {}\n\n session = self.config_models.session()\n\n # find Group or Data layer object\n OWSLayer = self.co... | [
"0.67701876",
"0.6577738",
"0.6516718",
"0.6471045",
"0.62507623",
"0.62314963",
"0.62190706",
"0.6218088",
"0.62123156",
"0.62123156",
"0.61886233",
"0.6174235",
"0.6168924",
"0.6141858",
"0.612278",
"0.6120039",
"0.60999846",
"0.60504276",
"0.6031817",
"0.59935963",
"0.5977... | 0.7206746 | 0 |
Return contacts metadata for a basic DataSet dataproduct. | def basic_dataset_contacts(self, data_set_view, session):
# collect contacts for basic DataSet and related GDI resources
gdi_oids = [
data_set_view.gdi_oid, data_set_view.data_set.gdi_oid_data_source
]
return self.contacts(gdi_oids, session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basic_dataset_metadata(self, data_set_view, session):\n metadata = {}\n\n contacts = self.basic_dataset_contacts(data_set_view, session)\n\n metadata = {\n 'identifier': data_set_view.name,\n 'display': data_set_view.data_set.data_set_name,\n 'type': 'datas... | [
"0.70957017",
"0.6029492",
"0.60244423",
"0.5971579",
"0.5823789",
"0.5810419",
"0.5684084",
"0.5576861",
"0.55693126",
"0.5546394",
"0.554111",
"0.5482603",
"0.54492116",
"0.54473823",
"0.5446493",
"0.5446493",
"0.5446493",
"0.54323864",
"0.5393266",
"0.538147",
"0.5356055",... | 0.72183543 | 0 |
Return primary key, geometry columns, types and srids from a PostGIS table. | def postgis_metadata(self, data_source_id, schema, table_name):
metadata = {}
try:
engine = self.engine_for_data_source(data_source_id)
if engine is None:
return {
'error': "FEHLER: DataSource nicht gefunden"
}
# c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_info(self):\n epsg = None\n meta = MetaData()\n table_obj = Table(self._table, meta,\n autoload=True, autoload_with=self._engine)\n if not self._columns:\n self._columns = table_obj.columns.keys()\n geo_cols = [(col.name, col.type... | [
"0.67692256",
"0.675476",
"0.62519324",
"0.60473233",
"0.5883852",
"0.58504605",
"0.5701166",
"0.5491535",
"0.5480299",
"0.5475951",
"0.5452421",
"0.53603435",
"0.5338191",
"0.5314427",
"0.52559847",
"0.52456456",
"0.5243877",
"0.5240255",
"0.52377796",
"0.5215144",
"0.521342... | 0.696644 | 0 |
Return SQLAlchemy engine for a data_source. | def engine_for_data_source(self, data_source_id):
engine = None
# find data_source
DataSource = self.config_models.model('data_source')
session = self.config_models.session()
query = session.query(DataSource) \
.filter_by(gdi_oid=data_source_id)
data_source =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database_engine() -> Engine:\n return engine",
"def get_db_engine():\n # get database connection url\n connection_url = get_db_connection_url()\n\n # Create engine from connection url\n engine = create_engine(connection_url)\n\n return engine",
"def get_engine(self, db_name):\n ... | [
"0.7026651",
"0.6842614",
"0.67209196",
"0.6679287",
"0.6633262",
"0.6460196",
"0.6328281",
"0.6285054",
"0.6285054",
"0.62150884",
"0.61740327",
"0.61366487",
"0.61350334",
"0.6116982",
"0.60951006",
"0.60835916",
"0.6050043",
"0.5965481",
"0.5956415",
"0.59335893",
"0.58849... | 0.87228316 | 0 |
Recursively check if layer is a WMS layer. | def layer_in_ows(self, ows_layer, root_layer):
if root_layer is None:
# no WMS root layer
return False
in_wms = False
# get parent groups
parents = [p.group for p in ows_layer.parents]
for parent in parents:
if parent.gdi_oid == root_layer.gdi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_layer(obj):\n # TODO(b/110718070): Replace with isinstance(obj, base_layer.Layer).\n return hasattr(obj, \"_is_layer\") and not isinstance(obj, type)",
"def is_feature_layer(layer):\n return getattr(layer, '_is_feature_layer', False)",
"def IsLayer(self, *args):\n return _XCAFDoc.XCAFDoc_Layer... | [
"0.69694364",
"0.6235193",
"0.6218354",
"0.593918",
"0.5923161",
"0.58760947",
"0.5860823",
"0.5807114",
"0.5681459",
"0.55938524",
"0.5574623",
"0.5512457",
"0.5449315",
"0.54430646",
"0.53812546",
"0.53716415",
"0.53391325",
"0.5313924",
"0.5287635",
"0.52501976",
"0.524820... | 0.76703054 | 0 |
Return ows_metadata for a layer. | def ows_metadata(self, layer):
ows_metadata = {}
if layer.ows_metadata:
try:
# load JSON from ows_metadata
ows_metadata = json.loads(layer.ows_metadata)
except ValueError as e:
self.logger.warning(
"Invalid JSON... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataproduct_metadata(self, ows_layer, permissions, session):\n metadata = {}\n\n # type\n sublayers = None\n data_set_view = None\n searchterms = []\n if ows_layer.type == 'group':\n if ows_layer.name not in permissions.get('group_layers', []):\n ... | [
"0.6738899",
"0.62456894",
"0.59765214",
"0.56073684",
"0.5586877",
"0.5581771",
"0.5532094",
"0.5492781",
"0.54767776",
"0.54743665",
"0.5456338",
"0.54506356",
"0.54184407",
"0.53791165",
"0.5372126",
"0.53449667",
"0.53406215",
"0.5337875",
"0.5326182",
"0.5314207",
"0.530... | 0.81569564 | 0 |
Split comma separated values into list. | def split_values(self, value):
if value:
return [s.strip() for s in value.split(',')]
else:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_by_comma(s):\n return s.strip().split(\",\")",
"def separate_comma(s):\n return s.split(',')",
"def to_python(self, value):\n # Return an empty list if no input was given.\n if not value:\n return []\n return value.split(',')",
"def pure_list(comma_list):\n ... | [
"0.78025526",
"0.76226556",
"0.7475591",
"0.72795135",
"0.7144818",
"0.69944984",
"0.69677824",
"0.6933669",
"0.6908274",
"0.68442553",
"0.6830242",
"0.6824286",
"0.67987007",
"0.67562747",
"0.6737418",
"0.6710399",
"0.67035455",
"0.66600406",
"0.6642529",
"0.6638843",
"0.660... | 0.8507184 | 0 |
Update QML with embedded symbols. | def update_qml(self, qml):
if qml is None:
return qml
try:
# parse XML
root = ElementTree.fromstring(qml)
# embed symbols
self.embed_qml_symbols(root, 'SvgMarker', 'name')
self.embed_qml_symbols(root, 'SVGFill', 'svgFile')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embed_qml_symbols(self, root, layer_class, prop_key):\n for svgprop in root.findall(\".//layer[@class='%s']/prop[@k='%s']\" %\n (layer_class, prop_key)):\n symbol_path = svgprop.get('v')\n path = os.path.abspath(\n os.path.join(QGS_... | [
"0.67538667",
"0.5128117",
"0.509659",
"0.5053252",
"0.4964151",
"0.49451157",
"0.4761072",
"0.4732717",
"0.47295678",
"0.46906155",
"0.4686383",
"0.46371529",
"0.46117783",
"0.4515449",
"0.4510255",
"0.4473232",
"0.44729185",
"0.44690013",
"0.4440391",
"0.4439548",
"0.443494... | 0.76550114 | 0 |
Embed symbol resources as base64 in QML. | def embed_qml_symbols(self, root, layer_class, prop_key):
for svgprop in root.findall(".//layer[@class='%s']/prop[@k='%s']" %
(layer_class, prop_key)):
symbol_path = svgprop.get('v')
path = os.path.abspath(
os.path.join(QGS_RESOURCES_DI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_qml(self, qml):\n if qml is None:\n return qml\n\n try:\n # parse XML\n root = ElementTree.fromstring(qml)\n\n # embed symbols\n self.embed_qml_symbols(root, 'SvgMarker', 'name')\n self.embed_qml_symbols(root, 'SVGFill', 'sv... | [
"0.55629766",
"0.54794717",
"0.5280593",
"0.49432886",
"0.49401248",
"0.48893714",
"0.48839408",
"0.48512277",
"0.48236877",
"0.48004314",
"0.47988746",
"0.47885874",
"0.47874668",
"0.4764687",
"0.47481993",
"0.47099677",
"0.46938792",
"0.46663794",
"0.4606227",
"0.45966935",
... | 0.66117233 | 0 |
Adds human readable date variable. Assumes date is in seconds since epoch. time_var is netCDF.Variable object. | def add_utc_date(nc, time_var):
# Create Variable
utc = nc.createVariable('utc_time', int, ('time'))
setattr(utc, 'standard_name', "time")
setattr(utc, 'long_name', "UTC date yyyy-mm-dd hh:00:00 as yyyymmddhh")
setattr(utc, "units","Gregorian_year month day hour")
toUTC = lambda d: int(dt.datet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_info_day(date_str, infile):\n #date_str = str(sys.argv[1])\n #infile = './' + date_str + '.nc'\n\n # prepare date\n year,mon,day = date_str.split('-')\n year_num = int(float(year))\n mon_num = int(float(mon))\n day_num = int(float(day))\n\n\n datesec_calc = []\n val_pr_day = 4\n... | [
"0.53371304",
"0.52994335",
"0.5053854",
"0.5022046",
"0.5021961",
"0.5021961",
"0.50010127",
"0.4921834",
"0.49154162",
"0.48844352",
"0.48474166",
"0.48312527",
"0.4828444",
"0.48283142",
"0.47912452",
"0.47758126",
"0.4751266",
"0.47495",
"0.47279778",
"0.46959502",
"0.465... | 0.63723165 | 0 |
Adds a time bounds variable to variable. Assumes time dimension is called 'time' | def add_time_bounds(nc, varname):
THREE_HOURS = 60*60*3 # in seconds
bnds_name = 'time_bnds'
bounds_dim = 'nv'
# Create bounds dimension
nc.createDimension(bounds_dim, 2)
# Get variable matching varname
time_var = nc.variables['time']
time_var.setncattr('bounds', bnds_name)
time_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __define_variable_time(self, initial_guess, minimum, maximum):\n i = 0\n for nlp in self.nlp:\n if isinstance(nlp[\"tf\"], self.CX):\n time_bounds = Bounds(minimum[i], maximum[i], interpolation=InterpolationType.CONSTANT)\n time_init = InitialConditions(in... | [
"0.6587515",
"0.6190563",
"0.5912615",
"0.587993",
"0.58253014",
"0.56894726",
"0.56684715",
"0.56504494",
"0.5623413",
"0.5619893",
"0.55306077",
"0.55090916",
"0.5483374",
"0.5463484",
"0.5454657",
"0.5432568",
"0.5394258",
"0.53902286",
"0.53509086",
"0.5346871",
"0.534403... | 0.7952806 | 0 |
Initialize some callbacks inline Use this constructor to provide credentials and certificate callbacks inline, instead of defining your own class for these ones. You can e.g. also pass in one of the credential objects as 'credentials' instead of creating a function which returns a hardcoded object. | def __init__(self, credentials=None, certificate=None):
if credentials is not None:
self.credentials = credentials
if certificate is not None:
self.certificate = certificate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, req, credentials_fn):\n self.req = req\n self.credentials_fn = credentials_fn",
"def __init__(self, cred=None, max_tries=5, callback=newcred):\n self.set_cred(cred)\n self.try_count = 1\n self.max_tries = max_tries\n self.callback = callback",
"def _... | [
"0.65539837",
"0.64415884",
"0.6256035",
"0.6152882",
"0.61327577",
"0.6122212",
"0.60726905",
"0.5963776",
"0.5948654",
"0.5945171",
"0.5938793",
"0.59084725",
"0.59006447",
"0.58869493",
"0.5884443",
"0.5865886",
"0.58515286",
"0.5847019",
"0.57956296",
"0.5794808",
"0.5778... | 0.7311035 | 0 |
Certificate callback Override with your own function to determine whether the accept the server's certificate. | def certificate_check(self, certificate, valid, host):
raise Passthrough | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_server_certificate(self):\n return self._verify_server_certificate",
"def verify_server_certificate(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"verify_server_certificate\")",
"def verify_server_certificate(self) -> bool:\n return pulumi.get(self, \"verify_... | [
"0.69057816",
"0.6904875",
"0.6790211",
"0.646486",
"0.63657093",
"0.61513364",
"0.6096049",
"0.60317755",
"0.5979905",
"0.5940069",
"0.5871149",
"0.58208966",
"0.57788336",
"0.5753447",
"0.57468694",
"0.574129",
"0.570776",
"0.56400156",
"0.5629674",
"0.56151485",
"0.5603868... | 0.7030046 | 0 |
Transfer progress callback Override with your own function to report transfer progress. | def transfer_progress(self, stats): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onTransferUpdate(self, api, transfer):\n logging.info('Transfer update ({} {});'\n ' Progress: {} KB of {} KB, {} KB/s'\n .format(transfer,\n transfer.getFileName(),\n transfer.getTransferredBytes() / 1024,\n... | [
"0.7220874",
"0.7112329",
"0.69391227",
"0.69087076",
"0.68912673",
"0.6877024",
"0.6770549",
"0.67233896",
"0.67167825",
"0.6671872",
"0.66329044",
"0.6622333",
"0.66127753",
"0.65370864",
"0.65070117",
"0.64977056",
"0.6437404",
"0.6410456",
"0.63769513",
"0.6359364",
"0.63... | 0.7890586 | 0 |
Update tips callabck Override with your own function to report reference updates | def update_tips(self, refname, old, new): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __editShowCallTips(self):\n self.activeWindow().callTip()",
"def update_tips(self, usageText):\r\n try:\r\n self.widgetList[13].config(text=usageText, justify=LEFT)\r\n except TclError:\r\n kT.debug_log(\"Changed menu\", sys.exc_info()[2])\r\n return",
"def... | [
"0.6555432",
"0.64051604",
"0.5982053",
"0.58614695",
"0.5771405",
"0.570853",
"0.5652499",
"0.5582469",
"0.5555294",
"0.5554527",
"0.55478805",
"0.5545224",
"0.5434774",
"0.5425506",
"0.5390354",
"0.5354941",
"0.53439796",
"0.53439796",
"0.53439796",
"0.5318367",
"0.5292375"... | 0.8590424 | 0 |
Push update reference callback Override with your own function to report the remote's acceptace or rejection of reference updates. | def push_update_reference(self, refname, message): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ref_updated(self, event):\n pass",
"def _notify_update(self, cuds_object):",
"def notify(self, ref_output=None, moves_made=None):\n pass",
"def update_callback(app):\n print(\"Update callback invoked for %s\" % app.name)\n\n # TODO: Add integration tests here\n return True",
"def... | [
"0.700554",
"0.586919",
"0.58252454",
"0.55110234",
"0.5484074",
"0.5471983",
"0.5470453",
"0.5423666",
"0.5410064",
"0.53476197",
"0.53475934",
"0.5346236",
"0.5307683",
"0.528483",
"0.5284799",
"0.52797055",
"0.5253185",
"0.52331346",
"0.5220044",
"0.5199602",
"0.5196633",
... | 0.7560829 | 0 |
Name of the remote | def name(self):
return maybe_string(C.git_remote_name(self._remote)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_hostname(self):\n return pn_connection_remote_hostname(self._impl)",
"def get_remote_name(self, file_path: str, remote_name: str):\n if remote_name is None:\n remote_name = os.path.basename(file_path)\n return remote_name",
"def getRemoteHost():",
"def server_name(s... | [
"0.7341725",
"0.7134672",
"0.7032486",
"0.696617",
"0.693461",
"0.6897008",
"0.68189836",
"0.67615247",
"0.6744413",
"0.67394644",
"0.67394644",
"0.6712816",
"0.67052776",
"0.6688957",
"0.66647696",
"0.65945596",
"0.65823656",
"0.6563257",
"0.65593636",
"0.6494698",
"0.648166... | 0.7960541 | 0 |
Url of the remote | def url(self):
return maybe_string(C.git_remote_url(self._remote)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_url(self) -> str:\n return f\"https://api.figma.com/v1/files/{self.file_id}\"",
"def url(self):\n url = self.url\n return url",
"def getRemoteUrl(self):\n # try getting the remote object by unique id\n remote_url = self._getRemoteUrlTheOldWay()\n remote_obj ... | [
"0.7809164",
"0.7752618",
"0.7744077",
"0.76482004",
"0.76482004",
"0.76167583",
"0.7611277",
"0.7611277",
"0.76024985",
"0.7592173",
"0.7590239",
"0.7567472",
"0.75656253",
"0.75656253",
"0.7537656",
"0.7537656",
"0.7537656",
"0.7537656",
"0.7537656",
"0.7537656",
"0.7537656... | 0.7905048 | 0 |
Push url of the remote | def push_url(self):
return maybe_string(C.git_remote_pushurl(self._remote)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_push_url(self, name, url):\n err = C.git_remote_set_pushurl(self._repo._repo, to_bytes(name), to_bytes(url))\n check_error(err)",
"def remote_push(self, pNamespace):",
"def push(self):\n origin = self.git_repo.remotes.origin\n origin.push()",
"def push(args):\n if args.... | [
"0.7094837",
"0.6979935",
"0.68169296",
"0.67966676",
"0.66819257",
"0.6680206",
"0.66366327",
"0.6635456",
"0.6486271",
"0.6448664",
"0.64341855",
"0.62836725",
"0.625129",
"0.62458855",
"0.62370825",
"0.62095743",
"0.6193338",
"0.61739475",
"0.6118299",
"0.60442275",
"0.602... | 0.7172953 | 0 |
Save a remote to its repository's configuration. | def save(self):
err = C.git_remote_save(self._remote)
check_error(err) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_save(self, file_path=None, delete_local=False, remote_target=None):\n if not file_path:\n file_path = self.fname\n\n f = File()\n if not remote_target:\n remote_target = self.remote.get('target', None)\n LOG.info(\"Saving picture %s to %s\" % (file_path,... | [
"0.6913942",
"0.6310363",
"0.6138643",
"0.6070944",
"0.5944239",
"0.59436154",
"0.5880474",
"0.58746165",
"0.5848079",
"0.5820438",
"0.57785755",
"0.57339436",
"0.56392133",
"0.56184226",
"0.5592695",
"0.55855554",
"0.5575766",
"0.556263",
"0.5523025",
"0.55052197",
"0.548237... | 0.78605765 | 0 |
Total number of refspecs in this remote | def refspec_count(self):
return C.git_remote_refspec_count(self._remote) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_refs(self):\n return self._n_refs",
"def get_total_rehashes(self):\n return self.count_rehashes",
"def __len__(self):\n total_objs = 0\n\n if self._shelve is not None:\n total_objs += len(self._shelve)\n\n if self._dict is not None:\n total_objs +=... | [
"0.6764848",
"0.644436",
"0.64315546",
"0.6388287",
"0.63136035",
"0.63098884",
"0.62839144",
"0.62362033",
"0.6197885",
"0.61837137",
"0.6138996",
"0.6132474",
"0.6095574",
"0.6055916",
"0.60469747",
"0.60452753",
"0.6015536",
"0.5992",
"0.59615195",
"0.5940339",
"0.5924425"... | 0.85212857 | 0 |
Refspecs that will be used for pushing | def push_refspecs(self):
specs = ffi.new('git_strarray *')
err = C.git_remote_get_push_refspecs(specs, self._remote)
check_error(err)
return strarray_to_strings(specs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_refs(self):\n pass",
"def push_update_reference(self, refname, message):",
"def refs(self):\n return self._refs",
"def updateScptRefs(self):\n for scpt in self.refs_scpt.keys():\n self.refs_scpt[scpt] = scpt.getRef()\n self.scptRefs = set(self.refs_scpt.values(... | [
"0.6074251",
"0.6062355",
"0.5899434",
"0.5841198",
"0.57566303",
"0.5702181",
"0.56438404",
"0.5604831",
"0.55328727",
"0.5516635",
"0.55016184",
"0.54588157",
"0.54560244",
"0.5452985",
"0.5420332",
"0.53919894",
"0.53701526",
"0.53461057",
"0.5345899",
"0.53423005",
"0.534... | 0.63625705 | 0 |
Call fn and return the credentials object | def get_credentials(fn, url, username, allowed):
url_str = maybe_string(url)
username_str = maybe_string(username)
creds = fn(url_str, username_str, allowed)
credential_type = getattr(creds, 'credential_type', None)
credential_tuple = getattr(creds, 'credential_tuple', None)
if not credential... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_creds():\n\tcredentials = None\n\tif os.path.exists('token.pickle'):\n\t\twith open('token.pickle', 'rb') as token:\n\t\t\tcredentials = pickle.load(token)\n\t# If there are no (valid) credentials available, let the user log in.\n\tif not credentials or not credentials.valid:\n\t\tif credentials and creden... | [
"0.60266757",
"0.59413564",
"0.5846529",
"0.581955",
"0.58150387",
"0.58117324",
"0.58065265",
"0.5805673",
"0.57518536",
"0.57470065",
"0.57216364",
"0.5717514",
"0.5700105",
"0.56918997",
"0.56840074",
"0.56808466",
"0.5680676",
"0.5675405",
"0.56722444",
"0.5664514",
"0.56... | 0.6949153 | 0 |
Create a new remote with the given name and url. Returns a object. If 'fetch' is provided, this fetch refspec will be used instead of the default | def create(self, name, url, fetch=None):
cremote = ffi.new('git_remote **')
if fetch:
err = C.git_remote_create_with_fetchspec(cremote, self._repo._repo, to_bytes(name), to_bytes(url), to_bytes(fetch))
else:
err = C.git_remote_create(cremote, self._repo._repo, to_bytes(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_remote(self, name: str, url: str, **kwargs: Any) -> Remote:\n return Remote.create(self, name, url, **kwargs)",
"def fetch(self, remote, *args):\n return self.cmd('fetch', remote, *args)",
"def add_fetch(self, name, refspec):\n\n err = C.git_remote_add_fetch(self._repo._repo, to... | [
"0.75323445",
"0.65989864",
"0.6469159",
"0.63439584",
"0.6275085",
"0.5893828",
"0.57484573",
"0.5714986",
"0.5672253",
"0.55887216",
"0.5522805",
"0.54660064",
"0.5437272",
"0.5430468",
"0.5422879",
"0.5369303",
"0.5340879",
"0.5239376",
"0.5218165",
"0.52128315",
"0.520344... | 0.8370093 | 0 |
Rename a remote in the configuration. The refspecs in standard format will be renamed. Returns a list of fetch refspecs (list of strings) which were not in the standard format and thus could not be remapped. | def rename(self, name, new_name):
if not new_name:
raise ValueError("Current remote name must be a non-empty string")
if not new_name:
raise ValueError("New remote name must be a non-empty string")
problems = ffi.new('git_strarray *')
err = C.git_remote_rename(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gitRenameRemote(self):\n remotes = self.vcs.gitGetRemotesList(self.project.getProjectPath())\n remote, ok = QInputDialog.getItem(\n None,\n self.tr(\"Rename\"),\n self.tr(\"Select a remote repository:\"),\n remotes,\n 0, False)\n if ... | [
"0.63354367",
"0.59142274",
"0.5644527",
"0.5351181",
"0.52948046",
"0.5238612",
"0.5197955",
"0.5156204",
"0.51546645",
"0.51463294",
"0.5122313",
"0.50963366",
"0.509136",
"0.50567704",
"0.5055112",
"0.5046217",
"0.5033727",
"0.5026965",
"0.50152934",
"0.50002825",
"0.49920... | 0.6283107 | 1 |
Set the pushURL for a remote | def set_push_url(self, name, url):
err = C.git_remote_set_pushurl(self._repo._repo, to_bytes(name), to_bytes(url))
check_error(err) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_remote_url(self, git_remote_url):\n self._git_remote_url = git_remote_url",
"def push_url(self):\n\n return maybe_string(C.git_remote_pushurl(self._remote))",
"def setRemoteUrl(self, value, **kwargs):\n if value:\n value = urlparse.urlunparse(urlparse.urlparse(value))\n ... | [
"0.72324055",
"0.71841437",
"0.69710207",
"0.66419417",
"0.6640427",
"0.6405677",
"0.61682636",
"0.6008587",
"0.5950349",
"0.5879518",
"0.5878566",
"0.5850352",
"0.5836166",
"0.5828629",
"0.58109",
"0.5789106",
"0.57801384",
"0.5705603",
"0.5705531",
"0.5667261",
"0.56259835"... | 0.77281153 | 0 |
Add a fetch refspec (str) to the remote | def add_fetch(self, name, refspec):
err = C.git_remote_add_fetch(self._repo._repo, to_bytes(name), to_bytes(refspec))
check_error(err) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_push(self, name, refspec):\n\n err = C.git_remote_add_push(self._repo._repo, to_bytes(name), to_bytes(refspec))\n check_error(err)",
"def fetch_pull(ref):\n origin.fetch(tags=True)\n repo.git.checkout(\"{}\".format(ref))\n repo.git.pull(\"origin\", \"{}\".fo... | [
"0.65405554",
"0.63312775",
"0.5966933",
"0.57998365",
"0.5740081",
"0.5735921",
"0.57280624",
"0.57224613",
"0.5703283",
"0.56584454",
"0.56575096",
"0.5571788",
"0.55627555",
"0.55626905",
"0.5540516",
"0.548836",
"0.5485281",
"0.5485032",
"0.5458031",
"0.54532164",
"0.5430... | 0.8219534 | 0 |
Add a push refspec (str) to the remote | def add_push(self, name, refspec):
err = C.git_remote_add_push(self._repo._repo, to_bytes(name), to_bytes(refspec))
check_error(err) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_fetch(self, name, refspec):\n\n err = C.git_remote_add_fetch(self._repo._repo, to_bytes(name), to_bytes(refspec))\n check_error(err)",
"def cmd_push_review(remote):\n return ['git', 'push', remote]",
"def _git_add(repo, path, contents='example!\\n'):\n path.write_text(contents)\n ... | [
"0.68458635",
"0.6618803",
"0.6397485",
"0.627628",
"0.61030674",
"0.6059851",
"0.6020045",
"0.60113615",
"0.59857327",
"0.59671175",
"0.5963221",
"0.59560585",
"0.59545165",
"0.59238607",
"0.5921502",
"0.5911289",
"0.58821833",
"0.5830431",
"0.5815642",
"0.5809405",
"0.58039... | 0.7897243 | 0 |
Downloads the 6B GloVe embeddings (approx. 1GB) | def download_glove ():
# Get the URL ...
print("Downloading https://nlp.stanford.edu/data/glove.6B.zip ...")
res = requests.get("https://nlp.stanford.edu/data/glove.6B.zip", stream=True)
if res.status_code != 200:
print("Could not download the 6B GloVe Dataset! The server responded with code " + res.status_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_glove_embedding():\n embedding = {}\n N = 400_000\n print(\"Reading glove embedding...\")\n with open(GLOVE_EMBD_PATH, \"rb\") as f:\n for line in tqdm(f, total=N):\n line = line.decode().split()\n word = line[0].lower()\n vector = np.array(line[1:]).asty... | [
"0.7076395",
"0.64558613",
"0.6354679",
"0.61358154",
"0.61284745",
"0.60184133",
"0.6010079",
"0.59805787",
"0.5972328",
"0.59562606",
"0.5899516",
"0.5830953",
"0.57806957",
"0.5730951",
"0.5724267",
"0.57074106",
"0.5684446",
"0.5642139",
"0.5635222",
"0.5618081",
"0.56131... | 0.7243812 | 0 |
Runs the Stanza module | def run_stanza (arguments):
if arguments.download:
# Download the full Stanza dataset
result = input("ATTENTION! This will download the full English Stanza corpus (approx. 400 MB). Do you wish to continue (y/n)? ")
if result == "y" or result == "yes":
# For a list of processors, see https://stanford... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run():\n main()",
"def run(self, args):\n pass",
"def main():\n\ttoken = os.getenv(\"BOT_TOKEN\")\n\tapplication = Application.builder().token(token).read_timeout(30).write_timeout(30).build()\n\tload_interactions(application)\n\tprint(\"Simple Media Converter instance started!\")\n\tapplication.... | [
"0.6028765",
"0.59991264",
"0.5996253",
"0.5902331",
"0.5847812",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
"0.58472365",
... | 0.6173642 | 0 |
Runs the GloVe module | def run_glove (arguments):
if arguments.download:
# Download the 6B GloVe dataset
result = input("ATTENTION! This will download approximately 1GB of data. Do you wish to continue (y/n)? ")
if result == "y" or result == "yes":
download_glove()
sys.exit(0) # Afterwards exit normally | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n obj = VplexStorageview()\n obj.perform_module_operation()",
"def main():\n\timport docopt\n\targs = docopt.docopt(main.__doc__)\n\tv = Ventilator(args[\"--port\"], int(args[\"--speed\"]))\n\tif args[\"--debug\"]:\n\t\tlogging.basicConfig(level=logging.DEBUG)\n\telse:\n\t\tlogging.basicConfig(... | [
"0.6183873",
"0.61158395",
"0.6082892",
"0.60333556",
"0.5949687",
"0.59383035",
"0.5913861",
"0.58946764",
"0.5856102",
"0.58391666",
"0.58317477",
"0.5813667",
"0.5773393",
"0.5761071",
"0.57519263",
"0.5735813",
"0.5703431",
"0.56931114",
"0.569222",
"0.569222",
"0.5691295... | 0.6541627 | 0 |
Runs the Data module | def run_data (arguments):
if arguments.define_labels:
data.define_labels()
elif arguments.preprocess:
# Preprocess from data_raw --> data_preprocessed
data.preprocess()
elif arguments.annotate:
# Annotate from data_preprocessed --> data_annotated
reverse = False # DEBUG
annotator.annotate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n\t\tself.print_header_information()\n\n\t\t#self.get_number_of_instances_from_user()\n\n\t\t#self.compile_dataframe(self.number_of_instances)\n\n\t\tprint \"\\n{}\".format(self.data)\n\n\t\t# Uncomment these lines for debugging\n\t\tself.compile_dataframe_default()\n\t\t# print \"\\n{}\".format(sel... | [
"0.7152246",
"0.6843876",
"0.6765248",
"0.66976744",
"0.66915",
"0.6601861",
"0.6464472",
"0.64639926",
"0.6440317",
"0.6437759",
"0.64203024",
"0.6409332",
"0.6399841",
"0.63861287",
"0.63166547",
"0.6303447",
"0.6303447",
"0.6303447",
"0.6303447",
"0.6303447",
"0.6303447",
... | 0.6965196 | 1 |
tests where symbols are looked up properly | def test_symbol_lookup(self):
def check_lookup(symbol, expected):
op = BaseWhereOperator.get_operator(symbol)
self.assertEqual(op, expected)
check_lookup('EQ', EqualsOperator)
check_lookup('IN', InOperator)
check_lookup('GT', GreaterThanOperator)
check_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_symbol_lookup(self):\r\n\r\n def check_lookup(symbol, expected):\r\n op = BaseWhereOperator.get_operator(symbol)\r\n self.assertEqual(op, expected)\r\n\r\n check_lookup('EQ', EqualsOperator)\r\n check_lookup('IN', InOperator)\r\n check_lookup('GT', Greater... | [
"0.7615396",
"0.68382215",
"0.6708252",
"0.659964",
"0.64436066",
"0.6381638",
"0.63209176",
"0.6301587",
"0.6294034",
"0.62852746",
"0.62724996",
"0.62620026",
"0.61632264",
"0.61437625",
"0.6124064",
"0.61073846",
"0.6088397",
"0.6071878",
"0.60535747",
"0.60304224",
"0.602... | 0.7542443 | 1 |
matrix_set_diag operator implemented in numpy. Returns a numpy array with the diagonals of input array replaced with the provided diagonal values. | def matrix_set_diag(input_np, diagonal, k=0, align="RIGHT_LEFT"):
out = np.array(input_np, copy=True)
cols = input_np.shape[-1]
rows = input_np.shape[-2]
onlyOneDiagonal = True
if isinstance(k, (tuple, list)):
if len(k) < 2 or k[0] == k[1]:
k = k[0]
else:
on... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_diag(x, new_diag):\n arr_shape = x.shape\n off_diag = (1 - _torch.eye(arr_shape[-1])) * x\n diag = _torch.einsum(\"ij,...i->...ij\", _torch.eye(new_diag.shape[-1]), new_diag)\n return diag + off_diag",
"def set_mat_diag(mat, diag=0, val=0):\n m = mat.shape[0]\n step = m + 1\n start =... | [
"0.74522567",
"0.7357435",
"0.71183485",
"0.67566574",
"0.6728996",
"0.6719767",
"0.65984404",
"0.65970296",
"0.6580404",
"0.65264386",
"0.65135664",
"0.64551324",
"0.64260054",
"0.6417673",
"0.63621813",
"0.6301156",
"0.62709117",
"0.62459886",
"0.6244929",
"0.6234028",
"0.6... | 0.7570219 | 0 |
The stream effect has the colors of the LEDs move like a stream, where the color of a LEDs is given to its neighbor in the next update step. | def stream_handler(args_dict: dict):
color_sequence = args_dict['color_sequence']
color_seq_len = args_dict['color_seq_len']
color_itr = args_dict['color_itr']
n_leds = args_dict['n_leds']
step_sequence = [color_sequence[c % color_seq_len] for c in range(color_itr, n_leds + color_itr)]
# Upda... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show(self):\n\t\tself.processQueue()\n\t\tself.flattenLayers()\n\t\tcount = 0\n\t\tfor v in self.ledsColorBuffer:\n\t\t\tself.strip.setPixelColor(count, v)\n\t\t\tcount += 1\n\t\tself.strip.show()",
"def demo(self):\n self.clear()\n\n white = neo.Color(255, 255, 255)\n black = neo.Color(... | [
"0.6599297",
"0.65627533",
"0.6331775",
"0.62021",
"0.6179241",
"0.61761546",
"0.6153618",
"0.59917074",
"0.59736294",
"0.59636015",
"0.5950049",
"0.59427375",
"0.5905459",
"0.5854121",
"0.58495724",
"0.5800509",
"0.57976097",
"0.5783879",
"0.577515",
"0.57635885",
"0.5758384... | 0.67854285 | 0 |
Retrieve al cursos from graph | def get_cursos(request):
if request.method == 'GET':
cursos = Curso.nodes.all()
cursos_list = []
for i in range(0, len(cursos)):
cursos_list.append(cursos[i].__dict__["nombre"])
return JsonResponse({"cursos": cursos_list}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_full_graph(self):",
"def graph(self):\n ...",
"def download_chicago_graph():\n\n\tG = ox.graph_from_place(\"Chicago,IL, United States\", network_type='drive')\n\treturn G",
"def getData(graph, request):\r\n results = list(graph.query(request))\r\n return results",
"def get_graph(self)... | [
"0.60265046",
"0.5684899",
"0.5633646",
"0.56242675",
"0.5566034",
"0.5564065",
"0.55356544",
"0.55326086",
"0.5355961",
"0.53407145",
"0.5306177",
"0.5233318",
"0.52299714",
"0.51916367",
"0.51910627",
"0.5189231",
"0.51728517",
"0.5166251",
"0.5166251",
"0.51599175",
"0.515... | 0.57523143 | 1 |
Predict the BDEs of each bond in a list of molecules. | def predict(smiles_list, drop_duplicates=True, batch_size=1, verbose=False):
molecule_list = [Molecule(smiles=smiles) for smiles in smiles_list]
smiles_list = [mol.smiles for mol in molecule_list]
pred_df = pd.concat(
(
get_fragments(mol, drop_duplicates=drop_duplicates)
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(smiles_list, drop_duplicates=True, verbose=True):\n\n is_valid = pd.Series({smiles: not check_input(smiles)[0] for smiles in smiles_list}, name='is_valid')\n pred_df = pd.concat([predict_bdes(smiles, draw=False) for smiles in smiles_list])\n pred_df = pred_df.merge(is_valid, left_on='molecule'... | [
"0.6377305",
"0.57994026",
"0.56501853",
"0.52041197",
"0.5169816",
"0.5126491",
"0.51183426",
"0.51093304",
"0.50972986",
"0.50279194",
"0.5017863",
"0.49950963",
"0.49750766",
"0.4968196",
"0.49513084",
"0.4942393",
"0.49264514",
"0.49236074",
"0.4922351",
"0.4922289",
"0.4... | 0.58677953 | 1 |
This function makes a list of all the songs in album | def songs_list(name_of_album):
songs = ""
data = dbase()
data = data[name_of_album][0]
for song in data.keys():
songs += song
songs += ", "
return songs[:-2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_songs_list(name_of_album):\r\n songs = []\r\n data1 = dbase()\r\n data1 = data1[name_of_album][0]\r\n for song in data1.keys():\r\n songs += [song]\r\n return songs",
"def album_list(self):\n\n artist_id = self.addon_args[\"artist_id\"][0]\n\n xbmcplugin.setContent(... | [
"0.8295144",
"0.78646994",
"0.78634316",
"0.7836907",
"0.7691762",
"0.76080465",
"0.75683284",
"0.7421076",
"0.738293",
"0.7337441",
"0.7323385",
"0.7289032",
"0.7279224",
"0.72707593",
"0.7217044",
"0.7155472",
"0.71446615",
"0.7133181",
"0.71268225",
"0.7097782",
"0.7070707... | 0.81815284 | 1 |
This func calc the number of words in one song | def get_len(song, album):
length = 0
words = dbase()[album][0][song]
words = words[2]
words = words.split()
for word in words:
length += 1
return str(length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def song_length(ans):\r\n length = 0\r\n flag = 1\r\n albums = simple_album_list()\r\n for album in albums:\r\n songs = simple_songs_list(album)\r\n for song in songs:\r\n if ans == song:\r\n words = dbase()[album][0][song]\r\n words = words[2]\r\n... | [
"0.7641895",
"0.74189013",
"0.7375139",
"0.7181407",
"0.71441495",
"0.70609474",
"0.70113283",
"0.6958899",
"0.6921988",
"0.6921822",
"0.6886437",
"0.6875009",
"0.6845606",
"0.68437195",
"0.68406963",
"0.6803877",
"0.67994726",
"0.67805064",
"0.6773257",
"0.67365235",
"0.6724... | 0.764421 | 0 |
This func calc how many words there is in all of the songs, albums. using "get_len" function | def song_length(ans):
length = 0
flag = 1
albums = simple_album_list()
for album in albums:
songs = simple_songs_list(album)
for song in songs:
if ans == song:
words = dbase()[album][0][song]
words = words[2]
words = w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_len(song, album):\r\n length = 0\r\n words = dbase()[album][0][song]\r\n words = words[2]\r\n words = words.split()\r\n for word in words:\r\n length += 1\r\n return str(length)",
"def common():\r\n full_song = \"\"\r\n albums = simple_album_list()\r\n for album in album... | [
"0.8198582",
"0.66658145",
"0.64683807",
"0.6397444",
"0.6326289",
"0.6298644",
"0.623144",
"0.62150586",
"0.62072754",
"0.61455053",
"0.6131659",
"0.61273545",
"0.6073577",
"0.60692155",
"0.6067708",
"0.60635406",
"0.60574627",
"0.59762967",
"0.5966263",
"0.59660995",
"0.595... | 0.81630695 | 1 |
This function returns the lyrics of specific song | def song_lyrics(ans):
albums = simple_album_list()
for album in albums:
songs = simple_songs_list(album)
for song in songs:
if ans == song:
words = dbase()[album][0][song]
words = words[2]
return words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lyrics(self):\n return get_lyrics(self.artist, self.title,'')",
"def get_lyrics(artist, song, language='', linesep='\\n', timeout=None):\n return get_all_lyrics(artist, song, language, linesep, timeout)[0]",
"def get_lyrics(self):\n url = 'http://api.lyricsnmusic.com/songs?api_key=[5358b25... | [
"0.82025915",
"0.7692463",
"0.760172",
"0.72425085",
"0.71974313",
"0.71780723",
"0.7152949",
"0.71083266",
"0.70352906",
"0.7034073",
"0.7004775",
"0.6972529",
"0.69618744",
"0.6934143",
"0.6913037",
"0.68426704",
"0.68249315",
"0.6794879",
"0.6770472",
"0.67184097",
"0.6686... | 0.81326777 | 1 |
This function finds what album the song in | def song_album(ans):
albums = simple_album_list()
for album in albums:
songs = simple_songs_list(album)
for song in songs:
if ans == song:
return album | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_album_playlist(data):\n\n return data['album'].lower() + '.m3u'",
"def search_for_album(album_name):\n\n print(f'Searching for album: {album_name}')\n\n search_result = spotifyObject.search(q=f'\"{album_name}\"', limit=20, type='album')\n\n items = search_result['albums']['items']\n\n res... | [
"0.7356128",
"0.72707754",
"0.7060411",
"0.7050987",
"0.69334686",
"0.6912387",
"0.67691773",
"0.66861814",
"0.66782176",
"0.66549325",
"0.66268027",
"0.6598319",
"0.65646094",
"0.6564256",
"0.6559331",
"0.6554879",
"0.65491766",
"0.65131474",
"0.6505864",
"0.64808756",
"0.64... | 0.83801645 | 0 |
This function makes list of the top 50 commonest words of all songs | def common():
full_song = ""
albums = simple_album_list()
for album in albums:
songs = simple_songs_list(album)
for song in songs:
full_song += str(song_lyrics(song))
split_lyrics = full_song.lower().split()
counter = collections.Counter(split_lyrics)
most_wo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_k_frequent(top_k, words, list_of_texts):\n dict_top_freq = {}\n for word in words:\n dict_top_freq[word.lower()] = 0\n for string in list_of_texts:\n if word.lower() in string.lower():\n counter = string.lower().count(word.lower())\n dict_top_fre... | [
"0.738273",
"0.7270854",
"0.72609174",
"0.6993908",
"0.6986561",
"0.69415885",
"0.6875806",
"0.6855121",
"0.684043",
"0.6821874",
"0.6817871",
"0.68166554",
"0.67563236",
"0.6738581",
"0.6699482",
"0.6695034",
"0.6693428",
"0.66674244",
"0.6641728",
"0.66324925",
"0.66190416"... | 0.7426751 | 0 |
Points List of tuples, where each tuple has (x,y) coods of the points. numLines Number of pairs of points to be randomly sampled numIter Number of ietrations for which estimates of Prob should be refined e_tilde Critical distance for 50% probability of memebership in the line gamma_tilde Critical fraction of valid poin... | def iterative_function(points, numLines, numIter, e_tilde, gamma_tilde, beta_tilde):
numPoints = len(points)
# Randomly sample pairs and get the corresponding rho and theta parameters for a line fitted to the pair:
# Returns a list of tuples - Each tuple has the rho and theta parameters for the l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateData(numPoints,x,y):\n\tfor i in range(0,numPoints):\n\t\tif (i % 2 == 0):\n\t\t\tx.append(random.normalvariate(25, 15))\n\t\t\ty.append(random.normalvariate(25, 15))\n\t\t\t \n\t\t\t\n\t\telse:\n\t\t\tx.append(random.normalvariate(75, 15))\n\t\t\ty.append(random.normalvariate(75, 15))",
"def generat... | [
"0.6171076",
"0.61004645",
"0.60166216",
"0.5971953",
"0.5899086",
"0.5896352",
"0.5832605",
"0.58060277",
"0.5772896",
"0.57310075",
"0.57118297",
"0.5706741",
"0.5691438",
"0.5668014",
"0.566632",
"0.564936",
"0.5631067",
"0.56161624",
"0.56137055",
"0.55902743",
"0.5562805... | 0.6206707 | 0 |
This function call from contact. | def call_from_contact(self):
log_test_case(self.name, 'call_from_contact')
#lick_textview_by_text(SC.PRIVATE_CONTACT_NUMBER)
click_textview_by_id('primary_action_view')
sleep(1)
goback()
sleep(3)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self):",
"def force_contact(self, *args, **kwargs) -> Any:\n pass",
"def call(self, callee: \"SIPPhoneTemplate\") -> None:",
"def call(self) -> global___Snippet.ClientCall:",
"def call(self) -> global___Snippet.ClientCall:",
"def receiveContactList(self, contactList):",
"def moment_cont... | [
"0.68409646",
"0.660355",
"0.6514977",
"0.6372869",
"0.6372869",
"0.6274491",
"0.6248815",
"0.61637676",
"0.61566913",
"0.60917664",
"0.5976085",
"0.59733593",
"0.59509075",
"0.58956426",
"0.5874206",
"0.58698475",
"0.585964",
"0.58154577",
"0.580931",
"0.58043754",
"0.579605... | 0.7567253 | 0 |
Assign slots for organizations within a program Gets the slot assignment data as a JSON string from the program and enqueues a task to process the slot assignments | def assignProgramSlots(request, *args, **kwargs):
program = None
params = request.REQUEST
# Query the program entity
try:
program = program_logic.getFromKeyName(params["programkey"])
except KeyError:
logging.error("programkey not in params")
return responses.terminateTask()
if not program:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assignSlots(request, *args, **kwargs):\n\n # Setup an artifical request deadline\n timelimit = int(request.REQUEST.get(\"timelimit\", 20000))\n timekeeper = Timekeeper(timelimit)\n\n program_key = request.REQUEST.get(\"programkey\")\n last_key = request.REQUEST.get(\"lastkey\", \"\")\n program = program_... | [
"0.8256426",
"0.5762987",
"0.56316525",
"0.54743224",
"0.53757113",
"0.5314603",
"0.5236988",
"0.52270603",
"0.52103895",
"0.51965916",
"0.5142545",
"0.5133743",
"0.5121921",
"0.5057504",
"0.49842697",
"0.49663857",
"0.49040845",
"0.4877993",
"0.48507854",
"0.4843296",
"0.481... | 0.7803846 | 1 |
Sets the slots attribute for each organization entity | def assignSlots(request, *args, **kwargs):
# Setup an artifical request deadline
timelimit = int(request.REQUEST.get("timelimit", 20000))
timekeeper = Timekeeper(timelimit)
program_key = request.REQUEST.get("programkey")
last_key = request.REQUEST.get("lastkey", "")
program = program_logic.getFromKeyName(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def occupy_slot(self, slot, vehicle):\n self.__occupied_slots__[slot.slot_number] = vehicle.registration_number, vehicle.color\n self.__vehicle_slot_mapping__[vehicle.registration_number] = slot.slot_number\n self.__available_slots__.remove(slot)",
"def extend_slots(self, prediction, item):\... | [
"0.5510804",
"0.5312831",
"0.52753824",
"0.52753824",
"0.5273821",
"0.52403814",
"0.5212397",
"0.51739573",
"0.51648086",
"0.51483923",
"0.51372176",
"0.51309526",
"0.5111528",
"0.5084358",
"0.5033539",
"0.49991065",
"0.4996006",
"0.4996006",
"0.4996006",
"0.49839744",
"0.494... | 0.6378653 | 0 |
receive batch from replay and transfer batch from cpu to gpu | def sample_batch(pid, args, batch_queue, port_dict, device, actor_id_to_ip_dataport, local_size, cache_array):
def recv_data(k, data_stream, actor_set, real_data_tasks_i):
for real_data in data_stream:
tmp = []
tmp.append(real_data.state)
tmp.append(real_data.action)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, sess):\n global send_counter\n \n #sess.run(self.sync) # copy weights from shared to local\n rollout = self.pull_batch_from_queue()\n batch = process_rollout(rollout, gamma=0.99, lambda_=1.0)\n\n should_compute_summary = self.task == 0 and self.local_ste... | [
"0.6505807",
"0.63949424",
"0.63113874",
"0.61615974",
"0.6134468",
"0.6134468",
"0.61168593",
"0.6034089",
"0.5956476",
"0.5939015",
"0.58440447",
"0.5803942",
"0.5793098",
"0.57923245",
"0.57748014",
"0.5772822",
"0.57639885",
"0.5756384",
"0.5732913",
"0.57300854",
"0.5729... | 0.7087414 | 0 |
Get raw data from data file, returned in mV SPAM raw data is single precision float with unit Volts. Calling this applies the ts_lsb calculated when the headers are read. This is because when a recording consists of multiple data files, each channel of each data file might have a different scaling. The only way to make... | def getUnscaledSamples(self, **kwargs) -> TimeData:
# initialise chans, startSample and endSample with the whole dataset
options = self.parseGetDataKeywords(kwargs)
# get the files to read and the samples to take from them, in the correct order
dataFilesToRead, samplesToRead, scalings =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_magnetometer(self):\n data = self.mag.read_bytes(Register.OUT_X_L_M, 6)\n return lsm9ds1.to_vector(data)",
"def read_raw_data(self):\n dat_file = os.path.join(DATA_DIR, self.patient_number + '.txt')\n if not os.path.exists(dat_file):\n raise AssertionError(\"{} doe... | [
"0.5571445",
"0.5542686",
"0.55078024",
"0.5504112",
"0.54853296",
"0.5461196",
"0.5426089",
"0.539896",
"0.5366386",
"0.53356355",
"0.53265965",
"0.53247327",
"0.529701",
"0.52936316",
"0.5283426",
"0.527169",
"0.52697086",
"0.5268657",
"0.5241611",
"0.5232119",
"0.5224715",... | 0.55713576 | 1 |
Get the data files that have to be read to cover the sample range | def getDataFilesForSamples(
self, startSample: int, endSample: int
) -> Tuple[List[str], List[List[int]], List[float]]:
# have the datafiles saved in sample order beginning with the earliest first
# go through each datafile and find the range to be read
dataFilesToRead = []
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_samples_file(foldername, filter=None):\n samples = []\n for file in os.listdir(foldername):\n if filter and file.find(filter) == -1:\n continue\n for sample in sfile(foldername + '/' + file, None).get_samples():\n samples.append(sample)\n return samples",
"def... | [
"0.61742574",
"0.60562795",
"0.5931317",
"0.5895991",
"0.5861483",
"0.58041275",
"0.5802405",
"0.57899123",
"0.5788426",
"0.57653975",
"0.5759746",
"0.5747541",
"0.57445914",
"0.57307",
"0.5728617",
"0.5701655",
"0.5679718",
"0.56450206",
"0.5641442",
"0.5636241",
"0.56325316... | 0.73086745 | 0 |
Get defaults for channel headers Returns Dict[str, Any] Dictionary of headers for channels and default values | def chanDefaults(self) -> Dict[str, Any]:
chanH = {}
chanH["gain_stage1"] = 1
chanH["gain_stage2"] = 1
chanH["hchopper"] = 0 # this depends on sample frequency
chanH["echopper"] = 0
# channel output information (sensor_type, channel_type, ts_lsb, pos_x1, pos_x2, pos_y1, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaults():\n return {}",
"def default_channel_response_data(channel):\n channel_record = Channel.objects.get(name=channel.name)\n return {\n \"title\": channel.title,\n \"name\": channel.name,\n \"description\": channel.description,\n \"public_description\": channel.... | [
"0.62941504",
"0.6244179",
"0.620184",
"0.59563303",
"0.5954738",
"0.58055735",
"0.5720258",
"0.57148266",
"0.56928277",
"0.5690497",
"0.5689257",
"0.56565005",
"0.56229764",
"0.55866164",
"0.55399114",
"0.55186236",
"0.5510632",
"0.54901797",
"0.5486276",
"0.5461099",
"0.544... | 0.70106703 | 0 |
Read header files For SPAM data, the may be more than one header file as data can be split up into smaller files as it is recorded. In that case, the header information should be somehow merged. All sampling frequencies should be the same | def readHeader(self) -> None:
# read header files
self.headersList = []
self.chanHeadersList = []
for headerFile in self.headerF:
if "xtrx" in headerFile.lower():
headers, chanHeaders = self.readHeaderXTRX(headerFile)
else:
headers,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_header(self):\n # Read entire header into memory in one read to minimize Disk I/O.\n self.fh.seek(0)\n hdr = self.fh.read(self.header['header size'])\n\n # Find several markers in the byte-string\n # Each of these may occur more than once, find last.\n polylist_po... | [
"0.68931645",
"0.68798554",
"0.68419707",
"0.6750417",
"0.67503536",
"0.6726142",
"0.64970535",
"0.64856166",
"0.6483004",
"0.6462398",
"0.642394",
"0.63903534",
"0.6343897",
"0.63411504",
"0.62974936",
"0.6291137",
"0.62813884",
"0.6280724",
"0.62803566",
"0.62442863",
"0.62... | 0.7617964 | 0 |
Read a XTR header file The raw data for SPAM is in single precision Volts. However, if there are multiple data files for a single recording, each one may have a different gain. Therefore, a scaling has to be calculated for each data file and channel. This scaling will convert all channels to mV. For the most part, this... | def readHeaderXTR(self, headerFile: str) -> None:
with open(headerFile, "r") as f:
lines = f.readlines()
sectionLines = {}
# let's get data
for line in lines:
line = line.strip()
line = line.replace("'", " ")
# continue if line is empty
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readHead(self):\n filesize = self.rhd.tell()\n \n #the order in which all of this is called is critcal\n self.header_identifier = hex(np.uint32(struct.unpack('<I', self.rhd.read(4))))\n v = np.int8(struct.unpack('BBBB', self.rhd.read(4)))\n\n #read each property of the... | [
"0.6155055",
"0.5993816",
"0.5884923",
"0.58070946",
"0.55780053",
"0.5524579",
"0.55149055",
"0.5444751",
"0.5440984",
"0.5410213",
"0.5406023",
"0.5403349",
"0.540114",
"0.53573203",
"0.52880806",
"0.52805924",
"0.52777493",
"0.5273233",
"0.5264056",
"0.52473116",
"0.523383... | 0.66186225 | 0 |
Read a XTRX header files XTRX are newer header files and will supercede XTR | def readHeaderXTRX(self, headerFile):
raise NotImplementedError("Support for XTRX files has not yet been implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readHeader(self) -> None:\n # read header files\n self.headersList = []\n self.chanHeadersList = []\n for headerFile in self.headerF:\n if \"xtrx\" in headerFile.lower():\n headers, chanHeaders = self.readHeaderXTRX(headerFile)\n else:\n ... | [
"0.6655318",
"0.6545926",
"0.6512777",
"0.5899843",
"0.58021617",
"0.5711781",
"0.5699319",
"0.568349",
"0.5606272",
"0.5598395",
"0.5573075",
"0.5572416",
"0.556946",
"0.5562428",
"0.5521986",
"0.55197376",
"0.5510907",
"0.5490756",
"0.54724866",
"0.54674906",
"0.5455055",
... | 0.7716968 | 0 |
Merge headers from all the header files Checks all the header files to see if there are any gaps and calculates the sample ranges for each file together with the total number of samples. Sets the start and end time of the recording and class variables datetimeStart and datetimeStop. | def mergeHeaders(self, headersList: List, chanHeadersList: List) -> None:
# take the first header as an example
self.headers = headersList[0]
self.chanHeaders = chanHeadersList[0]
if len(headersList) == 1:
# just fill in the data file list and data ranges
self.dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readHeaderXTR(self, headerFile: str) -> None:\n with open(headerFile, \"r\") as f:\n lines = f.readlines()\n sectionLines = {}\n # let's get data\n for line in lines:\n line = line.strip()\n line = line.replace(\"'\", \" \")\n # continue i... | [
"0.6403937",
"0.61514765",
"0.6100263",
"0.5859067",
"0.58415174",
"0.58295155",
"0.57660097",
"0.56070304",
"0.55764234",
"0.5484562",
"0.5480894",
"0.5478244",
"0.545221",
"0.5397874",
"0.53785336",
"0.5354963",
"0.51996344",
"0.5187501",
"0.5178293",
"0.5173099",
"0.516023... | 0.71078265 | 0 |
Information about the data files as a list of strings Returns List[str] List of information about the data files | def printDataFileList(self) -> List[str]:
textLst: List[str] = []
textLst.append("Data File\t\tSample Ranges")
for dFile, sRanges in zip(self.dataFileList, self.dataRanges):
textLst.append("{}\t\t{} - {}".format(dFile, sRanges[0], sRanges[1]))
textLst.append("Total samples = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_data(self):\n data_list = []\n for root, dirs, files in os.walk(pathfinder.data_path()):\n for name in files:\n data_list.append(os.path.join(root, name))\n return data_list",
"def getDataFiles(directoryName):\r\n \r\n return listdir(directoryName)",
... | [
"0.7393555",
"0.7135669",
"0.69985956",
"0.6970242",
"0.6864774",
"0.6864221",
"0.68211174",
"0.67915004",
"0.678704",
"0.6742841",
"0.6741322",
"0.6736098",
"0.67299247",
"0.6709108",
"0.6708198",
"0.6699793",
"0.6695189",
"0.66744316",
"0.6654875",
"0.6652273",
"0.66320395"... | 0.7159409 | 1 |
Given a set of results, return a list of LDAPSearchResult objects. | def get_search_results(results):
if len(results) == 0:
return []
if type(results) == tuple and len(results) == 2:
(code, arr) = results
elif type(results) == list:
arr = results
res = []
for item in arr:
res.append(LDAPSearchResult(item))
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_search_results(fields, results):\n my_results = []\n for result in results:\n my_results.append(SearchAnimeResult(fields, result))\n return my_results",
"def list_results(cls, output_dir, **kwargs):\n results = cls.load(output_dir, **kwargs)\n return results.get_results()"... | [
"0.5853295",
"0.5794549",
"0.5777972",
"0.5770905",
"0.5710312",
"0.57052636",
"0.56758606",
"0.56412905",
"0.5539216",
"0.5504885",
"0.5490016",
"0.54144686",
"0.53994405",
"0.5384345",
"0.53460926",
"0.53145885",
"0.53108484",
"0.5308784",
"0.5290834",
"0.52842665",
"0.5256... | 0.7374579 | 0 |
Look for transaction receipt, only raise not found error if they are missing for longer than two minutes. | async def _check_transaction_receipt(self, tx_hash: str, timestamp: int):
async_scheduler: AsyncCallScheduler = AsyncCallScheduler.shared_instance()
try:
return await async_scheduler.call_async(self._w3.eth.getTransactionReceipt, tx_hash)
except TransactionNotFound as e:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_receipt(tx_hash, duration=C.EVM_TIMEOUT):\n slept = 0\n tx_rcpt = None\n\n while slept < duration:\n # because web3 throws if not present vs returning None (like the docs say)\n try:\n tx_rcpt = g.w3.eth.getTransactionReceipt(tx_hash)\n except TransactionNotFou... | [
"0.6613937",
"0.6224734",
"0.5850289",
"0.56903857",
"0.5246986",
"0.52447987",
"0.51985824",
"0.51980007",
"0.5125841",
"0.5107872",
"0.50937873",
"0.50544405",
"0.4955215",
"0.49193367",
"0.49190685",
"0.48734447",
"0.48641413",
"0.48391086",
"0.48348594",
"0.483187",
"0.48... | 0.7078107 | 0 |
Test case for add_asset_share_feed | def test_add_asset_share_feed(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_assets_signal(self):\n story = create_story(title=\"Test Story\", summary=\"Test Summary\",\n byline=\"Test Byline\", status='published')\n asset = create_html_asset(type='text', title='Test Asset', \n body='Test content')\n ... | [
"0.65638447",
"0.6394304",
"0.63698304",
"0.6273951",
"0.613335",
"0.6046205",
"0.60451096",
"0.60319424",
"0.599211",
"0.5991656",
"0.5964404",
"0.59383875",
"0.5885912",
"0.58813864",
"0.5863835",
"0.57720274",
"0.57403314",
"0.5740057",
"0.57348704",
"0.5733369",
"0.572277... | 0.9495953 | 0 |
Build redirect with redirect_state parameter. | def get_redirect_uri(self, state=None):
regex = re.compile(r"\:(80|443)\/")
uri = regex.sub("/", self.redirect_uri)
if self.REDIRECT_STATE and state:
uri = url_add_parameters(uri, {'redirect_state': state})
return uri | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_redirect_uri(self, state=None):\n if state is not None:\n uri = self.blank_redirect_uri\n if self.REDIRECT_STATE and state:\n uri = url_add_parameters(uri, {'redirect_state': state})\n else:\n uri = self.redirect_uri\n return uri",
"def... | [
"0.6220852",
"0.58699924",
"0.5820168",
"0.5787547",
"0.568278",
"0.560986",
"0.5485404",
"0.54818624",
"0.54510164",
"0.5417507",
"0.54143995",
"0.54086787",
"0.5376258",
"0.53444564",
"0.53163904",
"0.52998877",
"0.5273541",
"0.525929",
"0.5201142",
"0.51966715",
"0.5181374... | 0.5998109 | 1 |
Loads surface mesh using meshio. Not meant for mixed shape meshes. | def load_mesh(fname):
fname = abs_fname_(fname)
m = meshio.read(fname)
mesh = Mesh()
mesh.vertices = m.points
for i, c in enumerate(m.cells):
if i == 0:
faces = c.data
else:
faces = np.vstack((faces, c.data))
mesh.faces = faces
return mesh | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_mesh(self, script_to_apply=None): \n # convert to an obj file using meshlab\n if script_to_apply is None:\n meshlabserver_cmd = 'meshlabserver -i \\\"%s\\\" -o \\\"%s\\\"' %(self.filename, self.obj_filename)\n else:\n meshlabserver_cmd = 'meshlabserver -i ... | [
"0.7057171",
"0.70245314",
"0.67579937",
"0.67061126",
"0.6692487",
"0.6679398",
"0.6569063",
"0.6533282",
"0.6514972",
"0.6505622",
"0.6436628",
"0.6435029",
"0.6251096",
"0.62127954",
"0.62039167",
"0.6150478",
"0.61312926",
"0.611122",
"0.6106273",
"0.6066741",
"0.6060872"... | 0.7224944 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.