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 |
|---|---|---|---|---|---|---|
Update `probabilities` such that each probability distribution is normalized (i.e., sums to 1, with relative proportions the same). | def normalize(probabilities):
for person in probabilities:
# normalize the "gene"
geneSum = probabilities[person]["gene"][0] + probabilities[person]["gene"][1] + probabilities[person]["gene"][2]
for i in range(3):
probabilities[person]["gene"][i] /= geneSum
# normalize ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(init_probs):\n total_prob = sum(init_probs)\n if total_prob > 0. + InferenceUtils._eps:\n for idx in range(len(init_probs)):\n init_probs[idx] = init_probs[idx] / total_prob\n\n # TODO: check refactor > do we have to return distrib with new insta... | [
"0.7348318",
"0.68965816",
"0.68523186",
"0.67245287",
"0.65878546",
"0.6497214",
"0.63326037",
"0.61899316",
"0.6167956",
"0.60946774",
"0.6094176",
"0.6080334",
"0.6080117",
"0.60709256",
"0.60655546",
"0.5976193",
"0.5956363",
"0.59385234",
"0.59376335",
"0.5935575",
"0.59... | 0.7671539 | 0 |
Returns wether the code is currently in the runtime or building phase | def is_runtime_phase():
return os.getenv('FAIRING_RUNTIME', None) != None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_runtime(self):\n\n return self.is_valid_platform() and self['ENVIRONMENT']",
"def has_compiled(self, phase='predict'):\n return self._graph_executor.has_compiled(phase)",
"def is_devel(self):\r\n\r\n return self.is_debug()",
"def in_build(self):\n\n return self.is_valid_pla... | [
"0.6960687",
"0.6873371",
"0.67680323",
"0.66959435",
"0.64917874",
"0.64917874",
"0.6448313",
"0.6100761",
"0.605261",
"0.6036466",
"0.60267997",
"0.6004312",
"0.60020846",
"0.59926885",
"0.5991379",
"0.59727997",
"0.5934243",
"0.59249496",
"0.59081984",
"0.59026945",
"0.590... | 0.73991734 | 0 |
Opens a URI without using a proxy and reads all data from it. | def _ReadNoProxy(uri):
return urllib2.build_opener(urllib2.ProxyHandler({})).open(
urllib2.Request(uri), timeout=1).read() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(self) -> None:\n\n self.r = urlopen(self.url(), timeout=self.TIMEOUT)",
"def open(self, fullurl, data=None, method=None):\n fullurl = unwrap(toBytes(fullurl))\n # percent encode url, fixing lame server errors for e.g, like space\n # within url paths.\n fullurl = quote(... | [
"0.63884306",
"0.62678653",
"0.62050414",
"0.5982591",
"0.59400105",
"0.59224564",
"0.58880776",
"0.5879283",
"0.58296996",
"0.5797411",
"0.57586926",
"0.5745863",
"0.574048",
"0.5739027",
"0.5690802",
"0.56879985",
"0.55849826",
"0.5552425",
"0.5544786",
"0.5528398",
"0.5522... | 0.6911702 | 0 |
Get the default service account for the host GCE instance. Fetches GOOGLE_GCE_METADATA_DEFAULT_ACCOUNT_URI and returns its contents. | def DefaultAccount(self):
if not self.connected:
return None
try:
return _ReadNoProxy(GOOGLE_GCE_METADATA_DEFAULT_ACCOUNT_URI)
except urllib2.HTTPError as e:
if e.code == 404:
return None
raise MetadataServerException(e)
except urllib2.URLError as e:
raise CannotC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_credentials(scopes):\n credentials, _ = google.auth.default(scopes=scopes)\n return credentials",
"def get_service_account_name():\n # Get the credential\n if os.path.exists(os.getenv(\"GCP_AUTOMATION_CONFIG\")):\n credential_location = os.getenv(\"GCP_AUTOMATION_CONFIG\")\n ... | [
"0.6467155",
"0.61172706",
"0.60549235",
"0.60172904",
"0.5775506",
"0.574537",
"0.574537",
"0.57407176",
"0.5729527",
"0.56457466",
"0.56095725",
"0.551219",
"0.5442747",
"0.5438566",
"0.5413697",
"0.5372204",
"0.5372204",
"0.5372204",
"0.5355967",
"0.53399086",
"0.53399086"... | 0.8137239 | 0 |
Get the project that owns the current GCE instance. Fetches GOOGLE_GCE_METADATA_PROJECT_URI and returns its contents. | def Project(self):
if not self.connected:
return None
try:
return _ReadNoProxy(GOOGLE_GCE_METADATA_PROJECT_URI)
except urllib2.HTTPError as e:
raise MetadataServerException(e)
except urllib2.URLError as e:
raise CannotConnectToMetadataServerException(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetProject(self):\n errors = []\n objects = list(request_helper.MakeRequests(\n requests=[(self.compute.projects,\n 'Get',\n self.messages.ComputeProjectsGetRequest(\n project=properties.VALUES.core.project.Get(\n ... | [
"0.69035757",
"0.6895152",
"0.67446786",
"0.6714865",
"0.6683495",
"0.66086197",
"0.6555879",
"0.6526271",
"0.64918816",
"0.64403236",
"0.64297616",
"0.6398177",
"0.6322898",
"0.63193315",
"0.63193315",
"0.63193315",
"0.63193315",
"0.63193315",
"0.63193315",
"0.6280249",
"0.6... | 0.8417992 | 0 |
Get the list of service accounts available from the metadata server. | def Accounts(self):
if not self.connected:
return []
try:
accounts_listing = _ReadNoProxy(
GOOGLE_GCE_METADATA_ACCOUNTS_URI + '/')
accounts_lines = accounts_listing.split()
accounts = []
for account_line in accounts_lines:
account = account_line.strip('/')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_accounts(self) -> Sequence[str]:\n return pulumi.get(self, \"service_accounts\")",
"def list_accounts(self):\n pass",
"def get_accounts(self):\r\n return self._accounts",
"def get_accounts(self):\n return self.accounts",
"def get_accounts(self):\n\n\t\treturn self.__... | [
"0.7727759",
"0.7191721",
"0.71418333",
"0.7078873",
"0.70322686",
"0.70096487",
"0.6996888",
"0.6991004",
"0.69906896",
"0.6844258",
"0.68132955",
"0.68014175",
"0.67935866",
"0.67425555",
"0.6742149",
"0.6738644",
"0.67116845",
"0.66877526",
"0.66752905",
"0.6649459",
"0.66... | 0.7544532 | 1 |
Get a singleton that fetches GCE metadata. | def Metadata():
def _CreateMetadata(unused_none):
global _metadata
if not _metadata:
_metadata = _GCEMetadata()
_metadata_lock.lock(function=_CreateMetadata, argument=None)
_metadata_lock.unlock()
return _metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_metadata(self) -> Metadata:\n manifest = self._get_manifest()\n\n return Metadata(**manifest[\"metadata\"])",
"def get(self):\n return self._metadata",
"def get_metadata(self):\n return self.manager.get_metadata(self)",
"def get_instance():\r\n try:\r\n module_i... | [
"0.64651906",
"0.60670877",
"0.60101914",
"0.6000224",
"0.5893446",
"0.58755267",
"0.58519554",
"0.5821281",
"0.5796832",
"0.57793313",
"0.5768779",
"0.57570475",
"0.5755814",
"0.5720616",
"0.5706986",
"0.5677855",
"0.56741625",
"0.5664571",
"0.5660234",
"0.56291467",
"0.5610... | 0.7494278 | 0 |
Returns the base path of the Access Zone. | def get_zone_base_path(self, access_zone):
try:
zone_path = (self.zone_summary_api.
get_zones_summary_zone(access_zone)).to_dict()
return zone_path['summary']['path']
except Exception as e:
error_msg = self.determine_error(error_obj=e)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_path(self):\n return self._base_path",
"def get_zonepath(self, refresh=False):\n return self.get_attr(ZONE_ENTRY['ZROOT'], refresh)",
"def get_base_path(self) -> str:\n raise NotImplementedError()",
"def base_path(self):\n return Path(self.path)",
"def base_path(self):\... | [
"0.7329515",
"0.7076482",
"0.70471233",
"0.69008577",
"0.6893322",
"0.6753992",
"0.6714823",
"0.6711664",
"0.6498454",
"0.6451775",
"0.6409097",
"0.63424486",
"0.6325115",
"0.63007265",
"0.6269372",
"0.62501705",
"0.61877066",
"0.6175071",
"0.61656606",
"0.6154836",
"0.615305... | 0.8123169 | 0 |
Use this command to edit a task. $ trackmywork edit 2 m "Changing the task message" t 3h l "" | def command(task_id, message, time, project, category, links):
task = storage.get_by_id(task_id)
if not task:
click.echo(f"Task {task_id} not found.")
sys.exit(1)
new_values = {
'message': message,
'time': time,
'project': project,
'category': category,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit(tid, tag, description, title, priority, end):\n try:\n manager = Actions()\n if tid is None:\n raise ValueError(\"Input tid!\")\n manager.edit_task(tid,\n title=title,\n tag=tag,\n priority=priori... | [
"0.76266325",
"0.7618207",
"0.7132559",
"0.6808483",
"0.67945284",
"0.6653009",
"0.6628986",
"0.6628269",
"0.65990484",
"0.6581324",
"0.6560869",
"0.6440934",
"0.63683903",
"0.63630384",
"0.6324294",
"0.6316813",
"0.62791055",
"0.62666583",
"0.6233657",
"0.6183895",
"0.618219... | 0.79256684 | 0 |
A dict of x, y, width and height of the trimmed area within the original image. | def sprite_source_size(self):
if self.trimmed:
return {
'x': self.trim_offsets[0],
'y': self.trim_offsets[1],
'w': self.trim_offsets[2] - self.trim_offsets[0],
'h': self.trim_offsets[3] - self.trim_offsets[1],
}
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_image(image):\n bbox = image.getbbox()\n return image.crop(bbox)",
"def crop(self, image):\n\t\treturn image.copy()[self.ymin:self.ymax,self.xmin:self.xmax]",
"def crop_bounding_box(im, x, y, w, h):\n return im[y:y+h, x:x+w]",
"def as_bounds(self) -> Dict[str, float]:\n return {\... | [
"0.63789374",
"0.6179232",
"0.6122598",
"0.60189074",
"0.5899477",
"0.5826279",
"0.57770544",
"0.57470673",
"0.57237035",
"0.5674101",
"0.5668785",
"0.5613715",
"0.56072557",
"0.55902934",
"0.5586875",
"0.55865693",
"0.558306",
"0.55677956",
"0.5558475",
"0.5552691",
"0.55526... | 0.6814099 | 0 |
The sum of width and height. Note that this is not ACTUALLY the circumference! | def circumference(self):
return self.width + self.height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculatearea(self):\r\n return self.width * self.height",
"def calculateperimeter(self):\r\n return (self.width * 2) + (self.height * 2)",
"def perimeter(self):\n return 2 * (self.height + self.width)",
"def perimeter(self):\n\t\treturn 2 * (self.width + self.height)",
"def perime... | [
"0.71800035",
"0.7149736",
"0.71027356",
"0.7078878",
"0.702873",
"0.6946088",
"0.6882668",
"0.6881731",
"0.68220913",
"0.68220913",
"0.6779442",
"0.6777669",
"0.6764908",
"0.6764908",
"0.6764908",
"0.6764908",
"0.6764908",
"0.6764908",
"0.6764908",
"0.6764908",
"0.67477906",... | 0.76774967 | 0 |
A key function for sorting Sprites by their width attribute. | def sort_width(sprite):
return sprite.width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_height(sprite):\n return sprite.height",
"def sort_area(sprite):\n return sprite.area",
"def sort_key(self):\n ...",
"def sort(self, key_func):\n pass",
"def sort_name(sprite):\n return sprite.name",
"def sort_sprites(sprites, sort_type):\n sort_func = globals()['sort_'... | [
"0.6224015",
"0.62071264",
"0.58886963",
"0.58881176",
"0.5798669",
"0.56780237",
"0.5575542",
"0.55297107",
"0.55194455",
"0.5511433",
"0.54910177",
"0.5479103",
"0.5464517",
"0.53186625",
"0.52034795",
"0.5186224",
"0.51494133",
"0.5060388",
"0.5024787",
"0.5022377",
"0.500... | 0.7824869 | 0 |
A key function for sorting Sprites by their height attribute. | def sort_height(sprite):
return sprite.height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_width(sprite):\n return sprite.width",
"def sort_area(sprite):\n return sprite.area",
"def sort(self, key_func):\n pass",
"def sort_maxside(sprite):\n return max(sprite.width, sprite.height)",
"def _get_heightmap_key(self, p1: Point3D, p2: Point3D, p3: Point3D) -> Hashable:\n ... | [
"0.661695",
"0.6535336",
"0.5951767",
"0.579211",
"0.57219535",
"0.5710713",
"0.5638926",
"0.56159556",
"0.5582387",
"0.54221755",
"0.5271681",
"0.5271681",
"0.5271681",
"0.5250129",
"0.52144355",
"0.51565444",
"0.5136759",
"0.51224595",
"0.51046467",
"0.50399035",
"0.5033076... | 0.7621063 | 0 |
A key function for sorting Sprites by their name attribute. | def sort_name(sprite):
return sprite.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_key(self):\n ...",
"def sort(self, key_func):\n pass",
"def sort_sprites(sprites, sort_type):\n sort_func = globals()['sort_' + sort_type]\n return sorted(sprites, key=sort_func, reverse=sort_type != 'name')",
"def get_sort_key(self) -> str:\n return self.name",
"def _gr... | [
"0.6631027",
"0.647035",
"0.64167017",
"0.62548167",
"0.61942005",
"0.61473954",
"0.6139011",
"0.5985338",
"0.5959501",
"0.5932297",
"0.59291553",
"0.58704185",
"0.58239174",
"0.581752",
"0.5782962",
"0.5782962",
"0.5645406",
"0.56444883",
"0.5636112",
"0.56198025",
"0.561727... | 0.7530825 | 0 |
A key function for sorting Sprites by their area property. | def sort_area(sprite):
return sprite.area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self, key_func):\n pass",
"def sort_key(self):\n ...",
"def sort_sprites(sprites, sort_type):\n sort_func = globals()['sort_' + sort_type]\n return sorted(sprites, key=sort_func, reverse=sort_type != 'name')",
"def sortRegioni(tupla):\n\t\n\treturn int(tupla[0])",
"def sort_wid... | [
"0.6032342",
"0.58830875",
"0.5752889",
"0.5739861",
"0.5715908",
"0.5654399",
"0.5630161",
"0.56174624",
"0.55439436",
"0.5515432",
"0.5481578",
"0.5455596",
"0.53962964",
"0.5306955",
"0.5306776",
"0.528841",
"0.5274715",
"0.5272779",
"0.52226514",
"0.52061397",
"0.5150963"... | 0.7870696 | 0 |
A key function for sorting Sprites by their circumference property. | def sort_circumference(sprite):
return sprite.circumference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(o):\n return hypot((x - o.x), (y - o.y))",
"def sort_area(sprite):\n return sprite.area",
"def sort_width(sprite):\n return sprite.width",
"def sort(self, key_func):\n pass",
"def test_sorting():\n circles = [Circle(i) for i in range(10, 1, -1)] \n sorted_circles = sorted(... | [
"0.63177353",
"0.5916227",
"0.5636585",
"0.5474369",
"0.54349333",
"0.5429711",
"0.53461033",
"0.5339276",
"0.5286037",
"0.52746147",
"0.51721734",
"0.5159244",
"0.5094792",
"0.5085343",
"0.50837994",
"0.5022103",
"0.50191337",
"0.4900456",
"0.4859315",
"0.48354027",
"0.47914... | 0.73712957 | 0 |
A key function for sorting Sprites by the longest of their two sides. | def sort_maxside(sprite):
return max(sprite.width, sprite.height) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_key(self):\n longest = None\n for key in self:\n if not longest or len(key) > len(longest):\n longest = key\n return longest",
"def sort_width(sprite):\n return sprite.width",
"def sort_area(sprite):\n return sprite.area",
"def longest_name():\... | [
"0.6207665",
"0.6047913",
"0.60159534",
"0.59955096",
"0.5969164",
"0.58554727",
"0.5801387",
"0.57013625",
"0.5664634",
"0.564134",
"0.5636362",
"0.560898",
"0.559832",
"0.5524619",
"0.54948455",
"0.5493564",
"0.5433914",
"0.5429683",
"0.5356947",
"0.53369766",
"0.5325361",
... | 0.64841 | 0 |
A utility function for sorting a list of Sprite instances. sort_sprite should be one of 'width', 'height', 'name', 'area', 'circumference', or 'maxside' | def sort_sprites(sprites, sort_type):
sort_func = globals()['sort_' + sort_type]
return sorted(sprites, key=sort_func, reverse=sort_type != 'name') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_name(sprite):\n return sprite.name",
"def sort_area(sprite):\n return sprite.area",
"def sort_width(sprite):\n return sprite.width",
"def sort_height(sprite):\n return sprite.height",
"def sort_maxside(sprite):\n return max(sprite.width, sprite.height)",
"def sort_circumference(sp... | [
"0.726147",
"0.71374565",
"0.69908696",
"0.6874966",
"0.64026535",
"0.59863085",
"0.5448864",
"0.540087",
"0.5330147",
"0.5279491",
"0.5238275",
"0.5176354",
"0.5150514",
"0.5124298",
"0.51124424",
"0.51010805",
"0.51010805",
"0.50985247",
"0.5098512",
"0.5050989",
"0.5047450... | 0.8211479 | 0 |
Return a Layout containing the provided sprites laid out linearly horizontally. | def layout_horizontal(sprites):
result = Layout()
for sprite in sprites:
result.sprite_positions.append(SpritePosition(sprite, result.width, 0))
result.width += sprite.width
result.height = max(result.height, sprite.height)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_vertical(sprites):\n result = Layout()\n for sprite in sprites:\n result.sprite_positions.append(\n SpritePosition(sprite, 0, result.height))\n result.height += sprite.height\n result.width = max(result.width, sprite.width)\n return result",
"def render(\n x... | [
"0.76347125",
"0.56856465",
"0.55034906",
"0.5402938",
"0.53874",
"0.53240436",
"0.5251552",
"0.5226913",
"0.51918864",
"0.518357",
"0.51514846",
"0.51079714",
"0.50302404",
"0.5003588",
"0.49906033",
"0.49579713",
"0.49318057",
"0.4931599",
"0.48837286",
"0.48821652",
"0.488... | 0.87087053 | 0 |
Return a Layout containing the provided sprites laid out linearly vertically. | def layout_vertical(sprites):
result = Layout()
for sprite in sprites:
result.sprite_positions.append(
SpritePosition(sprite, 0, result.height))
result.height += sprite.height
result.width = max(result.width, sprite.width)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_horizontal(sprites):\n result = Layout()\n for sprite in sprites:\n result.sprite_positions.append(SpritePosition(sprite, result.width, 0))\n result.width += sprite.width\n result.height = max(result.height, sprite.height)\n return result",
"def render(\n xs: np.array,... | [
"0.7490819",
"0.5380607",
"0.5287634",
"0.5109913",
"0.5051685",
"0.5043355",
"0.5035227",
"0.5022621",
"0.499461",
"0.49869573",
"0.49815091",
"0.49762812",
"0.49273208",
"0.4921848",
"0.49192566",
"0.489987",
"0.4887431",
"0.48632923",
"0.48544025",
"0.48367232",
"0.4823511... | 0.8863264 | 0 |
Run the Kfold cross validation. model is a blank version of the model you want to train, which will be copied at each CV iteration | def train_kfold(self, blank_model, model_params, dataset, batch_size, drop_last_batch=True):
kfold = StratifiedKFold(n_splits=self.cv, shuffle=True)
best_val_loss = 999999
best_cv = 0
best_model = None
for i, (train_idx, test_idx) in enumerate(kfold.split(dataset, dataset.targets... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_validation(exp_name):\n click.echo(\"Mode: Cross-validation.\")\n # defaults = get_defaults()\n\n # fitted_model_filename = add_extension(fitted_model_filename)\n\n # derive final path for fitted model as base output path for fitted models + model filename\n # fitted_model_path = os.path.j... | [
"0.758794",
"0.7510445",
"0.73646635",
"0.7363736",
"0.7361118",
"0.72702056",
"0.7174628",
"0.7130998",
"0.696685",
"0.69646007",
"0.69556",
"0.693936",
"0.692508",
"0.68650997",
"0.6853345",
"0.6849685",
"0.68461406",
"0.68451124",
"0.6834828",
"0.6817886",
"0.6797188",
"... | 0.7932286 | 0 |
Checks if the sentiment for our stockName is positive or negative, returns True if majority of valid tweets have positive sentiment | def stockSentiment(stockName, numTweets=100):
listOfTweets = user.search(stockName, count=numTweets)
threshold = posSentTweet = negSentTweet = 0
for tweet in listOfTweets:
analysis = TextBlob(tweet.text)
if analysis.sentiment.polarity >= threshold:
posSentTweet = posSentTweet +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_positive(text) :\n r = requests.post(\"http://text-processing.com/api/sentiment/\", data={'text': text})\n return r.json()['probability']['pos'] > r.json()['probability']['neg']",
"def test(self, tweets, without_neutral=True):\n correct = 0\n total = 0\n for tweet in tweets:\n ... | [
"0.7007031",
"0.6616565",
"0.6460929",
"0.63501424",
"0.62836975",
"0.61827385",
"0.6182005",
"0.61268514",
"0.60830224",
"0.60300577",
"0.6004018",
"0.59769857",
"0.5955943",
"0.59269845",
"0.59109956",
"0.5867363",
"0.58236325",
"0.57529086",
"0.5736752",
"0.56542516",
"0.5... | 0.80119866 | 0 |
Setup the Bluetooth Speaker platform. | def setup_platform(hass, config, add_devices, discovery_info=None):
name = config.get(CONF_NAME)
address = config.get(CONF_ADDRESS)
volume = float(config.get(CONF_VOLUME))
pre_silence_duration = float(config.get(CONF_PRE_SILENCE_DURATION))
post_silence_duration = float(config.get(CONF_POST_SILENCE_D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n try:\n print(\"Initializing driver\")\n pcms = alsaaudio.pcms()\n mixers = alsaaudio.mixers()\n print(f'Available PCMs: {pcms}')\n print(f'Available Mixers: {mixers}')\n self._device = alsaaudio.PCM(device=self._dev_name)\n... | [
"0.5857222",
"0.58364004",
"0.57944995",
"0.5762191",
"0.57366234",
"0.5734976",
"0.5726399",
"0.56645304",
"0.5656306",
"0.56462806",
"0.5613873",
"0.5611077",
"0.5602112",
"0.55981094",
"0.5579357",
"0.557577",
"0.5571606",
"0.55591726",
"0.5554699",
"0.5537336",
"0.5531611... | 0.7132496 | 0 |
return (begin, end) tuple which contains linenumbers of start/stop of comment area. | def commentsStartStopLineNmbr(data):
begin = 0
end = 0
i = 0
if data is None or len(data) < 1:
return None
while i < len(data):
if "<table class=\"CMheadingBar\"" in data[i]:
if begin is 0:
begin = i
else:
end = i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_range(self) -> Tuple[int, int]:\n if self._line_range is None:\n node_extent = self.node.extent\n comment_extent = self.node.comment_extent\n if comment_extent.start.file is None:\n comment_extent = node_extent\n\n self._line_range = (\n ... | [
"0.69204915",
"0.61163014",
"0.6087544",
"0.60657454",
"0.59917873",
"0.5966549",
"0.5957662",
"0.5908033",
"0.5874553",
"0.5856955",
"0.58159626",
"0.5809588",
"0.57954884",
"0.57809764",
"0.57749593",
"0.57746506",
"0.57473797",
"0.56913483",
"0.5633429",
"0.5627474",
"0.56... | 0.7108393 | 0 |
Parse comments from site | def parseComments(data):
global comments
reviewBegins = '<div style="margin-left:0.5em;">'
reviewEnds = '<div style="padding-top: 10px; clear: both; width: 100%;">'
stars_line = 'margin-right:5px;'
stars = re.compile('\d+.\d+ out of 5 stars')
header_line = '<span style="vertical-align:middle;"'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_comments_html(advertise: Dict[str, Any]) -> Optional[List[str]]:\n if \"comments_html\" in advertise.keys():\n\n filtred_comments: str = advertise[\"comments_html\"][200::]\n\n tmp: List[str] = re.split(\"[ \\n\\t]{2,}\", filtred_comments)\n if '' in tmp:\n ... | [
"0.70923054",
"0.6858415",
"0.6827713",
"0.66849715",
"0.64667034",
"0.64621407",
"0.64451265",
"0.629178",
"0.6278752",
"0.62266237",
"0.6181161",
"0.6092758",
"0.6089912",
"0.60620606",
"0.6055307",
"0.6054427",
"0.6050955",
"0.60060996",
"0.60034513",
"0.59695345",
"0.5960... | 0.70183945 | 1 |
Parses the response content to pull errors. Child classes should override this method based on what the errors in the XML response body look like. They can choose to look at the 'ack', 'Errors', 'errorMessage' or whatever other fields the service returns. the implementation below is the original code that was part of e... | def _get_resp_body_errors(self):
if self._resp_body_errors and len(self._resp_body_errors) > 0:
return self._resp_body_errors
errors = []
warnings = []
resp_codes = []
if self.verb is None:
return errors
dom = self.response.dom()
if dom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __parse_response(self, response_text):\n root = etree.fromstring(response_text)\n namespace = re.search('{(.*)}', root.tag).group(1)\n status_path = '{%s}Status' % namespace\n status = int(root.findtext(status_path))\n response = None\n if status != 0:\n res... | [
"0.71550524",
"0.69809824",
"0.68810725",
"0.67953825",
"0.6791895",
"0.6750196",
"0.6719506",
"0.66831756",
"0.65668875",
"0.6557811",
"0.65548986",
"0.65261036",
"0.6501146",
"0.64835584",
"0.6470674",
"0.64509344",
"0.6349157",
"0.63469356",
"0.6333514",
"0.63147753",
"0.6... | 0.7791317 | 0 |
Initialize all necessary data needed to perform the rule check. Child classes that need to save some context data should override this method, and create the data structures they need in order to perform their checks, and save this data in self as attributes. To avoid attribute collisions, attribute names starting with... | def init_context_data(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.data = None\n self.decisionTree = {}\n self.enClass = 0\n self.nlClass = 0\n self.listAttributes = [\"Contains-het\", \"Contains-de\", \"Contains-een\", \"Contains-en/aan\", \"Contains-ij\", \"wordLength14\",\n \"Contains-a/... | [
"0.5826407",
"0.5806933",
"0.5788446",
"0.5787996",
"0.5787823",
"0.57581276",
"0.5739409",
"0.5691293",
"0.5691293",
"0.5691293",
"0.5691293",
"0.5691293",
"0.5664666",
"0.5664666",
"0.5664666",
"0.5654279",
"0.5651187",
"0.56497914",
"0.5635051",
"0.56341904",
"0.56249326",... | 0.6084732 | 0 |
Test calling the API with invalid hub parameters. | def test_execute_invalid_api_parameters(self):
quantum_program = self._get_quantum_program()
# Invoke with hub, group and project parameters.
FAKE_QE_HUB = 'HUB'
FAKE_QE_GROUP = 'GROUP'
FAKE_QE_PROJECT = 'PROJECT'
quantum_program.set_api(QE_TOKEN, QE_URL,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_hubs_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.hubs(-1)",
"def test_invalid_request(self):\n response = self.client.post(telemetry_url)\n self.assertEqual(400, response.status_code)\n\n response = self.client.post(telemetry_url, {\n ... | [
"0.7026234",
"0.66320807",
"0.66060495",
"0.660001",
"0.6568346",
"0.6549651",
"0.6541933",
"0.65326697",
"0.653062",
"0.6522051",
"0.6499948",
"0.6408988",
"0.6408759",
"0.6399277",
"0.63575727",
"0.62974006",
"0.6244453",
"0.6229556",
"0.62143123",
"0.62074286",
"0.6193638"... | 0.6960295 | 1 |
Test calling the API with modified hub parameters. | def test_execute_api_modified_parameters(self):
quantum_program = self._get_quantum_program()
# Invoke with hub, group and project parameters.
FAKE_QE_HUB = 'HUB'
FAKE_QE_GROUP = 'GROUP'
FAKE_QE_PROJECT = 'PROJECT'
quantum_program.set_api(QE_TOKEN, QE_URL,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_calls_parameters(self):\n quantum_program = self._get_quantum_program()\n\n # Invoke with hub, group and project parameters.\n quantum_program.set_api(QE_TOKEN, QE_URL, QE_HUB, QE_GROUP, QE_PROJECT)\n\n self.log.info(quantum_program.online_backends())\n self.log.info... | [
"0.72585666",
"0.658508",
"0.6462637",
"0.6403695",
"0.6275603",
"0.62741715",
"0.6166477",
"0.59010184",
"0.5899192",
"0.5890859",
"0.58898914",
"0.5822162",
"0.5803467",
"0.5787644",
"0.57832736",
"0.577041",
"0.5768365",
"0.5740819",
"0.5731347",
"0.57308006",
"0.57163054"... | 0.6671979 | 1 |
Test calling some endpoints of the API with no hub parameters. | def test_api_calls_no_parameters(self):
quantum_program = self._get_quantum_program()
# Invoke with no hub, group or project parameters.
quantum_program.set_api(QE_TOKEN, QE_URL)
self.log.info(quantum_program.online_backends())
self.log.info(quantum_program.get_backend_paramete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_request(self):\n urls = [\"https://api.omniture.com/admin/1.4/rest/\",\n \"https://api2.omniture.com/admin/1.4/rest/\",\n \"https://api3.omniture.com/admin/1.4/rest/\",\n \"https://api4.omniture.com/admin/1.4/rest/\",\n \"https://ap... | [
"0.7140949",
"0.65379906",
"0.64931345",
"0.63607204",
"0.63213974",
"0.6265517",
"0.6238395",
"0.62368876",
"0.6218834",
"0.6218165",
"0.6208521",
"0.61820996",
"0.61808807",
"0.6177925",
"0.6150597",
"0.614194",
"0.6130757",
"0.612733",
"0.6124778",
"0.6115707",
"0.6114818"... | 0.70893246 | 1 |
Test calling some endpoints of the API with hub parameters. | def test_api_calls_parameters(self):
quantum_program = self._get_quantum_program()
# Invoke with hub, group and project parameters.
quantum_program.set_api(QE_TOKEN, QE_URL, QE_HUB, QE_GROUP, QE_PROJECT)
self.log.info(quantum_program.online_backends())
self.log.info(quantum_pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_request(self):\n urls = [\"https://api.omniture.com/admin/1.4/rest/\",\n \"https://api2.omniture.com/admin/1.4/rest/\",\n \"https://api3.omniture.com/admin/1.4/rest/\",\n \"https://api4.omniture.com/admin/1.4/rest/\",\n \"https://ap... | [
"0.6746003",
"0.6493288",
"0.63161945",
"0.6263593",
"0.6245531",
"0.6164344",
"0.61339265",
"0.6113354",
"0.61105967",
"0.60806125",
"0.60394204",
"0.6035437",
"0.6033574",
"0.60083216",
"0.59718585",
"0.5939808",
"0.5932727",
"0.5923979",
"0.59126633",
"0.590975",
"0.589610... | 0.67583245 | 0 |
The policy is the best action in the given state according to the values computed by value iteration. You may break ties any way you see fit. Note that if there are no legal actions, which is the case at the terminal state, you should return None. | def getPolicy(self, state):
"*** YOUR CODE HERE ***"
# OUR CODE HERE
possibleActions = self.mdp.getPossibleActions(state)
#checking for terminal state (no possible actions)
if len(possibleActions) is 0:
return None
#attempt at using the Counter
eValsActions = util.Counter()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computeActionFromQValues(self, state):\n actions = self.getLegalActions(state)\n if len(actions) == 0:\n return None\n qVals = [self.getQValue(state, a) for a in actions]\n bestActions = []\n bestVal = max(qVals)\n ... | [
"0.76518464",
"0.7514951",
"0.750535",
"0.7422988",
"0.7374947",
"0.7333288",
"0.73329633",
"0.7313349",
"0.727814",
"0.72609013",
"0.7233381",
"0.7125327",
"0.70963556",
"0.70804584",
"0.70765764",
"0.70520097",
"0.7025357",
"0.70238316",
"0.7017081",
"0.70063794",
"0.700637... | 0.7954697 | 0 |
Loads weights from one of the waifu2x JSON files, i.e. waifu2x/models/vgg_7/art/noise0_model.json data (passed in) is assumed to be the output of json.load or some similar on such a file | def load_waifu2x_json(self, data: list):
self.conv1.load_waifu2x_json(data[0])
self.conv2.load_waifu2x_json(data[1])
self.conv3.load_waifu2x_json(data[2])
self.conv4.load_waifu2x_json(data[3])
self.conv5.load_waifu2x_json(data[4])
self.conv6.load_waifu2x_json(data[5])
self.conv7.load_waifu2x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()",
"def load_weight(model):\n file = h5py.File(WEIGHT_SAVE, 'r')\n weight = []\n for i in r... | [
"0.6488443",
"0.62604135",
"0.61644244",
"0.60816514",
"0.604148",
"0.6019102",
"0.60177386",
"0.60040563",
"0.60030246",
"0.5998064",
"0.599155",
"0.5979306",
"0.59469867",
"0.5919713",
"0.5865932",
"0.5829013",
"0.5796365",
"0.578166",
"0.5680778",
"0.5673663",
"0.56730056"... | 0.6863052 | 0 |
Generate a dict to turn punctuation into a token. | def token_lookup():
token_dict = {}
token_dict['.'] = "||Period||"
token_dict[','] = "||Comma||"
token_dict['"'] = "||Quotation_Mark||"
token_dict[';'] = "||Semicolon||"
token_dict['!'] = "||Exclamation_Mark||"
token_dict['?'] = "||Question_Mark||"
token_dict['('] = "||Left_Parentheses||... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_lookup():\n token_dict = {'.':'||Period||', ', ':'||Comma||', '\"':'||Quotation_Mark||', ';':'||Semicolon||',\n '!':'||Exclamation_mark||', '?':'||Question_mark||', '(':'||Left_Parentheses||',\n ')':'||Right_Parentheses||', '--':'||Dash||', '\\n':'||Return||'}\n re... | [
"0.66179246",
"0.6473263",
"0.63673395",
"0.63541335",
"0.6318267",
"0.6195351",
"0.6170302",
"0.61027676",
"0.61009026",
"0.6056571",
"0.583608",
"0.580536",
"0.57960415",
"0.5735746",
"0.5717652",
"0.5713248",
"0.5703686",
"0.56706595",
"0.56492156",
"0.56279296",
"0.562042... | 0.6736538 | 0 |
This is an endtoend test of EPSFBuilder on a simulated image. | def test_epsf_build(self):
size = 25
oversampling = 4.
stars = extract_stars(self.nddata, self.init_stars, size=size)
epsf_builder = EPSFBuilder(oversampling=oversampling, maxiters=20,
progress_bar=False)
epsf, fitted_stars = epsf_builder(stars... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expose_test(self):\n with self.lock:\n self.dark = 1\n self.tstart = time.time()\n self.timestamp = time.strftime(\"%Y-%m-%dT%H:%M:%S\", time.localtime(self.tstart))\n imagesize = (self.expArea[3] - self.expArea[1],\n self.expArea[2] - ... | [
"0.6532734",
"0.65219575",
"0.61546344",
"0.6055118",
"0.59790444",
"0.5955276",
"0.58926064",
"0.58453953",
"0.5843574",
"0.5825598",
"0.5800128",
"0.57825714",
"0.5774205",
"0.57699555",
"0.57476026",
"0.5737863",
"0.573536",
"0.5732193",
"0.5694142",
"0.56920683",
"0.56847... | 0.6694861 | 0 |
Test that the input fitter is an EPSFFitter instance. | def test_epsf_build_invalid_fitter(self):
with pytest.raises(TypeError):
EPSFBuilder(fitter=EPSFFitter, maxiters=3)
with pytest.raises(TypeError):
EPSFBuilder(fitter=LevMarLSQFitter(), maxiters=3)
with pytest.raises(TypeError):
EPSFBuilder(fitter=LevMarLSQF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_training_is_training_instance(self):\n self.assertIsInstance(self.weekly_training, Training)\n self.assertIsInstance(self.one_off_training, Training)",
"def test_fitters_interface(fitter):\n fitter = fitter()\n\n model = models.Gaussian1D(10, 4, 0.3)\n x = np.arange(21)\n y = m... | [
"0.58193254",
"0.576989",
"0.5444093",
"0.5416641",
"0.54027134",
"0.53487724",
"0.5334198",
"0.52976006",
"0.5282834",
"0.52802503",
"0.5256052",
"0.5253613",
"0.51621646",
"0.5144735",
"0.5130423",
"0.5122691",
"0.51144564",
"0.5113895",
"0.5088265",
"0.5082022",
"0.5029815... | 0.6341368 | 0 |
An instance of a `FitInterferometer` corresponding to the maximum log likelihood model inferred by the nonlinear search. | def max_log_likelihood_fit(self) -> FitInterferometer:
return self.analysis.fit_interferometer_via_instance_from(
instance=self.instance
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_log_likelihood_fit(self) -> ag.FitQuantity:\r\n\r\n return self.analysis.fit_quantity_for_instance(instance=self.instance)",
"def log_likelihood_function(self, instance):\r\n\r\n try:\r\n return self.fit_interferometer_for_instance(\r\n instance=instance\r\n ... | [
"0.69463223",
"0.63066924",
"0.6028813",
"0.5956261",
"0.5869772",
"0.5844398",
"0.5813573",
"0.57820946",
"0.5766396",
"0.5750532",
"0.5746389",
"0.5708685",
"0.5698256",
"0.5519008",
"0.55123526",
"0.55059314",
"0.5490913",
"0.5480697",
"0.54476845",
"0.54429275",
"0.543328... | 0.81059855 | 0 |
An instance of a `Tracer` corresponding to the maximum log likelihood model inferred by the nonlinear search. The `Tracer` is computed from the `max_log_likelihood_fit`, as this ensures that all linear light profiles are converted to normal light profiles with their `intensity` values updated. | def max_log_likelihood_tracer(self) -> Tracer:
return (
self.max_log_likelihood_fit.model_obj_linear_light_profiles_to_light_profiles
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_log_likelihood_tracer(self) -> Tracer:\r\n return self.analysis.tracer_via_instance_from(instance=self.instance)",
"def max_log_likelihood_fit(self) -> FitInterferometer:\r\n return self.analysis.fit_interferometer_via_instance_from(\r\n instance=self.instance\r\n )",
"d... | [
"0.74774915",
"0.66032386",
"0.57672596",
"0.5737945",
"0.558012",
"0.53950375",
"0.53794014",
"0.53068775",
"0.53021854",
"0.528267",
"0.5255574",
"0.5232161",
"0.5228557",
"0.5171876",
"0.5137233",
"0.5123503",
"0.510592",
"0.50647867",
"0.506299",
"0.50606036",
"0.5060061"... | 0.81920236 | 0 |
The real space mask used by this modelfit. | def real_space_mask(self) -> aa.Mask2D:
return self.max_log_likelihood_fit.dataset.real_space_mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mask(self):\n return self._mask",
"def mask(self):\n return self._mask",
"def mask(self):\n return self._mask",
"def mask(self):\n return self._mask",
"def mask(self):\n return self.mask_index",
"def medicalMask(self) -> float:\n return self._coreEstimation.m... | [
"0.71758425",
"0.71758425",
"0.71758425",
"0.71758425",
"0.6801398",
"0.67848504",
"0.6766158",
"0.65531385",
"0.65167063",
"0.64373904",
"0.6400794",
"0.6234843",
"0.6231467",
"0.61996174",
"0.61990255",
"0.61990255",
"0.61990255",
"0.6129481",
"0.60355794",
"0.60135835",
"0... | 0.820525 | 0 |
Calculate the annualised sample covariance matrix of (daily) asset returns. | def sample_cov(prices, frequency=252):
if not isinstance(prices, pd.DataFrame):
warnings.warn("prices are not in a dataframe", RuntimeWarning)
prices = pd.DataFrame(prices)
daily_returns = daily_price_returns(prices)
return daily_returns.cov() * frequency | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cov(self):\n E_x = Sample.mean(self)\n Std_x = Sample.std(self)\n cov = Std_x/E_x\n return(cov)",
"def covariance(mtrx):\r\n\r\n # Average column of matrix\r\n T = np.transpose(mtrx)\r\n ave = np.zeros(len(mtrx))\r\n mtrx = np.asarray(mtrx)\r\n\r\n if isinstance(mtr... | [
"0.61024827",
"0.60882634",
"0.60061836",
"0.60022545",
"0.5951774",
"0.5946839",
"0.5942755",
"0.593687",
"0.5928027",
"0.5898082",
"0.58764166",
"0.5865247",
"0.5839527",
"0.5812346",
"0.5749281",
"0.5738869",
"0.57069844",
"0.5693732",
"0.56880194",
"0.567809",
"0.5676851"... | 0.60892475 | 1 |
Estimate the semicovariance matrix, i.e the covariance given that the returns are less than the benchmark. .. semicov = E([min(r_i B, 0)] . [min(r_j B, 0)]) | def semicovariance(prices, benchmark=0, frequency=252):
if not isinstance(prices, pd.DataFrame):
warnings.warn("prices are not in a dataframe", RuntimeWarning)
prices = pd.DataFrame(prices)
daily_returns = daily_price_returns(prices)
drops = np.fmin(daily_returns - benchmark, 0)
return d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decomposeCov(M):\n U,s,V = linalg.svd(M)\n R = mat(U)\n if R[1,0] > 0: R = -1.*R\n if linalg.det(R) < 0:\n R[:,1] = -1.*R[:,1]\n\n S = mat(diag(s))\n return R,S",
"def sigma_from_cov(params, cov):\n rands = np.random.multivariate_normal(params, cov, 10000)\n breakdowns = -1*ran... | [
"0.6204444",
"0.5936843",
"0.58973277",
"0.5895796",
"0.58810544",
"0.58502036",
"0.5757374",
"0.57432806",
"0.57359",
"0.571641",
"0.56612056",
"0.56434214",
"0.56434214",
"0.56368524",
"0.56346697",
"0.5591559",
"0.55855596",
"0.5577742",
"0.5570818",
"0.5570406",
"0.556534... | 0.6246111 | 0 |
Calculate the minimum covariance determinant, an estimator of the covariance matrix that is more robust to noise. | def min_cov_determinant(prices, frequency=252, random_state=None):
if not isinstance(prices, pd.DataFrame):
warnings.warn("prices are not in a dataframe", RuntimeWarning)
prices = pd.DataFrame(prices)
assets = prices.columns
X = prices.pct_change().dropna(how="all")
X = np.nan_to_num(X.v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covariance(data_matrix):\n return np.asmatrix(np.cov(data_matrix, rowvar=0))",
"def cov_matrix(X, mu):\n m, n = X.shape\n X_minus_mu = X - mu\n sigma = (1 / m) * (X_minus_mu.T).dot(X_minus_mu)\n\n return sigma",
"def _mn_cov_ ( self , size = -1 , root = False ) :\n #\n if size <= 0 : s... | [
"0.6320921",
"0.63008386",
"0.62460333",
"0.6208877",
"0.6198202",
"0.61210555",
"0.6080598",
"0.606703",
"0.6057687",
"0.603914",
"0.5986421",
"0.59207064",
"0.59205496",
"0.58831877",
"0.5879957",
"0.5871225",
"0.5817185",
"0.57943755",
"0.5783197",
"0.5736097",
"0.573593",... | 0.6314101 | 1 |
Calculate the LedoitWolf shrinkage estimate. | def ledoit_wolf(self):
X = np.nan_to_num(self.X.values)
shrunk_cov, self.delta = covariance.ledoit_wolf(X)
return self.format_and_annualise(shrunk_cov) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lapse(self):\n pass",
"def sweep50W(self):\n return 25.9",
"def eady_growth_rate(data):\n N2 = ixr.brunt_vaisala(data)\n f = 2.0*omega*xruf.sin(xruf.deg2rad(data.lat))\n\n dz = ixr.domain.calculate_dz(data)\n du = ixr.domain.diff_pfull(data.ucomp, data)\n\n N = xruf.sqrt(N2.whe... | [
"0.60400766",
"0.59365445",
"0.5810836",
"0.5762381",
"0.5751515",
"0.5725546",
"0.5681198",
"0.56707937",
"0.5667252",
"0.56470907",
"0.5641813",
"0.56293994",
"0.5625519",
"0.56059796",
"0.560109",
"0.5598705",
"0.5592972",
"0.5587249",
"0.55850375",
"0.5578529",
"0.5576009... | 0.6030858 | 1 |
handle book "finish" in model | def book_finished(request, slug):
book = Book.objects.get(slug=slug)
book.finished = True
book.finished_at = timezone.datetime.today()
book.save()
messages.info(request, "Book marked as finished")
return redirect('/book/' + slug + "/") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish(self):",
"def finish(self):",
"def finish(self):\n pass",
"def finish(self):\n pass",
"def finish():\n pass",
"def finish(self) -> None:",
"def finish(self) -> None:",
"def done(self):",
"def done(self):",
"def back(self):\n self.book.back()\n self.bo... | [
"0.651837",
"0.651837",
"0.6296331",
"0.6296331",
"0.6232587",
"0.62136847",
"0.62136847",
"0.60935384",
"0.60935384",
"0.6090043",
"0.6085858",
"0.6074087",
"0.60662776",
"0.6063426",
"0.6063426",
"0.6063426",
"0.6063426",
"0.6054718",
"0.6011309",
"0.58680695",
"0.5864044",... | 0.7256532 | 0 |
Mask an item or a list of items, so it can not be searched. | def mask(self, item_or_items: Union[str, list]) -> None:
if isinstance(item_or_items, str):
self._masked_items.add(item_or_items)
elif isinstance(item_or_items, list):
for item in item_or_items:
assert isinstance(item, str)
self._masked_items.add(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_list(self, items):\n\n result_type = type(items)\n results = []\n for item in items:\n results.append(self._mask(item))\n\n return result_type(results)",
"def clear_mask(self, item_or_items: Union[str, list]) -> None:\n if isinstance(item_or_items, str) and... | [
"0.71734196",
"0.6949816",
"0.6528739",
"0.62340534",
"0.5941682",
"0.5838568",
"0.56591773",
"0.5654658",
"0.54791373",
"0.54755586",
"0.53369683",
"0.52959144",
"0.52852184",
"0.5266971",
"0.5258228",
"0.52347344",
"0.5234729",
"0.5205539",
"0.520498",
"0.51970905",
"0.5194... | 0.7793145 | 0 |
Enumerate all matched terms according to the prefix. | def enumerate_match(self, prefix: List[str]) -> List[str]:
matched_terms = []
cur = self._root
for i, token in enumerate(prefix):
if token not in cur.children:
break
cur = cur.children[token]
if cur.is_term:
item = "".join(prefi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefixSearch(self, prefix: str, _prec=\"\"):\n if prefix == \"\":\n # prefix exhasuted, match all\n yield from self.keys(_prec)\n else:\n try:\n # prefix not exhausted, traverse further\n chld = self.children[prefix[0]]\n ... | [
"0.6639456",
"0.6516617",
"0.61553776",
"0.61436945",
"0.6130935",
"0.60279405",
"0.60198647",
"0.5976832",
"0.5889858",
"0.57862514",
"0.5730367",
"0.56938714",
"0.56853217",
"0.5670705",
"0.5616336",
"0.5614195",
"0.5613336",
"0.5585791",
"0.55320466",
"0.5512074",
"0.55025... | 0.824299 | 0 |
Load all lexicons into the trie tree. | def load_lexicons(self, folder: str, file_name: str):
file_path = os.path.join(folder, file_name)
with open(file_path, "r", encoding="utf-8") as f_in:
for line in f_in.readlines():
line = line.replace("\n", "")
tokens = list(line)
self.insert(t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadTrie(self):\n for file in self._gram_files:\n trie_file = getTrieFile(os.path.basename(file), self._pickle_dir)\n with open(trie_file, 'rb') as fd:\n self._tries.append(pickle.load(fd))",
"def _add_all_to_tree(elms, trie):\n for elm in elms:\n ... | [
"0.70103794",
"0.60826737",
"0.5833833",
"0.58041453",
"0.58041453",
"0.57136434",
"0.5500055",
"0.544029",
"0.5410637",
"0.541009",
"0.53844976",
"0.53844976",
"0.53844976",
"0.53844976",
"0.5345329",
"0.5302791",
"0.52921546",
"0.52657026",
"0.5254543",
"0.524532",
"0.52442... | 0.6468606 | 1 |
Checks if scope_path is seeded and puts it into to_user. for parameters see base._editSeed() | def _editSeed(self, request, seed):
# if scope_path is present
if 'scope_path' in seed.keys():
# fill the to_user field with the scope path
seed['to_user'] = seed['scope_path'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial(self, request, *args, **kwargs):\n try:\n request.data[\"user\"] = request.auth.user\n except:\n pass\n return super(BoundToUserMixin, self).initial(request, *args, **kwargs)",
"def before_request ():\n try:\n g.user = current_user\n except Name... | [
"0.5439406",
"0.5422712",
"0.52258366",
"0.5164079",
"0.50828594",
"0.50826675",
"0.5003571",
"0.4918171",
"0.4914299",
"0.4907016",
"0.49020693",
"0.48807842",
"0.4876331",
"0.48537108",
"0.48348698",
"0.48314634",
"0.48105988",
"0.47979325",
"0.47977874",
"0.47941908",
"0.4... | 0.7813154 | 0 |
Reports the time summaries for this run. Returns a string ready to be printed out. | def reportTimes(self):
outputTime = "Global Time\t"+str(self.globalTime/ 60.0)+ \
"\nMatching Time\t" + str(self.globalMatching/ 60.0)+ \
"\nDeletion Time\t" + str(self.globalDeletion/ 60.0)+ \
"\nSubsumption Time\t" + str(self.globalSubsumption/ 60.0)+ \
"\nSelection Time\t"+str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report(self) -> str:\n return REPORT_TIMEFRAME.format(self.name,\n self.times_run,\n self.average_runtime)",
"def render_timing_report(self):\r\n report = ('Timing report\\n'\r\n '=============\\n')\r\n for ... | [
"0.76224065",
"0.7170328",
"0.6984836",
"0.6865964",
"0.68170786",
"0.6785364",
"0.6738881",
"0.6686491",
"0.6552146",
"0.65373576",
"0.6534475",
"0.6499587",
"0.64938",
"0.6482341",
"0.64753103",
"0.64553666",
"0.64503497",
"0.63862836",
"0.6380132",
"0.6368545",
"0.63616604... | 0.7542045 | 1 |
Establish a connection with the given XenServer using XMLRPC | def getXenConnection(server, logger):
server = server.lower()
#read the global 'locations' file with all information
if os.path.isfile(LOCATIONS_CONF):
try:
locationConf = ConfigObj(LOCATIONS_CONF)
#check if the server is specified
if server in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xs_connection(password, url, user='root'):\n \n conn = xmlrpclib.Server(url)\n connection = conn.session.login_with_password(user, password)\n \n if connection['Status'] == 'Success':\n token = connection['Value']\n sys.stderr.write (\"\\n Connection unique ref: %s\\n\" %token)\n ... | [
"0.6573482",
"0.6204108",
"0.5981148",
"0.59743536",
"0.589587",
"0.58379835",
"0.5822125",
"0.5776857",
"0.5766201",
"0.575728",
"0.5750974",
"0.56980014",
"0.56352746",
"0.55725807",
"0.55596584",
"0.5543674",
"0.552844",
"0.5514942",
"0.5501016",
"0.54789513",
"0.5441803",... | 0.71508884 | 0 |
Function to make a new, random ball. | def make_ball():
ball = Ball()
# Starting position of the ball.
# Take into account the ball size so we don't spawn on the edge.
ball.x = random.randrange(BALL_SIZE, SCREEN_WIDTH - BALL_SIZE)
ball.y = random.randrange(BALL_SIZE, SCREEN_HEIGHT - BALL_SIZE)
# Speed and direction of rectangle
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_ball(id):\n ball = Ball()\n\n ball.id = id\n\n # Size of the ball\n # ball.size = random.randrange(10, 30)\n ball.size = 10\n\n # Starting position of the ball.\n # Take into account the ball size so we don't spawn on the edge.\n ball.x = random.randrange(ball.size, WINDOW_WIDTH - ... | [
"0.7997919",
"0.7979903",
"0.7828779",
"0.770357",
"0.75933796",
"0.72658503",
"0.71938133",
"0.716515",
"0.6854851",
"0.6770598",
"0.66657805",
"0.6590058",
"0.6589296",
"0.65399325",
"0.65335727",
"0.6460613",
"0.64353716",
"0.6428926",
"0.6326836",
"0.63059175",
"0.6277418... | 0.85226744 | 0 |
These arguments should be helpful in tweaking the outputs to better fit the hardware or specific decoder requirements. I.e. if your hardware shapes the signal on longer/shorter intervals than the actual value, it can be adjusted here. Currently only bit_X_part_duration and packet_separation are used. `n. Performance sh... | def __init__(self,
bit_one_part_min_duration=55, # microseconds
bit_one_part_max_duration=61,
bit_one_part_duration=58,
bit_zero_part_min_duration=95,
bit_zero_part_max_duration=9900,
bit_zero_part_duration=100,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_synth_data(n):",
"def measure_all_1(n, state):\n state = state.copy()\n\n outs = ''\n for i in range(n):\n out = measure_single(n, state,\n i) # After measuring bit0, bit0 collapses. It affects the subsequent bit1 measurement, but does not affect the 1000... | [
"0.5669672",
"0.55470574",
"0.55303466",
"0.5242294",
"0.52390707",
"0.51292825",
"0.51087517",
"0.5086169",
"0.50713027",
"0.5057984",
"0.5040431",
"0.49897262",
"0.4978931",
"0.4975838",
"0.49727336",
"0.48955587",
"0.48590678",
"0.48550522",
"0.48550522",
"0.48501915",
"0.... | 0.59223044 | 0 |
delete pipeline with name is empty | def test_delete_pipeline_with_name_is_empty(self):
pipeline_name = ''
with nose.tools.assert_raises_regexp(BceClientError,
'pipeline_name can\'t be empty string'):
self.client.delete_pipeline(pipeline_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_pipeline_with_name_is_none(self):\n with nose.tools.assert_raises_regexp(ValueError,\n 'arg \"pipeline_name\" should not be None'):\n self.client.delete_pipeline(None)",
"def test_list_pipeline_delete_one(self):\n response = self.client.delete_pipeline(self... | [
"0.7732262",
"0.76229423",
"0.64914685",
"0.64858747",
"0.6106427",
"0.6091376",
"0.5948275",
"0.588508",
"0.5849737",
"0.571674",
"0.5584181",
"0.5460383",
"0.5422234",
"0.5408701",
"0.54028195",
"0.53799385",
"0.5361476",
"0.5329178",
"0.52891815",
"0.52666765",
"0.5263914"... | 0.7667069 | 1 |
delete pipeline with name is none | def test_delete_pipeline_with_name_is_none(self):
with nose.tools.assert_raises_regexp(ValueError,
'arg "pipeline_name" should not be None'):
self.client.delete_pipeline(None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_pipeline_delete_one(self):\n response = self.client.delete_pipeline(self.pipeline_name)\n nose.tools.assert_is_not_none(response)\n\n response = self.client.list_pipelines()\n exsit = False\n for pipeline in response.pipelines:\n if pipeline.pipeline_name... | [
"0.763168",
"0.71707374",
"0.66285604",
"0.64226484",
"0.6412838",
"0.63978565",
"0.61271435",
"0.59604853",
"0.5898413",
"0.58966225",
"0.5781897",
"0.5680162",
"0.5664345",
"0.561427",
"0.555643",
"0.5535108",
"0.5525379",
"0.55244136",
"0.5465732",
"0.54537594",
"0.5414938... | 0.7625798 | 1 |
Return the points of the player's hand type and the points of the largest card | def score_on_hands(cards_on_hand):
score = 0
straightCount = 0
max_card = 0
suite_dict = {}
face_dict = {}
transfer_dict = {'A':1,'J':11,'Q':12,'K':13}
card_face = []
'''Circulate the player's hand, build a list of points and a suit dict'''
for index in range(len(cards_on_ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hand_points(hand):\n points = [[]]\n branch = 1\n for card in hand:\n if not card[\"is_hidden\"]:\n if card[\"value\"].isnumeric():\n for possibility in range(branch):\n points[possibility].append(int(card[\"value\"]))\n elif card[\"value\"] == \"A\":\n for possibility in... | [
"0.7345715",
"0.6820116",
"0.6792824",
"0.67184216",
"0.6671203",
"0.6506451",
"0.648527",
"0.6457946",
"0.64482373",
"0.63901895",
"0.63653654",
"0.6356537",
"0.63349295",
"0.63116616",
"0.63022965",
"0.63019645",
"0.62861043",
"0.6262797",
"0.62608933",
"0.6257797",
"0.6253... | 0.7179427 | 1 |
init draft draft_file (str) draft_work (list) if user did not have draft.json it will return None | def __init__(self, path: str, filename: str, draft: dict) -> None:
self.draft_file = draft["fileDraft"]
self.draft_out = draft["outputDraft"]
self.pre_data = None
self.filename = filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_draft():\n with open(basedir + \"fixture/7149593_formatted.json\", \"r\") as f:\n storage.save_draft(user_id, \"bib\", \"7149593\", f.read(), \"1362044230872\")\n with open(basedir + \"some/path/\" + user_id + \"/bib/7149593\", \"r\") as f:\n json_data = json.loads(f.read())\n ... | [
"0.5677488",
"0.5291713",
"0.5274986",
"0.5244381",
"0.5198095",
"0.51400155",
"0.50597966",
"0.5025025",
"0.49975803",
"0.49552223",
"0.49455118",
"0.4918419",
"0.49164775",
"0.49087638",
"0.49034452",
"0.48699167",
"0.4825065",
"0.4804959",
"0.47942033",
"0.47536626",
"0.47... | 0.6959813 | 0 |
prepare filename to dict | def _filename_pre_data(self) -> dict:
key = []
remainder = ""
prework = {}
for i in self.draft_file:
if i == "{":
remainder = ""
elif i == "}":
key.append(remainder)
else:
remainder += i
list_file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_to_dictionary():\n\n return;",
"def make_file_dict():\r\n fileDict = {'pageUrls': [],\r\n 'pageFileNames': [],\r\n 'pageIds': [],\r\n 'fileUrls': [],\r\n 'fileIds': [],\r\n 'fileNames': [],\r\n 'cssUrls': [],... | [
"0.71812004",
"0.6705322",
"0.6690661",
"0.66186893",
"0.6445358",
"0.64392036",
"0.64164746",
"0.6411736",
"0.63395435",
"0.6329124",
"0.6299308",
"0.61634296",
"0.6087172",
"0.6072993",
"0.60555255",
"0.60460156",
"0.60145646",
"0.59737724",
"0.5971008",
"0.59170955",
"0.59... | 0.6893264 | 1 |
make that studect_data(dict) ready for the next step by get the output draft and set it into student_data and have its value is "N/"A | def prepare_student_data(self) -> dict:
self._filename_pre_data()
empty_student = {}
empty_student["scoreTimestamp"] = "N/A"
for i in self.draft_out:
empty_student[i] = "N/A"
for i in self.pre_data:
empty_student[i] = self.pre_data[i]
self.pre_data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_student_data(self, data, csvwriter):\n url_base = data['base_url']\n course_id = data['course']\n is_resumen = data['format']\n course_key = CourseKey.from_string(course_id)\n if is_resumen:\n header = ['Username', 'Email', 'Run', 'Seccion', 'SubSeccion', 'U... | [
"0.6489561",
"0.6420505",
"0.62448007",
"0.5916584",
"0.577582",
"0.5774251",
"0.56840724",
"0.5663926",
"0.5551127",
"0.5542213",
"0.54767984",
"0.5294155",
"0.5282048",
"0.5276514",
"0.5263904",
"0.5198079",
"0.51527464",
"0.51271755",
"0.5115177",
"0.5107831",
"0.5105366",... | 0.7730551 | 0 |
Method saves RSSfeed content to cache. | def save_news_to_cache(self, rss_feed):
self.print_if_verbose(
f"Method 'save_news_to_cache' is working: \n"
f"Saving news to cache... \n"
)
rss_feed_to_cache_title = self.source
if not os.path.exists("cache"):
os.mkdir("cache")
os.chdir("ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_cache(feed):\n if ARGV.get(NOCACHE_OPT):\n return\n CACHE['feed'] = feed\n CACHE['last-request'] = str(time.time())\n CACHE['max-age'] = feed.headers['Cache-Control'].split('=')[1]\n save_datfile()",
"def add_to_cache(self, content: Content):\n cache = self.cache\n c... | [
"0.67586154",
"0.6627388",
"0.6459616",
"0.63490593",
"0.62718034",
"0.62651795",
"0.6241656",
"0.6175605",
"0.617538",
"0.61674666",
"0.61565787",
"0.58985907",
"0.5897402",
"0.58390415",
"0.5832458",
"0.58263427",
"0.5811275",
"0.58038193",
"0.57993054",
"0.5782869",
"0.574... | 0.73235667 | 0 |
Method saves images to local image_cache | def save_image_to_image_cache(self, image_url, image_name):
self.print_if_verbose(
f"Method 'save_image_to_image_cache' is working: \n"
f"Saving image to image_cache... \n"
)
os.chdir("image_cache")
try:
urlretrieve(image_url, image_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache(self):\n\t\tprint self.url\n\t\tif self.url and not self.streetimage:\n\t\t\tresult = urllib.urlretrieve(self.url)\n\t\t\tfname = os.path.basename(self.url).split('&')[-1]+\".jpg\"\n\t\t\tprint 'fname = ', fname, 'result = ', result\n\t\t\tself.streetimage.save(fname, File(open(result[0])))\n\t\t\tself.s... | [
"0.7162924",
"0.696713",
"0.6893315",
"0.68605286",
"0.6816649",
"0.6638263",
"0.66211474",
"0.6558931",
"0.6538121",
"0.6499858",
"0.64770514",
"0.6462724",
"0.6439817",
"0.64209604",
"0.6399955",
"0.6393154",
"0.63581383",
"0.6332679",
"0.63150334",
"0.62993383",
"0.629635"... | 0.7229129 | 0 |
Method prints RSSfeed content in standard format. | def print_content(self, rss_feed):
self.print_if_verbose(
f"Method 'print_content' is working: \n"
f"Print information about RSS-feed: \n"
)
for key in rss_feed:
if type(rss_feed[key]) != list:
print(f"{key}: {rss_feed[key]}")
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output(self):\n feed = []\n feed.append('''<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n <?xml-stylesheet href=\"http://www.blogger.com/styles/atom.css\" type=\"text/css\"?>\n <feed version=\"%(version)s\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"%(lan... | [
"0.69217837",
"0.6848304",
"0.67503965",
"0.6540545",
"0.6479408",
"0.63609755",
"0.62872815",
"0.604937",
"0.60263556",
"0.60063654",
"0.5867962",
"0.57046604",
"0.5669589",
"0.56494915",
"0.55631423",
"0.5525209",
"0.55078566",
"0.5471238",
"0.54546905",
"0.5432877",
"0.541... | 0.79999995 | 0 |
Method prints RSSfeed content in JSON format. | def print_json_content(self, rss_feed):
self.print_if_verbose(
f"Method 'print_json_content' is working: \n"
f"RSS feed will be printed in JSON format: \n"
)
json_content = json.dumps(rss_feed, indent=3)
print(json_content)
self.print_if_verbose(f"Metho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_content(self, rss_feed):\n\n self.print_if_verbose(\n f\"Method 'print_content' is working: \\n\"\n f\"Print information about RSS-feed: \\n\"\n )\n\n for key in rss_feed:\n if type(rss_feed[key]) != list:\n print(f\"{key}: {rss_feed[ke... | [
"0.70555997",
"0.64175785",
"0.64175785",
"0.6284882",
"0.6267104",
"0.6229609",
"0.61915755",
"0.6137583",
"0.58659434",
"0.5838001",
"0.5723957",
"0.57200825",
"0.5677733",
"0.5626589",
"0.5596967",
"0.5479984",
"0.5475434",
"0.543073",
"0.54114175",
"0.5400201",
"0.5398685... | 0.8396723 | 0 |
Method prints RSSfeed content from cache. | def print_content_from_cache(self, rss_feed):
self.print_if_verbose(f"Method 'print_content_from_cache' is working: \n")
for news in rss_feed:
for key in news.keys():
print(f"{key}: {news[key]}")
print()
self.print_if_verbose(f"Method 'print_content_fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_content_from_cache(self):\n\n rss_feed = []\n news_to_show = 0\n\n try:\n self.print_if_verbose(\n f\"Method 'get_content_from_cache' is working: \\n\"\n f\"Trying to get content from cache...\"\n )\n os.chdir(\"cache\")\n ... | [
"0.6982981",
"0.64359665",
"0.6297086",
"0.61537176",
"0.5946821",
"0.5885559",
"0.58853716",
"0.5868752",
"0.58248276",
"0.57419926",
"0.5715743",
"0.5712399",
"0.57096833",
"0.56506985",
"0.5642677",
"0.5574007",
"0.55680573",
"0.55316573",
"0.55299604",
"0.55256534",
"0.54... | 0.83626264 | 0 |
Method saves RSSfeed content to HTMLfile. If path is wrong returns exception. | def save_to_html(self, rss_feed, date=None):
self.print_if_verbose(f"Method 'save_to_html' is working: \n")
add_to_html_file = "<!DOCTYPE html>\n<html lang='en'>\n<head>\n<meta charset='UTF-8'>\n</head>\n<body>\n"
if not os.path.exists(self.to_html_path):
try:
os.m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_news_in_html_file(news, path_to_html, logger):\n check_path_to_directory(path_to_html, logger)\n html_file = tags.html(title='RSS news')\n html_file.add(tags.head(tags.meta(charset='utf-8')))\n\n logger.info('Converting news to html format...')\n for article in news:\n html_factory(a... | [
"0.70882803",
"0.6659082",
"0.6444682",
"0.6379773",
"0.6294752",
"0.6192147",
"0.610183",
"0.60757816",
"0.60023487",
"0.5964989",
"0.59016937",
"0.5819117",
"0.58073294",
"0.5782866",
"0.5758187",
"0.57215035",
"0.56917626",
"0.56676036",
"0.56220895",
"0.56053066",
"0.5592... | 0.75413376 | 0 |
Method saves RSSfeed content to FB2file. If path is wrong returns exception. | def save_to_fb2(self, rss_feed, date=None):
self.print_if_verbose(f"Method 'save_to_fb2' is working: \n")
if not os.path.exists(self.to_fb2_path):
try:
os.makedirs(self.to_fb2_path)
except Exception as error:
print(f"Exception {error} - wrong pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_file(self, content):\n try:\n with open(self.full_path_to_file, \"wb\") as fp:\n fp.write(content)\n except PermissionError:\n logging.error(\n \"Conversion cannot be performed. Permission denied for this directory\"\n )\n ... | [
"0.6336935",
"0.6105859",
"0.5953287",
"0.59252447",
"0.58727354",
"0.5848965",
"0.5748638",
"0.57357615",
"0.57232815",
"0.57130784",
"0.5701286",
"0.56320465",
"0.5586502",
"0.5526823",
"0.5505389",
"0.55029744",
"0.54756254",
"0.54639256",
"0.5439159",
"0.5437611",
"0.5437... | 0.73413247 | 0 |
Calculate contributions mask to be within the given value range. | def _setValidRange(self, contribs, valueRange):
testfor(contribs.ndim == 2, ValueError)
numContribs, numReps = contribs.shape
self._validRange = np.zeros_like(contribs.T, dtype = bool)
for ri in range(numReps):
# the single set of R for this calculation
rset = con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mask_for_values_between_exponent_limits(self):\n mask_between_exp_limits = None\n new_exp_lower = new_exp_upper = None\n if self.exp_lower is not None:\n new_exp_lower = self.exp_lower + 1\n if self.exp_upper is not None:\n new_exp_upper = self.exp_upper - 1\n... | [
"0.6139728",
"0.5778516",
"0.5743647",
"0.5667564",
"0.5649735",
"0.5611406",
"0.5567767",
"0.55613536",
"0.5501029",
"0.54364896",
"0.54216534",
"0.5400132",
"0.5389187",
"0.5379457",
"0.53776085",
"0.5347557",
"0.5343009",
"0.53155017",
"0.53128374",
"0.5302718",
"0.5296207... | 0.60455686 | 1 |
Lower limit in display units including the unit text. | def lowerDisplay(self):
return "{0:g} ({1})".format(self._param.toDisplay(self.lower),
self._param.displayMagnitudeName()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_display_size(self):\n return '%d MB' % self.size if self.size < 1024 else '%.2f GB' % (self.size / 1024.0)",
"def unit_of_measurement(self):\n return \"%\"",
"def units(self):\n pass",
"def unit_of_measurement(self):\n return '%'",
"def unit_of_measurement(self) -> str:\n ... | [
"0.68737787",
"0.6705744",
"0.6617617",
"0.65782964",
"0.6403219",
"0.6403219",
"0.6349418",
"0.62952155",
"0.62344605",
"0.6159931",
"0.6157702",
"0.61567926",
"0.6149927",
"0.6146399",
"0.6140932",
"0.61266",
"0.61061746",
"0.6068677",
"0.605865",
"0.5996165",
"0.5980514",
... | 0.6856167 | 1 |
Upper limit in display units including the unit text. | def upperDisplay(self):
return "{0:g} ({1})".format(self._param.toDisplay(self.upper),
self._param.displayMagnitudeName()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_display_size(self):\n return '%d MB' % self.size if self.size < 1024 else '%.2f GB' % (self.size / 1024.0)",
"def unit_of_measurement(self):\n return \"%\"",
"def unit_of_measurement(self):\n return '%'",
"def units(self):\n pass",
"def unit_of_measurement(self) -> str:\n ... | [
"0.70054436",
"0.6769809",
"0.6708141",
"0.6669131",
"0.65528774",
"0.65528774",
"0.65095055",
"0.6420288",
"0.6403162",
"0.63651204",
"0.63568985",
"0.6297604",
"0.62844765",
"0.62185395",
"0.6201521",
"0.6183936",
"0.61839217",
"0.6120024",
"0.611906",
"0.6106219",
"0.60859... | 0.7146413 | 0 |
Returns np arrays for the bin values, observability and the CDF based on the bin values. | def _calcBins(self, contribs, parValues, fraction, minReq):
# single set of R for this calculation
bins = np.zeros(self.binCount)
binObs = np.zeros(self.binCount)
for bi in range(self.binCount):
val, obs = self._calcBin(
self._binMask(bi, parValues),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bc_array_for_all_frequencies(self, loaded_table, boundary_condition):\n if self.frequencies is None:\n number_frequencies = 1\n else:\n number_frequencies = len(self.frequencies)\n\n if loaded_table:\n list_arrays = [np.zeros(number_frequencies, dtype=fl... | [
"0.61884326",
"0.60316277",
"0.60187405",
"0.6011523",
"0.5961007",
"0.59270096",
"0.5858573",
"0.5848494",
"0.58279395",
"0.58030796",
"0.5800227",
"0.57804126",
"0.57344216",
"0.5731898",
"0.5731898",
"0.566924",
"0.5661775",
"0.55975986",
"0.55752337",
"0.5569703",
"0.5556... | 0.643362 | 0 |
Updates ranges of all histograms. | def updateRanges(self):
# work directly on the histograms, no copy
for i in range(len(self)):
self[i].updateRange() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoHistogramRange(self):\n self.vb.enableAutoRange(self.vb.XAxis, True)\n self.vb.enableAutoRange(self.vb.YAxis, True)\n # self.range = None\n # self.updateRange()\n # self.vb.setMouseEnabled(False, False)\n\n # def updateRange(self):\n # self.vb.autoRange()\n ... | [
"0.6792945",
"0.67535067",
"0.67533433",
"0.67533433",
"0.6722245",
"0.6722245",
"0.6479876",
"0.64566374",
"0.6367419",
"0.63112515",
"0.6116528",
"0.60730416",
"0.59745663",
"0.5908539",
"0.5886132",
"0.5849696",
"0.57824105",
"0.5766566",
"0.5716636",
"0.5643945",
"0.56388... | 0.8878231 | 0 |
activeVal is set after a successful MC run. It is a list of arrays, with each array storing the parameter values of a successful run. If index is supplied, only the array at that list index is returned, otherwise the entire list is returned. Used to store the fit results in each parameter. | def activeVal(selforcls, val, index = None):
if index is None:
return selforcls.activeValues()
else:
return selforcls.activeValues()[
index%len(selforcls.activeValues())] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setActiveVal(selforcls, val, index = None):\n if not selforcls.isActive():\n logging.error(\"Value of parameter cannot be set, \"\n \"parameter not active!\")\n return\n\n tempVal = selforcls.activeValues()\n if index is None:\n ind... | [
"0.6020497",
"0.5685184",
"0.53795695",
"0.53574705",
"0.5278439",
"0.52379537",
"0.5211085",
"0.51439047",
"0.510269",
"0.50727105",
"0.50727105",
"0.5066421",
"0.50607145",
"0.50317687",
"0.500099",
"0.49392658",
"0.4925629",
"0.4915637",
"0.4901665",
"0.489409",
"0.4881361... | 0.6224224 | 0 |
Sets or appends to the list of activeVal. There could be a race condition if two mcFit instances try to append at the same time. Therefore, an index can be supplied to identify the list index to set or change. Each mcFit instance should be assigned a serial (index) number. If the list is not long enough to accommodate ... | def setActiveVal(selforcls, val, index = None):
if not selforcls.isActive():
logging.error("Value of parameter cannot be set, "
"parameter not active!")
return
tempVal = selforcls.activeValues()
if index is None:
index = len(tempVal)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self, index, value):\n missing = index - len(self) + 1\n if missing > 0:\n self.extend([None] * missing)\n list.__setitem__(self, index, value)",
"def __setitem__(self, i, val):\n\t\tif i < self.n:\n\t\t\tself.v[i] = val",
"def __setitem__(self, index, value):\n ... | [
"0.6192069",
"0.60728383",
"0.5936898",
"0.5906566",
"0.5865935",
"0.5829412",
"0.574235",
"0.5725492",
"0.5709034",
"0.5685339",
"0.5677327",
"0.56530786",
"0.5648228",
"0.5621754",
"0.5617098",
"0.5600828",
"0.5592704",
"0.55780846",
"0.5575421",
"0.5571872",
"0.5571067",
... | 0.73371154 | 0 |
Gets the snapshot_metadata of this VersionedFlowSnapshot. The metadata for this snapshot | def snapshot_metadata(self):
return self._snapshot_metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_snapshot_metadata(self, snapshot_id):\n url = \"snapshots/%s/metadata\" % snapshot_id\n resp, body = self.get(url)\n body = json.loads(body)\n self.validate_response(schema.show_snapshot_metadata, resp, body)\n return rest_client.ResponseBody(resp, body)",
"def show_sn... | [
"0.75155294",
"0.67023194",
"0.65991884",
"0.6548966",
"0.6492202",
"0.6428583",
"0.6423407",
"0.6405962",
"0.6306713",
"0.6278455",
"0.6236187",
"0.6236187",
"0.6236187",
"0.6236187",
"0.6236187",
"0.62086684",
"0.61940265",
"0.6182489",
"0.6182489",
"0.6180863",
"0.6175664"... | 0.83801657 | 0 |
Sets the snapshot_metadata of this VersionedFlowSnapshot. The metadata for this snapshot | def snapshot_metadata(self, snapshot_metadata):
if snapshot_metadata is None:
raise ValueError("Invalid value for `snapshot_metadata`, must not be `None`")
self._snapshot_metadata = snapshot_metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metadata(self, snapshot, metadata):\n body = {'metadata': metadata}\n return self._create(\"/snapshots/%s/metadata\" % base.getid(snapshot),\n body, \"metadata\")",
"def set_metadata(self, snapshot_id, metadata, **kwargs):\n body = {'metadata': metadata}\n ... | [
"0.83712",
"0.8329036",
"0.69013786",
"0.6655103",
"0.6382433",
"0.626016",
"0.626016",
"0.622943",
"0.6184342",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.605118",
"0.59974533",
"0.59923416",
"0.589582",
"0.589582",
"0.589... | 0.85901093 | 0 |
Gets the flow_contents of this VersionedFlowSnapshot. The contents of the versioned flow | def flow_contents(self):
return self._flow_contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(self):\n self.syncContents()\n return self._contents",
"def get_contents(self):\n return self.contents",
"def contents(self):\n return self._contents",
"def get_contents(self):\n with closing(self.open()) as handle:\n return handle.read()",
"def co... | [
"0.66757303",
"0.62290907",
"0.6197192",
"0.59705305",
"0.5878344",
"0.5796029",
"0.5763083",
"0.5516891",
"0.5505247",
"0.54965574",
"0.54637045",
"0.54631704",
"0.5415392",
"0.53776175",
"0.536303",
"0.5346532",
"0.5295824",
"0.5295824",
"0.5295824",
"0.5295824",
"0.5293879... | 0.75096315 | 0 |
Sets the flow_contents of this VersionedFlowSnapshot. The contents of the versioned flow | def flow_contents(self, flow_contents):
if flow_contents is None:
raise ValueError("Invalid value for `flow_contents`, must not be `None`")
self._flow_contents = flow_contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(self, contents):\n\n self._contents = contents",
"def set_contents(self, contents):\n self.validate_contents(contents)\n #Copy-ing the contents list is necessary because it can be modified \n #by UI elements that are based on this class\n self.contents = copy(conte... | [
"0.5873673",
"0.58573955",
"0.5356069",
"0.53205866",
"0.52961564",
"0.507953",
"0.5026219",
"0.50057846",
"0.49433386",
"0.48465547",
"0.48465547",
"0.47895524",
"0.47386765",
"0.47386765",
"0.46821818",
"0.46728328",
"0.4583075",
"0.4578419",
"0.4568628",
"0.45118272",
"0.4... | 0.7428742 | 0 |
Gets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow. | def external_controller_services(self):
return self._external_controller_services | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_controller_services(self, external_controller_services):\n\n self._external_controller_services = external_controller_services",
"def exposed_services(self):\n return self._exposed_services",
"def get_current_services(self,sim):\n current_services = sim.get_alloc_entities()\n ... | [
"0.63227344",
"0.56581736",
"0.53822076",
"0.5345333",
"0.53095484",
"0.530191",
"0.5297033",
"0.5236078",
"0.52339894",
"0.52310747",
"0.51765954",
"0.5120164",
"0.50976235",
"0.5094909",
"0.5077057",
"0.50099176",
"0.5002442",
"0.49720675",
"0.4959182",
"0.49488658",
"0.494... | 0.81535 | 0 |
Sets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow. | def external_controller_services(self, external_controller_services):
self._external_controller_services = external_controller_services | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_controller_services(self):\n return self._external_controller_services",
"def external_ids(self, external_ids):\n\n self._external_ids = external_ids",
"def exposed_services(self, exposed_services):\n\n self._exposed_services = exposed_services",
"def _set_controller(self, v... | [
"0.658346",
"0.51898247",
"0.51228046",
"0.49471608",
"0.47565818",
"0.47565818",
"0.47195998",
"0.45883906",
"0.44981703",
"0.44052467",
"0.43850753",
"0.43745434",
"0.43683144",
"0.4353919",
"0.43460214",
"0.4309255",
"0.42675003",
"0.42650962",
"0.4246743",
"0.42305523",
"... | 0.8468243 | 0 |
Gets the parameter_providers of this VersionedFlowSnapshot. Contains basic information about parameter providers referenced in the versioned flow. | def parameter_providers(self):
return self._parameter_providers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider_params(self):\n return self.tree.get('provider_params', {})",
"def all_providers(self) -> List[ProviderInfo]:\n sp_key = self.__providers_key()\n value = self.get(name=sp_key)\n if value is None:\n return []\n js = utf8_decode(data=value)\n array ... | [
"0.7007249",
"0.61865747",
"0.60932356",
"0.6047994",
"0.60459554",
"0.6015926",
"0.6015926",
"0.6015926",
"0.6015926",
"0.6015926",
"0.6015926",
"0.59945995",
"0.59945995",
"0.59182954",
"0.58808595",
"0.58627284",
"0.5730422",
"0.5724208",
"0.571871",
"0.57134426",
"0.57121... | 0.80047333 | 0 |
Sets the parameter_providers of this VersionedFlowSnapshot. Contains basic information about parameter providers referenced in the versioned flow. | def parameter_providers(self, parameter_providers):
self._parameter_providers = parameter_providers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_providers(self):\n return self._parameter_providers",
"def parameter_contexts(self, parameter_contexts):\n\n self._parameter_contexts = parameter_contexts",
"def provider_params(self):\n return self.tree.get('provider_params', {})",
"def parameters(self, parameters):\n\n ... | [
"0.6349689",
"0.5952384",
"0.56540287",
"0.53550196",
"0.53550196",
"0.53550196",
"0.51900417",
"0.512226",
"0.5103046",
"0.5091386",
"0.5070409",
"0.49835092",
"0.49684978",
"0.49183768",
"0.48783487",
"0.48691717",
"0.4818158",
"0.4812805",
"0.4807325",
"0.48066327",
"0.480... | 0.8015235 | 0 |
Gets the parameter_contexts of this VersionedFlowSnapshot. The parameter contexts referenced by process groups in the flow contents. The mapping is from the name of the context to the context instance, and it is expected that any context in this map is referenced by at least one process group in this flow. | def parameter_contexts(self):
return self._parameter_contexts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_contexts(self):\n return tuple(getattr(self, name) for name in self.__argnames__)",
"def get_contexts(self):\n return self._contexts",
"def get_contexts(self):\n params = self._get_configurational_params()\n builds = self._get_builds()\n\n ctx_params = itertools.produ... | [
"0.6186989",
"0.60678494",
"0.6034285",
"0.57978076",
"0.5718987",
"0.5601156",
"0.55219734",
"0.5495203",
"0.5372476",
"0.5309605",
"0.5279569",
"0.52359176",
"0.5205325",
"0.51551515",
"0.51125336",
"0.5102993",
"0.50635713",
"0.50354475",
"0.5029947",
"0.50209457",
"0.5006... | 0.7592681 | 0 |
Sets the parameter_contexts of this VersionedFlowSnapshot. The parameter contexts referenced by process groups in the flow contents. The mapping is from the name of the context to the context instance, and it is expected that any context in this map is referenced by at least one process group in this flow. | def parameter_contexts(self, parameter_contexts):
self._parameter_contexts = parameter_contexts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_contexts(self, contexts):\n self._contexts = contexts",
"def parameter_contexts(self):\n return self._parameter_contexts",
"def update(self, contextset):\n self._contexts.update(contextset.get_contexts())",
"def set_contexts(self, path_context: str):\n self.path, self.mode... | [
"0.6403469",
"0.5939657",
"0.5094899",
"0.50620306",
"0.5013662",
"0.49896467",
"0.49327752",
"0.48905647",
"0.48811802",
"0.47928238",
"0.47024944",
"0.46778068",
"0.46764642",
"0.46742034",
"0.46499863",
"0.4630622",
"0.4608403",
"0.45698825",
"0.45489085",
"0.45285198",
"0... | 0.79279155 | 0 |
Gets the flow_encoding_version of this VersionedFlowSnapshot. The optional encoding version of the flow contents. | def flow_encoding_version(self):
return self._flow_encoding_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoding(self):\n return self.original.encoding",
"def flow_encoding_version(self, flow_encoding_version):\n\n self._flow_encoding_version = flow_encoding_version",
"def encoding(self):\n return self._encoding",
"def encoding(self):\n return self._encoding",
"def encoding(se... | [
"0.6260871",
"0.6109093",
"0.60388505",
"0.60388505",
"0.60388505",
"0.60388505",
"0.5965365",
"0.59034485",
"0.5898288",
"0.58397555",
"0.5827975",
"0.57529813",
"0.56854403",
"0.5617346",
"0.558402",
"0.5467311",
"0.5450552",
"0.5449334",
"0.5410547",
"0.54058725",
"0.54004... | 0.79059565 | 0 |
Sets the flow_encoding_version of this VersionedFlowSnapshot. The optional encoding version of the flow contents. | def flow_encoding_version(self, flow_encoding_version):
self._flow_encoding_version = flow_encoding_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flow_encoding_version(self):\n return self._flow_encoding_version",
"def encoding(self, encoding):\n\n self._encoding = encoding",
"def set_encoding(self, encoding):\n\n self._encoding = encoding",
"def encoding(self, encoding):\n if encoding is None:\n raise ValueError... | [
"0.66736966",
"0.58571243",
"0.58275366",
"0.5791346",
"0.566458",
"0.56271887",
"0.5596561",
"0.55775213",
"0.5577486",
"0.555697",
"0.5535698",
"0.5236223",
"0.50859153",
"0.5032931",
"0.48970616",
"0.48817796",
"0.48706242",
"0.47449",
"0.47412664",
"0.46945748",
"0.468185... | 0.82961506 | 0 |
Gets the flow of this VersionedFlowSnapshot. The flow this snapshot is for | def flow(self):
return self._flow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFlow(self):\n return self._flow",
"def get_flow(self, uuid):\n return Flow.deserialize(self._get_single('flows', {'uuid': uuid}))",
"def get_flow(self, flow_name: str) -> \"Flow\":\n if flow_name not in self.flows:\n raise ValueError(\"Flow is not contained in this Storag... | [
"0.7379466",
"0.6781517",
"0.6685178",
"0.60488605",
"0.6008015",
"0.60059667",
"0.5927424",
"0.59273106",
"0.5903583",
"0.5843571",
"0.58065546",
"0.5722223",
"0.55836266",
"0.5567539",
"0.55481815",
"0.54643285",
"0.5417385",
"0.5333574",
"0.53092957",
"0.5300495",
"0.52970... | 0.6824039 | 1 |
Sets the flow of this VersionedFlowSnapshot. The flow this snapshot is for | def flow(self, flow):
self._flow = flow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_flow(self, flow):\r\n self.flow = flow",
"def set_cur_flow(self, flow):\n self.cur_flow = flow",
"def set_flow_source(self, source):\n self._source = source",
"def flows(self, flows):\n\n self._flows = flows",
"def set_flow_state(self, state):\n source, clone =... | [
"0.70686585",
"0.69125307",
"0.6306861",
"0.6027127",
"0.58933383",
"0.57597303",
"0.5727777",
"0.5652507",
"0.55490685",
"0.54941237",
"0.54612213",
"0.53285825",
"0.5255896",
"0.52233005",
"0.5174087",
"0.5111768",
"0.49811852",
"0.49525854",
"0.48680583",
"0.486662",
"0.48... | 0.7334191 | 0 |
Gets the bucket of this VersionedFlowSnapshot. The bucket where the flow is located | def bucket(self):
return self._bucket | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucket(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bucket\")",
"def bucket(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bucket\")",
"def bucket(self):\n if not hasattr(self, \"_bucket\"):\n self._bucket = self._get_or_create_bucket(self.bucket_name)\... | [
"0.78069574",
"0.78069574",
"0.7710763",
"0.7691495",
"0.7655935",
"0.76269865",
"0.76269865",
"0.7556832",
"0.7556832",
"0.7556832",
"0.7556832",
"0.7556832",
"0.7456765",
"0.72359926",
"0.7172862",
"0.71176875",
"0.69666916",
"0.6939062",
"0.6920855",
"0.6910778",
"0.683748... | 0.8017462 | 0 |
Sets the bucket of this VersionedFlowSnapshot. The bucket where the flow is located | def bucket(self, bucket):
self._bucket = bucket | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_image_bucket(self, value):\n self.image_bucket = value",
"def __init__(self, bucket):\n self.bucket = bucket",
"def bucket(self):\n if not hasattr(self, \"_bucket\"):\n self._bucket = self._get_or_create_bucket(self.bucket_name)\n return self._bucket",
"def buck... | [
"0.7186771",
"0.68779075",
"0.6785613",
"0.667325",
"0.66621596",
"0.65803295",
"0.6543764",
"0.6543764",
"0.6543764",
"0.6543764",
"0.6543764",
"0.6406765",
"0.6357553",
"0.6302178",
"0.6273225",
"0.6273225",
"0.6228045",
"0.6178882",
"0.61779845",
"0.61259234",
"0.6115869",... | 0.80024356 | 0 |
Gets the latest of this VersionedFlowSnapshot. | def latest(self):
return self._latest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest(self):\n return self.journal_data[self.latest_id]",
"def get_latest_revision(self):\n revision_list = self.get_revision_list()\n if revision_list:\n return revision_list[-1]\n else:\n raise NoRevisionsExistError()",
"def get_latest(self, name):\n ... | [
"0.70233417",
"0.6663617",
"0.6593615",
"0.65461594",
"0.6545754",
"0.6521191",
"0.64221674",
"0.63784236",
"0.6323985",
"0.6314438",
"0.62969947",
"0.62746644",
"0.6249728",
"0.621321",
"0.6209161",
"0.6130742",
"0.6110239",
"0.6094407",
"0.60749656",
"0.60749656",
"0.607346... | 0.71543825 | 0 |
Sets the latest of this VersionedFlowSnapshot. | def latest(self, latest):
self._latest = latest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest(self, value):\n self.journal_data[self.latest_id] = value",
"def last_update(self, last_update):\n\n self._last_update = last_update",
"def last_updated(self, last_updated):\n\n self._last_updated = last_updated",
"def last_updated(self, last_updated):\n\n self._last_up... | [
"0.56970704",
"0.5584318",
"0.5571926",
"0.5571926",
"0.5571926",
"0.5571926",
"0.55521595",
"0.5540341",
"0.549731",
"0.5486416",
"0.54847425",
"0.5465948",
"0.54285127",
"0.540792",
"0.5372909",
"0.530602",
"0.52589697",
"0.51641023",
"0.5145097",
"0.51391363",
"0.5101425",... | 0.6956269 | 0 |
decorator, to check if any arguments are None; raise exception if so | def arguments_not_none(func):
def wrapper(*args, **kwargs):
for arg in args:
if arg is None:
raise NullArgument()
for arg, val in kwargs.iteritems():
if val is None:
raise NullArgument()
try:
return func(*args, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_require_at_least_one_but_none_provided(self):\n from plone.api.exc import MissingParameterError\n _func = at_least_one_of('arg1', 'arg2')(undecorated_func)\n with self.assertRaises(MissingParameterError):\n _func()",
"def raise_on_kwargs_not_empty(kwargs):\n if kwargs:... | [
"0.7179476",
"0.7005238",
"0.6862655",
"0.67738134",
"0.66771066",
"0.66719574",
"0.6670857",
"0.66649455",
"0.6516356",
"0.64760697",
"0.64564824",
"0.64414316",
"0.6400211",
"0.63677275",
"0.6340219",
"0.6336073",
"0.6278074",
"0.624633",
"0.62405366",
"0.6194473",
"0.61714... | 0.7990307 | 0 |
Does the range (start1, end1) overlap with (start2, end2)? From Ned Batchelder | def overlap(start1, end1, start2, end2):
return not (end1 < start2 or end2 < start1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ranges_overlap(start1, end1, start2, end2):\n return start1 <= end2 and end1 >= start2",
"def overlap(t1start, t1end, t2start, t2end):\n\n return (t1start <= t2start <= t1end) or (t2start <= t1start <= t2end)",
"def dates_intervals_are_overlapped(start_1, end_1, start_2, end_2):\n return end_1 >= ... | [
"0.9136054",
"0.8766053",
"0.86649185",
"0.8614897",
"0.8568691",
"0.8040404",
"0.79916596",
"0.79050434",
"0.7863665",
"0.7816917",
"0.7795002",
"0.77819324",
"0.7761843",
"0.7755675",
"0.76948917",
"0.7658933",
"0.76514626",
"0.7645277",
"0.76171124",
"0.75732416",
"0.75300... | 0.91575056 | 0 |
Gets the most appropriate provider manager depending on config. If local is True, then don't bother with the runtime/config and try to get the requested service manager directly from the local service implementations known to this mongodb implementation. | def get_provider_manager(osid, runtime=None, proxy=None, local=False):
if runtime is not None and not local:
try:
# Try to get the manager from the runtime, if available:
config = runtime.get_configuration()
parameter_id = Id('parameter:' + osid.lower() + 'ProviderImpl@mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugins_get_mgr():\n global pluginmgr\n return pluginmgr",
"def get_manager(self, name):\n\n if name == \"control\":\n manager = self._control_manager\n elif name == \"alarm\":\n manager = self._alarm_manager\n elif name == \"state\":\n manager = se... | [
"0.60364807",
"0.59472436",
"0.59169286",
"0.5853699",
"0.57207507",
"0.5716708",
"0.5675645",
"0.56740063",
"0.5661868",
"0.56517935",
"0.561996",
"0.56145036",
"0.5549924",
"0.552947",
"0.5511615",
"0.54560804",
"0.54558784",
"0.54422766",
"0.54190433",
"0.540673",
"0.54012... | 0.763456 | 0 |
Returns a search provider. | def _get_search_provider(self, engine, api_key):
if engine not in SearchProxy._engines:
raise KeyError("No such engine found: " + engine)
# Use caching
return SearchProxy._engines[engine](api_key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_provider(self) -> Optional[Provider]:\n if not self.provider:\n return None\n return Provider.objects.get_subclass(pk=self.provider.pk)",
"def find_provider(self) -> DataProvider:\n data_source = self._single_data_source()\n identifiers = self._make_identifiers()\n ... | [
"0.67729783",
"0.6718573",
"0.6717137",
"0.6710824",
"0.6573458",
"0.64831233",
"0.647294",
"0.6448106",
"0.6442226",
"0.6382654",
"0.6293731",
"0.62925255",
"0.62718844",
"0.6164266",
"0.6067232",
"0.6029334",
"0.6016101",
"0.595153",
"0.5943089",
"0.58939993",
"0.5797317",
... | 0.6940315 | 0 |
Normalizes query, the goal is to reduce the number of unique queries. | def _normalize_query(self, query):
return re.sub('\s+', ' ', query).strip().lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_query(self, query):\n if not query:\n return {}\n\n def _parse_value(value):\n \"\"\"Checks and parses if supplied value is a float, bool, or int\"\"\"\n # Check if it is a boolean, int, or float value\n try:\n value = json.loa... | [
"0.6814932",
"0.6377694",
"0.61607236",
"0.60682076",
"0.5984933",
"0.5917141",
"0.58574533",
"0.5849663",
"0.5790046",
"0.5782918",
"0.5746508",
"0.5692975",
"0.56837636",
"0.5566909",
"0.55489427",
"0.546305",
"0.5441469",
"0.5441324",
"0.5426586",
"0.5394316",
"0.53928113"... | 0.63966286 | 1 |
Returns search results for the given query. Uses search engine specified when object was created. | def search(self, query):
return self._search_provider.search(self._normalize_query(query)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, query=None, options=None):\n return self.create_search(query, options).search()",
"def _search(self, query):\n return self._request(query)",
"def search(self, query):",
"def search(self, q, *args, **kwargs):\n\t\treturn self.__model.objects.search(q, *args, **kwargs)",
"def s... | [
"0.8006484",
"0.796888",
"0.782748",
"0.7698193",
"0.75524807",
"0.7472724",
"0.744233",
"0.7354309",
"0.73182344",
"0.72385937",
"0.7187812",
"0.7147223",
"0.7100142",
"0.7097355",
"0.7087547",
"0.7054167",
"0.7036175",
"0.7032594",
"0.7032379",
"0.70082915",
"0.6978113",
... | 0.81955093 | 0 |
List all registered fuelmaster | def get(self):
return get_all_fuelmaster() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list():\n rino.remote.list()",
"def get_bus_list():\n\n\tbuses = db.session.query(Bus.bus_name).all()\n\n \n\treturn buses",
"def list_all(self):\n\n url = 'equipamento/list/'\n\n code, xml = self.submit(None, 'GET', url)\n\n return self.response(code, xml)",
"def get_all_sensor... | [
"0.60012436",
"0.5986072",
"0.5853507",
"0.57456124",
"0.5729652",
"0.5678258",
"0.56627524",
"0.56465113",
"0.56461614",
"0.56365293",
"0.5625861",
"0.56063926",
"0.55918413",
"0.5579228",
"0.55619735",
"0.5560769",
"0.55473894",
"0.5540286",
"0.55253315",
"0.55137026",
"0.5... | 0.7972504 | 0 |
Creates a new fuelmaster | def post(self):
data = request.json
return save_new_fuelmaster(data=data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _createMaster(self, *args, **kwds):\n raise NotImplementedError",
"def create_master_resource(self, name):\n vdu_id = str(uuid.uuid4())\n userdata = \"\"\"#cloud-config\n\n runcmd:\n - /usr/rift/scripts/cloud/enable_lab {site}\n \"\"\"\n\n site = \"\"\n if self._s... | [
"0.6816229",
"0.64668983",
"0.62813395",
"0.62446845",
"0.6169536",
"0.6169536",
"0.61356246",
"0.6132837",
"0.61031365",
"0.59870327",
"0.59829056",
"0.59733576",
"0.58920753",
"0.5812014",
"0.58021694",
"0.57926846",
"0.57718396",
"0.5765476",
"0.5765476",
"0.5765476",
"0.5... | 0.71277624 | 0 |
get a fuelmaster given its identifier | def get(self, fuelid):
user = get_a_fuelmaster(fuelid)
if not user:
api.abort(404)
else:
return user
data = request.json
return get_a_fuelmaster(data=data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_master(searchname):\n masters = get_masters()\n masternames = []\n master_lookup = {}\n for mn, path in masters:\n master = {}\n master['mastername'] = mn\n master_lookup[mn] = path\n masternames.append(master)\n\n candidates = [mn for mn in masternames if mn['mastername'] == searchname... | [
"0.6281987",
"0.62778556",
"0.618738",
"0.6151269",
"0.6090545",
"0.6026856",
"0.5942235",
"0.59144944",
"0.5639281",
"0.5639281",
"0.56307095",
"0.5623589",
"0.5600634",
"0.5590971",
"0.55718446",
"0.5563223",
"0.55552864",
"0.55219615",
"0.5472625",
"0.546722",
"0.5446527",... | 0.71977645 | 0 |
This function picks a random word from the SOWPODS dictionary. | def pick_random_word():
# open the sowpods dictionary
with open("resources/ex30/sowpos.txt", 'r') as f:
words = f.readlines()
# generate a random index
# -1 because len(words) is not a valid index into the list `words`
index = random.randint(0, len(words) - 1)
# print out the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_word():\r\n # Opening the SOWPODS dictionary and getting a random word\r\n with open(r\"C:\\Users\\Santosh\\Desktop\\sowpods.txt\") as f:\r\n content = f.read()\r\n return random.choice(content.split())",
"def get_word():\n word=words_dict[randrange(0,len(words_dict))]\n return w... | [
"0.84963965",
"0.8297684",
"0.8297684",
"0.8297684",
"0.77926",
"0.7765932",
"0.76985675",
"0.76985675",
"0.76985675",
"0.7654141",
"0.76440424",
"0.7621508",
"0.7612562",
"0.75299704",
"0.7442256",
"0.7369817",
"0.72951597",
"0.7231558",
"0.7231546",
"0.7192046",
"0.71634084... | 0.8604508 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.