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 |
|---|---|---|---|---|---|---|
Gets the claim_id of this CancelClaimRequest. | def claim_id(self) -> str:
return self._claim_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfCancelClaimRequestParticipant:\n return self._participant",
"def claim_id(self, claim_id: str):\n if claim_id is None:\n raise ValueError(\"Invalid value for `claim_id`, must not be `None`\") # noqa: E501\n\n self._claim_id = claim_id",
"def claim_... | [
"0.65584064",
"0.53480613",
"0.53480613",
"0.5325822",
"0.52917284",
"0.51542556",
"0.51258606",
"0.5120093",
"0.5110072",
"0.50802976",
"0.5056338",
"0.5052991",
"0.49733397",
"0.49415457",
"0.49334362",
"0.49256182",
"0.49254164",
"0.49254164",
"0.49254164",
"0.49244657",
"... | 0.7223548 | 1 |
Sets the claim_id of this CancelClaimRequest. | def claim_id(self, claim_id: str):
if claim_id is None:
raise ValueError("Invalid value for `claim_id`, must not be `None`") # noqa: E501
self._claim_id = claim_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abort_resource_claim(self, context, claim):\n if self.disabled:\n return\n\n # un-claim the resources:\n if self.claims.pop(claim.claim_id, None):\n LOG.info(_(\"Aborting claim: %s\") % claim)\n values = claim.undo_claim(self.compute_node)\n self... | [
"0.5649211",
"0.5539124",
"0.539139",
"0.539139",
"0.52534735",
"0.51559585",
"0.51121545",
"0.50601566",
"0.5045018",
"0.5022828",
"0.4971132",
"0.49458092",
"0.49458092",
"0.48982158",
"0.488486",
"0.4877389",
"0.47319147",
"0.47283593",
"0.47244233",
"0.47178707",
"0.46877... | 0.70443064 | 1 |
Gets the participant of this CancelClaimRequest. | def participant(self) -> AllOfCancelClaimRequestParticipant:
return self._participant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfAcknowledgeClaimRequestParticipant:\n return self._participant",
"def participant(self, participant: AllOfCancelClaimRequestParticipant):\n if participant is None:\n raise ValueError(\"Invalid value for `participant`, must not be `None`\") # noqa: E501\n\n ... | [
"0.67635447",
"0.608266",
"0.5839472",
"0.5598538",
"0.5598538",
"0.5555457",
"0.5507715",
"0.5454061",
"0.51445997",
"0.5135461",
"0.5093453",
"0.4875301",
"0.48209915",
"0.48058555",
"0.4664206",
"0.4650998",
"0.46476087",
"0.4646766",
"0.46417183",
"0.46295804",
"0.4615743... | 0.8644753 | 0 |
Sets the participant of this CancelClaimRequest. | def participant(self, participant: AllOfCancelClaimRequestParticipant):
if participant is None:
raise ValueError("Invalid value for `participant`, must not be `None`") # noqa: E501
self._participant = participant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def participant(self) -> AllOfCancelClaimRequestParticipant:\n return self._participant",
"def participant(self, participant: AllOfAcknowledgeClaimRequestParticipant):\n if participant is None:\n raise ValueError(\"Invalid value for `participant`, must not be `None`\") # noqa: E501\n\n ... | [
"0.68957514",
"0.64282024",
"0.5298585",
"0.52758694",
"0.52446246",
"0.49859458",
"0.4926268",
"0.4857139",
"0.4795969",
"0.47757593",
"0.47732013",
"0.4710261",
"0.4704354",
"0.47002757",
"0.46990043",
"0.46812555",
"0.46590385",
"0.4599837",
"0.45744365",
"0.4519012",
"0.4... | 0.8001641 | 0 |
Gets the reason of this CancelClaimRequest. | def reason(self) -> ConfirmClaimRequestpropertiesReason:
return self._reason | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_reason(self):\n return self._dict.get('cancel_reason')",
"def getreason(self):\n return self.__reason",
"def reason(self) -> str:\n return self._reason",
"def reason(self) -> str:\n return pulumi.get(self, \"reason\")",
"def reason(self) -> Optional[str]:\n ret... | [
"0.79750174",
"0.6935758",
"0.6855553",
"0.68111926",
"0.66845834",
"0.65137833",
"0.6501617",
"0.6448776",
"0.64433444",
"0.6423687",
"0.63700235",
"0.6146557",
"0.6107115",
"0.61049896",
"0.6078111",
"0.60585654",
"0.59725267",
"0.58466864",
"0.5823141",
"0.58182657",
"0.57... | 0.8009041 | 0 |
Sets the reason of this CancelClaimRequest. | def reason(self, reason: ConfirmClaimRequestpropertiesReason):
if reason is None:
raise ValueError("Invalid value for `reason`, must not be `None`") # noqa: E501
self._reason = reason | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reason(self) -> ConfirmClaimRequestpropertiesReason:\n return self._reason",
"def reason(self, reason):\n\n self._reason = reason",
"def reason(self, reason: str):\n\n self._reason = reason",
"def reason(self, reason):\n allowed_values = [\"CLIENT_ORDER\", \"TRADE_CLOSE\", \"P... | [
"0.7011891",
"0.67284906",
"0.6629073",
"0.65367883",
"0.6503634",
"0.57616943",
"0.5759013",
"0.5696771",
"0.56342477",
"0.5627284",
"0.56187135",
"0.5601288",
"0.55769986",
"0.55550396",
"0.5524179",
"0.54830694",
"0.5477842",
"0.5396954",
"0.5393097",
"0.5364241",
"0.53536... | 0.7533724 | 0 |
A contrived instance of the Swarm class at a certain timestep | def swarm():
attrs_at_t = {
"position": np.array([[5, 5, 5], [3, 3, 3], [1, 1, 1]]),
"velocity": np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]]),
"current_cost": np.array([2, 2, 2]),
"pbest_cost": np.array([1, 2, 3]),
"pbest_pos": np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, experiment) -> None:\n self.logger = get_logger()\n np.random.seed(experiment.seed)\n self.gpu_imported = False\n\n from sktime.forecasting.naive import NaiveForecaster # type: ignore\n\n # Disable container if certain features are not supported but enforced -... | [
"0.6238605",
"0.6027384",
"0.58035123",
"0.58017886",
"0.57656986",
"0.5728511",
"0.56881696",
"0.5685048",
"0.566662",
"0.5657241",
"0.5647759",
"0.56329703",
"0.56107444",
"0.5609077",
"0.5550517",
"0.55491215",
"0.55471325",
"0.5541601",
"0.5539787",
"0.552764",
"0.5524261... | 0.6183798 | 1 |
Lazyinitialize and return the map '__inits'. | def _get_inits(self):
# Fast-path already loaded
if self.__inits is not None:
return self.__inits
# Initialize the dictionary
self.__inits = dict()
# Populate this dictionary with PyTorch's initialization functions
for name in dir(torch.nn.init):
if len(name) == 0 or name[0] == "_": ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.map = defaultdict(list)",
"def __init__(self):\n self._map = {}",
"def __init__(self):\n self.map = {}",
"def __init___0(self, map):\n super(LongObjectHashMap, self).__init__()\n self.__init__()\n putAll(map)",
"def initMaps(self):\r\n ... | [
"0.6993006",
"0.6786959",
"0.6697211",
"0.65989107",
"0.65955734",
"0.65414006",
"0.6363612",
"0.6357842",
"0.6316137",
"0.6269083",
"0.62458223",
"0.62295544",
"0.6169978",
"0.61410826",
"0.60328925",
"0.60254985",
"0.60150677",
"0.6006629",
"0.598576",
"0.598576",
"0.595955... | 0.69034976 | 1 |
Getter for the immutable configuration. | def config(self):
return self._config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self.config",
"def config(self):\r\n return self._config",
"def get_configuration(self) -> dict:\n return self.config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n return self.__config",
"def _get_config(self):\n retu... | [
"0.7532254",
"0.7434306",
"0.7398484",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"0.7383885",
"... | 0.74967396 | 1 |
Resolve the given keywordarguments with the associated default value. | def _resolve_defaults(self, **kwargs):
res = list()
for name, value in kwargs.items():
if value is None:
value = self.default(name)
if value is None:
raise RuntimeError(f"Missing default {name}")
res.append(value)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_defaults(func, args, kwargs):\n\n sig = signature(func)\n bound_arguments = sig.bind(*args, **kwargs)\n for param in sig.parameters.values():\n if param.name not in bound_arguments.arguments:\n bound_arguments.arguments[param.name] = param.default\n args = [bound_arguments.... | [
"0.62737644",
"0.62166053",
"0.61661214",
"0.6039033",
"0.600659",
"0.5755124",
"0.5740943",
"0.57397556",
"0.5715185",
"0.5697836",
"0.5645638",
"0.564297",
"0.5631306",
"0.5627819",
"0.5617296",
"0.55944556",
"0.5590815",
"0.55748945",
"0.5564289",
"0.55477095",
"0.5541425"... | 0.7209708 | 0 |
Get (optionally make each parameter's gradient) a reference to the flat gradient. | def get_gradient(self):
# Fast path
if self._gradient is not None:
return self._gradient
# Flatten (make if necessary)
gradient = tools.flatten(tools.grads_of(self._model.parameters()))
self._gradient = gradient
return gradient | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_grad(self, params: Sequence[float] = []) -> np.ndarray:\n self.check_parameters(params)\n if hasattr(self, 'utry'):\n return np.array([])\n\n return self.gate.get_grad(params) # type: ignore",
"def get_gradient(self, name, return_names=False):\r\n matches = self.gr... | [
"0.67258173",
"0.66931844",
"0.6671657",
"0.666168",
"0.6633882",
"0.66105443",
"0.6609874",
"0.65999806",
"0.6564061",
"0.65447426",
"0.6535032",
"0.6535032",
"0.6496627",
"0.6485122",
"0.645268",
"0.64155984",
"0.64155984",
"0.6404585",
"0.6384728",
"0.6378193",
"0.6351607"... | 0.7660772 | 0 |
Overwrite the gradient with the given one. | def set_gradient(self, gradient, relink=None):
# Fast path 'set(get())'-like
if gradient is self._gradient:
return
# Assignment
if (self._config.relink if relink is None else relink):
tools.relink(tools.grads_of(self._model.parameters()), gradient)
self._gradient = gradient
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_gradient(self, learning_rate):\n raise NotImplementedError()",
"def gradient(self, x):\n pass",
"def update_gradients(self, grads):\n self.variance.gradient = grads[0]",
"def _UpdateGradient(self):\n self.mol.GetGradient('analytic')",
"def GradientAdjuster(self):\n ... | [
"0.6853908",
"0.6827795",
"0.6768993",
"0.6743093",
"0.66109955",
"0.65472317",
"0.6457684",
"0.6408017",
"0.6408017",
"0.6404418",
"0.6394301",
"0.6387639",
"0.63845134",
"0.63560945",
"0.6331574",
"0.62266386",
"0.6209401",
"0.6209401",
"0.620928",
"0.6202469",
"0.6138053",... | 0.6841816 | 1 |
Estimate loss at the current parameters, with a batch of the given dataset. | def loss(self, dataset=None, loss=None, training=None):
# Recover the defaults, if missing
dataset, loss = self._resolve_defaults(trainset=dataset, loss=loss)
# Sample the train batch
inputs, targets = dataset.sample(self._config)
# Guess whether computation is for training, if necessary
if trai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_loss(self, input_dataset, target_dataset):\n\t\t#######################################################################\n\t\t# ** START OF YOUR CODE **\n\t\t#######################################################################\n\t\tprediction = self.network.forward(input_dataset)\n... | [
"0.73818934",
"0.7358056",
"0.7084048",
"0.7058428",
"0.70112884",
"0.67972136",
"0.6793552",
"0.6736881",
"0.67039496",
"0.66482806",
"0.6622441",
"0.6595061",
"0.6553711",
"0.6547793",
"0.6482799",
"0.6478653",
"0.6476673",
"0.6454832",
"0.6449189",
"0.6435698",
"0.64344716... | 0.7548214 | 0 |
Update the parameters using the given gradient, and the given optimizer. | def update(self, gradient, optimizer=None, relink=None):
# Recover the defaults, if missing
optimizer = self._resolve_defaults(optimizer=optimizer)[0]
# Set the gradient
self.set_gradient(gradient, relink=(self._config.relink if relink is None else relink))
# Perform the update step
optimizer.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateParams(self,gradients):\n for i in xrange(len(self.params)):\n self.params[i].set_value(self.params[i].get_value()-gradients[i]/(1/self.learning_rate+self.iterations))",
"def update_parameters(parameters, grads, learning_rate):\n pass",
"def update(params: hk.Params, opt_state: O... | [
"0.74504733",
"0.74125546",
"0.74061626",
"0.739677",
"0.7362719",
"0.73294646",
"0.7314505",
"0.7245679",
"0.71247953",
"0.71035093",
"0.70949864",
"0.70821273",
"0.70228684",
"0.7003241",
"0.69547",
"0.69541496",
"0.6953168",
"0.6949138",
"0.6941658",
"0.68929714",
"0.68911... | 0.82992876 | 0 |
Returns the revision number of the documentation helper | def getRevisionNumber(self):
return self.getDocumentedObject().getRevision() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revision():\n pass",
"def get_revision(self) -> str:\n raise NotImplementedError",
"def get_reversion():\n return to_str(backend.get().af_get_revision())",
"def get_document_revision(draft):\n rev = draft.Properties.Item[\"ProjectInformation\"][\"Revision\"].Value\n return int(rev)",
... | [
"0.75591534",
"0.7176995",
"0.6906323",
"0.6825782",
"0.6816973",
"0.6808191",
"0.6727399",
"0.672288",
"0.670609",
"0.670609",
"0.66322637",
"0.65568364",
"0.6457645",
"0.6452884",
"0.64518714",
"0.64462185",
"0.64440936",
"0.640579",
"0.63940203",
"0.6378211",
"0.63773394",... | 0.74285233 | 1 |
Returns the building_state of the documentation helper | def getBuildingState(self):
return self.getDocumentedObject().getBuildingState() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getstate__(self):\n return '1.0', self.__dict__",
"def build_info(self):\n return self._build_info",
"def getBuild():",
"def _get_state(self):",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return sel... | [
"0.5996054",
"0.59351057",
"0.59308064",
"0.5894623",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
"0.5755433",
... | 0.7356538 | 0 |
Returns the installation_state of the documentation helper | def getInstallationState(self):
return self.getDocumentedObject().getInstallationState() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getstate__(self):\n return '1.0', self.__dict__",
"def __bool__(self):\n return self.installed",
"def installed(self):\n if self._installed is None:\n self._installed = (self.path is not None)\n return self._installed",
"def test_module_doc(self):\n self.as... | [
"0.563757",
"0.55448323",
"0.54356486",
"0.53925073",
"0.5391503",
"0.5266913",
"0.5242307",
"0.52030516",
"0.5165966",
"0.5157053",
"0.5146448",
"0.5146448",
"0.5145781",
"0.51445997",
"0.5140736",
"0.5140736",
"0.5140736",
"0.5140736",
"0.5140736",
"0.5140736",
"0.5140736",... | 0.7628828 | 0 |
Returns the list of maintainers of the business template | def getMaintainerList(self):
return self.getDocumentedObject().getMaintainerList() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maintainers(path):\n pkg = catkin_pkg.package.parse_package(path)\n for m in pkg.maintainers:\n yield m.name, m.email",
"def get_maintainers(path, sections, level=0):\n maintainers = []\n lists = []\n for section in sections:\n tmp_maint, tmp_lists = get_section_maintainers(path,... | [
"0.71670526",
"0.57291937",
"0.5708895",
"0.56494933",
"0.54957306",
"0.52068835",
"0.519594",
"0.51794",
"0.51772916",
"0.5174925",
"0.51703",
"0.51602983",
"0.51108074",
"0.51013446",
"0.5087488",
"0.50530934",
"0.5052825",
"0.50417316",
"0.50362384",
"0.5026272",
"0.501886... | 0.6833903 | 1 |
Returns the list of dependencies of the business template | def getDependencyList(self):
return self.getDocumentedObject().getDependencyList() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_makefile_dependencies(self, template: Union[Path, str]) -> List[Path]:\n if isinstance(template, Path):\n template = template.read_text()\n dependencies = self.variable_files + self.yasha_extensions_files\n referenced_template_partials = find_referenced_templates(self.env.pa... | [
"0.70268905",
"0.684348",
"0.6608646",
"0.6571686",
"0.6553572",
"0.65488034",
"0.65329045",
"0.6526772",
"0.6526585",
"0.65231925",
"0.6338688",
"0.6267865",
"0.62528545",
"0.6232679",
"0.619495",
"0.6190423",
"0.6155949",
"0.61517686",
"0.6142433",
"0.613119",
"0.612179",
... | 0.7118099 | 0 |
Saves a dummy tokenized corpus to file and reads it | def test_unlabeled_corpus_saving(self):
original_corpus = [["Yo", "soy", "una", "oración", "gramatical", ",",
"regocíjense", "en", "mi", "glória", "."],
["Yo", "ungrammatical", "es", "oración", ","
"tú", "presumido", "elitista", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(self):\n\n x = [] # input documents\n for file_path in glob.glob(self.train_dir + '*.txt'):\n file_as_string = open(file_path).read()\n x.append(file_as_string)\n\n self.tokenizer.fit_on_texts(x)\n print('input vocabulary size:', len(self.tokenizer.word_index))\n pickle_file =... | [
"0.6683646",
"0.6558421",
"0.6415234",
"0.6296283",
"0.62567896",
"0.6207593",
"0.62057245",
"0.6168442",
"0.6166183",
"0.6162617",
"0.6142047",
"0.61382973",
"0.61257404",
"0.61155325",
"0.6110446",
"0.6080938",
"0.60807514",
"0.6071364",
"0.6066978",
"0.6061769",
"0.6054339... | 0.7455388 | 0 |
Saves corpus to file as G or unG and loads with reader | def test_labeled_corpus_saving(self):
original_corpus = [["Yo", "soy", "una", "oración", "gramatical", ",",
"regocíjense", "en", "mi", "glória", "."],
["Yo", "ungrammatical", "es", "oración", ","
"tú", "presumido", "elitista", ".... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(data_path):\n print(\"RNN Language MODEL: Loading gigaword corpus\")\n return data.CorpusGigaword(data_path)",
"def save(file, corpus):\n with open(file, 'w') as f_out:\n f_out.write(corpus)",
"def test_unlabeled_corpus_saving(self):\n\n original_corpus = [[\"Yo\", \"soy\",... | [
"0.66802055",
"0.6517697",
"0.6413594",
"0.6041964",
"0.59901166",
"0.5943074",
"0.58893937",
"0.5885977",
"0.5851539",
"0.5844479",
"0.5814858",
"0.5806204",
"0.5805687",
"0.5789219",
"0.57719606",
"0.57119584",
"0.56951493",
"0.5610936",
"0.5608055",
"0.5598674",
"0.5593661... | 0.68314505 | 0 |
Print query plans by running EXPLAIN on the queries. This also checks for distribution styles which cause a performance penalty. When the query plan consists of multiple query plans (which means, there will be temporary tables created), warn about that as well. A query plan has multiple subqueries when the query plan h... | def explain_queries(dsn: dict, relations: List[RelationDescription]) -> None:
transforms = [relation for relation in relations if relation.sql_file_name is not None]
if not transforms:
logger.info("No transformations were selected")
return
queries_with_temps = 0
counter: Dict[str, int] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explain(self, query, all_plans=False, max_plans=None, opt_rules=None):\n options = {\"allPlans\": all_plans}\n if max_plans is not None:\n options[\"maxNumberOfPlans\"] = max_plans\n if opt_rules is not None:\n options[\"optimizer\"] = {\"rules\": opt_rules}\n\n ... | [
"0.60454094",
"0.57867223",
"0.5622512",
"0.5551654",
"0.53180766",
"0.51592",
"0.51583326",
"0.5144332",
"0.512256",
"0.497037",
"0.49124336",
"0.4910604",
"0.4896818",
"0.48868772",
"0.48627636",
"0.4828058",
"0.4767987",
"0.47338057",
"0.4703885",
"0.46736893",
"0.46396133... | 0.6842807 | 0 |
restore packages required by tests | def restore(c):
c.run('pip install -r tests/requirements.txt') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n builtins.__import__ = self.original_imports",
"def tearDown(self):\n\n def reset_module(name, module):\n if module:\n sys.modules[name] = module\n else:\n sys.modules.pop(name, None)\n reset_module('simplejson', self.simplejson)\n reset_module('json',... | [
"0.70386827",
"0.68917936",
"0.6747531",
"0.6430803",
"0.6386545",
"0.63033724",
"0.6299603",
"0.6249798",
"0.6207736",
"0.615193",
"0.6128174",
"0.6094456",
"0.60940164",
"0.6078902",
"0.6071979",
"0.60655504",
"0.6059042",
"0.6059042",
"0.6059042",
"0.6059042",
"0.6059042",... | 0.75833416 | 0 |
Asynchronously run function func in a separate thread. Any args and kwargs supplied for this function are directly passed | async def to_thread(func, *args, **kwargs):
loop = asyncio.get_running_loop()
ctx = contextvars.copy_context()
func_call = functools.partial(ctx.run, func, *args, **kwargs)
return await loop.run_in_executor(None, func_call) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def run_async(self, func, *args):\n return await self.eventloop.run_in_executor(None, func, *args)",
"async def run_in_executor(self, func: Callable, *args, **kwargs) -> Callable:\n\n return await utils.run_in_executor(self, func, *args, **kwargs)",
"def async_thread_call(fun, *args, **kwar... | [
"0.802733",
"0.76854813",
"0.7541517",
"0.7402016",
"0.7319474",
"0.72449887",
"0.7124707",
"0.70953923",
"0.7022538",
"0.70146286",
"0.68466824",
"0.6842826",
"0.68293655",
"0.6748599",
"0.6718475",
"0.67118776",
"0.6701636",
"0.6696408",
"0.6695396",
"0.6683793",
"0.6668651... | 0.8166729 | 0 |
Test reading of selections | def test_read_selection():
# test one channel for each selection
ch_names = ['MEG 2211', 'MEG 0223', 'MEG 1312', 'MEG 0412', 'MEG 1043',
'MEG 2042', 'MEG 2032', 'MEG 0522', 'MEG 1031']
sel_names = ['Vertex', 'Left-temporal', 'Right-temporal', 'Left-parietal',
'Right-parietal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load_selections(self, selection):\n selection.load_selections([SAMPLE_ROI])\n rows, cols = np.column_stack(self.roi_coords)\n for pixel in self.image_set._roi_data[rows, cols]:\n assert np.array_equal(\n pixel, [255.0, 0.0, 0.0, 255.]\n )\n ... | [
"0.68627185",
"0.67245066",
"0.6698195",
"0.66768897",
"0.6239678",
"0.62247646",
"0.6216286",
"0.6147808",
"0.6068246",
"0.6068246",
"0.60553855",
"0.60553855",
"0.6048488",
"0.59582263",
"0.59461415",
"0.59399205",
"0.5934548",
"0.5933191",
"0.5933191",
"0.5862856",
"0.5832... | 0.7450754 | 0 |
Set the RAID level and enforce restrictions based on it. | def level(self, value):
self._level = mdraid.RAID_levels.raidLevel(value) # pylint: disable=attribute-defined-outside-init | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def set_volume(self, level: float) -> None:\n if 0.0 <= level <= 100.0:\n await self.relay(\"set_volume\")(level)\n else:\n raise exceptions.ProtocolError(f\"volume {level} is out of range\")",
"def set_risk(self, event):\n if not self.caller.check_permstring(\"bu... | [
"0.5900001",
"0.5721373",
"0.56641144",
"0.55890644",
"0.54322106",
"0.53719246",
"0.5357899",
"0.53200305",
"0.531423",
"0.5305148",
"0.52952915",
"0.52640986",
"0.52593005",
"0.5225371",
"0.52164674",
"0.51859725",
"0.5176793",
"0.5175078",
"0.51628816",
"0.5149921",
"0.514... | 0.6582935 | 0 |
Whether or not a bitmap should be created on the array. If the the array is sufficiently small, a bitmap yields no benefit. If the array has no redundancy, a bitmap is just pointless. | def createBitmap(self):
return self.level.has_redundancy and self.size >= 1000 and self.format.type != "swap" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boolean(operation, bitmaps):\n\n maxX, maxY = size = bitmaps[0].size()\n result = bitmap(size)\n for x in range(maxX):\n for y in range(maxY):\n pixel = bitmaps[0].get(x,y)\n for b in bitmaps[1:]:\n pixel = apply(operation, (pixel, b.get(x,y)))\n ... | [
"0.5711391",
"0.5578023",
"0.5522623",
"0.55190635",
"0.5416681",
"0.5410643",
"0.5383515",
"0.534708",
"0.53022337",
"0.52064997",
"0.51892835",
"0.51621425",
"0.51530045",
"0.51455915",
"0.51396513",
"0.5137458",
"0.5131842",
"0.5128583",
"0.5120213",
"0.5111307",
"0.508589... | 0.7070911 | 0 |
Estimate the superblock size for a member of an array, given the total available memory for this array and raid level. | def getSuperBlockSize(self, raw_array_size):
return mdraid.get_raid_superblock_size(raw_array_size,
version=self.metadataVersion) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self):\n # For container members return probed size, as we cannot determine it\n # when teared down.\n if self.type == \"mdbiosraidarray\":\n return self._size\n\n if not self.exists or not self.mediaPresent:\n try:\n size = self.level.get_s... | [
"0.6560867",
"0.60525334",
"0.58276767",
"0.5526972",
"0.5518182",
"0.5457633",
"0.54481673",
"0.53774196",
"0.5312824",
"0.5285637",
"0.523636",
"0.52266747",
"0.52049375",
"0.51603484",
"0.51501036",
"0.51243424",
"0.5099344",
"0.5096797",
"0.5086692",
"0.50835633",
"0.5067... | 0.6155427 | 1 |
This array's mdadm.conf entry. | def mdadmConfEntry(self):
if self.memberDevices is None or not self.mdadmFormatUUID:
raise errors.DeviceError("array is not fully defined", self.name)
# containers and the sets within must only have a UUID= parameter
if self.type == "mdcontainer" or self.type == "mdbiosraidarray":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _config_md(self):\n self.cntrl[\"imin\"] = 0\n self.cntrl[\"ntx\"] = 1\n self.cntrl[\"irest\"] = 0\n self.cntrl[\"maxcyc\"] = 0\n self.cntrl[\"ncyc\"] = 0\n self.cntrl[\"dt\"] = 0.002\n self.cntrl[\"nstlim\"] = 5000\n self.cntrl[\"ntpr\"] = 500\n s... | [
"0.57267016",
"0.5694743",
"0.5616297",
"0.5412698",
"0.52210397",
"0.5202625",
"0.5200525",
"0.5149606",
"0.5128292",
"0.51210165",
"0.51210165",
"0.51210165",
"0.5116704",
"0.51102847",
"0.5095763",
"0.506082",
"0.50395584",
"0.5036575",
"0.5024734",
"0.5007899",
"0.5006345... | 0.8235505 | 0 |
Total number of devices in the array, including spares. | def totalDevices(self):
if not self.exists:
return self._totalDevices
else:
return len(self.parents) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_devices(self):\n return self.drt_manager.get_number_of_devices()",
"def num_devices(self):\n # put every device into bypass mode (IR = all 1's)\n tdi = bits.bits()\n tdi.ones(_flush_size)\n self.driver.scan_ir(tdi)\n # now each DR is a single bit\n # the DR chain length is ... | [
"0.72783875",
"0.7213328",
"0.71339613",
"0.69303787",
"0.6843241",
"0.6801235",
"0.67578346",
"0.666934",
"0.6656027",
"0.66361606",
"0.66151303",
"0.66120684",
"0.66026324",
"0.6561837",
"0.65616184",
"0.6547956",
"0.65011466",
"0.6492598",
"0.64866495",
"0.6474302",
"0.646... | 0.74849176 | 0 |
Return True if the array is running in degraded mode. | def degraded(self):
rc = False
degraded_file = "%s/md/degraded" % self.sysfsPath
if os.access(degraded_file, os.R_OK):
val = open(degraded_file).read().strip()
if val == "1":
rc = True
return rc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_is_degraded(self):\n return self._cluster_is_degraded",
"def run_degraded(self):\n return self._run_degraded",
"def cluster_is_degraded(self, cluster_is_degraded):\n \n self._cluster_is_degraded = cluster_is_degraded",
"def environment_needs_upgrade(self, db):\n\n ... | [
"0.74468637",
"0.6978083",
"0.63526213",
"0.5973242",
"0.5931586",
"0.5923811",
"0.5850111",
"0.5786948",
"0.5749716",
"0.5732268",
"0.5731566",
"0.571509",
"0.5644276",
"0.56406456",
"0.56382126",
"0.5621209",
"0.5603482",
"0.5590045",
"0.55799276",
"0.5578309",
"0.5564095",... | 0.7289897 | 1 |
Returns this array's members. If the array is a BIOS RAID array then its unique parent is a container and its actual member devices are the container's parents. | def members(self):
if self.type == "mdbiosraidarray":
members = self.parents[0].parents
else:
members = self.parents
return list(members) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def members(self) -> object:\n return self._members",
"def get_members(self):\n return sorted([x[\"patient\"] for x in self.pedigree])",
"def members(self):\n return self._members",
"def members(self) -> \"List[str]\":\n return self._attrs.get(\"members\")",
"def members(self) -... | [
"0.61973387",
"0.60599583",
"0.59555405",
"0.5900033",
"0.5900033",
"0.5900033",
"0.5747056",
"0.56927097",
"0.5660452",
"0.56358093",
"0.5529541",
"0.55137974",
"0.5495251",
"0.5460617",
"0.54484105",
"0.5417417",
"0.5412901",
"0.5392785",
"0.5392785",
"0.5392785",
"0.539278... | 0.81027997 | 0 |
An MDRaidArrayDevice is complete if it has at least as many component devices as its count of active devices. | def complete(self):
return (self.memberDevices <= len(self.members)) or not self.exists | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_full(self):\n\n return self.count == len(self.array)",
"def is_devices_file_empty(self) -> bool:\n return len(self._devices_names) == 0",
"def is_full(self) -> bool:\n return self._array[0].all()",
"def num_devices(self):\n\t\t\treturn cuda.Device.count()",
"def is_array(self):\... | [
"0.6204871",
"0.5654548",
"0.55137485",
"0.5476837",
"0.547637",
"0.5475766",
"0.543526",
"0.5363918",
"0.5363918",
"0.5363918",
"0.5363918",
"0.53110677",
"0.53021514",
"0.5291546",
"0.52591723",
"0.52361983",
"0.52098626",
"0.52098626",
"0.5194426",
"0.5166191",
"0.5166191"... | 0.5925373 | 1 |
Remove any stale LVM metadata that preexisted in a new array's ondisk footprint. | def removeStaleLVM():
log.debug("waiting 5s for activation of stale lvm on new md array %s", self.path)
time.sleep(5)
udev.settle()
try:
pv_info = lvm.pvinfo(device=self.path)[self.path]
except (errors.LVMError, KeyError) as e:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handleCleanMetadataKeep(self):\n logging.debug(\"Removing all metadata found...\")\n filePath = self.filesList.selectedItems()[0].text(2)\n self.filesList.removeAllMeta(filePath)",
"def reset_memory(self):\n self.memory = []",
"def purge_outdated(self):\n todelete = []\n ... | [
"0.5924344",
"0.582797",
"0.5711007",
"0.55690396",
"0.555827",
"0.5542481",
"0.55304277",
"0.5530293",
"0.5512735",
"0.55046225",
"0.5482329",
"0.5454239",
"0.54540074",
"0.5399546",
"0.5387027",
"0.53801054",
"0.53657824",
"0.5358577",
"0.5347126",
"0.5331276",
"0.53290063"... | 0.6921122 | 0 |
Update an image's total likes when a user likes it. users_like is a ManyToManyField so we send a m2m_changed signal to this receiver function. It updates the total_likes field for an image instance when that image's like count changes. Saying "(m2m_changed...)" connects this users_like_changed receiver function to the ... | def users_like_changed(sender, instance, **kwargs):
instance.total_likes = instance.users_like.count()
instance.save() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def like(self, data_base, user):\n cursor = data_base.cursor()\n cursor.execute(f\"UPDATE post SET likes = likes + 1 WHERE id = '{self.id}'\") # Increments the likes\n cursor.execute(f\"INSERT INTO user_like (user_id, post_id) VALUES ({user.id}, {self.id})\")\n if self.commit_to_db:\n ... | [
"0.6525215",
"0.6521622",
"0.6354634",
"0.5991368",
"0.59026736",
"0.58872616",
"0.5883138",
"0.58102816",
"0.57430744",
"0.5701689",
"0.5657063",
"0.5547686",
"0.55232435",
"0.54997104",
"0.5462449",
"0.54308313",
"0.54213345",
"0.54213345",
"0.54213345",
"0.5407653",
"0.536... | 0.82943195 | 0 |
Updates vehicle's last date and duration if it exists in the database, creates a new vehicle if it doesn't. Updates vehicle's price/seller/mileage if a change is found from the existing price/seller. | def update_vehicle(vehicle, marketplace):
api = PscraperAPI()
seller_id = get_seller_id(vehicle, api)
if seller_id == -1:
return
# Post to history table
api.history_post(**{
'vin': vehicle[VIN],
'price': vehicle[PRICE],
'seller': seller_id,
'date': CURR_DATE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_vehicle_db_entry(cur, ulog, log_id, vehicle_name):\n\n vehicle_data = DBVehicleData()\n if 'sys_uuid' in ulog.msg_info_dict:\n vehicle_data.uuid = escape(ulog.msg_info_dict['sys_uuid'])\n\n if vehicle_name == '':\n cur.execute('select Name '\n 'from ... | [
"0.6022283",
"0.60146856",
"0.5466974",
"0.54229707",
"0.5400045",
"0.53945935",
"0.5297448",
"0.5028537",
"0.50255257",
"0.49987572",
"0.49789652",
"0.49690008",
"0.4945047",
"0.49177167",
"0.48964798",
"0.4888726",
"0.48844332",
"0.48789513",
"0.48725942",
"0.48639888",
"0.... | 0.7566497 | 0 |
Returns a seller id (primary_key). Search for existing seller by address. If not found creates a new seller and returns its id. Requires `seller` to have `streetAddress`, `city` and `state`. If any are missing returns 1. | def get_seller_id(vehicle, api):
seller = vehicle[SELLER]
try:
address = ADDRESS_FORMAT.format(seller[STREET_ADDRESS], seller[CITY], seller[STATE])
except KeyError:
send_slack_message(text=f'Address error for seller: {seller} and vehicle: {vehicle}')
return -1
# Search for exist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seller(self):\n if \"seller\" in self._prop_dict:\n return self._prop_dict[\"seller\"]\n else:\n return None",
"def create_seller(self, order_items_with_sellers):\n seller = {}\n\n for item in order_items_with_sellers:\n\n item_seller = item.pop(\"... | [
"0.5838762",
"0.5589778",
"0.5363158",
"0.51414835",
"0.4917831",
"0.48628408",
"0.47639155",
"0.46608904",
"0.4619975",
"0.45797047",
"0.45524642",
"0.4546192",
"0.45180133",
"0.45144153",
"0.45110527",
"0.450679",
"0.4498182",
"0.44433165",
"0.4442908",
"0.44150788",
"0.436... | 0.79333526 | 0 |
Context manager for applying `options` to `camera` | def _applied_camera_options(options, panel, camera):
from maya import cmds
old_options = None
if options is not None:
options = _parse_options(options)
old_options = dict()
for opt in options:
try:
old_options[opt] = cmds.getAttr(camera + "." + opt)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createCameraOptions(self):\n\t\tcamera = mc.optionMenuGrp(\"cameraPresets\", query=True, value=True)\n\t\trig = mc.checkBox(\"createRig\", query=True, value=True)\n\t\tphysical = mc.checkBox(\"physicalCam\", query=True, value=True)\n\n\t\t#print camera, rig, physical\n\t\tself.createCamera(camera, rig, physica... | [
"0.6634104",
"0.5975495",
"0.5830725",
"0.5761938",
"0.5723571",
"0.5629487",
"0.5602971",
"0.55979174",
"0.5582553",
"0.5562712",
"0.5544929",
"0.5543145",
"0.55121243",
"0.54859847",
"0.5469863",
"0.54658794",
"0.54485327",
"0.54485327",
"0.54485327",
"0.54485327",
"0.54341... | 0.76654744 | 0 |
Context manager for isolating `nodes` in `panel` | def _isolated_nodes(nodes, panel):
from maya import cmds
if nodes is not None:
cmds.isolateSelect(panel, state=True)
for obj in nodes:
cmds.isolateSelect(panel, addDagObject=obj)
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_nodes(self):",
"def plotInternalNodes( self ):\n\n \n for node_id in self.mTree.chain.keys():\n\n node = self.mTree.node( node_id )\n if node.succ == []: continue\n \n x = self.mNodeWidthsEnd[node_id]\n y = self.mNodeHeights[node_id]... | [
"0.5922117",
"0.5861056",
"0.5821003",
"0.56688917",
"0.56634045",
"0.55984384",
"0.5594422",
"0.5526654",
"0.54405886",
"0.5355178",
"0.52818495",
"0.52444124",
"0.52413833",
"0.52249444",
"0.52019596",
"0.5173768",
"0.516533",
"0.5153556",
"0.5110525",
"0.5091126",
"0.50588... | 0.6871829 | 0 |
Copies the image at path to the system's global clipboard. | def _image_to_clipboard(path):
import PySide.QtGui
image = PySide.QtGui.QImage(path)
clipboard = PySide.QtGui.QApplication.clipboard()
clipboard.setImage(image, mode=PySide.QtGui.QClipboard.Clipboard) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imageToClipboard(self, imagePath):\n subprocess.Popen([\"xclip\", \"-selection\", \"clipboard\", \"-t\", \"image/png\", \"-i\", imagePath])",
"def _copy_image(self, name):\n image = self._get_image(name)\n QtGui.QApplication.clipboard().setImage(image)",
"def pull(cls, image_path: str)... | [
"0.7961338",
"0.75202537",
"0.7466434",
"0.7201786",
"0.6706538",
"0.6553526",
"0.6495429",
"0.64867824",
"0.64613926",
"0.6399536",
"0.6383092",
"0.6340555",
"0.63187766",
"0.62546164",
"0.6202112",
"0.61882156",
"0.6181949",
"0.6165936",
"0.61511457",
"0.6138789",
"0.613202... | 0.82610446 | 0 |
Return available screen size without space occupied by taskbar | def _get_screen_size():
import PySide.QtGui
rect = PySide.QtGui.QDesktopWidget().screenGeometry(-1)
return [rect.width(), rect.height()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_screen_resolution() -> tuple:\n root = tkinter.Tk()\n root.withdraw()\n return root.winfo_screenwidth(), root.winfo_screenheight()",
"def get_curr_screen_size():\n root = tk.Tk()\n root.update_idletasks()\n root.attributes('-fullscreen', True)\n root.state('iconic')\n... | [
"0.78982854",
"0.7850482",
"0.77242196",
"0.7231198",
"0.7129019",
"0.6943986",
"0.6920462",
"0.6910313",
"0.6907015",
"0.6890995",
"0.6859646",
"0.6852029",
"0.6801858",
"0.6686967",
"0.6676965",
"0.6656755",
"0.66419977",
"0.6589057",
"0.6541778",
"0.65144944",
"0.6496563",... | 0.80106145 | 0 |
this function checks for the channel id of the message and the channel id that we are currently set up with if they do not match, a different server is talking to us and we need to switch ids | def check_server_id(message):
global server_id
if server_id is 0: # the channel_id is not set up at all
server_id = message.channel.id # this is the current server that we're talking to
channel = client.get_channel(server_id) # this is the current channel in that server that we will... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_react_invalid_message_id_in_different_channel():\n clear()\n user_a, user_b = register_n_users(2)\n # user_a create a channel\n channels_create(user_a[\"token\"], \"public_channel_a\", True)[\"channel_id\"]\n # user_b create a channel and send message in his own channel\n public_channel_... | [
"0.6464594",
"0.61057186",
"0.6081553",
"0.60029614",
"0.5816137",
"0.57766455",
"0.5732155",
"0.5721855",
"0.57159436",
"0.56495",
"0.5646752",
"0.5597534",
"0.55924404",
"0.5532289",
"0.551915",
"0.55178785",
"0.5504246",
"0.54991776",
"0.54842055",
"0.54765975",
"0.546579"... | 0.8044859 | 0 |
Si viene del form, eliminar los resources de favorite. | def delete(self, request, *args, **kwargs):
favorites = self.get_object()
favorites_list = favorites.anuncios.all()
if favorites_list:
for favorite in favorites_list:
favorites.anuncios.remove(favorite)
msg_success = 'Se han eliminado todos los anuncios de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_fav(request, favorite_id):\n # Gets a favorite designated by favorite_id or returns 404\n favorite = get_object_or_404(Favorite, pk=favorite_id)\n favorite.delete()\n\n print(\"{}, {} a été supprimé des favoris\".format(\n favorite.products.name, favorite.products.bra... | [
"0.6298642",
"0.6046698",
"0.5834785",
"0.58271194",
"0.57427776",
"0.57152236",
"0.5711849",
"0.5689799",
"0.56716377",
"0.5657353",
"0.56441236",
"0.5606371",
"0.558897",
"0.5567493",
"0.55378246",
"0.55259836",
"0.5498272",
"0.5495839",
"0.5485714",
"0.5481957",
"0.5464602... | 0.71054 | 0 |
Makes data(losses and performance) into a dictionary for the sake of data plotting. | def verbose_data_dict(perf_data, epoch_losses, batch_losses):
data_dict = []
if epoch_losses is not None and len(epoch_losses['actor_mse']) > 0:
data_dict.append({'title': "Actor_MSE_Loss_vs_Epoch", 'data': epoch_losses['actor_mse'],
'y_label': 'Loss' + '( min: ' + str(min(epoc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_visualization_dict(self):\n self._data = {}\n self._data['name'] = self.name\n self._data['type'] = self.__repr__()\n self._data['color'] = self._color_rgb\n\n try:\n self._data['simulation_matrix'] = \\\n self._visualiz... | [
"0.6428221",
"0.6370351",
"0.63488334",
"0.62696755",
"0.61769027",
"0.6172959",
"0.6154137",
"0.6150135",
"0.6101624",
"0.6085333",
"0.6069834",
"0.6062865",
"0.60580146",
"0.6051934",
"0.60359126",
"0.6021584",
"0.5972537",
"0.5971956",
"0.59192777",
"0.59124386",
"0.591126... | 0.67623484 | 0 |
Left rotates array in place. | def left_rotate(arr):
return arr[1:] + [arr[0]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_rotate_left(x):\n return jnp.roll(x, -1)",
"def rotate_one_left(a):\n first = a[0]\n for i in range(1, len(a)):\n a[i-1] = a[i]\n a[len(a)-1] = first\n return a",
"def rotLeft(a, d):\n for i in range(d):\n arr = left_rotate(arr)\n return arr",
"def left_rotate_s3(ar... | [
"0.7854973",
"0.7784085",
"0.7601401",
"0.75644875",
"0.7368276",
"0.7294856",
"0.7139411",
"0.7134433",
"0.7118476",
"0.7074384",
"0.7049175",
"0.7034415",
"0.7001875",
"0.6999863",
"0.6877383",
"0.6863193",
"0.6856836",
"0.68064946",
"0.6760732",
"0.6756952",
"0.67057365",
... | 0.83796865 | 0 |
Rotates array a left d times. | def rotLeft(a, d):
for i in range(d):
arr = left_rotate(arr)
return arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_rotate_s5(arr, d):\n n = len(arr)\n reverse(arr, 0, d - 1)\n reverse(arr, d, n - 1)\n reverse(arr, 0, n - 1)",
"def left_rotate_s2(arr, d):\n n = len(arr)\n for i in range(d):\n for i in range(n-1):\n arr[i], arr[i + 1] = arr[i + 1], arr[i]",
"def rot_left(a, d):\n\... | [
"0.7938855",
"0.7863176",
"0.77619755",
"0.7746417",
"0.7675666",
"0.765385",
"0.751234",
"0.7508662",
"0.74861276",
"0.6955023",
"0.6937487",
"0.6847347",
"0.67692757",
"0.666606",
"0.66466427",
"0.6645032",
"0.66172624",
"0.65686184",
"0.6524597",
"0.6524597",
"0.6410889",
... | 0.8551989 | 0 |
Call regionInstances.bulkInsert to create instances | def create_instances_request(nodes, placement_groups=None, exclusive=False):
assert len(nodes) > 0
assert len(nodes) <= BULK_INSERT_LIMIT
# model here indicates any node that can be used to describe the rest
model = next(iter(nodes))
partition = lkp.node_partition(model)
template = lkp.node_temp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_instance_bulk(self, context, tenant_id, neutron_ports, vms,\n port_profiles, sync=False):",
"def bulk_insert(objects, model, session):\n session.bulk_insert_mappings(model, objects)",
"def bulkInsert(self, url, values):\n pass",
"def bulk_insert(engine, model,... | [
"0.70526975",
"0.63425976",
"0.61953104",
"0.6036918",
"0.60104376",
"0.5980589",
"0.5968712",
"0.5875212",
"0.58712333",
"0.5704445",
"0.5646855",
"0.5628462",
"0.5616152",
"0.56033796",
"0.5600429",
"0.559364",
"0.556472",
"0.5562958",
"0.5548185",
"0.5527968",
"0.552467",
... | 0.6958836 | 1 |
expand nodes in hostlist to hostnames | def expand_nodelist(nodelist):
if not nodelist:
return []
# TODO use a python library instead?
nodes = run(f"{lkp.scontrol} show hostnames {nodelist}").stdout.splitlines()
return nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_hosts():\n task_run(\"/bin/hostname -f\",RING_1_dev__allnodes)",
"def _nodelist_expand(nodelist):\n\n nodes = []\n resource_names = []\n\n # loop around resource\n for m in re.finditer(r\"(?:,)?([^,^[]*(?:\\[[^\\]]*\\])?)\", nodelist):\n if len(m.groups()) > 0 and m.group(1) != \"\... | [
"0.66660947",
"0.6634966",
"0.6114458",
"0.6082304",
"0.60345757",
"0.5907606",
"0.59021163",
"0.58536005",
"0.57937294",
"0.5788136",
"0.5783061",
"0.5779116",
"0.5699986",
"0.5688895",
"0.5682259",
"0.5679997",
"0.5672043",
"0.56352824",
"0.56273997",
"0.5595487",
"0.559369... | 0.83691394 | 0 |
set nodes down with reason | def down_nodes(nodelist, reason):
if isinstance(nodelist, list):
nodelist = util.to_hostlist(nodelist)
run(f"{lkp.scontrol} update nodename={nodelist} state=down reason='{reason}'") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changes_while_node_down_test(self):\n debug(\"changes_while_node_down_test()\")\n cluster = self.cluster\n cluster.populate(2).start()\n node1, node2 = cluster.nodelist()\n wait(2)\n session = self.patient_cql_connection(node2)\n\n self.prepare_for_changes(sessi... | [
"0.6101143",
"0.60904354",
"0.6065961",
"0.6042155",
"0.60247266",
"0.5930229",
"0.58531755",
"0.58479285",
"0.5803292",
"0.56738263",
"0.567308",
"0.5659848",
"0.56508297",
"0.5637126",
"0.5607967",
"0.55748886",
"0.5555865",
"0.5555375",
"0.55359596",
"0.5534503",
"0.553157... | 0.7425733 | 0 |
hold job, set comment to reason | def hold_job(job_id, reason):
run(f"{lkp.scontrol} hold jobid={job_id}")
run(f"{lkp.scontrol} update jobid={job_id} comment='{reason}'") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment():",
"def comment(self,msg):\n self.unhang()\n self.indent()\n print (msg,end='\\n',flush=True, file=self.fp)\n self.hanging=False",
"def work(self, job):\n pass",
"def performBreak(self, reason):\n\t\tself.skyfall = False\n\t\tself.fireball = False\n\t\tself.ca... | [
"0.6116245",
"0.60561556",
"0.5993727",
"0.5909679",
"0.5845094",
"0.58438116",
"0.5659582",
"0.5611545",
"0.55970633",
"0.55968153",
"0.55894154",
"0.5562122",
"0.55099565",
"0.55019814",
"0.5483915",
"0.5466384",
"0.5453021",
"0.54319894",
"0.54319894",
"0.54319894",
"0.543... | 0.75542176 | 0 |
resume exclusive nodes in the node list | def prolog_resume_nodes(job_id, nodelist):
# called from PrologSlurmctld, these nodes are expected to be in the same
# partition and part of the same job
nodes = nodelist
if not isinstance(nodes, list):
nodes = expand_nodelist(nodes)
if len(nodes) == 0:
return
model = next(iter(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transition(self):\n for node in self.net.nodes():\n if node not in self.evidence:\n self.update_node(node)",
"def ex_resume_node(self, node):\n domain = self._get_domain_for_node(node=node)\n return domain.resume() == 0",
"def deactivate_all(self):\n\t self.active_nodes = [F... | [
"0.6039704",
"0.5874949",
"0.5761586",
"0.57401973",
"0.55302316",
"0.5403723",
"0.53842384",
"0.53842384",
"0.53842384",
"0.5377627",
"0.5374294",
"0.53651124",
"0.534899",
"0.53298706",
"0.5308601",
"0.53050643",
"0.5283417",
"0.5244342",
"0.52025056",
"0.5186184",
"0.51855... | 0.6094034 | 0 |
Closure function for np.quantile | def quantile_func(q):
def f(x):
return np.quantile(x, q)
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_quantile():\n return np.logspace(-5, 0, 100)",
"def test__quantile(self):\r\n # regular cases\r\n sample_data = array(range(25, 42))\r\n assert_almost_equal(_quantile(sample_data, 0.5), median(sample_data))\r\n\r\n # sorted data is assumed for this function\r\n s... | [
"0.6775677",
"0.67522997",
"0.6492043",
"0.64537555",
"0.6434359",
"0.637416",
"0.6288685",
"0.6286637",
"0.62539876",
"0.6169628",
"0.6156031",
"0.61249554",
"0.6086439",
"0.60459363",
"0.60375434",
"0.6035999",
"0.6030225",
"0.60297734",
"0.6017067",
"0.6005929",
"0.5984996... | 0.8043225 | 0 |
Observe a set of particles with dim=mc,d and compare the moments to self.truth_particles | def evaluate(self, particles, **kwargs):
truth = self.truth
metrics = self.metrics
moments = self.moments
results = []
# for key in truth:
th_hvi = np.concatenate([particles[key].reshape(particles[key].shape[0], -1) for key in truth], axis=1)
tr = np.concatenate([... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize():\n # Instantiate three particles for testing\n particles = [Particle(0.3, 0.5, 1), \n Particle(0.0, -0.5, -1), \n Particle(-0.1, -0.4, 3)]\n simulator = ParticleSimulator(particles)\n visualize(simulator)",
"def update_particles(self):\n for... | [
"0.5655855",
"0.5446719",
"0.5417968",
"0.5348118",
"0.5334365",
"0.53247184",
"0.53061557",
"0.5292401",
"0.52172005",
"0.52072585",
"0.5186435",
"0.5176101",
"0.51516974",
"0.5149383",
"0.5142063",
"0.5136488",
"0.51320744",
"0.5106009",
"0.50968605",
"0.5090908",
"0.508919... | 0.63818204 | 0 |
Save the results to a .csv | def log_results(self, path):
pd.DataFrame(self.results).to_csv(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_file(self, results):\n with open(self.outputFilename, \"w\") as csvFile:\n csvWriter = csv.writer(csvFile, delimiter=',') \n title_row = ('asset_id', 'component_id', 'latitude', 'longitude', 'installation_date', 'commissioning_date', 'street_name', 'cabinet_id', 'nominal... | [
"0.7939049",
"0.7769004",
"0.769822",
"0.76656073",
"0.7656452",
"0.76372147",
"0.75850946",
"0.7568135",
"0.75580364",
"0.75563097",
"0.7374247",
"0.73633283",
"0.72895443",
"0.727119",
"0.72637475",
"0.72458535",
"0.7231727",
"0.722955",
"0.716969",
"0.71466446",
"0.7144216... | 0.78940666 | 1 |
The index_scores, will be used to plot results | def __init__(self, index_scores):
self.index_scores = index_scores | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_idx_scores_mapping(scores):\n return {i: score for i, score in enumerate(scores)}",
"def observe(self, scores, **fields):\n [self._scores.append({'value': s, 'index': i, **fields}) for s, i in zip(scores, self.index_scores)]\n for s in self.statistics:\n v = self.statistics[s]... | [
"0.6533381",
"0.6369769",
"0.61390495",
"0.6121153",
"0.59632015",
"0.5922732",
"0.5910442",
"0.5901386",
"0.5872586",
"0.58519816",
"0.5814283",
"0.5780423",
"0.5774567",
"0.57218057",
"0.5709138",
"0.57006234",
"0.5688983",
"0.5684203",
"0.5672732",
"0.5584234",
"0.55428714... | 0.7451633 | 0 |
Observe a set of scores with dim t,1 | def observe(self, scores, **fields):
[self._scores.append({'value': s, 'index': i, **fields}) for s, i in zip(scores, self.index_scores)]
for s in self.statistics:
v = self.statistics[s](scores)
self._results.append({'statistics': s, 'value': v, **fields}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_scores(jenni, input):\n scores.view_scores(jenni, input)",
"def score_metrics(predicted_scores, scores):\n tf.summary.histogram('predicted_scores', predicted_scores)",
"def disp_score():",
"def score_samples(self, X):\n ...",
"def score(self):",
"def assign_score(self, trajs):\n ... | [
"0.611618",
"0.6017691",
"0.5834547",
"0.579261",
"0.5691078",
"0.5675392",
"0.56455916",
"0.5614545",
"0.55615246",
"0.55615246",
"0.55615246",
"0.5531173",
"0.5514315",
"0.5503408",
"0.5488851",
"0.5484888",
"0.54681283",
"0.5455666",
"0.54549855",
"0.5453776",
"0.5452231",... | 0.6500926 | 0 |
Return a pandas with the results with tag methods in methods | def get_results(self, methods: list = None):
df = pd.DataFrame(self._results)
if (methods is not None) & ('method' in df.columns):
df = df.loc[[x in methods for x in df.method.values]]
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply(self, method: str, *params: Optional[Any], **kwargs: Optional[Any]) -> UserList:\n output = []\n for df in self.data:\n output.append(getattr(df, method)(*params, **kwargs))\n\n return Dfs(output)",
"def process(self, method):\n process_dicts = []\n for d i... | [
"0.57386434",
"0.5600553",
"0.5515558",
"0.53883463",
"0.5320995",
"0.52555203",
"0.52191174",
"0.5218821",
"0.52013993",
"0.5200468",
"0.51852816",
"0.5180764",
"0.51705927",
"0.5146758",
"0.5126341",
"0.50833935",
"0.5071557",
"0.50664264",
"0.504845",
"0.5043656",
"0.50127... | 0.74027586 | 0 |
Return all the scores as a pandas object | def get_scores(self):
return pd.DataFrame(self._scores) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all(self):\n cursor = self._connection.cursor()\n cursor.execute('SELECT * FROM scores ORDER BY level')\n all_scores = cursor.fetchall()\n return all_scores",
"def __save_aggregate_scores(self):\n results = pd.DataFrame(\n columns=self.results[list(self.resu... | [
"0.69594073",
"0.68114984",
"0.6612388",
"0.65604424",
"0.6527703",
"0.64726496",
"0.637789",
"0.6347311",
"0.63466966",
"0.6346475",
"0.6323906",
"0.63166344",
"0.6310829",
"0.629126",
"0.62517774",
"0.623266",
"0.6215657",
"0.6170356",
"0.615619",
"0.61290854",
"0.6122654",... | 0.85031086 | 0 |
Create row from node, style and extra prefix items. | def from_node(cls, node: NodeOrLeaf, style: "Style", extra=()):
if not extra:
return Row("", "", node)
items = [(style.vertical if cont else style.empty) for cont in extra]
indent = "".join(items[:-1])
branch = style.horizontal if extra[-1] else style.end
pre = indent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_rows(node, style, extra=()):\n yield Row.from_node(node, style, extra)\n children = node.children\n if children:\n last_idx = len(children) - 1\n for idx, child in enumerate(children):\n yield from iter_rows(child, style, extra + (idx != last_idx,))",
"def _create_table... | [
"0.6225129",
"0.6128029",
"0.565839",
"0.5509341",
"0.5469091",
"0.5436451",
"0.54292",
"0.5425818",
"0.5356777",
"0.533884",
"0.5331975",
"0.5324983",
"0.5308367",
"0.5280422",
"0.5253857",
"0.5224552",
"0.52064747",
"0.52057403",
"0.51590645",
"0.5129769",
"0.5116835",
"0... | 0.7717186 | 0 |
Create rows from children of given node. | def iter_rows(node, style, extra=()):
yield Row.from_node(node, style, extra)
children = node.children
if children:
last_idx = len(children) - 1
for idx, child in enumerate(children):
yield from iter_rows(child, style, extra + (idx != last_idx,)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_children(self):\n\n if self.children is not None:\n return\n\n print \"Generating children for %s (%s rows)\" % (self.bbox, self.count)\n\n self.children = [QuadtreeNode(self.tree, b)\n for b in self.bounds.get_children()]\n\n with utils.m... | [
"0.6280323",
"0.6049176",
"0.5838033",
"0.58223164",
"0.57893825",
"0.57668483",
"0.57622784",
"0.56701744",
"0.5662558",
"0.56547344",
"0.56521267",
"0.55863667",
"0.55802196",
"0.5558164",
"0.5543524",
"0.5542926",
"0.54920536",
"0.5477567",
"0.5424447",
"0.54094183",
"0.53... | 0.6833357 | 0 |
Property for the initital velocity | def initial_velocity(self) -> float:
return self._initial_velocity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_velocity(self) -> int:\r\n ...",
"def velocity(self):\n return self._velocity",
"def velocity(self):\n return self._velocity",
"def getVelocity(self):\n return self.v",
"def velocity(self):\n return self.base_platform.velocity",
"def get_velocity(self):\n ... | [
"0.80913043",
"0.75396353",
"0.75396353",
"0.74211264",
"0.73711056",
"0.7323714",
"0.7313467",
"0.7154016",
"0.71083623",
"0.7086254",
"0.708309",
"0.70829433",
"0.70633",
"0.7061763",
"0.70503867",
"0.7015866",
"0.6983591",
"0.6909269",
"0.6857057",
"0.6843088",
"0.6833641"... | 0.80985844 | 0 |
Property for the last index that was calculated from previous data | def last_index(self) -> int:
return self._last_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_index(self):\n return len(self.chain) - 1",
"def _get_index(self):\n\n return self.index\n\n # to avoid having differences bigger than 2pi",
"def getLastPlotIndexKey(self):\n return self._lineIndex-1",
"def last_value(self):\n return 0",
"def last_sequence_in... | [
"0.70791596",
"0.687671",
"0.6817267",
"0.67973065",
"0.67855024",
"0.67476684",
"0.6746186",
"0.6703176",
"0.66532016",
"0.66217995",
"0.6615857",
"0.6611349",
"0.6557043",
"0.65560675",
"0.6544489",
"0.65032345",
"0.6438944",
"0.6415389",
"0.63958985",
"0.6395368",
"0.63922... | 0.7246059 | 0 |
Property for the constant error in accelerometer data | def acceleration_error_constant(self) -> float:
return self._acceleration_error_constant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ultrasonic_sensor_error(raw_sensor_value):\n\treturn raw_sensor_value * 1.1",
"def distmeter_err(self):\n from astropy import units\n return self.distmpc_err * units.Mpc.in_units(\"m\")",
"def get_ft_sensor_error(self):\r\n return self._arm.get_ft_sensor_error()",
"def _getErrorFu... | [
"0.69113165",
"0.659675",
"0.6520485",
"0.6480445",
"0.64563555",
"0.6435887",
"0.64273506",
"0.63828707",
"0.6368385",
"0.6342193",
"0.6259211",
"0.62317455",
"0.62232107",
"0.6214852",
"0.62079024",
"0.61972785",
"0.61821526",
"0.613354",
"0.61283034",
"0.6116567",
"0.60977... | 0.7513361 | 0 |
Returns an iterator for all of the values at each time step | def __iter__(self):
self.__getitem__(self._num_steps - 1)
return iter(self._previous_values[self.last_index:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for val in self.value:\n yield val",
"def __iter__(self):\n return self._timeseriesData.__iter__()",
"def __iter__(self):\n if len(self) == 0:\n return\n current = self.first_timestamp\n delta = datetime.timedelta(0, self.interval)\... | [
"0.7149",
"0.69724214",
"0.694793",
"0.69139016",
"0.68618613",
"0.6817834",
"0.6754157",
"0.6728915",
"0.6691499",
"0.66880846",
"0.6646326",
"0.6619737",
"0.66110194",
"0.6553187",
"0.65500456",
"0.6503743",
"0.6470912",
"0.64673764",
"0.6461518",
"0.6443159",
"0.6441597",
... | 0.7016037 | 1 |
Returns an iterator for the internal velocity storage | def get_velocity_iter(self):
return iter(self._velocity_storage) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterator(self):\n return _uhd_swig.range_vector_t_iterator(self)",
"def __iter__(self):\n return iter(self._get_storage())",
"def __iter__(self) -> Iterator[Vector]:\n return iter(self.__elements)",
"def __iter__(self):\n\t\treturn iter(self.__dStore)",
"def __next__(self):\n ... | [
"0.6616556",
"0.65820736",
"0.6420909",
"0.63578653",
"0.6265637",
"0.6141893",
"0.6117066",
"0.6112925",
"0.6110666",
"0.6099143",
"0.60795414",
"0.6077551",
"0.60768795",
"0.60768795",
"0.60139173",
"0.6013367",
"0.59723115",
"0.5933728",
"0.59187853",
"0.5873282",
"0.58423... | 0.8498439 | 0 |
Returns two new lines representing min/max accelerometer error | def get_accelerometer_error(self) -> (Iterable[float], Iterable[float]):
acceleration_error = self.compute_accelerometer_error()
upper_error = [None] * self.num_steps
lower_error = [None] * self.num_steps
upper_error[0] = lower_error[0] = self.initial_value
upper_error[1] = lowe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_accelerometer_error(self) -> float:\n number_iterations = min(self.past_n_steps, len(self.collected_data))\n if number_iterations <= 1:\n return self.acceleration_error_constant\n\n # Generate a best fitting line for the last few data points\n collected_data_itera... | [
"0.6378034",
"0.6121276",
"0.60740316",
"0.6031621",
"0.6030152",
"0.5989959",
"0.59866947",
"0.59296346",
"0.58951354",
"0.58764905",
"0.5760069",
"0.57554644",
"0.5736742",
"0.5698499",
"0.5661431",
"0.56111246",
"0.56087005",
"0.560261",
"0.5572686",
"0.5562732",
"0.554597... | 0.68684065 | 0 |
Computes the amount of error to propogate over the acceleration error lines | def compute_accelerometer_error(self) -> float:
number_iterations = min(self.past_n_steps, len(self.collected_data))
if number_iterations <= 1:
return self.acceleration_error_constant
# Generate a best fitting line for the last few data points
collected_data_iterator = rever... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acceleration_error_constant(self) -> float:\n return self._acceleration_error_constant",
"def calculate_error(self):\n \n delta = self.Y - self.T\n error = delta.dot(delta) / self.N\n error = format(error, '.5f')\n \n self.errors.append(error)",
"def error(l... | [
"0.748048",
"0.7207027",
"0.6731554",
"0.6720909",
"0.6683944",
"0.6673826",
"0.6495724",
"0.6419271",
"0.6397715",
"0.6352251",
"0.63491744",
"0.6309061",
"0.62610835",
"0.62111694",
"0.6195942",
"0.6193883",
"0.61893886",
"0.61635816",
"0.6145925",
"0.6140325",
"0.6135559",... | 0.75851095 | 0 |
r"""AlexNet model architecture from the | def alexnet(**kwargs):
model = AlexNet(**kwargs)
# if pretrained:
# model.load_state_dict(model_zoo.load_url(model_urls['alexnet']))
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagenet_alexnet(**kwargs):\r\n model = ImageNetAlexNet(**kwargs)\r\n return model",
"def load(self, name=\"\"):\n\n self.constructed = True\n if name == \"\":\n name = \"/home/unai/Escritorio/MultiNetwork/model/model\"\n\n network_descriptors = {\"Generic\": GenericDesc... | [
"0.6468875",
"0.64450973",
"0.64397836",
"0.631246",
"0.6307277",
"0.6291954",
"0.6257867",
"0.62547463",
"0.6231065",
"0.61943966",
"0.614853",
"0.6140133",
"0.6133221",
"0.6133221",
"0.61192954",
"0.61159253",
"0.610197",
"0.60987943",
"0.6097791",
"0.6090801",
"0.6086538",... | 0.6519144 | 0 |
Publish the given message in the given queue | def publish(self, queue, message):
# 1. Setup the channel to use to publish message
channel_handler = ChannelHandler(self._connection)
# 2. Open the channel before using it
channel_handler.open_channel()
# 3. Send the message via the channel
channel_handler.send_message... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(self, queue, message):\n\n # Instead of passing a queue to the constructor, the publish checks if\n # the target queue exists. If not, it declares the target queue\n if not self.queue:\n self.channel.queue_declare(queue=queue)\n self.queue = queue\n\n s... | [
"0.8643954",
"0.8193079",
"0.73761815",
"0.7362798",
"0.7300207",
"0.7300207",
"0.72929573",
"0.7252513",
"0.72269493",
"0.7207447",
"0.7089691",
"0.7081109",
"0.70327806",
"0.69590855",
"0.69156843",
"0.68879247",
"0.68605196",
"0.68238026",
"0.68050605",
"0.680458",
"0.6739... | 0.84276164 | 1 |
reprocess the data for a specific handler, or if to_wrangle is None, then all of them | def rewrangle_data(self, to_wrangle=None):
if to_wrangle is None:
for hname, h in self.handlers.items():
h.run_all()
elif to_wrangle in self.handlers.keys():
self.handlers[to_wrangle].run_all()
else:
print("Cannot wrangle %s as the handler was ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def justhandle(self, rawdata):\r\n\r\n return self.__handler(rawdata)",
"def handle(self, rawdata):\r\n\r\n return self.__filter(self.__handler(rawdata))",
"def post_process(cls, data):\n return data",
"def process_data(self, data):\n return data",
"def transform( reques... | [
"0.56861573",
"0.5428958",
"0.5379748",
"0.5375573",
"0.53490365",
"0.53490365",
"0.5169673",
"0.5086151",
"0.4996427",
"0.49945205",
"0.49587944",
"0.49227133",
"0.49021205",
"0.4871274",
"0.48709068",
"0.48529112",
"0.48206568",
"0.48013288",
"0.47877797",
"0.47634444",
"0.... | 0.79289836 | 0 |
Get the latest build NVR for a package in the given tag, or None on failure | def get_latest_build(tag, package):
proc = Popen(["osg-koji", "-q", "list-tagged", "--latest", tag, package],
stdout=PIPE)
out = proc.communicate()[0] or b''
ret = proc.returncode
latest_build_line = out.decode("latin-1").strip()
if ret != 0 or not latest_build_line:
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_latest_version(self, pkg: str) -> Optional[str]:\n return None",
"def get_latest_schemaorg_version():\n tag_name = requests.get(SCHEMAORG_VERSION_URL).json()[\"tag_name\"] # \"v13.0-release\"\n mat = re.match(r\"v([\\d.]+)-release\", tag_name)\n if not mat:\n raise ValueErro... | [
"0.65133154",
"0.6442254",
"0.6388923",
"0.6381485",
"0.62967944",
"0.62792045",
"0.62213624",
"0.5970627",
"0.58744514",
"0.5856911",
"0.5834958",
"0.5797918",
"0.5792218",
"0.57872283",
"0.5744755",
"0.5738689",
"0.57380426",
"0.5700647",
"0.56965417",
"0.56705976",
"0.5659... | 0.77276707 | 0 |
Get the line containing the build ID from `koji buildinfo` output | def get_build_line(latest_build):
proc = Popen(["osg-koji", "buildinfo", latest_build],
stdout=PIPE)
build_line = proc.stdout.readline().decode("latin-1").strip()
ret = proc.wait()
if ret != 0 or not build_line:
return
return build_line | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_build_id(build_line):\n match = re.search(r'\\[(\\d+)\\]', build_line)\n if match:\n return match.group(1)",
"def get_koji_build_info(build_id, remote, ctx):\n py_cmd = ('import koji; '\n 'hub = koji.ClientSession(\"{kojihub_url}\"); '\n 'print(hub.getBuild({buil... | [
"0.7374328",
"0.70434076",
"0.6746356",
"0.6632691",
"0.6575165",
"0.6451108",
"0.64389855",
"0.6393776",
"0.6311889",
"0.6234615",
"0.6233873",
"0.6188389",
"0.61587286",
"0.6146484",
"0.6144433",
"0.60601956",
"0.603308",
"0.603308",
"0.6017718",
"0.5953447",
"0.5895361",
... | 0.8049471 | 0 |
Get the build ID from the line containing it from `koji buildinfo` | def get_build_id(build_line):
match = re.search(r'\[(\d+)\]', build_line)
if match:
return match.group(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_build_line(latest_build):\n proc = Popen([\"osg-koji\", \"buildinfo\", latest_build],\n stdout=PIPE)\n build_line = proc.stdout.readline().decode(\"latin-1\").strip()\n ret = proc.wait()\n if ret != 0 or not build_line:\n return\n return build_line",
"def get_build_i... | [
"0.75649583",
"0.69285744",
"0.68628085",
"0.68614566",
"0.68190277",
"0.6613856",
"0.6569874",
"0.6481707",
"0.63098973",
"0.626081",
"0.61616975",
"0.6098235",
"0.604127",
"0.604127",
"0.6038827",
"0.5982138",
"0.59726",
"0.58639216",
"0.5854323",
"0.58107626",
"0.5739353",... | 0.80589104 | 0 |
Exports workspace dataframe to CSV | def workspace_df_to_csv(df, workspace_name):
file_name = workspace_name + '_questions.csv'
script_dir = os.path.dirname(__file__)
output_dir = os.path.join(script_dir, data_dir, 'workspace_training/')
output_path = os.path.join(output_dir, file_name)
df.to_csv(output_path, i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv(self, outpath):\n\n\t\tself.df.to_csv(outpath)",
"def export_to_csv(da_locals, selection_widget, out):\n df_name = selection_widget.value\n da_locals[df_name].to_csv(\"output/{}.csv\".format(df_name), index=False)\n out.clear_output()\n out.append_display_data(FileLinks(\"output\"))",
... | [
"0.77670306",
"0.7490905",
"0.74451315",
"0.7382341",
"0.73440903",
"0.73373663",
"0.7329099",
"0.72609687",
"0.7222006",
"0.72018445",
"0.71686333",
"0.7152943",
"0.71271056",
"0.7059147",
"0.7058712",
"0.7050394",
"0.7043992",
"0.6994114",
"0.6987132",
"0.69830644",
"0.6970... | 0.76266104 | 1 |
Reset the reference function. | def reset(self):
self.ref_value = 0.0
self._average = 0.0
self.num_samples = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self) -> None:\n self.f1.reset()",
"def reset() -> None:\n ...",
"def reset():",
"def reset():",
"def reset():",
"def reset():\n pass",
"def reset():\n pass",
"def reset(self):\n ...",
"def reset(self):\n ...",
"def _reset(self) -> None:",
"def _reset(sel... | [
"0.70669335",
"0.7006956",
"0.6970322",
"0.6970322",
"0.6970322",
"0.6934435",
"0.6934435",
"0.69272757",
"0.69272757",
"0.6917833",
"0.6917833",
"0.6906953",
"0.68971276",
"0.68971276",
"0.68971276",
"0.68971276",
"0.68971276",
"0.68971276",
"0.68971276",
"0.68971276",
"0.68... | 0.709938 | 0 |
Add two averaging objects. | def __iadd__(self, other):
if abs(self.T - other.T) > 1E-5:
msg = "The two objects being added needs to have the same "
msg += "temperature."
raise ValueError(msg)
if self.ref_value < other.ref_value:
diff = self.ref_value - other.ref_value
ot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add__(self, other):\n output = Spectrum(self.wavelengths, self.intensities)\n for wavelength, intensity in other:\n if output[wavelength]:\n output[wavelength] += intensity\n else:\n output[wavelength] = intensity\n return output",
"d... | [
"0.65966725",
"0.6594022",
"0.65775716",
"0.6366334",
"0.63605016",
"0.635555",
"0.63104796",
"0.6306173",
"0.6295934",
"0.6291391",
"0.6267711",
"0.61570907",
"0.6138102",
"0.61179954",
"0.61179954",
"0.6092483",
"0.6088019",
"0.607723",
"0.60561603",
"0.60542613",
"0.604374... | 0.6930572 | 0 |
Search word in brown corpus by input tags. return list | def searchbrown_word(tag):
brown_tagged_words = brown.tagged_words(categories='news')
hitwords = []
for i in range(len(brown_tagged_words)):
if tag == brown_tagged_words[i][1]:
hitwords.append(brown_tagged_words[i][0].lower())
return hitwords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def searchbrown_phrase(tags):\n l = len(tags)\n brown_tagged_words = brown.tagged_words(categories='news')\n hitwords = []\n for i in range(len(brown_tagged_words)-l+1):\n searchtags = [tag for _,tag in brown_tagged_words[i:i+l]]\n if tags == searchtags:\n hitwords.append(tuple... | [
"0.82346225",
"0.72370267",
"0.6667128",
"0.66039336",
"0.6343891",
"0.6325544",
"0.62973756",
"0.62163967",
"0.6191957",
"0.61840516",
"0.6172065",
"0.61653703",
"0.6159381",
"0.61557424",
"0.6037102",
"0.6013875",
"0.5996388",
"0.5989961",
"0.59427744",
"0.5922321",
"0.5894... | 0.82191074 | 1 |
Search phrase in brown corpus by input tags. return touple | def searchbrown_phrase(tags):
l = len(tags)
brown_tagged_words = brown.tagged_words(categories='news')
hitwords = []
for i in range(len(brown_tagged_words)-l+1):
searchtags = [tag for _,tag in brown_tagged_words[i:i+l]]
if tags == searchtags:
hitwords.append(tuple([w.lower()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findTags(user_input, tagged_text):\n result = []\n for item in tagged_text:\n for w in user_input:\n if w[WORD] == item[WORD]:\n tup = (w[WORD], item[TAG])\n result.append(tup)\n continue\n\n return result",
"def searchbrown_word(tag):\n brow... | [
"0.7323405",
"0.7256904",
"0.6471415",
"0.6298797",
"0.6258007",
"0.62395924",
"0.6230424",
"0.61130756",
"0.6106241",
"0.607558",
"0.59471667",
"0.5904043",
"0.5881575",
"0.5871321",
"0.58683366",
"0.5849914",
"0.58279663",
"0.57608694",
"0.57492155",
"0.5747765",
"0.573129"... | 0.77537024 | 0 |
Training a PG agent refers to updating its actor using the given observations/actions and the calculated qvals/advantages that come from the seen rewards. Recall that the expression for the policy gradient PG is PG = E_{tau} [sum_{t=0}^{T1} grad log pi(a_t|s_t) (Q_t b_t )] where tau=(s_0, a_0, s_1, a_1, s_2, a_2, ...) ... | def train(self, obs, acs, rews_list, next_obs, terminals):
# step 1: calculate q values of each (s_t, a_t) point,
# using rewards from that full rollout of length T: (r_0, ..., r_t, ..., r_{T-1})
q_values = self.calculate_q_vals(rews_list)
# step 2: calculate advantages that correspon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_policy(self, minibatch_size):\n \n steps = self.rewards.shape[0]\n batch_size = self.rewards.shape[0] * self.rewards.shape[1]\n #steps = 500\n #batch_size = 500\n #print(steps)\n #print(batch_size)\n \n # Compute advantages\n '''\n ... | [
"0.6461775",
"0.6358505",
"0.6335498",
"0.6321612",
"0.629683",
"0.627451",
"0.62688017",
"0.6210812",
"0.61625445",
"0.61530757",
"0.61292994",
"0.61104596",
"0.6109101",
"0.60926133",
"0.6089834",
"0.607147",
"0.60637623",
"0.6047324",
"0.5999297",
"0.5962702",
"0.5951364",... | 0.6888997 | 0 |
Computes advantages by (possibly) subtracting a baseline from the estimated Q values | def estimate_advantage(self, obs, q_values):
# TODO: Estimate the advantage when nn_baseline is True
# HINT1: pass obs into the neural network that you're using to learn the baseline
# extra hint if you're stuck: see your actor's run_baseline_prediction
# HINT2: advantage should be [Q-b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_advantages(rewards, masks, values, gamma, tau, device):\n\n #rewards, masks, values = to_device(torch.device('cpu'), rewards, masks, values)\n tensor_type = type(rewards)\n deltas = tensor_type(rewards.size(0), 1)\n advantages = tensor_type(rewards.size(0), 1)\n\n prev_value = 0\n pr... | [
"0.60986125",
"0.6081395",
"0.5957568",
"0.5926654",
"0.58474964",
"0.57941103",
"0.574644",
"0.5618834",
"0.55699664",
"0.5497583",
"0.54953307",
"0.54742604",
"0.54609567",
"0.5443063",
"0.5442629",
"0.54363966",
"0.5416651",
"0.54144156",
"0.54136133",
"0.5405343",
"0.5405... | 0.7239963 | 0 |
parses a composer expression into a function | def parse_func(expr, whitelist, locals):
parsed = parse(expr, whitelist)
src = 'def func(input): return {}'.format(parsed)
exec(src, locals)
return locals.pop('func') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile(expression):",
"def build_pfunc(cls, representation):\n if ut.is_str(representation):\n try:\n func = eval(representation)\n except:\n bf = 'cls.build_pfunc('\n af = ')'\n st = ut.parse_enclose_with_counter(repre... | [
"0.62416315",
"0.60134786",
"0.59669906",
"0.5831956",
"0.5735421",
"0.5674045",
"0.56086624",
"0.5583777",
"0.55810475",
"0.55692106",
"0.55554295",
"0.5539728",
"0.5508908",
"0.54794633",
"0.5434497",
"0.5426991",
"0.53963876",
"0.53936046",
"0.53921163",
"0.53910214",
"0.5... | 0.60177785 | 1 |
Takes a list of items and yields pairs of items that are spread apart. >>> list(collocates(range(10), 3, False)) [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (3, 6), (4, 5), (4, 6), (4, 7), (5, 6), (5, 7), (5, 8), (6, 7), (6, 8), (6, 9), (7, 8), (7, 9), (8, 9)] | def collocates(items, spread=3, bidir=True):
maximum = len(items)
deltas = range(1, spread + 1)
for i, x in enumerate(items):
for d in deltas:
j = i + d
if j >= maximum:
break
y = items[j]
yield (x, y)
if bidir:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]",
"def peers_for_cell(self, coords, include_self=False):\n for c in self.row_for_cell(coords, include_self=include_self):\n yield c\n for c in self.col_for_cell(coords, include_self=False):\n yield c\n for c in ... | [
"0.5910569",
"0.57053465",
"0.56162775",
"0.55082136",
"0.55038846",
"0.53497094",
"0.5304506",
"0.53030795",
"0.5287208",
"0.52847826",
"0.5243629",
"0.52045506",
"0.517801",
"0.513484",
"0.512707",
"0.5111783",
"0.51112527",
"0.5088456",
"0.5073195",
"0.5048562",
"0.5039642... | 0.75562626 | 0 |
Decorator to set custom name, tags and argument types to keywords. This decorator creates ``robot_name``, ``robot_tags`` and ``robot_types`` attributes on the decorated keyword method or function based on the provided arguments. Robot Framework checks them to determine the keyword's name, tags, and argument types, resp... | def keyword(name=None, tags=(), types=()):
if callable(name):
return keyword()(name)
def decorator(func):
func.robot_name = name
func.robot_tags = tags
func.robot_types = types
return func
return decorator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyword_only(func):\n\n @wraps(func)\n def wrapper(self, *args, **kwargs):\n if len(args) > 0:\n raise TypeError(\"Method %s forces keyword arguments.\" % func.__name__)\n self._input_kwargs = kwargs\n return func(self, **kwargs)\n\n return wrapper",
"def keyword_only... | [
"0.5872583",
"0.58191925",
"0.5574885",
"0.5375452",
"0.52900344",
"0.52860206",
"0.52121574",
"0.51214725",
"0.5098565",
"0.5096106",
"0.5078854",
"0.50692254",
"0.5045434",
"0.5044237",
"0.50398177",
"0.50364095",
"0.50164104",
"0.5001243",
"0.49819806",
"0.49507403",
"0.49... | 0.770149 | 0 |
Shift the letter c forward by num, rotating to stay in the alphabet. | def rotate_letter(c, num):
return chr(((ord(c) - 97) + num) % 26 + 97) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot(c,n):\n if 'a' <= c <= 'z': \n new_ord = ord(c) + n\n if new_ord > ord('z'):\n new_ord = new_ord - 26\n elif 'A' <= c <= 'Z': \n new_ord = ord(c) + n\n if new_ord > ord('Z'):\n new_ord = new_ord - 26\n else: \n new_ord = ord(c)\n return c... | [
"0.7599264",
"0.75181764",
"0.7403894",
"0.70059246",
"0.68149596",
"0.6776203",
"0.6703359",
"0.66517884",
"0.6631952",
"0.6598852",
"0.65239525",
"0.6441625",
"0.6436379",
"0.6398104",
"0.6294952",
"0.6284178",
"0.6279957",
"0.626807",
"0.6168435",
"0.61095005",
"0.60854095... | 0.8365867 | 0 |
Summarise the supplied data. | def summary(data, key=itemgetter(0), value=itemgetter(1)):
for k, group in groupby(data, key):
yield (k, sum(value(row) for row in group)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summarize(self, data):\n\n return self.summary(data).flatten()",
"def summarize_rec_data(data):\n\n # Warning: not all collectible data has a summary stats implemented below!\n # See get_rec_stats() above!\n\n stats = {}\n\n if 'hc_ro' in data:\n # Entropy across HC units average ov... | [
"0.82473314",
"0.68190163",
"0.6653518",
"0.6547359",
"0.63486844",
"0.632157",
"0.6303208",
"0.62244344",
"0.622046",
"0.62131",
"0.61966765",
"0.6175782",
"0.61309034",
"0.6121035",
"0.60992944",
"0.60874677",
"0.60798544",
"0.60653067",
"0.6040001",
"0.6014844",
"0.6004611... | 0.68359506 | 1 |
Determine next setpoint velocities of motors. | def _get_next_velocity(self):
self._predict_state()
# curr = pos_quat_to_euler(self.curr_quat)
dest = pos_quat_to_euler(self.dest_quat_predict)
error = self.calc_error(self.dest_quat_predict)
# TODO error should be computed for phi, th axis individually
# TODO recommen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_velocity(self, time):\n \"\"\"\n start_point = self.points[self.cur_start]\n cur_target = self.points[(self.cur_start + 1) % 4]\n total_time = self.total_time / 4\n avg_vel = (cur_target - start_point)/ total_time\n return avg_vel\n \"\"\"\n total_... | [
"0.5956906",
"0.5905405",
"0.5788971",
"0.57534546",
"0.5751847",
"0.5731228",
"0.57276845",
"0.57260036",
"0.56631887",
"0.565757",
"0.5656915",
"0.5637902",
"0.56324375",
"0.56301606",
"0.5626253",
"0.5614902",
"0.56104845",
"0.5597243",
"0.55932903",
"0.55837023",
"0.55641... | 0.72748643 | 0 |
Input geographical location, elevation, and timezone for solar model | def location_input():
# location for OPV greenhouse at UA CEAC in Tucson, AZ
latitude = 32.28 # OPV greenhouse latitude (deg)
longitude = -110.94 # OPV greenhouse longitude (deg)
timezone = -7 # Tucson, AZ timezone (UTC)
elevation = 718 # OPV greenhouse elevation (m)
return latitu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_model():\n \n latitude, longitude, timezone, elevation = location_input()\n year, time = time_input()\n\n lat_r = latitude/180*np.pi\n lon_r = longitude/180*np.pi \n n = 0\n for i in range(1900,year):\n if i%4 == 0:\n n += 366\n else:\n n+=365\n ... | [
"0.720217",
"0.6278542",
"0.5957885",
"0.5923194",
"0.5796652",
"0.57925653",
"0.5744695",
"0.57348114",
"0.57070917",
"0.56806874",
"0.5641186",
"0.56411266",
"0.5574454",
"0.55192786",
"0.5512377",
"0.54724246",
"0.54434204",
"0.54393286",
"0.5430587",
"0.54093325",
"0.5404... | 0.6696328 | 1 |
Input orientation of OPV greenhouse | def greenhouse_orientation():
# NEED TO CHECK THIS WITH COMPASS (OR IPHONE)
orientation_angle = 90 # angle between east-west line and the length of the greenhouse (0-90 degree)
orientation_angle = float(orientation_angle) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_orientation_vector():\n\topening_angle = geom_instance.source_opening_angle\n\ttest_orientation = o_gen_instance.generate_orientation_vector()\n\tassert test_orientation[0] < np.cos(opening_angle)\n\tassert test_orientation[1] < np.sin(opening_angle)",
"def check_orientation(event=None):\n\n if g... | [
"0.5596959",
"0.55865884",
"0.54955083",
"0.5452139",
"0.5439494",
"0.5391061",
"0.5361185",
"0.5359074",
"0.5357804",
"0.53573674",
"0.5350765",
"0.5340952",
"0.5284036",
"0.5260743",
"0.52579343",
"0.525494",
"0.52513784",
"0.5248226",
"0.5179179",
"0.516769",
"0.51092577",... | 0.6250316 | 0 |
Fit roof measurements to curve with curve fit function | def curve_fit():
x_west, z_west, x_east, z_east = roof_measurements()
# find best curve fit for west roof section
param_west, param_cov_west = optimize.curve_fit(test_func, x_west, z_west)
print(param_west)
# z = 7.29944696 + (1.27415518*x) + (-0.0680139854*x**2) + (0.00152035861*x**3)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_curve(x,y,p0,func):\n ifixx = np.zeros(np.array(x).shape)\n data = sodr.Data(x,y)\n model = sodr.Model(func)\n worker = sodr.ODR(data,model,p0,ifixx=ifixx,maxit=500)\n out = worker.run()\n out = worker.restart()\n return out",
"def fit(self):\n # Initialize parameter estimates... | [
"0.71537465",
"0.69680554",
"0.679016",
"0.679016",
"0.679016",
"0.67477286",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66912496",
"0.66267633",
"0.65973765",
"0.6533137",
"0.652416",
"0.64... | 0.7841299 | 0 |
Calculate incidence angle for every slope agle on greenhouse roof | def calc_incidence_angle():
Delta_r, lat_r, Omega_r, Zenith_r, Azimuth_r, Elev_angle = solar_model()
# Beta is equal to angle of tilted surface to horizontal (in radians)
roof_slopes_west = section_coordinates()
Beta_r = np.arctan(roof_slopes_west)
incidence_angles_west = np.zeros(101)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self) -> int:",
"def steps_to_angle():\n pass",
"def _angle_of_attack(self, rel_wind, blade_chord):\n # blade_chord_vector - (relative_wind + pi)\n # rel_oposite = rel_wind.rotated(math.pi)\n aoa_rad = rel_wind.theta - blade_chord.theta\n aoa_rad = vec.normalize_angle(a... | [
"0.66821456",
"0.66517246",
"0.65540296",
"0.64866096",
"0.64245534",
"0.6354043",
"0.6329925",
"0.6266904",
"0.62640566",
"0.6245545",
"0.6239461",
"0.62250423",
"0.6191864",
"0.61551094",
"0.61348003",
"0.6114601",
"0.60839367",
"0.6003822",
"0.5996145",
"0.5980365",
"0.594... | 0.7441713 | 0 |
Install log handler on Flask application. | def install_handler(self, app):
# Check if directory exists.
basedir = dirname(app.config["LOGGING_FS_LOGFILE"])
if not exists(basedir):
raise ValueError("Log directory {0} does not exist.".format(basedir))
handler = RotatingFileHandler(
app.config["LOGGING_FS_LO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_logging():\n if not app.debug:\n if app.config.get('LOG_CFG'):\n # initialize the Flask logger (removes all handlers)\n _ = app.logger\n dictConfig(app.config.get('LOG_CFG'))\n else:\n # capability with previous config settings\n # S... | [
"0.7344371",
"0.70853364",
"0.70731646",
"0.70674485",
"0.705092",
"0.69282633",
"0.68009686",
"0.6788408",
"0.6769149",
"0.6731039",
"0.67021066",
"0.65993214",
"0.6558515",
"0.63928616",
"0.63832265",
"0.63534236",
"0.6342074",
"0.6317112",
"0.610324",
"0.60688686",
"0.6035... | 0.7932272 | 0 |
u""" Returns the type of a bankcard based on its number. | def bankcard_type(number):
number = str(number)
if len(number) == 13:
if number[0] == "4":
return VISA
elif len(number) == 14:
if number[:2] == "36":
return MASTERCARD
elif len(number) == 15:
if number[:2] in ("34", "37"):
return AMEX
elif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_type(self):\n for card_type, card_type_re in CARD_TYPES.items():\n if re.match(card_type_re, self.card_number):\n return card_type",
"def card_type(self):\n return self._card_type",
"def cardholder_type(self) -> str:\n return self._cardholder_type",
"de... | [
"0.7235593",
"0.657394",
"0.6446712",
"0.6165629",
"0.60310364",
"0.5939769",
"0.5939769",
"0.5939769",
"0.5939769",
"0.5939769",
"0.5939769",
"0.5934418",
"0.58687687",
"0.5858348",
"0.5844346",
"0.5844346",
"0.5844346",
"0.5844346",
"0.5844346",
"0.5844346",
"0.5844346",
... | 0.8541396 | 0 |
Returns a Bankcard object for use in payment processing. | def get_bankcard_obj(self):
kwargs = {
'card_number': self.cleaned_data['number'],
'expiry_date': self.cleaned_data['expiry_month'].strftime("%m/%y"),
'ccv': self.cleaned_data['ccv_number'],
}
if self.cleaned_data['start_month']:
kwargs['start_date... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bank_account():\n return BankAccount()",
"def get_bank(self):\n return self._bank",
"def example_bank_account():\n \n return BankAccount(\"Test User\", 1000.0)",
"def get_bank(self):\n return self._i2c_read(_BANK_ADDRESS)",
"def card(self, card_id):\r\n return Card(self, c... | [
"0.6898274",
"0.6474104",
"0.64095557",
"0.6329279",
"0.6165475",
"0.60918",
"0.60918",
"0.59762645",
"0.59477663",
"0.59368324",
"0.59362984",
"0.5925832",
"0.5905647",
"0.57644904",
"0.5750776",
"0.572023",
"0.5712505",
"0.57123935",
"0.56781894",
"0.5656187",
"0.55767155",... | 0.7805551 | 0 |
Updates which DOT reports have been added. | def update_reports():
return os.listdir('./reports') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editReport(self, finalReport):\n report = self.mergeReport()\n for f in report.getAllFiles():\n f['outputModule'] = self.moduleName\n f['module_label'] = self.moduleName\n f['inputpfns'] = []\n f['inputs'] = self.inputFiles()\n finalReport.ad... | [
"0.5945368",
"0.5912849",
"0.57583475",
"0.55076814",
"0.5472582",
"0.54703474",
"0.542767",
"0.52748156",
"0.5201581",
"0.515456",
"0.51524",
"0.50901574",
"0.5081571",
"0.50802565",
"0.50742084",
"0.50626945",
"0.50613075",
"0.5058808",
"0.50587463",
"0.5033652",
"0.5027829... | 0.6085476 | 0 |
Updates which csv have been added. | def update_csv():
return os.listdir('./data') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload_csv(self):\n self.load_csv()\n self.tableView.insert_data(self.database)\n self.update()",
"def updateImportList(self):\n\t\tids_new = self.ids\n\t\tids_list = []\n\n\t\tif not os.path.exists(ids_file):\n\t\t\twith open(ids_file, 'a') as ids:\n\t\t\t\tpass\n\n\t\twith open(ids_fil... | [
"0.6823122",
"0.6503512",
"0.6460185",
"0.63271487",
"0.631609",
"0.6267979",
"0.62502736",
"0.61275387",
"0.610648",
"0.6101698",
"0.6091115",
"0.6065072",
"0.6055894",
"0.6032311",
"0.59814376",
"0.5874674",
"0.58562243",
"0.58496153",
"0.58462715",
"0.5802753",
"0.5775429"... | 0.68143374 | 1 |
Extracts all the pdf links from beautified soup of DOT website | def get_all_pdf(soup):
list_to_update = []
report = soup.find_all('div', class_='mb-4 clearfix')
for a in report[0].find_all('a', href=True):
sub_link = a['href']
if 'individual' in sub_link:
if not (sub_link.startswith('http') or sub_link.startswith('www')):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_PDF_links(soup):\n pdf_links = soup.find(\"div\", class_=\"calendar_panel time_table\").find_all(\"a\", class_=\"lnk\")\n pdf_links_parsed = []\n for p in pdf_links:\n if re.search(\"http.+\\.pdf\", p[\"onclick\"]):\n pdf_links_parsed.append(re.search(\"http.+\\.pdf\", p[\"onclic... | [
"0.73772895",
"0.68220514",
"0.66375023",
"0.6472883",
"0.6434274",
"0.6179533",
"0.61309844",
"0.60720843",
"0.6050501",
"0.59055036",
"0.5870308",
"0.584238",
"0.5808878",
"0.58073527",
"0.5776368",
"0.577581",
"0.5766544",
"0.5738477",
"0.57377106",
"0.5723062",
"0.5721917... | 0.6906867 | 1 |
Finds page numbers for operating metrics. | def find_operating_page_numbers(filename):
with pdfplumber.open(filename) as pdf:
page = pdf.pages[1] # page 41 is missing baggage information
text = page.extract_text()
op_re_exp = r'(Operating Carrier (\(Monthly\)|\(Quarterly\)) \s*\d{1,})|(Reporting Carrier(\s*|\s\(Quarterly\)\s*)\d{1,})'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_of_pages(self):",
"def get_page_nums(total_pages, cur_page):\n return [x+1 for x in xrange(total_pages)]",
"def calculate_num_scrape_pages(h, r):\n p = (int(search_hits)/res_per_page) + 1\n return p",
"def get_page(self, num):\n return num + 10",
"def get_n_needed_pages(n_re... | [
"0.6201139",
"0.57851094",
"0.561334",
"0.5521931",
"0.5492173",
"0.547871",
"0.5426811",
"0.5423849",
"0.53988284",
"0.5369168",
"0.5349151",
"0.532904",
"0.5316685",
"0.53142405",
"0.5308454",
"0.52776366",
"0.5262012",
"0.524816",
"0.5209908",
"0.52058834",
"0.5198922",
... | 0.6571985 | 0 |
Extracts monthly values out of pdf file. | def get_table_values_monthly(filename, page_num):
with pdfplumber.open(filename) as pdf:
page = pdf.pages[page_num - 1]
text = page.extract_text()
# Regex
re_month = re.compile(r'^[A-Za-z]*.\d{2,}') # Finds the month/year
re_new_rank = re.compile(r'^\d{1,}\s*[A-Z].*') # finds indices
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mo_parse_pdf(self, filepath):\n\n text = textract.process(filepath, encoding='utf-8')\n text = text.decode('utf-8')\n\n if 'PRESSURE CALIBRATION DATA' in text:\n self.mo_parse_p(filepath)\n\n elif 'TEMPERATURE CALIBRATION DATA' or 'CONDUCTIVITY CALIBRATION DATA' in text:\... | [
"0.65770966",
"0.6172922",
"0.57693976",
"0.5680681",
"0.5649114",
"0.5583239",
"0.5546003",
"0.5463524",
"0.5454394",
"0.5416907",
"0.5390241",
"0.5372492",
"0.5371953",
"0.5329655",
"0.53058374",
"0.52711207",
"0.5261857",
"0.52388436",
"0.52120996",
"0.5205693",
"0.5200957... | 0.78037965 | 0 |
Extracts quarterly values out of pdf file. | def get_table_values_quarterly(filename, page_num):
with pdfplumber.open(filename) as pdf:
page = pdf.pages[page_num - 1]
text = page.extract_text()
# Regex
re_month = re.compile(r'^[A-Za-z]*.-.[A-Za-z]*.\d{2,}') # Finds the month/year
re_new_rank = re.compile(r'^\d{1,}\s*[A-Z].*') # f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_values_monthly(filename, page_num):\n with pdfplumber.open(filename) as pdf:\n page = pdf.pages[page_num - 1] \n text = page.extract_text()\n\n # Regex\n re_month = re.compile(r'^[A-Za-z]*.\\d{2,}') # Finds the month/year\n re_new_rank = re.compile(r'^\\d{1,}\\s*[A-Z].*') # ... | [
"0.61200994",
"0.608699",
"0.598227",
"0.57926095",
"0.57713157",
"0.5651278",
"0.55844134",
"0.5506797",
"0.5395246",
"0.5352676",
"0.51856613",
"0.5141159",
"0.5138725",
"0.5122959",
"0.5085548",
"0.50819415",
"0.50684255",
"0.50408053",
"0.5031039",
"0.49987808",
"0.499724... | 0.80162287 | 0 |
Handle ACME "challenge" phase. | def acme_challenge(self, domain):
return self.network.send_and_receive_expected(
messages.ChallengeRequest(identifier=domain),
messages.Challenge) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def complete_challenge(\n self,\n key: josepy.jwk.JWK,\n identifier: acme.messages.Identifier,\n challenge: acme.messages.ChallengeBody,\n ):\n pass",
"async def on_challenge_update(self, challenge_data):\n pass",
"async def complete_challenge(\n self,\... | [
"0.6970326",
"0.6693624",
"0.6643815",
"0.64773405",
"0.63358575",
"0.6242549",
"0.62129736",
"0.61975175",
"0.61606115",
"0.6100218",
"0.6066958",
"0.6053227",
"0.5990355",
"0.59382343",
"0.5892142",
"0.582859",
"0.58263266",
"0.5807089",
"0.5653183",
"0.561288",
"0.5582941"... | 0.68218434 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.