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 |
|---|---|---|---|---|---|---|
Determine if host is an NCAR machine. | def is_ncar_host():
hostname = socket.getfqdn()
return any([re.compile(ncar_host).search(hostname)
for ncar_host in ['cheyenne', 'casper', 'hobart']]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_virtual_network_host():\n return False",
"def host_network(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"host_network\")",
"def host_network(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"host_network\")",
"def _hostOK(self, host):\n i... | [
"0.6501965",
"0.63369364",
"0.63369364",
"0.6258826",
"0.62153363",
"0.6206112",
"0.6124385",
"0.61164725",
"0.60886073",
"0.59925914",
"0.57593256",
"0.5735515",
"0.5731423",
"0.56886107",
"0.5684597",
"0.56826836",
"0.56811947",
"0.5668964",
"0.56552494",
"0.5647518",
"0.56... | 0.76548994 | 0 |
Plot the lasso path. Both response and explanatory variables are standardised first. | def plot_lasso_path(df, resp_var, exp_vars):
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import mpld3
from mpld3 import plugins
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import lasso_path
# Standardise the feature data and resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_ls(self, ax):\n t = self.t\n x_true = self.x_true\n x_ls = self.x_ls\n\n ax.plot(t, x_true, 'k-', label='true', lw=1.5)\n ax.plot(t, x_ls, 'r-', label=r'$\\vec{x}_{LS}$', lw=1.5)\n ax.set_title(r'Noisy $A\\vec{x} = \\vec{b}$')\n ax.set_xlabel(r'$t$')\n ax.set_ylabel(r'$x$'... | [
"0.6340906",
"0.6281318",
"0.6115534",
"0.6084241",
"0.597616",
"0.5909249",
"0.58691627",
"0.5844199",
"0.58061564",
"0.5768483",
"0.5735005",
"0.5722253",
"0.57167464",
"0.5705256",
"0.56905735",
"0.567608",
"0.56759995",
"0.56732213",
"0.56581134",
"0.5649674",
"0.56393766... | 0.7940134 | 0 |
Performs all possible regressions involving exp_vars and returns the one with the lowest BIC. | def best_subsets(df, resp_var, exp_vars):
import itertools
import numpy as np
import pandas as pd
import statsmodels.api as sm
# Dict to store BIC values
bics = {}
# Loop over all combinations
for k in range(1, len(exp_vars)+1):
for variables in itertools.combinations(exp_vars,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vars_exp ( self , var1 , var2 = 1 , name = '' , title = '' ) :\n f1 = isinstance ( var1 , num_types )\n f2 = isinstance ( var2 , num_types )\n\n if f1 and f2 :\n res = math.exp ( float ( var1 ) * float ( var2 ) )\n return ROOT.RooRealConstant.value ( res ) \n ... | [
"0.5180267",
"0.5097825",
"0.5002635",
"0.4995862",
"0.4964013",
"0.49594897",
"0.49002984",
"0.48942316",
"0.48403406",
"0.48345667",
"0.48293895",
"0.48122546",
"0.4785789",
"0.47786286",
"0.4759718",
"0.4752891",
"0.47417212",
"0.47370768",
"0.47217035",
"0.47103098",
"0.4... | 0.72201073 | 0 |
Return a function to be run in a child process which will trigger SIGNAME to be sent when the parent process dies | def on_parent_exit(signame):
signum = getattr(signal, signame)
def set_parent_exit_signal():
# http://linux.die.net/man/2/prctl
result = cdll['libc.so.6'].prctl(PR_SET_PDEATHSIG, signum)
if result != 0:
raise PrCtlError('prctl failed with error code %s' % result)
return s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _on_parent_process_kill(self):",
"def restart_worker_sig_handler(signum, frame):\n worker.logger.warn(\"Restarting celeryd (%s)\" % (\n \" \".join(sys.argv)))\n worker.stop()\n os.execv(sys.executable, [sys.executable] + sys.argv)",
"def kill_child_processes(parent_pid, sig=... | [
"0.68887794",
"0.58589965",
"0.57902265",
"0.5679062",
"0.56586134",
"0.56409353",
"0.56002575",
"0.5578554",
"0.554599",
"0.5496212",
"0.5490256",
"0.54645735",
"0.54275984",
"0.54222596",
"0.5408692",
"0.53661394",
"0.5358135",
"0.53576624",
"0.5354838",
"0.5353509",
"0.531... | 0.7408894 | 0 |
Load BingoCache/BingoIdentityCache from instance cache/memcache. This loads the shared BingoCache and the individual BingoIdentityCache for the current request's bingo identity and stores them both in the request cache. | def fill_request_cache():
if not request_cache.cache.get("bingo_request_cache_filled"):
# Assume that we're going to grab both BingoCache and
# BingoIdentityCache from memcache
memcache_keys = [
BingoCache.CACHE_KEY,
BingoIdentityCache.key_for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cache(self, request):\n if self._cache is None:\n if hasattr(request.registry, 'cache'):\n cache_ttl = float(fxa_conf(request, 'cache_ttl_seconds'))\n oauth_cache = TokenVerificationCache(request.registry.cache,\n ... | [
"0.6503289",
"0.6443186",
"0.63101304",
"0.6283545",
"0.6235592",
"0.58411324",
"0.57111114",
"0.55836624",
"0.5563811",
"0.55485547",
"0.5536702",
"0.55269796",
"0.5518655",
"0.54806966",
"0.5480063",
"0.54426354",
"0.5399799",
"0.5339687",
"0.53310114",
"0.5330868",
"0.5308... | 0.7794368 | 0 |
Compress value so it'll fit in a single memcache value. | def compress(value):
pickled = pickle_util.dump(value)
return zlib.compress(pickled) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compress_encode(value):\n return base64.b64encode(zlib.compress(value.encode(\"ascii\"))).decode(\"ascii\")",
"def _value_to_stored(value, min_compress_len):\n\n\t\tflags = 0\n\t\tif isinstance(value, str):\n\t\t\tpass\n\t\telif isinstance(value, int):\n\t\t\tflags |= Client._FLAG_INTEGER\n\t\t\tvalue = \... | [
"0.67580014",
"0.66109306",
"0.64519554",
"0.64384675",
"0.6226443",
"0.60176396",
"0.5946697",
"0.5818836",
"0.5781978",
"0.5735015",
"0.5735015",
"0.56555945",
"0.5606611",
"0.56048423",
"0.5551679",
"0.5543978",
"0.5543978",
"0.54599726",
"0.54450905",
"0.5370829",
"0.5368... | 0.74520665 | 0 |
Decompress value from its compressed memcache state. | def decompress(data):
pickled = zlib.decompress(data)
return pickle_util.load(pickled) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __handle_decompression(self, x):\n if self.__compress:\n return zlib.decompress(x)\n return x",
"def gzinflate(val):\n return zlib.decompress(val)",
"def get_uncompressed(self, value):\r\n # Seek the LZ Window on current LZ Window Counter value and write the current LZ Data (LZ... | [
"0.67337835",
"0.6070017",
"0.59238917",
"0.58945376",
"0.58618367",
"0.58618367",
"0.581784",
"0.5805997",
"0.576791",
"0.5634254",
"0.5624241",
"0.56218636",
"0.5608627",
"0.5475487",
"0.547103",
"0.54368865",
"0.54151255",
"0.53768843",
"0.5339868",
"0.51607317",
"0.515764... | 0.63248646 | 1 |
Set value in instance cache and a compressed version in memcache. BingoCache is always only stored in instance cache for up to 1 minute. | def set(key, value):
instance_cache.set(key, value, expiry=CacheLayers.INSTANCE_SECONDS)
memcache.set(key, CacheLayers.compress(value))
logging.info("Set BingoCache in instance cache and memcache") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cache(self, val):\n pass",
"def cache_set(self, key: str, value: bytes) -> None:\n if self.cache is not None:\n self.cache.set(key, value)",
"def set_to_cache(self, url, data):\n cache_key, cache_lookup = self.get_cacheable_info(url)\n MEM_CACHE[cache_key][cache_l... | [
"0.7235172",
"0.68352276",
"0.6783805",
"0.67784894",
"0.65572405",
"0.6474191",
"0.64520466",
"0.6408479",
"0.6402972",
"0.63136464",
"0.62815505",
"0.6263839",
"0.6199353",
"0.6171194",
"0.6164362",
"0.6127915",
"0.606097",
"0.60209334",
"0.60101235",
"0.5983274",
"0.597520... | 0.85241646 | 0 |
Load BingoCache or BingoIdentityCache into request cache. This will first try to prefetch the expected entities from memcache. If the requested BingoCache or BingoIdentityCache key still isn't in the current request cache after prefetching, load the key's value from the datastore using the passedin loader function and ... | def get(key, fxn_load):
CacheLayers.fill_request_cache()
if not request_cache.cache.get(key):
request_cache.cache[key] = fxn_load()
return request_cache.cache[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_request_cache():\n if not request_cache.cache.get(\"bingo_request_cache_filled\"):\n\n # Assume that we're going to grab both BingoCache and\n # BingoIdentityCache from memcache\n memcache_keys = [\n BingoCache.CACHE_KEY,\n BingoIdentit... | [
"0.66970843",
"0.6028387",
"0.591156",
"0.5768941",
"0.5710898",
"0.5621564",
"0.55696875",
"0.55436176",
"0.55379426",
"0.5349023",
"0.5244644",
"0.5235314",
"0.52311903",
"0.5225017",
"0.5195624",
"0.51776904",
"0.5170313",
"0.51579934",
"0.5146956",
"0.51413685",
"0.513629... | 0.6206268 | 1 |
Persist current state of experiment and alternative models. This persists the entire BingoCache state to the datastore. Individual participants/conversions sums might be slightly outofdate during any given persist, but hopefully not by much. This can be caused by memcache being cleared at unwanted times between a parti... | def persist_to_datastore(self):
# Start putting the experiments asynchronously.
experiments_to_put = []
for experiment_name in self.experiments:
experiment_model = self.get_experiment(experiment_name)
experiments_to_put.append(experiment_model)
async_experiments ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist(self):\n pass",
"def _save(self):\n self.logger.debug(\"Saving to persistence\")\n try:\n data = self.persistence_serialize()\n except NotImplementedError:\n # allow backwards compatibility or persisted_values way\n # generate item to be pe... | [
"0.6611025",
"0.64282924",
"0.60682565",
"0.60315686",
"0.59428346",
"0.59077376",
"0.5887174",
"0.5879499",
"0.58589494",
"0.5840332",
"0.5799324",
"0.5780706",
"0.57573116",
"0.5756066",
"0.57440186",
"0.57420766",
"0.57128626",
"0.57128626",
"0.5712467",
"0.5705719",
"0.57... | 0.80473787 | 0 |
Load BingoCache from the datastore, using archives if specified. | def load_from_datastore(archives=False):
# This shouldn't happen often (should only happen when memcache has
# been completely evicted), but we still want to be as fast as
# possible.
bingo_cache = BingoCache()
if archives:
# Disable cache writes if loading from ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_cache(self):\n self.cache = self.cache_manager.retrieve(self.cache_file)\n if self.cache is None:\n self.cache = {}\n return",
"def preload(self):\n # load the objects\n for otype, fname in self.TYPE2NAME.items():\n if fname:\n pat... | [
"0.61731595",
"0.60626674",
"0.5984077",
"0.59096265",
"0.5720955",
"0.57077307",
"0.56395257",
"0.55939204",
"0.55710626",
"0.5552558",
"0.5523494",
"0.551597",
"0.54980457",
"0.5496661",
"0.5486047",
"0.54830986",
"0.54799646",
"0.542277",
"0.53984845",
"0.5382176",
"0.5374... | 0.77723056 | 0 |
Permanently delete specified experiment and all alternatives. | def delete_experiment_and_alternatives(self, experiment):
if not experiment:
return
# First delete from datastore
experiment.delete()
experiment.reset_counters()
for alternative in self.get_alternatives(experiment.name):
alternative.delete()
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(ctx):\n user, project_name, _experiment = get_project_experiment_or_local(ctx.obj.get('project'),\n ctx.obj.get('experiment'))\n if not click.confirm(\"Are sure you want to delete experiment `{}`\".format(_experiment)):\n ... | [
"0.7510578",
"0.7241702",
"0.7116758",
"0.68159664",
"0.6654145",
"0.65915495",
"0.65274465",
"0.6472088",
"0.6448073",
"0.6341354",
"0.6061962",
"0.6025377",
"0.6000015",
"0.59795654",
"0.59677714",
"0.5967223",
"0.596447",
"0.5939268",
"0.59301615",
"0.5916338",
"0.5908325"... | 0.8713962 | 0 |
Permanently archive specified experiment and all alternatives. Archiving an experiment maintains its visibility for historical purposes, but it will no longer be loaded into the cached list of active experiments. | def archive_experiment_and_alternatives(self, experiment):
if not experiment:
return
experiment.archived = True
experiment.live = False
experiment.put()
alts = self.get_alternatives(experiment.name)
for alternative in alts:
alternative.archived =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def archive_experiment(experiment_dir: str,\n dst_dir: str,\n save_extensions: Union[str, Sequence[str]]='py',\n exclude_dirs: Union[str, Sequence[str]]='output',\n archive_format: str='zip',\n base_name: ... | [
"0.6223507",
"0.57100916",
"0.56061983",
"0.54085034",
"0.52556056",
"0.5227558",
"0.51688933",
"0.51586974",
"0.51116616",
"0.50952834",
"0.50716406",
"0.50631404",
"0.5059154",
"0.50136757",
"0.50054985",
"0.50015754",
"0.4908376",
"0.48794195",
"0.48527864",
"0.4830995",
"... | 0.84051466 | 0 |
Returns a string representation of the element set. | def __str__(self):
return ("Element set with name {0} containing elements with the "
"following ids {1}".format(self.name, self.ids)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n # string representation includes values of all inner fields\n return \"Nodeset: \" + \"\\n\".join([node.__str__() for node in self.nodeset]) + \"\\n\"",
"def __repr__(self):\n return 'TreeSet([{0}])'.format(','.join(str(item) for item in self))",
"def rsset2str(self, e... | [
"0.7763894",
"0.7456162",
"0.73500264",
"0.7297258",
"0.71224385",
"0.7106639",
"0.70656455",
"0.70219916",
"0.69556755",
"0.69194734",
"0.69095916",
"0.67918104",
"0.6740799",
"0.665822",
"0.66413724",
"0.6627908",
"0.6516216",
"0.64769197",
"0.6475422",
"0.64434963",
"0.643... | 0.7877685 | 0 |
View unread and read friendship requests | def friendship_request_list(request, template_name='/friend/requests_list.html'):
# friendship_requests = Friend.objects.requests(request.user)
friendship_requests = FriendshipRequest.objects.filter(rejected__isnull=True)
return render(request, template_name, {'requests': friendship_requests}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self, request):\n\n user_profile = get_object_or_404(UserProfile, user=request.user)\n # Get all sent accepted invitations\n sent = user_profile.creator_friendships.filter(status=1)\n # Get all received accepted invitations\n received = user_profile.invited_friendshi... | [
"0.67915237",
"0.639356",
"0.636288",
"0.6327052",
"0.62520874",
"0.6234537",
"0.61860865",
"0.6085776",
"0.6082629",
"0.6072229",
"0.6017205",
"0.5929222",
"0.592141",
"0.5916796",
"0.5893348",
"0.5871527",
"0.58640313",
"0.58468837",
"0.578494",
"0.5740667",
"0.572212",
"... | 0.6415068 | 1 |
Accept a friendship request | def friendship_accept(request, friendship_request_id):
#if request.method == 'POST':
#id1 = get_object_or_404(request.user.friendship_requests_sent,id=friendship_request_id)
f_request = FriendshipRequest.objects.get(from_user=friendship_request_id, to_user = request.user)
from_user = request.user
f_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_request(request, id):\n f_request = FriendRequest.objects.get(id=id)\n if f_request.to_user == request.user:\n f_request.to_user.profile.friends.add(f_request.from_user)\n f_request.from_user.profile.friends.add(f_request.to_user)\n f_request.delete()\n messages.success... | [
"0.75303346",
"0.71296865",
"0.7006911",
"0.6923629",
"0.6921514",
"0.68695146",
"0.6808402",
"0.67363393",
"0.6596455",
"0.6554246",
"0.6544674",
"0.6517635",
"0.6496669",
"0.64391506",
"0.6397415",
"0.63964635",
"0.6375508",
"0.63381994",
"0.6321746",
"0.62983584",
"0.62595... | 0.7262136 | 1 |
find the largest 5 digit number in a series | def find_largest_5_digit_number(digits):
return max(int(digits[i:i + 5]) for i, v in enumerate(digits)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_max_tidy_num(s_number):\n\n len_input = len(s_number) - 1\n\n if len_input == 0:\n return s_number\n\n for i in range(0, len_input):\n if int(s_number[i]) > int(s_number[i+1]):\n\n final_str = '9' * (len_input - i)\n s_number = s_number[:(i+1)]\n\n r... | [
"0.70105416",
"0.69172424",
"0.6843012",
"0.6663859",
"0.6645339",
"0.65732545",
"0.6561094",
"0.649613",
"0.6407684",
"0.6355883",
"0.6352937",
"0.6352192",
"0.6330805",
"0.6313377",
"0.63097316",
"0.6287743",
"0.6280297",
"0.6268046",
"0.6250991",
"0.6195952",
"0.6167482",
... | 0.7851844 | 0 |
Return length of longest suffix of 'a' matching a prefix of 'b' that is at least 'min_length' charachers long. If no such overlap exists, return 0. | def overlap(a, b, min_length=3):
start = 0 # start all the way at the left
while True:
start = a.find(b[:min_length], start) # look for b's suffix i a
if start == -1: # no more occurrences to right
return 0
# found occurrence; check for full suffix/prefix match
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap(a, b, min_length=3):\r\n start = 0 # start all the way at the left\r\n while True:\r\n start = a.find(b[:min_length], start) # look for b's prefix in a\r\n if start == -1: # no more occurrences to right\r\n return 0\r\n # found occurrence; check for full suffix/... | [
"0.7941139",
"0.7760494",
"0.6617685",
"0.65561116",
"0.6523843",
"0.64295024",
"0.6365952",
"0.63587284",
"0.6324673",
"0.6227521",
"0.61708623",
"0.61648244",
"0.61560893",
"0.6094795",
"0.60773504",
"0.6065693",
"0.60383505",
"0.60067284",
"0.59923077",
"0.59839416",
"0.59... | 0.79689455 | 0 |
Factory method to create a MemcachedZipHandler instance. | def create_handler(zip_files, max_age=None, public=None):
# verify argument integrity. If the argument is passed in list format,
# convert it to list of lists format
if zip_files and type(zip_files).__name__ == 'list':
num_items = len(zip_files)
while num_items > 0:
if type(zip_files[num_items - 1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport_factory(conf):\n\n return MemcachedTransport(conf)",
"def __new__(cls, *args, **kwargs):\n if cls.__instance is None:\n cls.__instance = super(CacheManagerSingleton, cls).__new__(cls)\n # Generate all ground truth data files from hard-coded data\n CacheMan... | [
"0.5553343",
"0.5520111",
"0.5516359",
"0.54733115",
"0.5460744",
"0.5410188",
"0.53911006",
"0.53312755",
"0.516686",
"0.5151937",
"0.5136932",
"0.50438714",
"0.5029927",
"0.5020021",
"0.49207148",
"0.4885875",
"0.48626146",
"0.48496023",
"0.48332196",
"0.48164874",
"0.48106... | 0.7277112 | 0 |
Compute any manual redirects for a request and execute them. This allows content authors to manually define a set of regex rules which, when matched, will cause an HTTP redirect to be performed. Redirect rules are typically stored in a file named redirects.yaml. See the comments in that file for more information about ... | def ProcessManualRedirects(self, contentUri, langName, isIntl):
# Redirect data is stored in memcache for performance
memcache_key = self.REDIRECT_PREFIX + contentUri
redirect_data = memcache.get(memcache_key)
if redirect_data is None:
logging.info('Redirect cache miss. Computing new redirect data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ComputeManualRedirectUrl(self, uri):\n # Redircts are defined in a file named redirects.yaml.\n try:\n f = open(self.REDIRECT_FILE)\n data = yaml.load(f)\n f.close()\n except IOError, e:\n logging.warning('Error opening redirect file (' + self.REDIRECT_FILE +\n ... | [
"0.61701614",
"0.59776556",
"0.5807084",
"0.5786611",
"0.56202924",
"0.5560146",
"0.552262",
"0.5396871",
"0.5358838",
"0.53069615",
"0.52527213",
"0.5152865",
"0.5134927",
"0.5128564",
"0.5105053",
"0.5098078",
"0.5050939",
"0.50236595",
"0.502065",
"0.5014705",
"0.50078255"... | 0.65105486 | 0 |
Read redirects file and evaluate redirect rules for a given URI. | def ComputeManualRedirectUrl(self, uri):
# Redircts are defined in a file named redirects.yaml.
try:
f = open(self.REDIRECT_FILE)
data = yaml.load(f)
f.close()
except IOError, e:
logging.warning('Error opening redirect file (' + self.REDIRECT_FILE +
'): ' + e.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_redirects(self) -> None:\n\n self._redirects_file = self._siteroot / \"_redirects\"\n\n if not self._redirects_file.exists():\n return\n\n with open(str(self._redirects_file)) as file:\n for line in file:\n if not line or line.strip() == \"\" or li... | [
"0.5980954",
"0.5665315",
"0.53870755",
"0.5312178",
"0.528899",
"0.52513254",
"0.51808214",
"0.513637",
"0.5090773",
"0.50711006",
"0.4989364",
"0.49726534",
"0.49270687",
"0.487758",
"0.48743257",
"0.48203328",
"0.48148596",
"0.4788519",
"0.47797474",
"0.47740433",
"0.47241... | 0.63753504 | 0 |
Any preprocessing work on the URL when it comes in. Put any work related to interpreting the incoming URL here. For example, this is used to redirect requests for a directory to the index.html file in that directory. Subclasses should override this method to do different preprocessing. | def PreprocessUrl(self, name, langName):
# determine if this is a request for a directory
final_path_segment = name
final_slash_offset = name.rfind('/')
if final_slash_offset != len(name) - 1:
final_path_segment = name[final_slash_offset + 1:]
if final_path_segment.find('.') == -1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PreprocessUrl(self, name, langName):\n # determine if this is a request for a directory\n final_path_segment = name\n final_slash_offset = name.rfind('/')\n if final_slash_offset != len(name) - 1:\n final_path_segment = name[final_slash_offset + 1:]\n if final_path_segment.find('.') == -1... | [
"0.65595925",
"0.62371564",
"0.62371564",
"0.62371564",
"0.62371564",
"0.62371564",
"0.62371564",
"0.62371564",
"0.6201911",
"0.6074093",
"0.60695094",
"0.5908513",
"0.58842516",
"0.5789974",
"0.5770618",
"0.55574447",
"0.5551105",
"0.5523389",
"0.55218476",
"0.5516021",
"0.5... | 0.6503057 | 1 |
Redirect an incoming request to the appropriate intl uri. For nonen langName, builds the intl/lang string from a base (en) string and redirects (302) the request to look for a version of the file in langName. For en langName, simply redirects a stripped uri string (intl/nn removed). | def RedirToIntl(self, name, intlString, langName):
if not (langName == 'en'):
builtIntlLangUri = ''.join([intlString, langName, '/', name, '?', self.request.query_string])
else:
builtIntlLangUri = name
uri = ''.join(['/', builtIntlLangUri])
logging.info('-->REDIRECTING %s to %s', name, uri)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RedirToIntl(self, name, intlString, langName):\n if not (langName == 'en'):\n builtIntlLangUri = ''.join([intlString, langName, '/', name, '?', self.request.query_string])\n else:\n builtIntlLangUri = name\n uri = ''.join(['/', builtIntlLangUri])\n logging.info('-->>REDIRECTING %s to %s'... | [
"0.79338527",
"0.62359256",
"0.6185339",
"0.61657155",
"0.6138757",
"0.55112725",
"0.5457701",
"0.5326888",
"0.5269344",
"0.5217913",
"0.51415336",
"0.51285076",
"0.5042326",
"0.5012348",
"0.49918345",
"0.49863163",
"0.495512",
"0.4918267",
"0.49066803",
"0.48681173",
"0.4857... | 0.79706997 | 0 |
Process the url and form a response, if appropriate. Attempts to retrieve the requested file (name) from cache, negative cache, or store (zip) and form the response. For intl requests that are not found (in the localized tree), returns False rather than forming a response, so that the request can be retried with the ba... | def CreateResponse(self, name, langName, isValidIntl, resetLangCookie):
# see if we have the page in the memcache
logging.info('PROCESSING %s langName [%s] isValidIntl [%s] resetLang [%s]',
name, langName, isValidIntl, resetLangCookie)
resp_data = self.GetFromCache(name)
if resp_data is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateResponse(self, name, langName, isValidIntl, resetLangCookie):\n # see if we have the page in the memcache\n logging.info('PROCESSING %s langName [%s] isValidIntl [%s] resetLang [%s]', \n name, langName, isValidIntl, resetLangCookie)\n resp_data = self.GetFromCache(name)\n if resp_data is... | [
"0.66120654",
"0.65268123",
"0.6407571",
"0.6281036",
"0.6224008",
"0.6092181",
"0.60672164",
"0.6050084",
"0.60138804",
"0.59765065",
"0.59756196",
"0.59482276",
"0.590747",
"0.59006286",
"0.5895301",
"0.5892017",
"0.58767676",
"0.58571863",
"0.5835249",
"0.5834951",
"0.5831... | 0.65997976 | 1 |
Retrieve file from zip files. Get the file from the source, it must not have been in the memcache. If possible, we'll use the zip file index to quickly locate where the file should be found. (See MapToFileArchive documentation for assumptions about file ordering.) If we don't have an index or don't find the file where ... | def GetFromStore(self, file_path):
resp_data = None
file_itr = iter(self.zipfilenames)
# check the index, if we have one, to see what archive the file is in
archive_name = self.MapFileToArchive(file_path)
if not archive_name:
archive_name = file_itr.next()[0]
while resp_data is None and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFromStore(self, file_path):\n resp_data = None\n file_itr = iter(self.zipfilenames)\n\n # check the index, if we have one, to see what archive the file is in\n archive_name = self.MapFileToArchive(file_path)\n if not archive_name:\n archive_name = file_itr.next()[0]\n\n while resp_dat... | [
"0.72806776",
"0.69575703",
"0.69575703",
"0.6610931",
"0.6565042",
"0.6423156",
"0.6423156",
"0.59593505",
"0.5941586",
"0.5926459",
"0.5922368",
"0.5897725",
"0.58433074",
"0.58173203",
"0.5801647",
"0.5797342",
"0.57942325",
"0.5745251",
"0.5729301",
"0.57191044",
"0.57087... | 0.7221067 | 1 |
Convenience method to load zip file. Just a convenience method to load the zip file from the data store. This is useful if we ever want to change data stores and also as a means of dependency injection for testing. This method will look at our file cache first, and then load and cache the file if there's a cache miss | def LoadZipFile(self, zipfilename):
zip_archive = None
zip_archive = self.zipfile_cache.get(zipfilename)
if zip_archive is None:
try:
zip_archive = zipfile.ZipFile(zipfilename)
self.zipfile_cache[zipfilename] = zip_archive
except (IOError, RuntimeError), err:
logging.erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFromStore(self, file_path):\n resp_data = None\n file_itr = iter(self.zipfilenames)\n\n # check the index, if we have one, to see what archive the file is in\n archive_name = self.MapFileToArchive(file_path)\n if not archive_name:\n archive_name = file_itr.next()[0]\n\n while resp_dat... | [
"0.6646545",
"0.6617761",
"0.6548587",
"0.6336854",
"0.62597984",
"0.6156918",
"0.6102764",
"0.5982188",
"0.5941739",
"0.5870383",
"0.58554274",
"0.58551425",
"0.58437604",
"0.581484",
"0.579171",
"0.5783447",
"0.57726353",
"0.5768827",
"0.56999445",
"0.56873256",
"0.5628753"... | 0.7851262 | 0 |
Given a file name, determine what archive it should be in. This method makes two critical assumptions. (1) The zip files passed as an argument to the handler, if concatenated in that same order, would result in a total ordering of all the files. See (2) for ordering type. (2) Upper case letters before lower case letter... | def MapFileToArchive(self, file_path):
num_archives = len(self.zipfilenames)
while num_archives > 0:
target = self.zipfilenames[num_archives - 1]
if len(target) > 1:
if self.CompareFilenames(target[1], file_path) >= 0:
return target[0]
num_archives -= 1
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_archive(self, file):\n self.recursive_archive_depth += 1\n # LOG: write_log or somehow log the archive file here\n if self.recursive_archive_depth >= self.max_recursive_depth:\n file.make_dangerous('Archive bomb')\n else:\n tempdir_path = file.make_temp... | [
"0.56640816",
"0.5663601",
"0.55304027",
"0.5527431",
"0.5490257",
"0.54835296",
"0.5478281",
"0.5445338",
"0.5266849",
"0.51730907",
"0.51652795",
"0.5161889",
"0.51601887",
"0.5149782",
"0.5122495",
"0.50841063",
"0.5071203",
"0.50524473",
"0.5049654",
"0.50475276",
"0.5041... | 0.5767938 | 0 |
Set caching headers for the request. | def SetCachingHeaders(self, revalidate):
max_age = self.MAX_AGE
#self.response.headers['Expires'] = email.Utils.formatdate(
# time.time() + max_age, usegmt=True)
cache_control = []
if self.PUBLIC:
cache_control.append('public')
cache_control.append('max-age=%d' % max_age)
if revalid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetCacheHeaders(self, response):\n headers = framework_helpers.StaticCacheHeaders()\n for name, value in headers:\n response.headers[name] = value",
"def add_cache_headers(headers, cached):\n # type: (dict, dict) -> None\n if cached[\"etag\"] is not None:\n headers[\"If-None-Match\"] ... | [
"0.8172239",
"0.75542694",
"0.72784966",
"0.7131047",
"0.70837665",
"0.70837665",
"0.70479906",
"0.70066833",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585",
"0.6995585... | 0.7740348 | 1 |
Get file from memcache, if available. | def GetFromCache(self, filename):
return memcache.get('%s%s' % (self.CACHE_PREFIX, filename)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_from_cache(name, filename):\n cache_filename = _get_cache_filename(name, filename)\n if (os.path.exists(cache_filename) and\n os.path.getmtime(filename) < os.path.getmtime(cache_filename)):\n with io.open(cache_filename) as f:\n return f.read()\n\n return None",... | [
"0.7086537",
"0.7081664",
"0.70663553",
"0.7023377",
"0.69856495",
"0.6901622",
"0.69004154",
"0.6888162",
"0.68084466",
"0.6790126",
"0.6739287",
"0.6668971",
"0.65946305",
"0.6578903",
"0.6540292",
"0.6523373",
"0.64662105",
"0.6450065",
"0.6413321",
"0.6389023",
"0.6359768... | 0.7810979 | 0 |
Store data in the cache. Store a piece of data in the memcache. Memcache has a maximum item size of 110^6 bytes. If the data is too large, fail, but log the failure. Future work will consider compressing the data before storing or chunking it | def StoreOrUpdateInCache(self, filename, data):
try:
if not memcache.add('%s%s' % (self.CACHE_PREFIX, filename), data):
memcache.replace('%s%s' % (self.CACHE_PREFIX, filename), data)
except (ValueError), err:
logging.warning('Data size too large to cache\n%s' % err) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_to_cache(self, url, data):\n cache_key, cache_lookup = self.get_cacheable_info(url)\n MEM_CACHE[cache_key][cache_lookup] = (data, time.time())",
"def _add_cached_chunk(self, offset, data):\n if (\n self._cached_chunk_position + len(self._cached_chunk) == offset\n ... | [
"0.6944579",
"0.66344434",
"0.6626177",
"0.6372168",
"0.6333758",
"0.6333758",
"0.6332073",
"0.6296332",
"0.62909555",
"0.62894046",
"0.6265833",
"0.6253157",
"0.6249672",
"0.6249226",
"0.62227345",
"0.62210804",
"0.62009084",
"0.61104",
"0.6106336",
"0.60940987",
"0.6074255"... | 0.77053434 | 0 |
Retrieve from negative cache. | def GetFromNegativeCache(self, filename):
return memcache.get('%s%s' % (self.NEG_CACHE_PREFIX, filename)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def StoreInNegativeCache(self, filename):\n memcache.add('%s%s' % (self.NEG_CACHE_PREFIX, filename), -1)",
"def StoreInNegativeCache(self, filename):\n memcache.add('%s%s' % (self.NEG_CACHE_PREFIX, filename), -1)",
"def get(self, key):\n if self.dexists('ttl', key) and int(dt.now().strftime('%s'))... | [
"0.6788978",
"0.6788978",
"0.6569011",
"0.64355195",
"0.6376094",
"0.6346235",
"0.62963635",
"0.6218707",
"0.62120837",
"0.6149408",
"0.6138171",
"0.6117757",
"0.61139184",
"0.6105711",
"0.6105711",
"0.6073906",
"0.6073594",
"0.60261786",
"0.59938675",
"0.5989952",
"0.5900331... | 0.8238239 | 0 |
Find (and return) port channels in a collection of interface names | def port_channels(input_interfaces):
ports = []
for interface in input_interfaces:
interface_lower = str(interface).lower()
if interface_lower.startswith('po'):
ports.append(interface)
return ports | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_ports():\n devices = []\n for p in list_ports.comports():\n for d in DESCRIPTORS:\n if d in p.device.lower():\n _in = p.hwid\n devices.append(p.device)\n return devices",
"def resolve_cable_ports(user_input):\n\n cpids = []\n\n if not user... | [
"0.6389325",
"0.63132304",
"0.6013211",
"0.5984734",
"0.5981916",
"0.59410566",
"0.58634573",
"0.58317214",
"0.58243847",
"0.5813211",
"0.5805911",
"0.5791786",
"0.5780785",
"0.5778303",
"0.57739276",
"0.57563186",
"0.57169175",
"0.5668577",
"0.56455386",
"0.5627714",
"0.5615... | 0.7964661 | 0 |
Returns an unsaved pending mission affectation matching this virtual affectation. | def to_pending_mission_affectation(self):
pma = PendingMissionAffectation()
pma.pending_mission_id = self.pending_bargain_shared_mission.pending_mission_id
pma.mission_grid_id = self.mission_grid_id
pma.folk = self.folk
return pma | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_mission(self):\n try:\n return self.missions[self.status.mission_task_list[0]]\n except KeyError:\n return None",
"def start(self):\n\t\tpm = PendingMission(mission_id=self.mission_id, kingdom_id=self.kingdom_id)\n\t\tpm.save()\n\t\t\n\t\treturn pm",
"def get_pen... | [
"0.5990928",
"0.5823332",
"0.5756806",
"0.5729823",
"0.55847603",
"0.5259515",
"0.5232678",
"0.519658",
"0.51835024",
"0.51695836",
"0.5163903",
"0.5047908",
"0.5047739",
"0.502301",
"0.49482068",
"0.49456456",
"0.49444503",
"0.4942401",
"0.49412155",
"0.49237147",
"0.4920354... | 0.74044937 | 0 |
The ID of the CEN instance. | def cen_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "cen_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cen_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"cen_id\")",
"def cen_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_id\")",
"def GetID(self):\n return hex(id(self()))",
"def get_cid(self):\n\t\tif self.client is None:\n\t\t\traise UsageError(... | [
"0.8129587",
"0.7574239",
"0.73882943",
"0.7371349",
"0.72498125",
"0.723656",
"0.7211935",
"0.7115196",
"0.7108107",
"0.70960236",
"0.70884943",
"0.7077688",
"0.7066497",
"0.70593053",
"0.7050281",
"0.7050281",
"0.7050281",
"0.7050281",
"0.7035081",
"0.7035081",
"0.70322824"... | 0.7913691 | 1 |
The ID of the region to which the CEN instance belongs. | def cen_region_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "cen_region_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cen_region_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"cen_region_id\")",
"def cen_region_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_region_id\")",
"def region_id(self) -> str:\n return self._region_id",
"def region_id(self):\n ret... | [
"0.8768245",
"0.84267455",
"0.83769083",
"0.83741206",
"0.74363637",
"0.7431856",
"0.7431856",
"0.7431856",
"0.7431856",
"0.7431856",
"0.7431856",
"0.7424926",
"0.73096526",
"0.7297636",
"0.7297636",
"0.72571874",
"0.7183217",
"0.7183217",
"0.7183217",
"0.7183217",
"0.7183217... | 0.8633322 | 1 |
A match statement that indicates the list of IDs of the destination instances. | def destination_instance_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "destination_instance_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_instance_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"destination_instance_ids\")",
"def get_matches(src,dst,src_list, dst_list):\n matches=[]\n for src_conn in src_list:\n print src_conn\n if (src_conn in dst_list) & (src_conn<>dst):... | [
"0.66293687",
"0.584307",
"0.570298",
"0.570298",
"0.5647407",
"0.56322867",
"0.56147623",
"0.54975283",
"0.54913634",
"0.5456974",
"0.54485357",
"0.54106045",
"0.5389359",
"0.53784835",
"0.5378027",
"0.5338724",
"0.5337242",
"0.5337242",
"0.52271736",
"0.51819456",
"0.517203... | 0.66953146 | 1 |
A match statement that indicates the list of IDs of the destination route tables. You can enter a maximum of 32 route table IDs. | def destination_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "destination_route_table_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_route_table_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"destination_route_table_ids\")",
"def source_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"source_route_table_ids\")",
"def sour... | [
"0.69743264",
"0.6261375",
"0.6261375",
"0.6047519",
"0.5508063",
"0.54827636",
"0.5430795",
"0.5430795",
"0.5333517",
"0.533181",
"0.5323903",
"0.5322374",
"0.5286618",
"0.5128098",
"0.5114155",
"0.5108711",
"0.51074666",
"0.50781316",
"0.49712175",
"0.49312362",
"0.49272785... | 0.72641164 | 1 |
A match statement that indicates the AS path list. The AS path is a wellknown mandatory attribute, which describes the numbers of the ASs that a BGP route passes through during transmission. | def match_asns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "match_asns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_asns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"match_asns\")",
"def get_shortest_as_path(self, routes):\n outroutes = []\n min_val = float('inf');\n # get shortest AS path first\n for r in routes:\n if len(r[MESG][APTH]) <... | [
"0.5371364",
"0.53383625",
"0.5181639",
"0.49464923",
"0.48909184",
"0.4861957",
"0.48263305",
"0.46395627",
"0.4578909",
"0.45410156",
"0.45190975",
"0.4500022",
"0.44789663",
"0.44756097",
"0.444566",
"0.44150913",
"0.44034302",
"0.43986976",
"0.43833217",
"0.43645912",
"0.... | 0.54595244 | 1 |
A match statement that indicates the list of IDs of the source instances. | def source_instance_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_instance_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_instance_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"source_instance_ids\")",
"def source_ids(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"source_ids\")",
"def match_ids(cls, ids):\n id_prefix = getattr(cls.get_model(), 'id_p... | [
"0.6443164",
"0.6103877",
"0.5900581",
"0.5620296",
"0.55694443",
"0.5494043",
"0.54536456",
"0.5433016",
"0.5433016",
"0.54055655",
"0.53340405",
"0.53299135",
"0.53194755",
"0.53194755",
"0.5309701",
"0.52253544",
"0.51810426",
"0.5173089",
"0.51658106",
"0.51557314",
"0.51... | 0.64716834 | 1 |
A match statement that indicates the list of IDs of the source regions. You can enter a maximum of 32 region IDs. | def source_region_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_region_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_region_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"source_region_ids\")",
"def match_regions(self):\n l = []\n for r1 in self.regions_names():\n for r2 in self.metric.index:\n r11 = r1.replace('-', ' ').lower()\n ... | [
"0.6523685",
"0.5676772",
"0.5560002",
"0.5490604",
"0.5457274",
"0.5433523",
"0.5394592",
"0.5381494",
"0.53552854",
"0.521409",
"0.52122635",
"0.51840144",
"0.5155615",
"0.5129843",
"0.5119144",
"0.5113142",
"0.5097017",
"0.5052334",
"0.5042797",
"0.50118935",
"0.50042856",... | 0.67309105 | 1 |
A match statement that indicates the list of IDs of the source route tables. You can enter a maximum of 32 route table IDs. | def source_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_route_table_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_route_table_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"source_route_table_ids\")",
"def destination_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"destination_route_table_ids\")",
"def dest... | [
"0.6829134",
"0.6671816",
"0.6671816",
"0.63114774",
"0.5344338",
"0.52796936",
"0.52796936",
"0.52785176",
"0.521983",
"0.51573634",
"0.51460934",
"0.5056448",
"0.505201",
"0.50228965",
"0.5011408",
"0.49829265",
"0.49799988",
"0.49721655",
"0.49143004",
"0.48997533",
"0.489... | 0.70975035 | 1 |
The routing table ID of the forwarding router. If you do not enter the routing table ID, the routing policy is automatically associated with the default routing table of the forwarding router. | def transit_router_route_table_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "transit_router_route_table_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_table_id(self):\n return self._route_table_id",
"def transit_router_route_table_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"transit_router_route_table_id\")",
"def local_gateway_route_table_arn(self) -> Optional[str]:\n return pulumi.get(self, \"local_gateway_rout... | [
"0.7603422",
"0.7191912",
"0.6762461",
"0.63644975",
"0.6239139",
"0.6238305",
"0.6223464",
"0.6223464",
"0.6195608",
"0.6195608",
"0.61490387",
"0.6029993",
"0.6029993",
"0.60265666",
"0.58762556",
"0.57759017",
"0.57759017",
"0.5712225",
"0.57070154",
"0.5693077",
"0.569100... | 0.73902917 | 1 |
A match statement that indicates the list of IDs of the destination instances. | def destination_instance_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "destination_instance_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_instance_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"destination_instance_ids\")",
"def get_matches(src,dst,src_list, dst_list):\n matches=[]\n for src_conn in src_list:\n print src_conn\n if (src_conn in dst_list) & (src_conn<>dst):... | [
"0.6631763",
"0.5845013",
"0.5703716",
"0.5703716",
"0.56455714",
"0.56335795",
"0.5615531",
"0.5496361",
"0.5489027",
"0.5455577",
"0.5447737",
"0.54103726",
"0.5387354",
"0.537838",
"0.53782797",
"0.53368783",
"0.53368783",
"0.53366894",
"0.52273476",
"0.5180563",
"0.517112... | 0.6697088 | 0 |
A match statement that indicates the list of IDs of the destination route tables. You can enter a maximum of 32 route table IDs. | def destination_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "destination_route_table_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_route_table_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"destination_route_table_ids\")",
"def source_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"source_route_table_ids\")",
"def sour... | [
"0.69722986",
"0.6259037",
"0.6259037",
"0.604473",
"0.5507974",
"0.5482817",
"0.54293156",
"0.54293156",
"0.5332397",
"0.5331461",
"0.53238237",
"0.5320408",
"0.5285632",
"0.51275384",
"0.51133215",
"0.5107322",
"0.5106392",
"0.50763834",
"0.49712718",
"0.49308005",
"0.49264... | 0.72624105 | 0 |
A match statement that indicates the AS path list. The AS path is a wellknown mandatory attribute, which describes the numbers of the ASs that a BGP route passes through during transmission. | def match_asns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "match_asns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_asns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"match_asns\")",
"def get_shortest_as_path(self, routes):\n outroutes = []\n min_val = float('inf');\n # get shortest AS path first\n for r in routes:\n if len(r[MESG][APTH]) <... | [
"0.53705055",
"0.53376454",
"0.5181498",
"0.49458438",
"0.4891773",
"0.48614576",
"0.48248735",
"0.46392006",
"0.45768175",
"0.4540679",
"0.45202136",
"0.44975975",
"0.44782123",
"0.44768474",
"0.4446969",
"0.4415206",
"0.44038856",
"0.439665",
"0.43824884",
"0.43633756",
"0.... | 0.5458726 | 0 |
ID of the RouteMap. It is available in 1.161.0+. | def route_map_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "route_map_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_map_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"route_map_id\")",
"def get_route_id(self):\n\n return self.route_id",
"def depmap_id(self) -> str:\n return self._depmap_id",
"def _get_route_map(self):\n return self.__route_map",
"def RouteID(self):\n ... | [
"0.7815957",
"0.66509336",
"0.6565399",
"0.64298916",
"0.6421517",
"0.6287077",
"0.602211",
"0.5974995",
"0.58819485",
"0.5876102",
"0.58695936",
"0.5804652",
"0.5804652",
"0.57955486",
"0.5772519",
"0.5745008",
"0.5696094",
"0.5669637",
"0.5669637",
"0.5666345",
"0.56652707"... | 0.77030134 | 1 |
A match statement that indicates the list of IDs of the source instances. | def source_instance_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_instance_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_instance_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"source_instance_ids\")",
"def source_ids(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"source_ids\")",
"def match_ids(cls, ids):\n id_prefix = getattr(cls.get_model(), 'id_p... | [
"0.64416796",
"0.61032516",
"0.58992916",
"0.5620932",
"0.55711854",
"0.5493359",
"0.54537725",
"0.5431943",
"0.5431943",
"0.54044855",
"0.5333025",
"0.5330615",
"0.5317565",
"0.5317565",
"0.5308116",
"0.5226256",
"0.51782185",
"0.5174742",
"0.51642966",
"0.5156024",
"0.51506... | 0.6470146 | 0 |
A match statement that indicates the list of IDs of the source regions. You can enter a maximum of 32 region IDs. | def source_region_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_region_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_region_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"source_region_ids\")",
"def match_regions(self):\n l = []\n for r1 in self.regions_names():\n for r2 in self.metric.index:\n r11 = r1.replace('-', ' ').lower()\n ... | [
"0.6522281",
"0.56791085",
"0.5561759",
"0.54917055",
"0.5457963",
"0.54334456",
"0.53953844",
"0.53816295",
"0.53555155",
"0.52146995",
"0.52143914",
"0.5186236",
"0.51557",
"0.51320744",
"0.5118515",
"0.511341",
"0.50984585",
"0.5050431",
"0.5043502",
"0.5013506",
"0.500523... | 0.67294717 | 0 |
A match statement that indicates the list of IDs of the source route tables. You can enter a maximum of 32 route table IDs. | def source_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "source_route_table_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_route_table_ids(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"source_route_table_ids\")",
"def destination_route_table_ids(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"destination_route_table_ids\")",
"def dest... | [
"0.68275225",
"0.6670483",
"0.6670483",
"0.6310271",
"0.5343822",
"0.52802384",
"0.52790356",
"0.52790356",
"0.5217504",
"0.5158308",
"0.5147541",
"0.50560963",
"0.5049596",
"0.5022402",
"0.50101984",
"0.49826515",
"0.49798137",
"0.4973456",
"0.49137002",
"0.49002236",
"0.489... | 0.7095857 | 0 |
Get an existing RouteMap resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
as_path_match_mode: Optional[pulumi.Input[str]] = None,
cen_id: Optional[pulumi.Input[str]] = None,
cen_region_id: Optional[pulumi.Input[str]] = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_by_id(state_id):\n for key, value in storage.all(\"State\").items():\n if state_id == value.id:\n return jsonify(value.to_dict())\n abort(404)",
"def get(resource_name, id, opts=None, destination_cidr_block=None, destination_ipv6_cidr_block=None, destination_prefix_list_id=N... | [
"0.575027",
"0.5662136",
"0.5618034",
"0.56085235",
"0.5605873",
"0.5599721",
"0.5599085",
"0.5560798",
"0.5548112",
"0.5511522",
"0.55087346",
"0.5469211",
"0.5462452",
"0.5414934",
"0.53981507",
"0.536481",
"0.53567076",
"0.5341507",
"0.5327118",
"0.5319226",
"0.5289664",
... | 0.57442373 | 1 |
The ID of the CEN instance. | def cen_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "cen_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cen_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cen_id\")",
"def cen_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_id\")",
"def GetID(self):\n return hex(id(self()))",
"def get_cid(self):\n\t\tif self.client is None:\n\t\t\traise UsageError(\... | [
"0.7912667",
"0.75731",
"0.738902",
"0.7368713",
"0.72486544",
"0.72370803",
"0.72106427",
"0.7115544",
"0.71077794",
"0.7094682",
"0.7088395",
"0.7077093",
"0.7066089",
"0.7059786",
"0.7049962",
"0.7049962",
"0.7049962",
"0.7049962",
"0.7034844",
"0.7034844",
"0.70329654",
... | 0.8128811 | 0 |
The ID of the region to which the CEN instance belongs. | def cen_region_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "cen_region_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cen_region_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"cen_region_id\")",
"def cen_region_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"cen_region_id\")",
"def region_id(self) -> str:\n return self._region_id",
"def region_id(self):\n retu... | [
"0.86330634",
"0.8426626",
"0.8376628",
"0.8374121",
"0.7434355",
"0.74298704",
"0.74298704",
"0.74298704",
"0.74298704",
"0.74298704",
"0.74298704",
"0.7423311",
"0.7307992",
"0.72962",
"0.72962",
"0.72552586",
"0.71815133",
"0.71815133",
"0.71815133",
"0.71815133",
"0.71815... | 0.8768542 | 0 |
ID of the RouteMap. It is available in 1.161.0+. | def route_map_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "route_map_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_map_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"route_map_id\")",
"def get_route_id(self):\n\n return self.route_id",
"def depmap_id(self) -> str:\n return self._depmap_id",
"def _get_route_map(self):\n return self.__route_map",
"def RouteID(self):... | [
"0.77030134",
"0.66509336",
"0.6565399",
"0.64298916",
"0.6421517",
"0.6287077",
"0.602211",
"0.5974995",
"0.58819485",
"0.5876102",
"0.58695936",
"0.5804652",
"0.5804652",
"0.57955486",
"0.5772519",
"0.5745008",
"0.5696094",
"0.5669637",
"0.5669637",
"0.5666345",
"0.56652707... | 0.7815957 | 0 |
Get locations (lat, lon, alt) from NetCDF files | def get_coordinates_from_NetCDF_file(ds=None, folder=None, filename=None,
falt_var='PS_RVSM',
flat_var='LAT_GIN', flon_var='LON_GIN',
AltVar='hPa', LonVar='lon', LatVar='lat',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nc_getLatsandLons(fn):\r\n\tfrom netCDF4 import Dataset\r\n\t# load the netcdf file\r\n\tncf1 = Dataset(fn, mode='r')\r\n\r\n\t# Pull out the lon and lat data\r\n\tlats = ncf1.variables[\"lat\"][:]\r\n\tlons = ncf1.variables[\"lon\"][:]\r\n\r\n\treturn lats, lons",
"def get_ecmwf_lat_lon(nc_file):\n from ... | [
"0.7403564",
"0.6852354",
"0.6696198",
"0.6691548",
"0.65808856",
"0.65664023",
"0.64421964",
"0.6437985",
"0.63819665",
"0.6379798",
"0.63754004",
"0.6309255",
"0.62769336",
"0.62543446",
"0.62077725",
"0.6151938",
"0.614214",
"0.60501754",
"0.6030478",
"0.6022665",
"0.60095... | 0.7120128 | 1 |
Retrieve the ARNA flights as a list of dataframes | def get_ARNA_flights_as_dfs():
flight_nums = [216, 217, 218, 219, 220, 221, 222, 223, 224, 225]
flight_IDs = ['C{}'.format(i) for i in flight_nums]
dfs = {}
for flight_ID in flight_IDs:
print(flight_ID)
try:
df = AC.get_FAAM_locations_as_df(flight_ID=flight_ID)
df... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ARNA_flight_log_as_df():\n flight_nums = [\n # 216,\n 217, 218, 219, 220, 221, 222, 223, 224, 225\n ]\n flight_IDs = ['C{}'.format(i) for i in flight_nums]\n dfs = []\n for flight_ID in flight_IDs:\n dfs += [get_summary4flight(flight_ID=flight_ID)]\n # Combine and ... | [
"0.7409789",
"0.7090325",
"0.6280231",
"0.6272145",
"0.62536603",
"0.6153452",
"0.6148603",
"0.57446134",
"0.5625828",
"0.55525786",
"0.55135477",
"0.5509249",
"0.5493118",
"0.5468958",
"0.5408954",
"0.53471655",
"0.533953",
"0.53305674",
"0.5327812",
"0.5322978",
"0.5317242"... | 0.7308549 | 1 |
Retrieve SWAS data for ARNA flights | def get_SWAS_data4flight(flight_ID=None):
# Where is the data?
folder = '{}/{}/'.format(get_local_folder('ARNA_data'), 'SWAS')
# filename = 'ARNA-FIRSTLOOK-SWAS_JDL_typo_fix.csv'
# var2use = 'comments4'
# format = '%d/%m/%Y %H:%M:%S'
# Or use latest file (NOTE: issue with column formating)
# fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stravadata(weeks=0):\n # we need to convert the weeks into seconds from UNIX epoch for Strava\n aftersecs = 0\n if weeks > 0:\n afterdate = datetime.today() + timedelta(weeks=-weeks)\n aftersecs = afterdate.timestamp()\n payload = {'access_token': app.config['STRAVA_READ_KEY'],\n ... | [
"0.593065",
"0.56724393",
"0.54521966",
"0.54383487",
"0.54220045",
"0.5413973",
"0.54017806",
"0.5289757",
"0.5273574",
"0.5251717",
"0.5250002",
"0.5218517",
"0.5202964",
"0.519066",
"0.5186756",
"0.51673275",
"0.51657254",
"0.5164581",
"0.51594484",
"0.5128474",
"0.5126855... | 0.7048819 | 0 |
Map variables names from SWAS to GEOS variable names | def map_SWAS_var2GEOS_var(var, invert=False):
d = {
# '1_3_butadiene':,
# '1_butene':,
# '2_3_methylpentane':,
# '224_tmp':,
'acetaldehyde': 'ALD2',
'acetone': 'ACET',
# 'acetylene':,
'benzene': 'BENZ', # GEOSChem, but not GEOS-CF outpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __splitVariableNames(self, name, indexes):\n if name == 'x':\n var = self.xCoordinates[indexes[0]][indexes[1]]\n elif name == 'y':\n var = self.yCoordinates[indexes[0]][indexes[1]]\n elif name == 'z':\n var = self.zCoordinates[indexes[0]][indexes[1]]\n elif name == 'colorMap':\n ... | [
"0.57957864",
"0.56193644",
"0.56079614",
"0.5570913",
"0.554127",
"0.526646",
"0.5223445",
"0.5190009",
"0.5184565",
"0.518167",
"0.5163691",
"0.512737",
"0.51179117",
"0.508274",
"0.50357985",
"0.50131136",
"0.5012648",
"0.49912292",
"0.49834296",
"0.49825644",
"0.49750087"... | 0.7860141 | 0 |
Make a single pd.DataFrame with all flight summaries | def get_ARNA_flight_log_as_df():
flight_nums = [
# 216,
217, 218, 219, 220, 221, 222, 223, 224, 225
]
flight_IDs = ['C{}'.format(i) for i in flight_nums]
dfs = []
for flight_ID in flight_IDs:
dfs += [get_summary4flight(flight_ID=flight_ID)]
# Combine and return as a si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_summary4flight(flight_ID='C217'):\n folder = '{}/{}/'.format(get_local_folder('ARNA_data'), 'CEDA/v2020_06')\n filename = 'flight-sum_faam_*_*_{}.csv'.format(flight_ID.lower())\n file2use = glob.glob(folder+filename)\n ass_str = 'WARNING: {} flight summaries found present for flight {}!'\n a... | [
"0.65529007",
"0.6332042",
"0.6294801",
"0.61330724",
"0.6122913",
"0.59796906",
"0.5971159",
"0.59106845",
"0.5889917",
"0.58696735",
"0.5853593",
"0.58019334",
"0.58014596",
"0.5776228",
"0.57569456",
"0.57487464",
"0.57243234",
"0.5715368",
"0.5696653",
"0.5687621",
"0.566... | 0.758644 | 0 |
Retrieve a FAAM flight summary as a dataframe | def get_summary4flight(flight_ID='C217'):
folder = '{}/{}/'.format(get_local_folder('ARNA_data'), 'CEDA/v2020_06')
filename = 'flight-sum_faam_*_*_{}.csv'.format(flight_ID.lower())
file2use = glob.glob(folder+filename)
ass_str = 'WARNING: {} flight summaries found present for flight {}!'
assert len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ARNA_flight_log_as_df():\n flight_nums = [\n # 216,\n 217, 218, 219, 220, 221, 222, 223, 224, 225\n ]\n flight_IDs = ['C{}'.format(i) for i in flight_nums]\n dfs = []\n for flight_ID in flight_IDs:\n dfs += [get_summary4flight(flight_ID=flight_ID)]\n # Combine and ... | [
"0.763434",
"0.6820693",
"0.6488799",
"0.61329865",
"0.6029833",
"0.59492785",
"0.5941787",
"0.5825339",
"0.576614",
"0.57521045",
"0.57289314",
"0.5726671",
"0.5711478",
"0.570252",
"0.56683797",
"0.5650006",
"0.5646711",
"0.5639837",
"0.5637948",
"0.55715644",
"0.5557649",
... | 0.75344974 | 1 |
Retrieve filters data from ARNA flights | def get_filters_data4flight_REDUNDANT(flight_ID='C217', all_flights=True):
# Where is the data?
folder = '{}/{}/'.format(get_local_folder('ARNA_data'), 'Filters')
# What is the name of the sheet in the excel file?
# filename = 'Overview_all_filters_ACSIS_5_and_ARNA-1.xlsx'
# filename = 'Overview_filte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filters(self):",
"def get_filters_data4flight(flight_ID='C217', all_flights=True):\n # Where is the data?\n folder = '{}/{}/'.format(get_local_folder('ARNA_data'), 'Filters')\n # What is the name of the sheet in the excel file?\n filename = 'Aerosol_composition_for_submission.xlsx'\n xl = ... | [
"0.6921749",
"0.6873442",
"0.6753001",
"0.6068519",
"0.60414773",
"0.60229284",
"0.6002124",
"0.5978262",
"0.59157664",
"0.5914371",
"0.58712125",
"0.5870981",
"0.5869803",
"0.5869645",
"0.5853167",
"0.5845318",
"0.5758801",
"0.5755471",
"0.5743446",
"0.57255775",
"0.57238895... | 0.6958342 | 0 |
Add a flag for biomass burning to dataframe using CIMs HCN data | def add_biomass_flag2df(df, CIMSdf=None, flight_ID='C225', threshold=None):
# Retrieve the CIMS HCN data if not provided
if isinstance(CIMSdf, type(None)):
df = get_CIMS_data4flight(flight_ID=flight_ID)
# What Criterion to use for biomass burning?
# 3 sigma enhancement over the background, and 1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testClinicalPatientHBI(self):\n attr = self.session.create_visit_attr()\n\n self.util.boolTypeTest(self, attr, \"hbi\")\n\n self.util.boolPropertyTest(self, attr, \"hbi\")",
"def ion_chi2_cut(stream, df):\n ion_chi2_threshold = quality_parameters['ion_chi2_threshold']\n \n truth... | [
"0.5435923",
"0.5314786",
"0.51944315",
"0.5183165",
"0.5118372",
"0.5118372",
"0.5059377",
"0.5059377",
"0.50399125",
"0.50373745",
"0.503491",
"0.5011678",
"0.4964013",
"0.49618185",
"0.49261418",
"0.49227327",
"0.49145445",
"0.49143153",
"0.49121946",
"0.4876793",
"0.48499... | 0.6859806 | 0 |
Get the core FAAM flight data for a specific flight | def get_FAAM_core4flightnum(flight_ID='C225', version='v2020_06',
folder=None, resample_data=True):
# Where are the files? Which files to use?
if isinstance(folder, type(None)):
folder = '{}/CEDA/{}/'.format(get_local_folder('ARNA_data'), version)
files2use = glob.glob(fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_FAAM_flights_df():\n # Flights to use...\n DataRoot = get_local_folder('DataRoot')\n folder = '/{}/FAAM/core_faam_NetCDFs/'.format(DataRoot)\n filename = 'FAAM_BAe146_Biomass_burning_and_ACISIS_flights_tabulated.csv'\n df = pd.read_csv(folder+filename)\n # Only consider the dates after Ja... | [
"0.6722249",
"0.6663759",
"0.6482151",
"0.63223237",
"0.6316205",
"0.63149655",
"0.62482905",
"0.61118454",
"0.59660304",
"0.5959914",
"0.5923635",
"0.5813742",
"0.576723",
"0.5709456",
"0.5651761",
"0.5572879",
"0.5548629",
"0.5543746",
"0.5486655",
"0.54631597",
"0.54115653... | 0.721255 | 0 |
Use the latest NOx/HONO data from Simone and Chris | def get_latest_NOx_HONO_data(flight_ID=None, version='v1'):
# Locations of data
folder = '{}/{}/'.format(get_local_folder('ARNA_data'), 'FAAM')
folder += 'ARNA_NOx_HONO_data/'
FileStr = 'NOx_and_HONO'
files2use = glob.glob('{}*{}*{}*'.format(folder, FileStr, version))
files2use = list(sorted(fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_obs_neo_top_mid_bot(ring):\n fobs_neo = \"/srv/ccrc/data25/z5218916/data/Eucface_data/swc_at_depth/FACE_P0018_RA_NEUTRON_20120430-20190510_L1.csv\"\n neo = pd.read_csv(fobs_neo, usecols = ['Ring','Depth','Date','VWC'])\n neo['Date'] = pd.to_datetime(neo['Date'],format=\"%d/%m/%y\",infer_datetime_... | [
"0.553499",
"0.54000497",
"0.5361197",
"0.5301937",
"0.5243987",
"0.524052",
"0.5225083",
"0.52154475",
"0.51852566",
"0.51594836",
"0.51537675",
"0.5129549",
"0.5101989",
"0.50984293",
"0.50936735",
"0.50797164",
"0.5057877",
"0.5057469",
"0.5053617",
"0.5046095",
"0.5036458... | 0.62824965 | 0 |
Explore the FAAM aerosol data (CDP, PCASP) from ARNA2 campaign | def explore_FAAM_aerosol_data():
# -- PCASP
dsPCASP = get_FAAM_mineral_dust_calibration(instrument='PCASP',
rtn_values=False)
# -- CDP
dsCDP = get_FAAM_mineral_dust_calibration(instrument='CDP',
rtn_values=Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_apc(df, results, len_prot):\n\n\n list_gaps = pos_gaps(df, GAPS)\n list_pos_conserved = pos_conserved(df, CONSERVATION)\n to_remove = list_gaps + list_pos_conserved\n \n results = make_results_df(results)\n restrain_results_prot_rna(results, len_prot, to_remove)\n\n\n apc = compute_apc(re... | [
"0.5556612",
"0.5550865",
"0.5526889",
"0.55222785",
"0.5476266",
"0.5474388",
"0.53001654",
"0.522233",
"0.52216876",
"0.5198479",
"0.51536995",
"0.5108662",
"0.5099214",
"0.50950027",
"0.5094507",
"0.50895536",
"0.50569654",
"0.5043567",
"0.5041505",
"0.5041226",
"0.5028745... | 0.74679685 | 0 |
Retrieve FAAM mineral dust calibration | def get_FAAM_mineral_dust_calibration(instrument='PCASP', rtn_values=True):
# Location and name of calibration files?
folder = '{}/FAAM/'.format(get_local_folder('ARNA_data'))
if instrument == 'PCASP':
# NOTE: range ~0.1-4 microns
filename = 'PCASP1_faam_20200128_v001_r000_cal.nc'
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calibration(self) -> int:",
"def get_calibration(self, name):\n name = name.lower()\n expected = ('absorption', 'badpixel', 'filter transmission', \n 'total transmission', 'gain', 'invntt', 'responsivity',\n 'timeconstant', 'stddev')\n if name not in... | [
"0.6338156",
"0.61180454",
"0.606011",
"0.6025908",
"0.5947843",
"0.5913504",
"0.5913246",
"0.57617736",
"0.57355696",
"0.56842995",
"0.5650147",
"0.55848324",
"0.5561683",
"0.55502063",
"0.55474335",
"0.55389833",
"0.55319655",
"0.5517216",
"0.5470456",
"0.5455845",
"0.54469... | 0.74670416 | 0 |
Make csv files of flagging (e.g. SLR, dust) for ARNA flights | def mk_file_of_flags(flights_nums=[]):
# Which flights to plot?
# Just use non-transit ARNA flights
if len(flights_nums) == 0:
flights_nums = [
217, 218, 219, 220, 221, 222, 223, 224, 225,
]
flight_IDs = ['C{}'.format(i) for i in flight_nums]
# Loop by flight and retrieve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_fallout(): \n with open('fallout.csv', 'w', newline='') as csvfile:\n wr = csv.writer(csvfile, delimiter=',')\n wr.writerows(environment)",
"def write_to_csv(all_roads, geo, out_fn):\n\n output_header = [\"road_id\", \"color\", \"origin_lon\",\n \"origin_lat\",... | [
"0.6336457",
"0.597503",
"0.5943763",
"0.58737653",
"0.5864741",
"0.58572274",
"0.5756641",
"0.5756393",
"0.57419914",
"0.5706379",
"0.5686049",
"0.5671033",
"0.56620437",
"0.56516457",
"0.55701894",
"0.55378085",
"0.5518037",
"0.55134594",
"0.5506527",
"0.54928076",
"0.54872... | 0.73833156 | 0 |
Retrieve DataFrame of FAAM BAe146 flights | def get_FAAM_flights_df():
# Flights to use...
DataRoot = get_local_folder('DataRoot')
folder = '/{}/FAAM/core_faam_NetCDFs/'.format(DataRoot)
filename = 'FAAM_BAe146_Biomass_burning_and_ACISIS_flights_tabulated.csv'
df = pd.read_csv(folder+filename)
# Only consider the dates after Jan 2018
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ARNA_flight_log_as_df():\n flight_nums = [\n # 216,\n 217, 218, 219, 220, 221, 222, 223, 224, 225\n ]\n flight_IDs = ['C{}'.format(i) for i in flight_nums]\n dfs = []\n for flight_ID in flight_IDs:\n dfs += [get_summary4flight(flight_ID=flight_ID)]\n # Combine and ... | [
"0.7218502",
"0.6603748",
"0.64688295",
"0.6318037",
"0.6246244",
"0.60887426",
"0.6086723",
"0.6084111",
"0.6052157",
"0.60213727",
"0.59955364",
"0.59890544",
"0.5826939",
"0.57904667",
"0.5752829",
"0.5750079",
"0.5736702",
"0.5727617",
"0.57274073",
"0.5721728",
"0.569873... | 0.7614418 | 0 |
Flight tracks for campaign | def get_flighttracks4campaign(campaign='ARNA-2', PressVar="PS_RVSM",
LonVar='LON_GIN', TimeVar='Time',
LatVar='LAT_GIN', resample_data=True):
# Get dataframe of all flights and select those for a given campaign
DataRoot = get_local_folder('DataRoot')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tracks(self):\r\n return None",
"def run_trackings():\n return analytics.select_rows(\n analytics.trackings_table(),\n 0,\n 2)",
"def french_trackings():\n return analytics.select_rows(\n analytics.trackings_table(),\n 0,\n 5)",
"def _generate_tracks... | [
"0.62894815",
"0.57710147",
"0.5695273",
"0.55896896",
"0.55860525",
"0.55291265",
"0.5454229",
"0.5331567",
"0.5243363",
"0.52033424",
"0.51963466",
"0.5190555",
"0.5167394",
"0.51597977",
"0.51393306",
"0.5137426",
"0.5129728",
"0.51296294",
"0.5126286",
"0.51139396",
"0.51... | 0.6553782 | 0 |
Make planeflight input files for various ground sites | def mk_planeflight_files4sites(testing_mode=False):
# Location of flight data
TYPE = ['CVO{}'.format(i) for i in range(1, 8)]
#
sdate = datetime.datetime(2015, 1, 1,)
edate = datetime.datetime(2021, 1, 1,)
dates = pd.date_range(sdate, edate, freq='T')
# Get list of species
num_tracers = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_siaf_pre_flight_reference_files_nircam():\n\n instrument = 'NIRCam'\n overwrite_wedge_file = False\n overwrite_grism_file = False\n\n\n # wedge definitions\n wedge_file = os.path.join(JWST_SOURCE_DATA_ROOT, instrument,\n '{}_siaf_wedge_offsets.txt'.format(in... | [
"0.6277958",
"0.62458235",
"0.6066833",
"0.5872542",
"0.58305043",
"0.58165705",
"0.57873917",
"0.57807213",
"0.5709727",
"0.57021165",
"0.5692767",
"0.5687253",
"0.5652405",
"0.5634063",
"0.5617115",
"0.56134456",
"0.55741876",
"0.5568163",
"0.5542688",
"0.5536674",
"0.55165... | 0.6662759 | 0 |
Store of planeflight slist to request outputs for | def get_planeflight_slist2output(num_tracers=None, folder=None,
OutputJVALs=False):
# Use the number of tracers in the input.geos file, unless specified
if isinstance(num_tracers, type(None)):
if isinstance(folder, type(None)):
TRAs = AC.get_specieslist_from_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveData(self): \n self.spIndex.close()\n output = open(PublicTransit.PICKLE_SAVE_FILE, 'wb') \n # cPickle the list using the highest protocol available.\n cPickle.dump(self.nodesDict, output, -1)\n cPickle.dump(self.linksDict, output, -1)\n cPickle.dump(self... | [
"0.59888595",
"0.57622135",
"0.55678904",
"0.5534577",
"0.5497685",
"0.54902357",
"0.5471098",
"0.5362654",
"0.5356936",
"0.5356936",
"0.52325267",
"0.52256703",
"0.5181901",
"0.5164523",
"0.5144304",
"0.514265",
"0.51241267",
"0.51239896",
"0.51116306",
"0.51106155",
"0.5107... | 0.58906573 | 1 |
Make planeflight input files for various FAAM campaigns | def mk_planeflight_files4FAAM_campaigns(folder=None, testing_mode=False,
num_tracers=None, OutputJVALs=True):
# Location of flight data
DataRoot = get_local_folder('DataRoot')
folderFAAMnetCDF = '/{}/FAAM/core_faam_NetCDFs/'.format(DataRoot)
# folder4csv = '/{}/FAA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mk_planeflight_files4sites(testing_mode=False):\n # Location of flight data\n TYPE = ['CVO{}'.format(i) for i in range(1, 8)]\n #\n sdate = datetime.datetime(2015, 1, 1,)\n edate = datetime.datetime(2021, 1, 1,)\n dates = pd.date_range(sdate, edate, freq='T')\n # Get list of species\n n... | [
"0.66081256",
"0.6361652",
"0.61228454",
"0.58896697",
"0.58269113",
"0.5796108",
"0.57603014",
"0.5747323",
"0.5716713",
"0.5702961",
"0.57019323",
"0.5661964",
"0.5656637",
"0.56522906",
"0.56328225",
"0.5628471",
"0.5598987",
"0.5556586",
"0.5543093",
"0.5538661",
"0.55311... | 0.7100015 | 0 |
Returns a new genome that is identical to input genome, with n genes marked as silent. | def silent_n_random_genes(genome, n):
genes_to_silence = randint(0, len(genome), n)
for i in genes_to_silence:
genome[i].is_silent = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplify_once(genome):\n gn = deepcopy(genome)\n n = randint(1, 4)\n action = choice(['silent', 'noop'])\n if action == 'silent':\n silent_n_random_genes(gn, n)\n else:\n noop_n_random_genes(gn, n)\n return gn",
"def noop_n_random_genes(genome, n):\n genes_to_silence = rand... | [
"0.69742674",
"0.61814624",
"0.5084359",
"0.5058214",
"0.48620316",
"0.4801692",
"0.47939005",
"0.47754225",
"0.47691792",
"0.4746599",
"0.47462875",
"0.47391346",
"0.47391346",
"0.47327465",
"0.46782973",
"0.46637827",
"0.46598697",
"0.4613672",
"0.4562637",
"0.4562637",
"0.... | 0.6981817 | 0 |
Returns a new genome that is identical to input genome, with n genes replaced with noop instructions. | def noop_n_random_genes(genome, n):
genes_to_silence = randint(0, len(genome), n)
for i in genes_to_silence:
genome[i].atom = copy(I_exec_noop) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplify_once(genome):\n gn = deepcopy(genome)\n n = randint(1, 4)\n action = choice(['silent', 'noop'])\n if action == 'silent':\n silent_n_random_genes(gn, n)\n else:\n noop_n_random_genes(gn, n)\n return gn",
"def copy(self):\n new_genome = Genome(self.pop)\n ... | [
"0.6380102",
"0.57533264",
"0.5714971",
"0.56702584",
"0.5534334",
"0.5501214",
"0.5345198",
"0.5303459",
"0.5302062",
"0.52911717",
"0.5243572",
"0.5227751",
"0.521425",
"0.5094848",
"0.5086654",
"0.5050946",
"0.5015364",
"0.5003053",
"0.49940684",
"0.49782723",
"0.49760196"... | 0.61785656 | 1 |
Private method interprets constructor keyword arguments and returns two dictionaries. One stores the halo catalog columns, the other stores the metadata. | def _parse_constructor_kwargs(self, **kwargs):
try:
halo_id = np.array(kwargs['halo_id'])
assert type(halo_id) is np.ndarray
Nhalos = custom_len(halo_id)
except KeyError:
msg = ("\nThe UserSuppliedHaloCatalog requires a ``halo_id`` keyword argument.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_catalog_info(self, catalog_info):\n cat = SourceFactory.build_catalog(**catalog_info)\n catalog_info['catalog'] = cat\n # catalog_info['catalog_table'] =\n # Table.read(catalog_info['catalog_file'])\n catalog_info['catalog_table'] = cat.table\n catalog_info['r... | [
"0.6177093",
"0.5973538",
"0.5971751",
"0.5876235",
"0.5827486",
"0.57998246",
"0.57885265",
"0.5768583",
"0.5757531",
"0.57513577",
"0.5745997",
"0.57280546",
"0.57257634",
"0.5708938",
"0.5686633",
"0.5684342",
"0.567555",
"0.5626168",
"0.5611129",
"0.56072915",
"0.55993176... | 0.78014 | 0 |
Redraw the view and its subcomponents to the content buffer. Recursively calls draw() on this view and it's subviews. If the force parameter is True, then force a full update of the buffer even if the component doesn't think it needs it. | def update(self, force = False):
for c in self.components:
c.update(force)
self.draw(force) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, force=False):\n self.axes.figure.canvas.draw()\n if self.colorbar is not None:\n if force is True:\n self.colorbar.update_bruteforce(self.pixels)\n else:\n self.colorbar.update_normal(self.pixels)\n self.colorbar.draw_all... | [
"0.67422885",
"0.6629564",
"0.6545638",
"0.6386477",
"0.6381825",
"0.6305405",
"0.6283448",
"0.6283448",
"0.6239317",
"0.62273836",
"0.61641675",
"0.6120819",
"0.6114004",
"0.6066532",
"0.5964558",
"0.59638196",
"0.5961427",
"0.5874057",
"0.57533026",
"0.57438356",
"0.5709857... | 0.6657414 | 1 |
Perform a win.refresh on this view's and it's subviews' windows, displaying the content buffers to the screen. | def refresh(self):
self.win.refresh()
for c in self.components:
c.refresh() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh(self):\n self.getWindow().getDecorView().postInvalidate()",
"def refresh(self):\n\n for w in self.windows.values():\n w.refresh()",
"def _refresh(self):\n self._need_display_update = True\n self._update()",
"def refresh(self) -> None:\n self.screen.re... | [
"0.7247143",
"0.7189299",
"0.68114066",
"0.66748095",
"0.6658856",
"0.6552248",
"0.6498167",
"0.64846826",
"0.647593",
"0.64553994",
"0.64521044",
"0.638972",
"0.6345377",
"0.63328564",
"0.6284631",
"0.62751037",
"0.6195663",
"0.6176461",
"0.61534727",
"0.61317897",
"0.612383... | 0.7196092 | 1 |
Draw the view to the content buffer. If force is True, then force a full redraw. | def draw(self, force = False):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self, force=False):\n self.display.draw(force)",
"def draw(self, surface, force=False):\n if self.redraw or force:\n surface.blit(self.image, self.loc)\n self.redraw = False",
"def update(self, force=False):\n self.axes.figure.canvas.draw()\n if self.c... | [
"0.769586",
"0.7040152",
"0.645467",
"0.60661364",
"0.60661364",
"0.60156",
"0.59898573",
"0.5947162",
"0.59142894",
"0.5898202",
"0.58598316",
"0.58594054",
"0.5836807",
"0.5834061",
"0.58330345",
"0.58009374",
"0.5795126",
"0.57863784",
"0.5768133",
"0.57375675",
"0.5723485... | 0.73988324 | 1 |
This method should be redefined by subclasses to handle the events captured by this controller. The type of the evt parameter will depend on the type of Controller. Return True if the event was handled, False otherwise. | def on_event(self, evt):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(self, event):\n try:\n for event_listeners in self.listeners[event.type]:\n if event_listeners:\n for listener in event_listeners:\n if listener(event) is False:\n return False\n except KeyError:... | [
"0.6627411",
"0.63246375",
"0.6065934",
"0.6065934",
"0.6065934",
"0.6065934",
"0.6065934",
"0.60309",
"0.60304743",
"0.5881259",
"0.57544726",
"0.5743592",
"0.5732675",
"0.5657902",
"0.56568515",
"0.5648627",
"0.56354356",
"0.56298137",
"0.5617847",
"0.5599251",
"0.55592537"... | 0.6620072 | 1 |
plots serveral 2D patches in a squareish grid | def plot_patches_in_grid(patches,
size_in_inches=(12, 12),
max_cols=6,
cmap=None):
n_cols = min(max_cols, int(np.sqrt(len(patches))))
n_rows = int(np.ceil(len(patches) / n_cols))
assert n_rows * n_cols >= len(patches)
for i, s in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self):\n done = []\n patches = []\n\n def chain(p):\n done.append(p)\n yield p\n last = p\n finished = False\n while not finished:\n seg0 = next(filter(lambda x: (x[0] not in done and\n ... | [
"0.6181039",
"0.6135946",
"0.60272384",
"0.5989714",
"0.5858805",
"0.57787955",
"0.57656956",
"0.576233",
"0.57522744",
"0.5723838",
"0.5718941",
"0.5693848",
"0.56436557",
"0.5632355",
"0.5627553",
"0.56216574",
"0.56184065",
"0.5616681",
"0.56163734",
"0.56133807",
"0.55773... | 0.6215272 | 0 |
plot a gradient of a color map | def plot_cmap(cmap):
gradient = np.linspace(0, 1, 256)
gradient = np.vstack((gradient, gradient))
pylab.imshow(gradient, aspect='auto', cmap=cmap)
pylab.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gradient_cmap(gcolors, nsteps=256, bounds=None):\n from matplotlib.colors import LinearSegmentedColormap\n\n ncolors = len(gcolors)\n if bounds is None:\n bounds = np.linspace(0, 1, ncolors)\n\n reds = []\n greens = []\n blues = []\n alphas = []\n for b, c in zip(bounds, gcolors)... | [
"0.66340154",
"0.63818365",
"0.61968935",
"0.61480755",
"0.6051361",
"0.6049797",
"0.6047201",
"0.60255486",
"0.60208243",
"0.59802973",
"0.5910603",
"0.5875477",
"0.58667725",
"0.57736564",
"0.5756684",
"0.57145125",
"0.5687927",
"0.56707996",
"0.56534827",
"0.5645068",
"0.5... | 0.7869021 | 0 |
gap is in the unit of windows. In each window in the gap, the window could have 0, 1, min_tags_in_windows1 tags. say gap = 1, min_tags_in_window= 2, gap_factor = 1 + poission(0,a) + poisson(1, a), where 1 represents no gap, poisson(0,a) represents a window with 0 tag, poisson(1,a) represents a window with 1 tag, The ga... | def gap_factor (gap, min_tags_in_window, average):
assert min_tags_in_window >= 1;
if gap == 0: return 1;
else:
i = 1;
gap_contribution = 1; # contribution from no gap
my_gap_factor = 0;
for i in range(0, min_tags_in_window): my_gap_factor +=poisson(i, average);
for i in range(1, gap+1): gap_contribution... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundary(gap, min_tags_in_window, average):\n\tassert min_tags_in_window >= 1;\n\ttemp = 0;\n\tfor i in range(0, min_tags_in_window): temp += poisson(i, average);\n\ttemp = pow(temp, gap+1); \n\treturn temp*temp; # start & end ",
"def gaps(self):\n return self.gaps_L + self.gaps_R",
"def pos_gaps(df, ga... | [
"0.7264445",
"0.6038522",
"0.5714613",
"0.5639418",
"0.55720323",
"0.54679775",
"0.5390237",
"0.5374334",
"0.5324121",
"0.5304474",
"0.5298672",
"0.52867746",
"0.52835244",
"0.5277086",
"0.52760553",
"0.5265334",
"0.5241339",
"0.52324754",
"0.52122355",
"0.5204236",
"0.519862... | 0.73780745 | 0 |
The condition for boundary is a continuous region of unqualified windows longer than gap | def boundary(gap, min_tags_in_window, average):
assert min_tags_in_window >= 1;
temp = 0;
for i in range(0, min_tags_in_window): temp += poisson(i, average);
temp = pow(temp, gap+1);
return temp*temp; # start & end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_boundary(self, x, l_old):\n pass",
"def expanded_boundaries(self):\n width = self._points[0][3][0] - self._points[0][1][0]\n height = self._points[0][3][1] - self._points[0][1][1]\n factor = np.multiply((width, height), Window.BORDER)\n return (\n np.subtr... | [
"0.67592514",
"0.6419204",
"0.6166285",
"0.61439735",
"0.6127559",
"0.605016",
"0.6048062",
"0.60470474",
"0.59738296",
"0.59717155",
"0.58906424",
"0.58846754",
"0.58667386",
"0.5856112",
"0.5853861",
"0.5853098",
"0.5847258",
"0.5842073",
"0.583289",
"0.57983935",
"0.579496... | 0.66268855 | 1 |
Run mypy on the given file. Because mypy's API is in flux we emulate parts of mypy.main.main() here and leave it to mypy to process it's options, for example. | def runtest(self):
# TODO: This should be hidden behind a debug / verbose flag.
print('Running mypy on', self.path)
# Construct a fake command line argv and let mypy do its
# own options parsing.
mypy_argv = [
str(self.path),
# TODO: This is where we'd ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_mypy(args: Namespace) -> None:\n # Make sure mypy can find the type hints for the Libpythonlang/Liblktlang\n # Python bindings.\n env = dict(os.environ)\n for prj in (\"python\", \"lkt\"):\n add_to_path(\n env,\n \"MYPYPATH\",\n P.join(LANGKIT_ROOT, \"con... | [
"0.66998076",
"0.6562969",
"0.63319504",
"0.6112015",
"0.60858727",
"0.60841346",
"0.6071653",
"0.6011207",
"0.6000055",
"0.5979269",
"0.5964157",
"0.59473795",
"0.5946047",
"0.59343857",
"0.5929956",
"0.5916229",
"0.5916229",
"0.5916229",
"0.5916229",
"0.5916229",
"0.5916229... | 0.6727343 | 0 |
Unwrap mypy errors so we get a clean error message without the full exception repr. | def repr_failure(self, excinfo):
if excinfo.errisinstance(MypyError):
return excinfo.value.args[0]
return super().repr_failure(excinfo) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tidy_error(ex=None) -> str:\r\n from sys import exc_info\r\n from os.path import join, abspath, dirname\r\n from traceback import extract_tb, format_list, format_exception_only\r\n\r\n show = join(dirname(abspath(__file__)), '')\r\n\r\n def _check_file(name):\r\n return name and name.star... | [
"0.67473096",
"0.65530634",
"0.6024047",
"0.60116005",
"0.59920275",
"0.59596324",
"0.5837122",
"0.5827848",
"0.5813864",
"0.58054703",
"0.5785039",
"0.57341504",
"0.57230437",
"0.57050484",
"0.56733805",
"0.5665562",
"0.56619126",
"0.5638449",
"0.56374866",
"0.56345826",
"0.... | 0.7062086 | 0 |
Counts the number of 'th' in word(input string). This program is case sensitive | def count_th(word):
# if word is an empty string return 0
if len(word) == 0:
return 0
# initialize a variable count to 0
count = 0
# create a function count_th_number to take position as argument
def count_th_number(pos):
# state a base case of position >= len(word) - 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self, word):\n pass",
"def count(word):\n\n return len(word)",
"def countWord(afz, word, output=True):\n count = 0\n for msg in msgs:\n if msg.afz == afz:\n count = count + msg.msg.lower().count(word.lower())\n print afz, 'heeft', count, 'keer', word, 'gezegd.'",... | [
"0.7719322",
"0.72584116",
"0.7034426",
"0.70135355",
"0.70029265",
"0.6970667",
"0.69369835",
"0.6892994",
"0.68369156",
"0.6726299",
"0.6722759",
"0.67089176",
"0.670856",
"0.6678322",
"0.6655947",
"0.6655023",
"0.6655023",
"0.66490614",
"0.66392666",
"0.6633138",
"0.662357... | 0.76235896 | 1 |
Construct a `CameraGeometry` from the name of the instrument and telescope id, if it can be found in a standard database. | def from_name(cls, name, tel_id):
return get_camera_geometry(name, tel_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_camera_geometry(instrument_name, cam_id, recalc_neighbors=True):\n\n # let's assume the instrument name is encoded in the\n # filename\n name = instrument_name.lower()\n geomfile = get_path('{}_camgeom.fits.gz'.format(name))\n\n geom = _load_camera_table_from_file(cam_id, geomfile=geomfile)\... | [
"0.71311337",
"0.6061083",
"0.6018443",
"0.5523679",
"0.53395474",
"0.5334718",
"0.5240905",
"0.5223754",
"0.51803523",
"0.5119183",
"0.50974834",
"0.5041967",
"0.4989922",
"0.49145526",
"0.49061072",
"0.48810774",
"0.48655242",
"0.48607817",
"0.48378637",
"0.4817476",
"0.479... | 0.7598315 | 0 |
rotate the camera coordinates about the center of the camera by specified angle. Modifies the CameraGeometry inplace (so after this is called, the pix_x and pix_y arrays are rotated. Notes This is intended only to correct simulated data that are rotated by a fixed angle. For the more general case of correction for came... | def rotate(self, angle):
rotmat = rotation_matrix_2d(angle)
rotated = np.dot(rotmat.T, [self.pix_x.value, self.pix_y.value])
self.pix_x = rotated[0] * self.pix_x.unit
self.pix_y = rotated[1] * self.pix_x.unit
self.pix_rotation -= angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self, angle):\n image_center = np.array(self.img.shape[1::-1]) / 2\n rot_mat = cv2.getRotationMatrix2D(tuple(image_center), angle, 1.0)\n\n self.img = cv2.warpAffine(\n self.img, rot_mat, self.img.shape[1::-1], flags=cv2.INTER_LINEAR\n )\n\n self.edits.appen... | [
"0.64143485",
"0.633505",
"0.60844123",
"0.6048541",
"0.6024194",
"0.5926783",
"0.5908256",
"0.58638513",
"0.5786148",
"0.5722611",
"0.5663923",
"0.56460214",
"0.563949",
"0.5636597",
"0.5636597",
"0.56202644",
"0.5571354",
"0.55566067",
"0.55451745",
"0.5534928",
"0.55254906... | 0.70894 | 0 |
Obtain the minimum seperation between two pixels on the camera | def get_min_pixel_seperation(pix_x, pix_y):
# dx = pix_x[1] - pix_x[0] <=== Not adjacent for DC-SSTs!!
# dy = pix_y[1] - pix_y[0]
dx = pix_x - pix_x[0]
dy = pix_y - pix_y[0]
pixsep = np.min(np.sqrt(dx ** 2 + dy ** 2)[1:])
return pixsep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMinimum(self):\n v1 = Vector(*self.p1)\n v2 = Vector(*self.p2)\n if v1.angle < v2.angle:\n return self.p1\n else:\n return self.p2",
"def minimal_image(x,y,z,D):\n diff = D\n x = (x+diff/2) % D - diff/2\n y = (y+diff/2) % D - diff/2\n z = (z+di... | [
"0.6388952",
"0.6376369",
"0.5926889",
"0.5916621",
"0.5915583",
"0.5908126",
"0.58448684",
"0.5789986",
"0.5748801",
"0.5700378",
"0.5675197",
"0.5662992",
"0.5606196",
"0.5605221",
"0.55871797",
"0.55671406",
"0.55635554",
"0.5561289",
"0.5546599",
"0.55461156",
"0.551662",... | 0.68466383 | 0 |
Helper function to provide the camera geometry definition for a camera by name. | def get_camera_geometry(instrument_name, cam_id, recalc_neighbors=True):
# let's assume the instrument name is encoded in the
# filename
name = instrument_name.lower()
geomfile = get_path('{}_camgeom.fits.gz'.format(name))
geom = _load_camera_table_from_file(cam_id, geomfile=geomfile)
neigh_li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_name(cls, name, tel_id):\n return get_camera_geometry(name, tel_id)",
"def _load_camera_geometry_from_fits_file(cam_id, geomfile='chercam.fits.gz'):\n camtable = Table.read(geomfile, hdu=\"CHERCAM\")\n geom = camtable[camtable['CAM_ID'] == cam_id]\n return geom",
"def guess_camera_geom... | [
"0.75824577",
"0.61315006",
"0.6083965",
"0.60181946",
"0.59747875",
"0.57978255",
"0.57828826",
"0.5740691",
"0.56376004",
"0.5628125",
"0.5597304",
"0.5512368",
"0.549554",
"0.54872465",
"0.5395099",
"0.5382035",
"0.53359234",
"0.5334262",
"0.5308082",
"0.52907413",
"0.5284... | 0.7036486 | 1 |
Read camera geometry from a FITS file with a ``CHERCAM`` extension. | def _load_camera_geometry_from_fits_file(cam_id, geomfile='chercam.fits.gz'):
camtable = Table.read(geomfile, hdu="CHERCAM")
geom = camtable[camtable['CAM_ID'] == cam_id]
return geom | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_collated(run):\n fname=get_collated_file(run)\n print(\"reading:\",fname)\n return fitsio.read(fname)",
"def read_file(file_name):\n fits_file = fits.open(file_name)\n\n header = fits_file[0].header\n image_data = fits_file[1].data\n\n segmentation_data = fits_file[2].data\n\n he... | [
"0.58447796",
"0.57191837",
"0.56337464",
"0.5586204",
"0.55446696",
"0.55136573",
"0.5501361",
"0.54789644",
"0.54430044",
"0.5391039",
"0.538306",
"0.5358822",
"0.53534764",
"0.53252405",
"0.5263066",
"0.5242876",
"0.5236221",
"0.5232611",
"0.5210363",
"0.51879877",
"0.5187... | 0.70371044 | 0 |
Displays current player ratings in tournament. | def display_player_ratings(player_ratings):
print('\nCLASSEMENT DES PARTICIPANTS:\n Nom ELO Score')
for i in range(0, len(player_ratings)):
print(players_table.get(doc_id=player_ratings[i][0])['Nom'],
players_table.get(doc_id=player_ratings[i][0])['ELO'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_round_matches(player_ratings):\r\n print('\\nMATCHES DE LA RONDE: ')\r\n for i in range(0, len(player_ratings), 2):\r\n print(players_table.get(doc_id=player_ratings[i][0])['Nom'], \"(BLANCS)\",\r\n \"contre\",\r\n players_table.get(doc_id=play... | [
"0.68019974",
"0.666061",
"0.6325232",
"0.6185169",
"0.6173029",
"0.60720843",
"0.60628706",
"0.60440284",
"0.5960025",
"0.59442365",
"0.59285295",
"0.59210926",
"0.58889705",
"0.58441776",
"0.5792146",
"0.57789665",
"0.57502013",
"0.57343143",
"0.5733002",
"0.5716808",
"0.57... | 0.7130215 | 0 |
Displays all tournament players registered in database sorted by name, or by ELO. | def display_tournament_player_list(self):
tournament_name = self.input_name("nom du tournoi")
tournament = tournaments_table.get(Query().Nom == tournament_name)
player_list = list()
for rated_player in tournament['Classement']:
player_list.append(players_table.get(doc_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_players_specific_tournament(self) -> None:\n id_choice = check.request_id(TOURNAMENTS)\n tournament_data = TOURNAMENTS.get(doc_id=id_choice)\n if tournament_data.get(\"players\") == {}:\n print(\"\\n This tournaments has no players yet\")\n else:\n players... | [
"0.76887727",
"0.7339851",
"0.7170343",
"0.69038105",
"0.6893615",
"0.68681896",
"0.66297156",
"0.6607506",
"0.6549008",
"0.64494073",
"0.6390599",
"0.63890797",
"0.638146",
"0.6368334",
"0.63205737",
"0.62315595",
"0.62161237",
"0.6204071",
"0.6196633",
"0.6108081",
"0.60820... | 0.7919385 | 0 |
Displays the list of all tournament names. | def display_tournament_list():
for tournament in tournaments_table:
print(tournament['Nom']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names():\n return render_template('playernames.html')",
"def display_tournament_player_list(self):\r\n tournament_name = self.input_name(\"nom du tournoi\")\r\n tournament = tournaments_table.get(Query().Nom == tournament_name)\r\n player_list = list()\r\n for rated_player in tou... | [
"0.74513817",
"0.69635993",
"0.6866932",
"0.66140485",
"0.65216726",
"0.63833475",
"0.62529963",
"0.6196368",
"0.6184073",
"0.61668134",
"0.61464155",
"0.61254084",
"0.61087877",
"0.6101415",
"0.6067844",
"0.60242784",
"0.60100573",
"0.6006366",
"0.598791",
"0.5986471",
"0.59... | 0.79702216 | 0 |
Displays all rounds for a given tournament. | def display_all_tournament_rounds(self):
tournament_name = self.input_name("nom du tournoi")
tournament = tournaments_table.get(Query().Nom == tournament_name)
print("Rondes du tournoi de", tournament_name, ": ")
for current_round in tournament['Rondes']:
print(current_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tournament_rounds_reports(self):\n tournament_id = self.select_tournament()\n self._model = Tournament({'id': tournament_id})\n self._view.report(self._model.get_rounds())\n\n self.tournament_menu()",
"def display_all_round_matches(self):\r\n tournament_name = self.input_na... | [
"0.74387515",
"0.73321843",
"0.70193946",
"0.68099576",
"0.65603083",
"0.64913565",
"0.625357",
"0.6094372",
"0.60136914",
"0.5983473",
"0.5976072",
"0.5966578",
"0.59501207",
"0.5870479",
"0.5812204",
"0.5808674",
"0.57780963",
"0.57587427",
"0.57538265",
"0.57498765",
"0.57... | 0.81031674 | 0 |
Displays the list of already played matches for a given tournament. | def display_all_round_matches(self):
tournament_name = self.input_name("nom du tournoi")
tournament = tournaments_table.get(Query().Nom == tournament_name)
print("Matches du tournoi de", tournament_name, "ayant eu lieu: ")
for match in tournament['Matches joues']:
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tournament_matches_report(self):\n tournament_id = self.select_tournament()\n self._model = Tournament({'id': tournament_id})\n self._view.report(self._model.get_matches())\n\n self.tournament_menu()",
"def display_matches(league, starting_date, ending_date):\n matches = get_ma... | [
"0.7676692",
"0.6940548",
"0.67989904",
"0.67735875",
"0.6698439",
"0.6618328",
"0.65883803",
"0.6384483",
"0.63436013",
"0.6330275",
"0.62628627",
"0.6250134",
"0.6245505",
"0.624181",
"0.62041503",
"0.6166644",
"0.61656326",
"0.61320776",
"0.61305916",
"0.607643",
"0.604790... | 0.7765536 | 0 |
Displays the list of imported players in current tournament. | def display_imported_players(players_id_list):
for player_id in players_id_list:
print(players_table.get(doc_id=player_id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_players_specific_tournament(self) -> None:\n id_choice = check.request_id(TOURNAMENTS)\n tournament_data = TOURNAMENTS.get(doc_id=id_choice)\n if tournament_data.get(\"players\") == {}:\n print(\"\\n This tournaments has no players yet\")\n else:\n players... | [
"0.71453434",
"0.71195453",
"0.7008409",
"0.655675",
"0.6504597",
"0.6483384",
"0.6160517",
"0.6131418",
"0.6071102",
"0.59826255",
"0.58773935",
"0.5859603",
"0.5855353",
"0.58507717",
"0.58392656",
"0.5820186",
"0.58003324",
"0.57863027",
"0.57753235",
"0.5773746",
"0.57653... | 0.76479304 | 0 |
Displays the number of imported players in current tournament. | def display_players_list_length(players_list):
print('Nombre de joueurs importés: ', len(players_list)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_imported_players(players_id_list):\r\n for player_id in players_id_list:\r\n print(players_table.get(doc_id=player_id))",
"def countPlayers():\n cur1 = conn.cursor()\n cur1.execute(\"\"\"SELECT * from players\"\"\")\n rows = cur1.fetchall()\n print \"\\t\\t\\tCount playe... | [
"0.66698086",
"0.6647706",
"0.6623648",
"0.65046823",
"0.63995594",
"0.6339519",
"0.63128495",
"0.6294659",
"0.6272845",
"0.62481165",
"0.6244453",
"0.6240274",
"0.61952615",
"0.61754274",
"0.61601526",
"0.615344",
"0.6146203",
"0.6126622",
"0.608586",
"0.60787225",
"0.606681... | 0.69702435 | 0 |
Input method for tournament time control. | def input_time_ctrl(self):
time_ctrl_list = ["bullet", "blitz", "coup rapide"]
time_ctrl = input("Entrez la cadence de jeu du tournoi (bullet, blitz ou coup rapide): ")
try:
if time_ctrl.lower() in time_ctrl_list:
return time_ctrl.lower()
except ValueErr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_data_for_time_calc():\n print(\"Pace & Distance -> Time\")\n print(\"=\" * 50)\n\n pace = input(\"Pace[min/km]: \")\n distance = float(input(\"Distance[km]: \"))\n\n calc_time(pace, distance)",
"def submitTime(self, event):\n try:\n time = float(self.integrationTimeBox.... | [
"0.6265153",
"0.6242054",
"0.61819386",
"0.6044409",
"0.60169655",
"0.6016436",
"0.58500415",
"0.5743969",
"0.5738457",
"0.56662",
"0.5650587",
"0.5642558",
"0.56280553",
"0.5625122",
"0.56166536",
"0.5604566",
"0.5602083",
"0.55531013",
"0.5536773",
"0.5528329",
"0.5525825",... | 0.650278 | 0 |
Input method for tournament description. | def input_desc():
desc = input("Entrez ici les remarques générales du directeur du tournoi: ")
return desc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_tournament_input_msg(self) -> Dict[str, Tuple[str, Any]]:\n return {\n \"name\": (\"Nom du tournoi : \", str),\n \"location\": (\"Lieu du tournoi : \", str),\n \"tournament_date\": (\"Date du tournoi (format 29-01-2021) : \", parse),\n \"description\"... | [
"0.6417912",
"0.63494045",
"0.6014696",
"0.59734625",
"0.586549",
"0.58063555",
"0.58063555",
"0.58063555",
"0.58063555",
"0.58063555",
"0.5730077",
"0.570926",
"0.57062113",
"0.5657488",
"0.56428605",
"0.56036377",
"0.557573",
"0.55637157",
"0.5539051",
"0.5515421",
"0.55118... | 0.6404588 | 1 |
Input method for player sex. | def input_player_sex(self):
sex_list = ['m', 'f', 'a']
try:
sex = input("Entrez le sexe du joueur ('M' pour masculin, 'F' pour féminin, 'A' pour autre): ")
if sex.lower() in sex_list:
return sex.capitalize()
else:
raise ValueErro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sex(sex):\n sex_m, sex_w = 0, 0\n if sex == \"w\":\n sex_w = 1\n if sex == \"m\":\n sex_m = 1\n\n return sex_m, sex_w",
"def UserInput(self, username, userinput):\n pass",
"def execute_for_command(self, skill_input: SkillInput, services: AssistantServicesBase):\n ... | [
"0.59579897",
"0.5946485",
"0.56905836",
"0.5646837",
"0.5630445",
"0.5623256",
"0.5613438",
"0.5593712",
"0.5489062",
"0.5480114",
"0.54634833",
"0.54432166",
"0.54362476",
"0.54252106",
"0.5405257",
"0.5344152",
"0.53393686",
"0.5334792",
"0.5324727",
"0.5307815",
"0.527865... | 0.7758753 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.