query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Properties used for UI display. | def displayData(cls):
return (
"paramName",
"autoFollow",
"lowerDisplay",
"upperDisplay",
"binCount",
"xscale",
"yweight"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_interface_display_options(cls):\n return",
"def properties(self,prop):\r\n # The particulars of how they are stored and manipulated (e.g., do\r\n # we want an inventory internally) is not settled. I've used a\r\n # property dictionary for now.\r\n #\r\n # How t... | [
"0.71048635",
"0.70476246",
"0.69116294",
"0.6767226",
"0.6767226",
"0.6767226",
"0.67460656",
"0.6678776",
"0.6579144",
"0.6508215",
"0.6505482",
"0.64166707",
"0.63853025",
"0.63517594",
"0.63517594",
"0.6347583",
"0.62288713",
"0.62006533",
"0.62006533",
"0.62006533",
"0.6... | 0.5985428 | 35 |
Returns np arrays for the bin values, observability and the CDF based on the bin values. | def _calcBins(self, contribs, parValues, fraction, minReq):
# single set of R for this calculation
bins = np.zeros(self.binCount)
binObs = np.zeros(self.binCount)
for bi in range(self.binCount):
val, obs = self._calcBin(
self._binMask(bi, parValues),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bc_array_for_all_frequencies(self, loaded_table, boundary_condition):\n if self.frequencies is None:\n number_frequencies = 1\n else:\n number_frequencies = len(self.frequencies)\n\n if loaded_table:\n list_arrays = [np.zeros(number_frequencies, dtype=fl... | [
"0.61884326",
"0.60316277",
"0.60187405",
"0.6011523",
"0.5961007",
"0.59270096",
"0.5858573",
"0.5848494",
"0.58279395",
"0.58030796",
"0.5800227",
"0.57804126",
"0.57344216",
"0.5731898",
"0.5731898",
"0.566924",
"0.5661775",
"0.55975986",
"0.55752337",
"0.5569703",
"0.5556... | 0.643362 | 0 |
Compares with another Histogram or tuple. | def __eq__(self, other):
return hash(self) == hash(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(cls, data_hist, ref_hist, params):\n raise NotImplementedError(\"This is an abstract function that needs to be implemented for each comparison function\")",
"def test_histogram(self):\n # Create a metrics with no metric instances\n mf = pmp.utils.create_metric_family(\n ... | [
"0.6363733",
"0.62826365",
"0.6201645",
"0.61849433",
"0.6002387",
"0.5925938",
"0.5895805",
"0.5891085",
"0.58745956",
"0.58563006",
"0.5760738",
"0.5759948",
"0.5750077",
"0.5740531",
"0.57403606",
"0.57348883",
"0.57054",
"0.56755686",
"0.56512666",
"0.56372654",
"0.563015... | 0.0 | -1 |
All properties needed to properly serialize and restore this histogram. Same order expected by the constructor. | def integralProps(self):
return ("param", "lower", "upper", "binCount", "xscale", "yweight",
"autoFollow") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_hist(self):\n self.x_min = {}\n self.x_max = {}\n self.x_max_minus_min = {}\n self.dx = {}\n self.n_bins = {}\n\n self.histogram_edges = {}\n self.histogram_values = {}\n self.histogram_cdf = {}",
"def __init__(self, iterable=None):\n super... | [
"0.64561546",
"0.62784886",
"0.623701",
"0.62329686",
"0.62132657",
"0.60772395",
"0.60772395",
"0.59930414",
"0.59690195",
"0.58718866",
"0.58685637",
"0.5847125",
"0.5834941",
"0.58306277",
"0.5820183",
"0.5785574",
"0.57667154",
"0.57654357",
"0.57625246",
"0.5755541",
"0.... | 0.0 | -1 |
Creates an histogram with default bin count, will be updated later. | def __init__(self, param, lower, upper, binCount = 50,
xscale = None, yweight = None, autoFollow = True):
logging.debug('Hist init: {} [{}, {}]'
.format(param.name(), lower, upper))
super(Histogram, self).__init__(title = "({0}, {1})".format(lower, upper))
# add ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeHistogram(values, numBins, xLabel, yLabel, title=None):",
"def integerHistogram(self, min, max):\n\t\th = Histogram(vals=None, n_bins= int(max)-int(min)+1, min_val=min-0.5, max_val=max+0.5)\n\t\treturn h",
"def histogram(self):\n if np.size(self.stats['Counts']): # don't do anything to an empty ... | [
"0.7529314",
"0.68496424",
"0.6774048",
"0.66510326",
"0.6642304",
"0.66372705",
"0.6617749",
"0.65883744",
"0.6458225",
"0.63955796",
"0.62952834",
"0.6290073",
"0.6252977",
"0.6248995",
"0.6227162",
"0.6185513",
"0.61788195",
"0.61734015",
"0.61620796",
"0.6138533",
"0.6126... | 0.6554567 | 8 |
Updates ranges of all histograms. | def updateRanges(self):
# work directly on the histograms, no copy
for i in range(len(self)):
self[i].updateRange() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoHistogramRange(self):\n self.vb.enableAutoRange(self.vb.XAxis, True)\n self.vb.enableAutoRange(self.vb.YAxis, True)\n # self.range = None\n # self.updateRange()\n # self.vb.setMouseEnabled(False, False)\n\n # def updateRange(self):\n # self.vb.autoRange()\n ... | [
"0.6792945",
"0.67535067",
"0.67533433",
"0.67533433",
"0.6722245",
"0.6722245",
"0.6479876",
"0.64566374",
"0.6367419",
"0.63112515",
"0.6116528",
"0.60730416",
"0.59745663",
"0.5908539",
"0.5886132",
"0.5849696",
"0.57824105",
"0.5766566",
"0.5716636",
"0.5643945",
"0.56388... | 0.8878231 | 0 |
Checks any type of parameter for activeness. Shorter than that below or a try/except clause. | def isActiveFitParam(param):
return isFitParam(param) and param.isActive() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_parameters(self):\n\n if self.process not in [\"Like\", \"Like-and-follow\"]:\n raiser('process')\n\n if \"type\" not in self.duration or \"value\" not in self.duration:\n raiser('duration(type or value)')\n else:\n typ = self.duration['type']\n ... | [
"0.6328872",
"0.58553636",
"0.5787745",
"0.5686539",
"0.5681573",
"0.5663482",
"0.55958295",
"0.55727077",
"0.5562681",
"0.5557375",
"0.5497238",
"0.5481537",
"0.54741496",
"0.5465524",
"0.54570794",
"0.53882223",
"0.53794974",
"0.5344438",
"0.53443813",
"0.53308666",
"0.5330... | 0.0 | -1 |
value bounds in display units used for parameter generator | def displayActiveRange(selforcls):
vRange = selforcls.activeRange()
try:
vRange = (selforcls.toDisplay(min(vRange)),
selforcls.toDisplay(max(vRange)))
except AttributeError:
pass # toDisplay() only in ParameterFloat
return vRange | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounds():\n return [0.00], [1.00]",
"def return_parameter_bounds(maximum_luminosity=20):\n return [(maximum_luminosity, maximum_luminosity + 3),\n (3 * 10 ** -4, 8 * 10 ** -3), (2., 350), (-8., -0.2),\n (-400, 400)]",
"def param_bounds(self) -> Optional[Sequence[Tupl... | [
"0.67344326",
"0.64112306",
"0.638761",
"0.6384587",
"0.62734604",
"0.6273355",
"0.62676686",
"0.6236934",
"0.6182922",
"0.6182922",
"0.6182922",
"0.6182922",
"0.6182922",
"0.6182922",
"0.6182922",
"0.6182922",
"0.6171337",
"0.6062237",
"0.60169405",
"0.59929866",
"0.5979151"... | 0.58516884 | 30 |
sets value range after converting input from display to SI units | def setDisplayActiveRange(selforcls, newRange):
newRange = (selforcls.toSi(min(newRange)),
selforcls.toSi(max(newRange)))
selforcls.setActiveRange(newRange) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range(self, value):\n self.value_range = tuple([float(x) for x in value.split(':')])",
"def setRange(self, range):\n\t\tself.range = range\n\t\tself.slider.setMinimum(0.0)\n\t\tself.slider.setMaximum(100.0)\n\t\tself.spinbox.setRange(self.range[0], self.range[1])\n\n\t\tdiff = self.range[1] - self.ran... | [
"0.6583798",
"0.64916384",
"0.6380624",
"0.63229555",
"0.61780244",
"0.6168865",
"0.6158152",
"0.6126535",
"0.60679597",
"0.60319746",
"0.5871323",
"0.58429414",
"0.58311766",
"0.58270514",
"0.5817835",
"0.5791778",
"0.5781371",
"0.575784",
"0.5748508",
"0.57477736",
"0.57121... | 0.0 | -1 |
activeVal is set after a successful MC run. It is a list of arrays, with each array storing the parameter values of a successful run. If index is supplied, only the array at that list index is returned, otherwise the entire list is returned. Used to store the fit results in each parameter. | def activeVal(selforcls, val, index = None):
if index is None:
return selforcls.activeValues()
else:
return selforcls.activeValues()[
index%len(selforcls.activeValues())] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setActiveVal(selforcls, val, index = None):\n if not selforcls.isActive():\n logging.error(\"Value of parameter cannot be set, \"\n \"parameter not active!\")\n return\n\n tempVal = selforcls.activeValues()\n if index is None:\n ind... | [
"0.6020497",
"0.5685184",
"0.53795695",
"0.53574705",
"0.5278439",
"0.52379537",
"0.5211085",
"0.51439047",
"0.510269",
"0.50727105",
"0.50727105",
"0.5066421",
"0.50607145",
"0.50317687",
"0.500099",
"0.49392658",
"0.4925629",
"0.4915637",
"0.4901665",
"0.489409",
"0.4881361... | 0.6224224 | 0 |
Sets or appends to the list of activeVal. There could be a race condition if two mcFit instances try to append at the same time. Therefore, an index can be supplied to identify the list index to set or change. Each mcFit instance should be assigned a serial (index) number. If the list is not long enough to accommodate ... | def setActiveVal(selforcls, val, index = None):
if not selforcls.isActive():
logging.error("Value of parameter cannot be set, "
"parameter not active!")
return
tempVal = selforcls.activeValues()
if index is None:
index = len(tempVal)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setitem__(self, index, value):\n missing = index - len(self) + 1\n if missing > 0:\n self.extend([None] * missing)\n list.__setitem__(self, index, value)",
"def __setitem__(self, i, val):\n\t\tif i < self.n:\n\t\t\tself.v[i] = val",
"def __setitem__(self, index, value):\n ... | [
"0.6192069",
"0.60728383",
"0.5936898",
"0.5906566",
"0.5865935",
"0.5829412",
"0.574235",
"0.5725492",
"0.5709034",
"0.5685339",
"0.5677327",
"0.56530786",
"0.5648228",
"0.5621754",
"0.5617098",
"0.5600828",
"0.5592704",
"0.55780846",
"0.5575421",
"0.5571872",
"0.5571067",
... | 0.73371154 | 0 |
VersionedFlowSnapshot a model defined in Swagger | def __init__(self, snapshot_metadata=None, flow_contents=None, external_controller_services=None, parameter_providers=None, parameter_contexts=None, flow_encoding_version=None, flow=None, bucket=None, latest=None):
self._snapshot_metadata = None
self._flow_contents = None
self._external_control... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_snapshot(model):\n with open(join(DATA_PATH, \"store.json\")) as file_handle:\n validator = Draft4Validator(json.load(file_handle))\n code, result = memote.test_model(\n model=model, results=True, pytest_args=[\"--tb\", \"no\"])\n assert validator.is_valid(result)\n config = memo... | [
"0.55468225",
"0.5274357",
"0.52415836",
"0.5236835",
"0.5128212",
"0.5123933",
"0.5115035",
"0.50458586",
"0.50371885",
"0.50291014",
"0.50029755",
"0.49980053",
"0.49270344",
"0.49212322",
"0.49115032",
"0.4887091",
"0.4878059",
"0.4875026",
"0.48575413",
"0.48463377",
"0.4... | 0.46108362 | 40 |
Gets the snapshot_metadata of this VersionedFlowSnapshot. The metadata for this snapshot | def snapshot_metadata(self):
return self._snapshot_metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_snapshot_metadata(self, snapshot_id):\n url = \"snapshots/%s/metadata\" % snapshot_id\n resp, body = self.get(url)\n body = json.loads(body)\n self.validate_response(schema.show_snapshot_metadata, resp, body)\n return rest_client.ResponseBody(resp, body)",
"def show_sn... | [
"0.75155294",
"0.67023194",
"0.65991884",
"0.6548966",
"0.6492202",
"0.6428583",
"0.6423407",
"0.6405962",
"0.6306713",
"0.6278455",
"0.6236187",
"0.6236187",
"0.6236187",
"0.6236187",
"0.6236187",
"0.62086684",
"0.61940265",
"0.6182489",
"0.6182489",
"0.6180863",
"0.6175664"... | 0.83801657 | 0 |
Sets the snapshot_metadata of this VersionedFlowSnapshot. The metadata for this snapshot | def snapshot_metadata(self, snapshot_metadata):
if snapshot_metadata is None:
raise ValueError("Invalid value for `snapshot_metadata`, must not be `None`")
self._snapshot_metadata = snapshot_metadata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metadata(self, snapshot, metadata):\n body = {'metadata': metadata}\n return self._create(\"/snapshots/%s/metadata\" % base.getid(snapshot),\n body, \"metadata\")",
"def set_metadata(self, snapshot_id, metadata, **kwargs):\n body = {'metadata': metadata}\n ... | [
"0.83712",
"0.8329036",
"0.69013786",
"0.6655103",
"0.6382433",
"0.626016",
"0.626016",
"0.622943",
"0.6184342",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.6145025",
"0.605118",
"0.59974533",
"0.59923416",
"0.589582",
"0.589582",
"0.589... | 0.85901093 | 0 |
Gets the flow_contents of this VersionedFlowSnapshot. The contents of the versioned flow | def flow_contents(self):
return self._flow_contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(self):\n self.syncContents()\n return self._contents",
"def get_contents(self):\n return self.contents",
"def contents(self):\n return self._contents",
"def get_contents(self):\n with closing(self.open()) as handle:\n return handle.read()",
"def co... | [
"0.66757303",
"0.62290907",
"0.6197192",
"0.59705305",
"0.5878344",
"0.5796029",
"0.5763083",
"0.5516891",
"0.5505247",
"0.54965574",
"0.54637045",
"0.54631704",
"0.5415392",
"0.53776175",
"0.536303",
"0.5346532",
"0.5295824",
"0.5295824",
"0.5295824",
"0.5295824",
"0.5293879... | 0.75096315 | 0 |
Sets the flow_contents of this VersionedFlowSnapshot. The contents of the versioned flow | def flow_contents(self, flow_contents):
if flow_contents is None:
raise ValueError("Invalid value for `flow_contents`, must not be `None`")
self._flow_contents = flow_contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(self, contents):\n\n self._contents = contents",
"def set_contents(self, contents):\n self.validate_contents(contents)\n #Copy-ing the contents list is necessary because it can be modified \n #by UI elements that are based on this class\n self.contents = copy(conte... | [
"0.5873673",
"0.58573955",
"0.5356069",
"0.53205866",
"0.52961564",
"0.507953",
"0.5026219",
"0.50057846",
"0.49433386",
"0.48465547",
"0.48465547",
"0.47895524",
"0.47386765",
"0.47386765",
"0.46821818",
"0.46728328",
"0.4583075",
"0.4578419",
"0.4568628",
"0.45118272",
"0.4... | 0.7428742 | 0 |
Gets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow. | def external_controller_services(self):
return self._external_controller_services | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_controller_services(self, external_controller_services):\n\n self._external_controller_services = external_controller_services",
"def exposed_services(self):\n return self._exposed_services",
"def get_current_services(self,sim):\n current_services = sim.get_alloc_entities()\n ... | [
"0.63227344",
"0.56581736",
"0.53822076",
"0.5345333",
"0.53095484",
"0.530191",
"0.5297033",
"0.5236078",
"0.52339894",
"0.52310747",
"0.51765954",
"0.5120164",
"0.50976235",
"0.5094909",
"0.5077057",
"0.50099176",
"0.5002442",
"0.49720675",
"0.4959182",
"0.49488658",
"0.494... | 0.81535 | 0 |
Sets the external_controller_services of this VersionedFlowSnapshot. The information about controller services that exist outside this versioned flow, but are referenced by components within the versioned flow. | def external_controller_services(self, external_controller_services):
self._external_controller_services = external_controller_services | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_controller_services(self):\n return self._external_controller_services",
"def external_ids(self, external_ids):\n\n self._external_ids = external_ids",
"def exposed_services(self, exposed_services):\n\n self._exposed_services = exposed_services",
"def _set_controller(self, v... | [
"0.658346",
"0.51898247",
"0.51228046",
"0.49471608",
"0.47565818",
"0.47565818",
"0.47195998",
"0.45883906",
"0.44981703",
"0.44052467",
"0.43850753",
"0.43745434",
"0.43683144",
"0.4353919",
"0.43460214",
"0.4309255",
"0.42675003",
"0.42650962",
"0.4246743",
"0.42305523",
"... | 0.8468243 | 0 |
Gets the parameter_providers of this VersionedFlowSnapshot. Contains basic information about parameter providers referenced in the versioned flow. | def parameter_providers(self):
return self._parameter_providers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider_params(self):\n return self.tree.get('provider_params', {})",
"def all_providers(self) -> List[ProviderInfo]:\n sp_key = self.__providers_key()\n value = self.get(name=sp_key)\n if value is None:\n return []\n js = utf8_decode(data=value)\n array ... | [
"0.7007249",
"0.61865747",
"0.60932356",
"0.6047994",
"0.60459554",
"0.6015926",
"0.6015926",
"0.6015926",
"0.6015926",
"0.6015926",
"0.6015926",
"0.59945995",
"0.59945995",
"0.59182954",
"0.58808595",
"0.58627284",
"0.5730422",
"0.5724208",
"0.571871",
"0.57134426",
"0.57121... | 0.80047333 | 0 |
Sets the parameter_providers of this VersionedFlowSnapshot. Contains basic information about parameter providers referenced in the versioned flow. | def parameter_providers(self, parameter_providers):
self._parameter_providers = parameter_providers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_providers(self):\n return self._parameter_providers",
"def parameter_contexts(self, parameter_contexts):\n\n self._parameter_contexts = parameter_contexts",
"def provider_params(self):\n return self.tree.get('provider_params', {})",
"def parameters(self, parameters):\n\n ... | [
"0.6349689",
"0.5952384",
"0.56540287",
"0.53550196",
"0.53550196",
"0.53550196",
"0.51900417",
"0.512226",
"0.5103046",
"0.5091386",
"0.5070409",
"0.49835092",
"0.49684978",
"0.49183768",
"0.48783487",
"0.48691717",
"0.4818158",
"0.4812805",
"0.4807325",
"0.48066327",
"0.480... | 0.8015235 | 0 |
Gets the parameter_contexts of this VersionedFlowSnapshot. The parameter contexts referenced by process groups in the flow contents. The mapping is from the name of the context to the context instance, and it is expected that any context in this map is referenced by at least one process group in this flow. | def parameter_contexts(self):
return self._parameter_contexts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_contexts(self):\n return tuple(getattr(self, name) for name in self.__argnames__)",
"def get_contexts(self):\n return self._contexts",
"def get_contexts(self):\n params = self._get_configurational_params()\n builds = self._get_builds()\n\n ctx_params = itertools.produ... | [
"0.6186989",
"0.60678494",
"0.6034285",
"0.57978076",
"0.5718987",
"0.5601156",
"0.55219734",
"0.5495203",
"0.5372476",
"0.5309605",
"0.5279569",
"0.52359176",
"0.5205325",
"0.51551515",
"0.51125336",
"0.5102993",
"0.50635713",
"0.50354475",
"0.5029947",
"0.50209457",
"0.5006... | 0.7592681 | 0 |
Sets the parameter_contexts of this VersionedFlowSnapshot. The parameter contexts referenced by process groups in the flow contents. The mapping is from the name of the context to the context instance, and it is expected that any context in this map is referenced by at least one process group in this flow. | def parameter_contexts(self, parameter_contexts):
self._parameter_contexts = parameter_contexts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_contexts(self, contexts):\n self._contexts = contexts",
"def parameter_contexts(self):\n return self._parameter_contexts",
"def update(self, contextset):\n self._contexts.update(contextset.get_contexts())",
"def set_contexts(self, path_context: str):\n self.path, self.mode... | [
"0.6403469",
"0.5939657",
"0.5094899",
"0.50620306",
"0.5013662",
"0.49896467",
"0.49327752",
"0.48905647",
"0.48811802",
"0.47928238",
"0.47024944",
"0.46778068",
"0.46764642",
"0.46742034",
"0.46499863",
"0.4630622",
"0.4608403",
"0.45698825",
"0.45489085",
"0.45285198",
"0... | 0.79279155 | 0 |
Gets the flow_encoding_version of this VersionedFlowSnapshot. The optional encoding version of the flow contents. | def flow_encoding_version(self):
return self._flow_encoding_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoding(self):\n return self.original.encoding",
"def flow_encoding_version(self, flow_encoding_version):\n\n self._flow_encoding_version = flow_encoding_version",
"def encoding(self):\n return self._encoding",
"def encoding(self):\n return self._encoding",
"def encoding(se... | [
"0.6260871",
"0.6109093",
"0.60388505",
"0.60388505",
"0.60388505",
"0.60388505",
"0.5965365",
"0.59034485",
"0.5898288",
"0.58397555",
"0.5827975",
"0.57529813",
"0.56854403",
"0.5617346",
"0.558402",
"0.5467311",
"0.5450552",
"0.5449334",
"0.5410547",
"0.54058725",
"0.54004... | 0.79059565 | 0 |
Sets the flow_encoding_version of this VersionedFlowSnapshot. The optional encoding version of the flow contents. | def flow_encoding_version(self, flow_encoding_version):
self._flow_encoding_version = flow_encoding_version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flow_encoding_version(self):\n return self._flow_encoding_version",
"def encoding(self, encoding):\n\n self._encoding = encoding",
"def set_encoding(self, encoding):\n\n self._encoding = encoding",
"def encoding(self, encoding):\n if encoding is None:\n raise ValueError... | [
"0.66736966",
"0.58571243",
"0.58275366",
"0.5791346",
"0.566458",
"0.56271887",
"0.5596561",
"0.55775213",
"0.5577486",
"0.555697",
"0.5535698",
"0.5236223",
"0.50859153",
"0.5032931",
"0.48970616",
"0.48817796",
"0.48706242",
"0.47449",
"0.47412664",
"0.46945748",
"0.468185... | 0.82961506 | 0 |
Gets the flow of this VersionedFlowSnapshot. The flow this snapshot is for | def flow(self):
return self._flow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFlow(self):\n return self._flow",
"def get_flow(self, uuid):\n return Flow.deserialize(self._get_single('flows', {'uuid': uuid}))",
"def get_flow(self, flow_name: str) -> \"Flow\":\n if flow_name not in self.flows:\n raise ValueError(\"Flow is not contained in this Storag... | [
"0.7379466",
"0.6781517",
"0.6685178",
"0.60488605",
"0.6008015",
"0.60059667",
"0.5927424",
"0.59273106",
"0.5903583",
"0.5843571",
"0.58065546",
"0.5722223",
"0.55836266",
"0.5567539",
"0.55481815",
"0.54643285",
"0.5417385",
"0.5333574",
"0.53092957",
"0.5300495",
"0.52970... | 0.6824039 | 1 |
Sets the flow of this VersionedFlowSnapshot. The flow this snapshot is for | def flow(self, flow):
self._flow = flow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_flow(self, flow):\r\n self.flow = flow",
"def set_cur_flow(self, flow):\n self.cur_flow = flow",
"def set_flow_source(self, source):\n self._source = source",
"def flows(self, flows):\n\n self._flows = flows",
"def set_flow_state(self, state):\n source, clone =... | [
"0.70686585",
"0.69125307",
"0.6306861",
"0.6027127",
"0.58933383",
"0.57597303",
"0.5727777",
"0.5652507",
"0.55490685",
"0.54941237",
"0.54612213",
"0.53285825",
"0.5255896",
"0.52233005",
"0.5174087",
"0.5111768",
"0.49811852",
"0.49525854",
"0.48680583",
"0.486662",
"0.48... | 0.7334191 | 0 |
Gets the bucket of this VersionedFlowSnapshot. The bucket where the flow is located | def bucket(self):
return self._bucket | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bucket(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bucket\")",
"def bucket(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bucket\")",
"def bucket(self):\n if not hasattr(self, \"_bucket\"):\n self._bucket = self._get_or_create_bucket(self.bucket_name)\... | [
"0.78069574",
"0.78069574",
"0.7710763",
"0.7691495",
"0.7655935",
"0.76269865",
"0.76269865",
"0.7556832",
"0.7556832",
"0.7556832",
"0.7556832",
"0.7556832",
"0.7456765",
"0.72359926",
"0.7172862",
"0.71176875",
"0.69666916",
"0.6939062",
"0.6920855",
"0.6910778",
"0.683748... | 0.8017462 | 0 |
Sets the bucket of this VersionedFlowSnapshot. The bucket where the flow is located | def bucket(self, bucket):
self._bucket = bucket | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_image_bucket(self, value):\n self.image_bucket = value",
"def __init__(self, bucket):\n self.bucket = bucket",
"def bucket(self):\n if not hasattr(self, \"_bucket\"):\n self._bucket = self._get_or_create_bucket(self.bucket_name)\n return self._bucket",
"def buck... | [
"0.7186771",
"0.68779075",
"0.6785613",
"0.667325",
"0.66621596",
"0.65803295",
"0.6543764",
"0.6543764",
"0.6543764",
"0.6543764",
"0.6543764",
"0.6406765",
"0.6357553",
"0.6302178",
"0.6273225",
"0.6273225",
"0.6228045",
"0.6178882",
"0.61779845",
"0.61259234",
"0.6115869",... | 0.80024356 | 0 |
Gets the latest of this VersionedFlowSnapshot. | def latest(self):
return self._latest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest(self):\n return self.journal_data[self.latest_id]",
"def get_latest_revision(self):\n revision_list = self.get_revision_list()\n if revision_list:\n return revision_list[-1]\n else:\n raise NoRevisionsExistError()",
"def get_latest(self, name):\n ... | [
"0.70233417",
"0.6663617",
"0.6593615",
"0.65461594",
"0.6545754",
"0.6521191",
"0.64221674",
"0.63784236",
"0.6323985",
"0.6314438",
"0.62969947",
"0.62746644",
"0.6249728",
"0.621321",
"0.6209161",
"0.6130742",
"0.6110239",
"0.6094407",
"0.60749656",
"0.60749656",
"0.607346... | 0.71543825 | 0 |
Sets the latest of this VersionedFlowSnapshot. | def latest(self, latest):
self._latest = latest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest(self, value):\n self.journal_data[self.latest_id] = value",
"def last_update(self, last_update):\n\n self._last_update = last_update",
"def last_updated(self, last_updated):\n\n self._last_updated = last_updated",
"def last_updated(self, last_updated):\n\n self._last_up... | [
"0.56970704",
"0.5584318",
"0.5571926",
"0.5571926",
"0.5571926",
"0.5571926",
"0.55521595",
"0.5540341",
"0.549731",
"0.5486416",
"0.54847425",
"0.5465948",
"0.54285127",
"0.540792",
"0.5372909",
"0.530602",
"0.52589697",
"0.51641023",
"0.5145097",
"0.51391363",
"0.5101425",... | 0.6956269 | 0 |
Returns the model properties as a dict | def to_dict(self):
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def get_properties(self):\n return self.properties",
"def asdict(self):\n return self._prop_dict",
"def json(self):\n rv = {\n prop: getattr(self, prop)\n f... | [
"0.7751993",
"0.7751993",
"0.73391134",
"0.7334895",
"0.7297356",
"0.727818",
"0.7159078",
"0.71578115",
"0.71494967",
"0.71494967",
"0.71283495",
"0.71275014",
"0.7122587",
"0.71079814",
"0.7060394",
"0.7043251",
"0.7034103",
"0.70233124",
"0.69635814",
"0.69586295",
"0.6900... | 0.0 | -1 |
Returns the string representation of the model | def to_str(self):
return pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ... | [
"0.85856473",
"0.7816244",
"0.77898955",
"0.77511245",
"0.77511245",
"0.7712556",
"0.76984036",
"0.766997",
"0.7650706",
"0.7601334",
"0.7583777",
"0.7571045",
"0.75404567",
"0.7523676",
"0.7515677",
"0.7501507",
"0.7488033",
"0.7488033",
"0.74696296",
"0.7452353",
"0.7446052... | 0.0 | -1 |
For `print` and `pprint` | def __repr__(self):
return self.to_str() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)",
"def print_out():\n pass",
"def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)",
"def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)",
"def _printable(self):\n ... | [
"0.75577617",
"0.73375154",
"0.6986672",
"0.698475",
"0.6944995",
"0.692333",
"0.6899106",
"0.6898902",
"0.68146646",
"0.6806209",
"0.6753795",
"0.67497987",
"0.6744008",
"0.6700308",
"0.6691256",
"0.6674591",
"0.6658083",
"0.66091245",
"0.6606931",
"0.6601862",
"0.6563738",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, VersionedFlowSnapshot):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
return the raw mongo client object...used for GridFS | def raw(self):
return self._mc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mongo_client():\n return MongoClient(STRING_CONNECTION)",
"def _get_mongo_client():\n return pymongo.MongoClient(mongo_uri)",
"def get_client():\n\n return MongoClientManager().client",
"def get_client() -> 'MongoCLient':\n client = pymongo.MongoClient()\n db = client['c3']\n c = db['js... | [
"0.79397935",
"0.77123386",
"0.7707316",
"0.76750153",
"0.75797075",
"0.7020345",
"0.68918586",
"0.6888702",
"0.6784793",
"0.6751236",
"0.66443473",
"0.6582273",
"0.652171",
"0.65152115",
"0.65055853",
"0.6468484",
"0.6419923",
"0.63917613",
"0.63768053",
"0.63760334",
"0.636... | 0.0 | -1 |
decorator, to check if any arguments are None; raise exception if so | def arguments_not_none(func):
def wrapper(*args, **kwargs):
for arg in args:
if arg is None:
raise NullArgument()
for arg, val in kwargs.iteritems():
if val is None:
raise NullArgument()
try:
return func(*args, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_require_at_least_one_but_none_provided(self):\n from plone.api.exc import MissingParameterError\n _func = at_least_one_of('arg1', 'arg2')(undecorated_func)\n with self.assertRaises(MissingParameterError):\n _func()",
"def raise_on_kwargs_not_empty(kwargs):\n if kwargs:... | [
"0.7179476",
"0.7005238",
"0.6862655",
"0.67738134",
"0.66771066",
"0.66719574",
"0.6670857",
"0.66649455",
"0.6516356",
"0.64760697",
"0.64564824",
"0.64414316",
"0.6400211",
"0.63677275",
"0.6340219",
"0.6336073",
"0.6278074",
"0.624633",
"0.62405366",
"0.6194473",
"0.61714... | 0.7990307 | 0 |
Does the range (start1, end1) overlap with (start2, end2)? From Ned Batchelder | def overlap(start1, end1, start2, end2):
return not (end1 < start2 or end2 < start1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ranges_overlap(start1, end1, start2, end2):\n return start1 <= end2 and end1 >= start2",
"def overlap(t1start, t1end, t2start, t2end):\n\n return (t1start <= t2start <= t1end) or (t2start <= t1start <= t2end)",
"def dates_intervals_are_overlapped(start_1, end_1, start_2, end_2):\n return end_1 >= ... | [
"0.9136054",
"0.8766053",
"0.86649185",
"0.8614897",
"0.8568691",
"0.8040404",
"0.79916596",
"0.79050434",
"0.7863665",
"0.7816917",
"0.7795002",
"0.77819324",
"0.7761843",
"0.7755675",
"0.76948917",
"0.7658933",
"0.76514626",
"0.7645277",
"0.76171124",
"0.75732416",
"0.75300... | 0.91575056 | 0 |
Gets the most appropriate provider manager depending on config. If local is True, then don't bother with the runtime/config and try to get the requested service manager directly from the local service implementations known to this mongodb implementation. | def get_provider_manager(osid, runtime=None, proxy=None, local=False):
if runtime is not None and not local:
try:
# Try to get the manager from the runtime, if available:
config = runtime.get_configuration()
parameter_id = Id('parameter:' + osid.lower() + 'ProviderImpl@mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugins_get_mgr():\n global pluginmgr\n return pluginmgr",
"def get_manager(self, name):\n\n if name == \"control\":\n manager = self._control_manager\n elif name == \"alarm\":\n manager = self._alarm_manager\n elif name == \"state\":\n manager = se... | [
"0.60364807",
"0.59472436",
"0.59169286",
"0.5853699",
"0.57207507",
"0.5716708",
"0.5675645",
"0.56740063",
"0.5661868",
"0.56517935",
"0.561996",
"0.56145036",
"0.5549924",
"0.552947",
"0.5511615",
"0.54560804",
"0.54558784",
"0.54422766",
"0.54190433",
"0.540673",
"0.54012... | 0.763456 | 0 |
DO NOT USE THIS FUNCTION! USE Robot CONSTRUCTOR (e.g., Robot(x, y, direction) ! Registers/creates a robot into the world | def __register__(self, x, y, direction):
if type(x) == int and type(y) == int and type(direction) == int and \
x >= 0 and x < self.width and y >= 0 and y < self.height and \
direction >= 0 and direction < 8:
self.robots.append([x, y, direction, 0, [], self.endurance])
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RobotInit():\n names = [\"Body\"]\n angles = [-0.038392066955566406, 0.1349501609802246, 1.1964781284332275, 0.07512402534484863, -1.4926238059997559, -1.3391400575637817, 0.11500811576843262, 0.029999971389770508, -0.25766992568969727, -0.09506607055664062, -0.9694461822509766, 2.086198091506958, -1.168... | [
"0.7119725",
"0.66708565",
"0.66150707",
"0.66150707",
"0.66150707",
"0.6515958",
"0.64653933",
"0.6401375",
"0.6401208",
"0.6392855",
"0.63742554",
"0.63672197",
"0.6210215",
"0.61475366",
"0.6102146",
"0.6056918",
"0.60055536",
"0.59444857",
"0.59425056",
"0.5940066",
"0.58... | 0.56903636 | 39 |
Simulate the world one time unit forward | def tick(self):
time.sleep(self.sleep_time)
self.time += 1
print("[Turn " + str(self.time) + "] Tick tock...")
directions = [(0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1)]
for i in range(len(self.robots)):
self.robots[i][2] = (self.robots[i][2] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self):\n self.world.slosh_oceans()\n self.world.transfer_energy_vertically()\n self.world.transfer_energy_horizontally()\n self.world.absorb_energy_from_core()\n self.world.absorb_energy_from_sun(self.sun)",
"def Advance():\n warp.step()",
"def move_forward():\n ... | [
"0.67292005",
"0.64945006",
"0.6397304",
"0.62559396",
"0.6235326",
"0.61036724",
"0.6097616",
"0.6019334",
"0.6011286",
"0.6009549",
"0.5931416",
"0.5928384",
"0.5917792",
"0.59098625",
"0.58788747",
"0.5878344",
"0.585945",
"0.58495826",
"0.58495194",
"0.5839053",
"0.583890... | 0.0 | -1 |
Prints the state of the world | def print_state(self):
grid = [["." for _ in range(self.width)] for _ in range(self.height)]
#icons = ["^", "/", ">", "\\", "|", "/", "<", "\\"] # NON-UNICODE, uncomment if problems
icons = [chr(0x2191), chr(0x2197), chr(0x2192), chr(0x2198), \
chr(0x2193), chr(0x2199), chr(0x21... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualize_world(self, brain):\n state_str = ' || '.join([str(self.sensors),\n str(self.actions),\n str(self.reward),\n str(self.size),\n str(self.color),\n ... | [
"0.79768616",
"0.77415276",
"0.76041234",
"0.74134165",
"0.73678154",
"0.73091733",
"0.725482",
"0.72466856",
"0.7233404",
"0.7192176",
"0.71410733",
"0.71096724",
"0.708291",
"0.70764035",
"0.70711076",
"0.7021502",
"0.6993268",
"0.6965721",
"0.6816595",
"0.6780067",
"0.6758... | 0.7107253 | 12 |
Creates and registers the robot into the world | def __init__(self, world, x, y, direction):
self.ID = world.__register__(x, y, direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_robot(self, x, y):\n state = ModelState()\n state.model_name = 'turtlebot3_waffle_pi'\n state.reference_frame = 'world'\n # pose\n state.pose.position.x = x\n state.pose.position.y = y\n state.pose.position.z = 0\n quaternion = tf.transformations.quat... | [
"0.687528",
"0.6874387",
"0.6782282",
"0.659252",
"0.64920413",
"0.64699507",
"0.64699507",
"0.64699507",
"0.645428",
"0.63304985",
"0.6298378",
"0.62861806",
"0.6221599",
"0.62053573",
"0.6201447",
"0.6148911",
"0.60959584",
"0.60619104",
"0.6057073",
"0.6025743",
"0.6023902... | 0.61964273 | 15 |
Detects obstacles/treasure in the direction given | def detect(self, world, direction):
return world.__detect__(self.ID, direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _detect_obstacles(self):\n def _distance(point, line_point1, line_point2):\n \"\"\"calcuate the distance between a point and a line\"\"\"\n vec1 = line_point1 - point\n vec2 = line_point2 - point\n distance = np.abs(np.cross(vec1,vec2)) / np.linalg.norm(line_p... | [
"0.6765248",
"0.6462678",
"0.6365802",
"0.6235155",
"0.5916832",
"0.5816423",
"0.5814319",
"0.5763923",
"0.57356083",
"0.5707155",
"0.5683583",
"0.5678774",
"0.5662664",
"0.56388575",
"0.56376547",
"0.56226844",
"0.56192607",
"0.56157404",
"0.5596173",
"0.55942667",
"0.558437... | 0.5707342 | 9 |
Turns the robot into specified direction. | def turn(self, world, direction):
world.__turn__(self.ID, int(direction)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRobotDirection(self, direction):\n self.direction = direction",
"def setRobotDirection(self, direction):\n self.direction = direction",
"def setRobotDirection(self, direction):\n self.direction = direction\n #raise NotImplementedError",
"def setRobotDirection(self, directio... | [
"0.7838874",
"0.7838874",
"0.76411635",
"0.76411635",
"0.75555784",
"0.75247675",
"0.73792523",
"0.7336378",
"0.72886634",
"0.72776496",
"0.72776496",
"0.7100742",
"0.7089828",
"0.7087633",
"0.7057973",
"0.7036288",
"0.69716114",
"0.69710374",
"0.6963444",
"0.69305086",
"0.69... | 0.6965067 | 18 |
Returns the current heading | def compass(self, world):
return world.__compass__(self.ID) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_heading(self):\n return self.heading[0]",
"def get_heading(self):\n return self.__heading",
"def get_heading(self):\n return self.__heading",
"def heading(self):\n return self._heading",
"def get_heading(self):\n raise NotImplementedError()",
"def current(self):... | [
"0.8722494",
"0.85420424",
"0.85420424",
"0.8422529",
"0.8013809",
"0.77427745",
"0.74058926",
"0.71911323",
"0.7114737",
"0.7080047",
"0.6995244",
"0.69748133",
"0.68499124",
"0.6691362",
"0.66788507",
"0.6677714",
"0.6649257",
"0.66430706",
"0.6629219",
"0.66105723",
"0.658... | 0.0 | -1 |
Copies files/folders from source path to destination path. | def copy(queue: Queue,
from_path: list,
to_path: str
) -> None:
if len(from_path) > 1: # In case files were got with mask
for single_path in from_path:
file = os.path.basename(os.path.normpath(single_path))
files_location = os.path.commonpath(from_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(source, destination):\r\n\r\n source_ = os.path.abspath(os.path.expanduser(source))\r\n destination_ = os.path.abspath(os.path.expanduser(destination))\r\n\r\n if not os.path.exists(destination_) and not os.path.isfile(source_):\r\n os.makedirs(destination_)\r\n\r\n def recurse(source, ... | [
"0.7983486",
"0.7957432",
"0.78940266",
"0.78808",
"0.78373456",
"0.78150314",
"0.77984804",
"0.77322704",
"0.76817423",
"0.7679654",
"0.7667483",
"0.76487505",
"0.7618055",
"0.75962996",
"0.75252116",
"0.74983615",
"0.74461746",
"0.74247384",
"0.7413823",
"0.7412289",
"0.738... | 0.66876113 | 97 |
Moves files/folders from source path to destination path. | def move(queue: Queue,
from_path: list,
to_path: str
) -> None:
if len(from_path) > 1: # In case files were got with mask
for single_path in from_path:
file = os.path.basename(os.path.normpath(single_path))
files_location = os.path.commonpath(from_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file(source, destination):\n shutil.move(source, destination)",
"def file_move(self, from_path, to_path):\n params = {'root': self.session.root,\n 'from_path': format_path(from_path),\n 'to_path': format_path(to_path)}\n\n url, params, headers = self.re... | [
"0.753389",
"0.7460408",
"0.7451957",
"0.7261906",
"0.7242846",
"0.7174383",
"0.71208817",
"0.70430756",
"0.69726026",
"0.6946707",
"0.6935526",
"0.69102216",
"0.6884413",
"0.6790367",
"0.67810595",
"0.67304283",
"0.6705451",
"0.6672422",
"0.66053575",
"0.65962404",
"0.658639... | 0.63737905 | 32 |
Query data from the database, open and close the connection | def query_conn(sql_request):
try:
conn = psycopg2.connect(database="news")
cursor = conn.cursor()
cursor.execute(sql_request)
results = cursor.fetchall()
conn.close()
return results
except psycopg2.Error as e:
print("Unable to connect to the database")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, query, data=None):\n data_from_db = None\n for _ in range(self.times_b4_data_lost):\n try:\n self.cursor = self.conn.cursor()\n logging.info(\"Try {}, {}\".format(query, data))\n if data:\n self.cursor.execut... | [
"0.66747355",
"0.6650483",
"0.64080244",
"0.6391838",
"0.6307109",
"0.62761843",
"0.62521106",
"0.6235912",
"0.61741835",
"0.6170851",
"0.613983",
"0.60761136",
"0.60655487",
"0.60382885",
"0.60382885",
"0.6032164",
"0.60165477",
"0.6013409",
"0.6010202",
"0.60101897",
"0.600... | 0.5900365 | 30 |
Returns a search provider. | def _get_search_provider(self, engine, api_key):
if engine not in SearchProxy._engines:
raise KeyError("No such engine found: " + engine)
# Use caching
return SearchProxy._engines[engine](api_key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_provider(self) -> Optional[Provider]:\n if not self.provider:\n return None\n return Provider.objects.get_subclass(pk=self.provider.pk)",
"def find_provider(self) -> DataProvider:\n data_source = self._single_data_source()\n identifiers = self._make_identifiers()\n ... | [
"0.67729783",
"0.6718573",
"0.6717137",
"0.6710824",
"0.6573458",
"0.64831233",
"0.647294",
"0.6448106",
"0.6442226",
"0.6382654",
"0.6293731",
"0.62925255",
"0.62718844",
"0.6164266",
"0.6067232",
"0.6029334",
"0.6016101",
"0.595153",
"0.5943089",
"0.58939993",
"0.5797317",
... | 0.6940315 | 0 |
Normalizes query, the goal is to reduce the number of unique queries. | def _normalize_query(self, query):
return re.sub('\s+', ' ', query).strip().lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_query(self, query):\n if not query:\n return {}\n\n def _parse_value(value):\n \"\"\"Checks and parses if supplied value is a float, bool, or int\"\"\"\n # Check if it is a boolean, int, or float value\n try:\n value = json.loa... | [
"0.6814932",
"0.6377694",
"0.61607236",
"0.60682076",
"0.5984933",
"0.5917141",
"0.58574533",
"0.5849663",
"0.5790046",
"0.5782918",
"0.5746508",
"0.5692975",
"0.56837636",
"0.5566909",
"0.55489427",
"0.546305",
"0.5441469",
"0.5441324",
"0.5426586",
"0.5394316",
"0.53928113"... | 0.63966286 | 1 |
Returns search results for the given query. Uses search engine specified when object was created. | def search(self, query):
return self._search_provider.search(self._normalize_query(query)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, query=None, options=None):\n return self.create_search(query, options).search()",
"def _search(self, query):\n return self._request(query)",
"def search(self, query):",
"def search(self, q, *args, **kwargs):\n\t\treturn self.__model.objects.search(q, *args, **kwargs)",
"def s... | [
"0.8006484",
"0.796888",
"0.782748",
"0.7698193",
"0.75524807",
"0.7472724",
"0.744233",
"0.7354309",
"0.73182344",
"0.72385937",
"0.7187812",
"0.7147223",
"0.7100142",
"0.7097355",
"0.7087547",
"0.7054167",
"0.7036175",
"0.7032594",
"0.7032379",
"0.70082915",
"0.6978113",
... | 0.81955093 | 0 |
List all registered fuelmaster | def get(self):
return get_all_fuelmaster() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list():\n rino.remote.list()",
"def get_bus_list():\n\n\tbuses = db.session.query(Bus.bus_name).all()\n\n \n\treturn buses",
"def list_all(self):\n\n url = 'equipamento/list/'\n\n code, xml = self.submit(None, 'GET', url)\n\n return self.response(code, xml)",
"def get_all_sensor... | [
"0.60012436",
"0.5986072",
"0.5853507",
"0.57456124",
"0.5729652",
"0.5678258",
"0.56627524",
"0.56465113",
"0.56461614",
"0.56365293",
"0.5625861",
"0.56063926",
"0.55918413",
"0.5579228",
"0.55619735",
"0.5560769",
"0.55473894",
"0.5540286",
"0.55253315",
"0.55137026",
"0.5... | 0.7972504 | 0 |
Creates a new fuelmaster | def post(self):
data = request.json
return save_new_fuelmaster(data=data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _createMaster(self, *args, **kwds):\n raise NotImplementedError",
"def create_master_resource(self, name):\n vdu_id = str(uuid.uuid4())\n userdata = \"\"\"#cloud-config\n\n runcmd:\n - /usr/rift/scripts/cloud/enable_lab {site}\n \"\"\"\n\n site = \"\"\n if self._s... | [
"0.6816229",
"0.64668983",
"0.62813395",
"0.62446845",
"0.6169536",
"0.6169536",
"0.61356246",
"0.6132837",
"0.61031365",
"0.59870327",
"0.59829056",
"0.59733576",
"0.58920753",
"0.5812014",
"0.58021694",
"0.57926846",
"0.57718396",
"0.5765476",
"0.5765476",
"0.5765476",
"0.5... | 0.71277624 | 0 |
get a fuelmaster given its identifier | def get(self, fuelid):
user = get_a_fuelmaster(fuelid)
if not user:
api.abort(404)
else:
return user
data = request.json
return get_a_fuelmaster(data=data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_master(searchname):\n masters = get_masters()\n masternames = []\n master_lookup = {}\n for mn, path in masters:\n master = {}\n master['mastername'] = mn\n master_lookup[mn] = path\n masternames.append(master)\n\n candidates = [mn for mn in masternames if mn['mastername'] == searchname... | [
"0.6281987",
"0.62778556",
"0.618738",
"0.6151269",
"0.6090545",
"0.6026856",
"0.5942235",
"0.59144944",
"0.5639281",
"0.5639281",
"0.56307095",
"0.5623589",
"0.5600634",
"0.5590971",
"0.55718446",
"0.5563223",
"0.55552864",
"0.55219615",
"0.5472625",
"0.546722",
"0.5446527",... | 0.71977645 | 0 |
This function picks a random word from the SOWPODS dictionary. | def pick_random_word():
# open the sowpods dictionary
with open("resources/ex30/sowpos.txt", 'r') as f:
words = f.readlines()
# generate a random index
# -1 because len(words) is not a valid index into the list `words`
index = random.randint(0, len(words) - 1)
# print out the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_word():\r\n # Opening the SOWPODS dictionary and getting a random word\r\n with open(r\"C:\\Users\\Santosh\\Desktop\\sowpods.txt\") as f:\r\n content = f.read()\r\n return random.choice(content.split())",
"def get_word():\n word=words_dict[randrange(0,len(words_dict))]\n return w... | [
"0.84963965",
"0.8297684",
"0.8297684",
"0.8297684",
"0.77926",
"0.7765932",
"0.76985675",
"0.76985675",
"0.76985675",
"0.7654141",
"0.76440424",
"0.7621508",
"0.7612562",
"0.75299704",
"0.7442256",
"0.7369817",
"0.72951597",
"0.7231558",
"0.7231546",
"0.7192046",
"0.71634084... | 0.8604508 | 0 |
Return bounding box from rect given as (x0, y0, width, height). Override this since matplotlib returns `Bbox`, not subclass, instance. | def from_rect(cls, rect):
x0, y0, width, height = rect
return cls.from_extents(x0, y0, x0 + width, y0 + height) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBox(self):\n minx, miny, maxx, maxy = self.substrates.bounds\n return pcbnew.BOX2I(\n pcbnew.VECTOR2I(int(minx), int(miny)),\n pcbnew.VECTOR2I(int(maxx - minx), int(maxy - miny)))",
"def to_bounding_box(self):\n if self.bbox is not None:\n return ... | [
"0.7809339",
"0.737255",
"0.72839624",
"0.72485626",
"0.7206412",
"0.7173969",
"0.7082922",
"0.70327616",
"0.7032551",
"0.7031062",
"0.7031062",
"0.6943999",
"0.6916056",
"0.68824434",
"0.6854536",
"0.6854536",
"0.6852709",
"0.68432486",
"0.68053687",
"0.6788081",
"0.67669916... | 0.66813505 | 27 |
Return bounding box from extents given as (x0, y0, x1, y1). Override this since matplotlib returns `Bbox`, not subclass, instance. | def from_extents(cls, x0, y0, x1, y1):
points = np.array([[x0, y0],
[x1, y1]], dtype=np.float_)
return cls(points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBox(self):\n minx, miny, maxx, maxy = self.substrates.bounds\n return pcbnew.BOX2I(\n pcbnew.VECTOR2I(int(minx), int(miny)),\n pcbnew.VECTOR2I(int(maxx - minx), int(maxy - miny)))",
"def boundingbox(self, *args, **kwargs):\n return _image.image_boundingbox(s... | [
"0.77139556",
"0.75832015",
"0.7493409",
"0.7409143",
"0.73218113",
"0.7249111",
"0.7207639",
"0.7112756",
"0.7025434",
"0.70228106",
"0.7002541",
"0.7002541",
"0.69599134",
"0.6954883",
"0.69427836",
"0.693529",
"0.6928705",
"0.69017816",
"0.6892683",
"0.6892683",
"0.6881103... | 0.0 | -1 |
Property trait that accesses an attr on a BoundingBox's `_bbox` trait. | def BboxProperty(attr_name, readonly=False):
def _bbox_getter(attr_name):
def get_attr(self):
return getattr(self._bbox, attr_name)
return get_attr
def _bbox_setter(attr_name):
def set_attr(self, value):
return setattr(self._bbox, attr_name, value)
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bbox(self, primitive):\n accessor = primitive.attributes.get(\"POSITION\")\n return accessor.min, accessor.max",
"def getbbox(self):\n pass",
"def __getitem__(self, name):\n return self.gattrs[name]",
"def get_attr(self, key: str) -> Any:\n raise NotImplementedError(\"T... | [
"0.5937778",
"0.561052",
"0.56001234",
"0.5597013",
"0.55287915",
"0.55163205",
"0.5487905",
"0.5487905",
"0.5485995",
"0.5485995",
"0.5484998",
"0.54427093",
"0.54417217",
"0.543217",
"0.5417654",
"0.5400444",
"0.53891706",
"0.5352632",
"0.5352632",
"0.53514254",
"0.5349861"... | 0.7442278 | 0 |
Callback method for observer pattern. | def _bbox_updated(self):
self.updated = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback(self):\n pass # pragma: no cover",
"def callback(self, *args):\n raise NotImplementedError()",
"def notifyObservers(self):",
"def subscribe(observer):",
"def subscribe(observer):",
"def onUpdated(self):",
"def observe(self, event_pattern, priority, callback):\n pass ... | [
"0.7871767",
"0.7563442",
"0.7464727",
"0.7017353",
"0.7017353",
"0.6823691",
"0.67623544",
"0.6746176",
"0.66721445",
"0.66322833",
"0.6630851",
"0.6630851",
"0.6598841",
"0.65900135",
"0.65850496",
"0.6563623",
"0.65347016",
"0.6479647",
"0.6454233",
"0.64524",
"0.64464146"... | 0.0 | -1 |
return a random url from the static range | def _create_random_url(self):
return self._base_url % random.randrange(self._random_create_start,
self._random_create_end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_url():\r\n url = u\"http://{0}.com\".format(random_string())\r\n return url",
"def url_maker():\n chars = string.ascii_lowercase + string.ascii_uppercase + string.digits\n tempchar = [random.choice(chars) for n in range(5)]\n return \"http://i.imgur.com/\" + \"\".join(tempch... | [
"0.75876474",
"0.72136134",
"0.70216435",
"0.6956417",
"0.6789919",
"0.6730312",
"0.6597461",
"0.65511966",
"0.6459239",
"0.6387315",
"0.6387315",
"0.63566333",
"0.6303848",
"0.62931544",
"0.6264384",
"0.61681366",
"0.60464245",
"0.6004846",
"0.60008365",
"0.59711754",
"0.595... | 0.810785 | 0 |
read the image urls from the self._image_urls_file_name and store in memory as a list, but return IOError if file DNE or 0 bytes. | def _read_image_urls(self):
if not os.path.isfile(self._image_urls_file_name):
raise IOError, "'%s' is not found" % self._image_urls_file_name
if os.path.getsize(self._image_urls_file_name) == 0:
raise IOError, "'%s' is empty" % self._image_urls_file_name
for line in open... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_images(input_file_path, output_path):\n if not exists(input_file_path):\n raise FileNotFoundError(input_file_path)\n if not exists(output_path):\n raise NotADirectoryError(output_path)\n\n faulty_lines = []\n with open(input_file_path) as infile:\n for line in infile:\n ... | [
"0.64938587",
"0.64104074",
"0.63533175",
"0.62307644",
"0.61395705",
"0.6009202",
"0.5853331",
"0.58512306",
"0.5811358",
"0.5738813",
"0.57255757",
"0.5710022",
"0.57027847",
"0.5694293",
"0.56759477",
"0.5669109",
"0.56605816",
"0.56493473",
"0.563708",
"0.5610239",
"0.560... | 0.8521112 | 0 |
create a list of valid image urls using a randomly generated self._base_url and then writes them to a text file. | def create_image_urls(self):
self._image_urls = []
while True:
image_url = self._create_random_url()
request = urllib2.Request(image_url)
opener = urllib2.build_opener(NoRedirection)
try:
response = opener.open(request)
code... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveImages(self):\n if self.imageLink and not self.image:\n f= open('imageLink.txt','wb')\n f.write(bytes(str(self.imageLink), 'UTF-8'))\n f.close()\n req = urllib3.urlopen(self.imageLink, headers={'User-Agent': 'Mozilla/5.0'})\n result = urllib3.ur... | [
"0.64285827",
"0.61699784",
"0.61367637",
"0.60362965",
"0.6010603",
"0.5938444",
"0.58879215",
"0.588389",
"0.5798857",
"0.566587",
"0.5665044",
"0.5651153",
"0.5647106",
"0.5646363",
"0.5635563",
"0.5531043",
"0.5524617",
"0.55107826",
"0.55068314",
"0.54994315",
"0.5456978... | 0.76970375 | 0 |
get a random url from memory and return a url, message | def get_image(self, image_id):
index = int(image_id)
if index >= len(self._image_urls):
message = "Url index does not exist: '%i'" % index
return (None, message)
url = self._image_urls[index]
message = "Successful URL found."
return (url, message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_url():\r\n url = u\"http://{0}.com\".format(random_string())\r\n return url",
"def get_random_proxy():\n url=requests.get(proxypool_url).text.strip()\n #logger.info(\"now url is\",url)\n return url",
"def _create_random_url(self):\n return self._base_url % random.randrange(self... | [
"0.72946",
"0.7005638",
"0.67019004",
"0.65324056",
"0.6492584",
"0.64760494",
"0.64545137",
"0.64361954",
"0.6227368",
"0.6179029",
"0.6105395",
"0.607622",
"0.6069228",
"0.60066736",
"0.5948768",
"0.5835882",
"0.58108807",
"0.57343805",
"0.5697531",
"0.56924003",
"0.5673659... | 0.0 | -1 |
get a random url from memory and return a url, message | def get_image_random(self):
index = random.randrange(0, len(self._image_urls_file_name))
if index >= len(self._image_urls):
message = "Url index does not exist: '%i'" % index
return (None, message)
url = self._image_urls[index]
message = "Successful URL found."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_url():\r\n url = u\"http://{0}.com\".format(random_string())\r\n return url",
"def get_random_proxy():\n url=requests.get(proxypool_url).text.strip()\n #logger.info(\"now url is\",url)\n return url",
"def _create_random_url(self):\n return self._base_url % random.randrange(self... | [
"0.7295841",
"0.70054376",
"0.6701809",
"0.65344566",
"0.64918506",
"0.64771074",
"0.6455124",
"0.6226324",
"0.6179463",
"0.6106759",
"0.60760075",
"0.6070169",
"0.60055596",
"0.5949609",
"0.58373594",
"0.5810207",
"0.5733943",
"0.5697383",
"0.5692985",
"0.5673936",
"0.563553... | 0.6436794 | 7 |
return a list of all image urls | def get_images(self, start=0, limit=100):
if not start:
start = 0
if not limit:
limit = 100
start = int(start)
limit = int(limit)
urls = self._image_urls[start:start + limit]
message = "%i Successful URLs found." % len(urls)
return (urls, m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_urls(self):\n return self.get_extract_image_urls(is_first=False)",
"async def get_url_images(session, url):\n content = await get_page(session, url)\n if not content:\n return []\n soup = BeautifulSoup(content, features=\"html.parser\")\n image_sources = [img['src'] for im... | [
"0.8349953",
"0.77791613",
"0.7765179",
"0.7594691",
"0.7517157",
"0.7453508",
"0.7445012",
"0.73694754",
"0.7334349",
"0.7295797",
"0.72804046",
"0.72675395",
"0.724446",
"0.72102153",
"0.7205248",
"0.71913284",
"0.7177829",
"0.71712375",
"0.71439433",
"0.7141298",
"0.711255... | 0.69298524 | 35 |
run the main logic | def main():
images = Images()
#print images.create_image_urls()
print images.get_image_random()
print images.get_image(12) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run():\n main()",
"def main(self):\r\n pass",
"def main():\n pass",
"def main():\n run_program()",
"def main():\n return",
"def Run():\r\n pass",
"def main(self) -> None:\n pass",
"def main():",
"def main():",
"def main():",
"def main():",
"def main():... | [
"0.8367626",
"0.79770964",
"0.79409385",
"0.7829103",
"0.7825246",
"0.78221136",
"0.7820035",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
"0.7789013",
... | 0.0 | -1 |
Creates a new fixture and adds it to the fixture pool | def create_fixture_instance(self, instance_dict):
class_name = instance_dict.get('class_name')
if not class_name:
raise AXApiInvalidParam("'class_name' must be supplied during fixture creation")
fix_class = self.get_fixture_class(name=class_name)
mark_active = instance_dict.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixtures():",
"def start_fixture(self):\n pass",
"def load_database(db_session, fixture):\n # TODO: the fixture file path controls\n\n # load the fixture\n datas = pickle.loads(fixture)\n db_session.add_all(datas)\n db_session.commit()\n print \"load database ok\"",
"def setUpFix... | [
"0.6056403",
"0.586278",
"0.5855234",
"0.5821136",
"0.57689506",
"0.5739174",
"0.56620824",
"0.5635566",
"0.56250745",
"0.5587689",
"0.5587689",
"0.5548034",
"0.5503349",
"0.549727",
"0.5428702",
"0.54181784",
"0.53824115",
"0.53703463",
"0.53610915",
"0.5360567",
"0.53593236... | 0.5883227 | 1 |
Verifies uniqueness of instance name, or raises AXApiInvalidParam if it already exists | def _verify_unique_instance_name(self, name):
existing = self.instances.find_one({'name': name, 'deleted': False})
if existing:
raise AXApiInvalidParam("Fixture instance with name '{}' already exists".format(name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duplicate_names_fail(self):\n name = 'some_name'\n instance_types.create(name, 256, 1, 120, 200, 'flavor1')\n self.assertRaises(exception.InstanceTypeExists,\n instance_types.create,\n name, 256, 1, 120, 200, 'flavor2')",
"def check_... | [
"0.6955145",
"0.64076835",
"0.6331418",
"0.6246967",
"0.6105957",
"0.6080625",
"0.60061294",
"0.5978304",
"0.5874458",
"0.5850276",
"0.5835531",
"0.5809082",
"0.57808006",
"0.5773074",
"0.5737927",
"0.5737927",
"0.57119274",
"0.57102257",
"0.56951034",
"0.5669034",
"0.5659929... | 0.79201096 | 0 |
Launches the necessary workflow to perform fixture instance action | def perform_fixture_instance_action(self, instance_id, action_name, user=None, arguments=None):
with lock_instance(instance_id):
instance = self.get_fixture_instance(id=instance_id)
fix_class = self.get_fixture_class(id=instance.class_id)
action = fix_class.actions.get(action... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_fixture(self):\n pass",
"def test_run_tempest(self, tempest_actions, show_step, _):\n show_step(1)\n tempest_actions.prepare_and_run_tempest()",
"def init_workflow():\n pass",
"def main():\n fixture_util = FixtureUtil()\n fixture_util.set_stream_handler_logging_level()... | [
"0.6931977",
"0.65578943",
"0.6186647",
"0.616885",
"0.6142634",
"0.6069325",
"0.6024939",
"0.5972109",
"0.5967295",
"0.59441286",
"0.59109944",
"0.5907235",
"0.5878874",
"0.5812543",
"0.58103865",
"0.5805487",
"0.58021915",
"0.5774877",
"0.57505906",
"0.5738221",
"0.57374245... | 0.6887621 | 1 |
Callback which we or axops invokes upon completion of an action job to transition the instance state. Payload will be the entire service object | def process_action_result(self, service):
logger.info("Notified of action result:\n%s", pretty_json(service))
annotations = service.get('annotations', {})
instance_id = annotations.get('instance_id')
action_name = annotations.get('action')
if not instance_id:
logger.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_action(self, state):",
"def instance_action():\n data = check_args(\n ('cloudProvider', 'apiKey', 'secretKey', 'instanceAction',\n 'instanceId')\n )\n job = jobs.instance_action.apply_async(args=(data,))\n return make_response(job_id=job.id)",
"def __call__(self, ... | [
"0.5909055",
"0.573255",
"0.5583706",
"0.5533153",
"0.5494742",
"0.54761547",
"0.5452019",
"0.5439728",
"0.53636885",
"0.5362042",
"0.52939844",
"0.5288115",
"0.52772313",
"0.5261649",
"0.52485555",
"0.5224333",
"0.5212607",
"0.52040434",
"0.5195659",
"0.5169902",
"0.51617724... | 0.68170696 | 0 |
Sets the instance's enabled field to be True or False depending on the policy | def set_enabled_from_policy(self, instance, service_status, action_name):
fixture_class = self.get_fixture_class(id=instance.class_id, verify_exists=False)
if not fixture_class:
logger.error("Fixture class %s for instance %s no longer exists. This should not happen.", instance.class_id, inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable(self):\n self.enabled = True",
"def enable(self):\n self.enabled = True",
"def set_enabled(self, enabled=True):\n self._enabled = enabled",
"def enabled(self, enabled):\n \n self._enabled = enabled",
"def setEnabled(self, enable: bool) -> None:\n self.en... | [
"0.70353025",
"0.70353025",
"0.7026392",
"0.70054436",
"0.6958848",
"0.6942414",
"0.6909379",
"0.68414813",
"0.68414813",
"0.6791215",
"0.67889",
"0.6772832",
"0.67663443",
"0.67381793",
"0.67381793",
"0.67381793",
"0.67381793",
"0.67381793",
"0.67381793",
"0.67381793",
"0.67... | 0.71664494 | 0 |
Checks the completed service for artifact named 'attributes' If exists, loads the json and updates the instance with attribute values | def update_attributes_from_artifacts(self, instance, service):
try:
artifacts = self.axops_client.search_artifacts({'workflow_id': service['id'], 'name': ATTRIBUTE_ARTIFACT_NAME})
if not artifacts:
logger.info("Job did not have '%s' artifact. Skipping attribute parsing", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_update_with_json_attrs(hass: HomeAssistant) -> None:\n\n respx.get(\"http://localhost\").respond(\n status_code=HTTPStatus.OK,\n json={\"key\": \"123\", \"other_key\": \"some_json_value\"},\n )\n assert await async_setup_component(\n hass,\n SENSOR_DOMAIN,\n ... | [
"0.5695464",
"0.55972224",
"0.55405647",
"0.54598075",
"0.5417405",
"0.54166555",
"0.5379903",
"0.53422505",
"0.5303454",
"0.52921903",
"0.5285825",
"0.52804995",
"0.5277226",
"0.5252016",
"0.5234792",
"0.52121645",
"0.52084136",
"0.5206056",
"0.5190542",
"0.51895976",
"0.517... | 0.778703 | 0 |
Returns a dictionary from the attribute artifact json file, or None if json was invalid | def download_artifact_json(self, artifact_id):
try:
response = self.axops_client.download_artifact(artifact_id)
data = io.BytesIO(response.raw.read())
tar = tarfile.open(mode='r:*', fileobj=data)
for member in tar.getnames():
attr_str = tar.extract... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_model_output_from_json(json_file_path: str) -> dict:\n cprint(f\"### Function Name:-> {inspect.stack()[0][3]} ###\", 'yellow', 'on_grey', attrs=['bold'])\n try:\n json_data = dict()\n json_file_path = Path(json_file_path)\n if json_file_path.exists():\n with open(... | [
"0.6071951",
"0.60544235",
"0.59932405",
"0.59605145",
"0.5904924",
"0.587944",
"0.58763856",
"0.57965106",
"0.5785816",
"0.5781285",
"0.5768887",
"0.57507616",
"0.5743237",
"0.57149357",
"0.57103604",
"0.5682458",
"0.56810623",
"0.563795",
"0.5632252",
"0.5611354",
"0.560419... | 0.6275994 | 0 |
Returns a single, unique fixture by name or id >>> fixmgr.get_fixture_instance(name='linux01') | def get_fixture_instance(self, id=None, name=None, verify_exists=True):
query = {}
if id:
query['_id'] = id
if name:
query['name_lower'] = name
if not query:
raise AXIllegalArgumentException("No query filters supplied")
fix_doc = self.instances... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fixture(name):\n path = os.path.join(os.environ.get(\"WORKSPACE\", \"./\"), \"fixtures\", name)\n if not os.path.isfile(path):\n raise NotFound(\"File {} not found\".format(path))\n return path",
"def _get_fixture(item, arg_name, fixture=None):\n if arg_name == \"request\":\n # ... | [
"0.6509923",
"0.62037605",
"0.6023634",
"0.5966281",
"0.59145325",
"0.5883537",
"0.576336",
"0.56827825",
"0.5630251",
"0.5515407",
"0.5480694",
"0.5458051",
"0.5450804",
"0.5437768",
"0.5419975",
"0.54180723",
"0.5371775",
"0.53615993",
"0.5356714",
"0.53151685",
"0.5307016"... | 0.7184157 | 0 |
Update one or more fields of a fixture | def update_fixture_instance(self, updates, user=None):
instance_id = updates.get('id')
if not instance_id:
raise AXApiInvalidParam("Fixture instance id not supplied")
with lock_instance(instance_id):
instance = self.get_fixture_instance(id=instance_id)
update... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update(self):\n doc_fields = document_fields.DocumentFields({\n 'foo@': 'bar',\n })\n self.assertEquals('bar', doc_fields['foo'])\n doc_fields.update({\n 'foo@': 'bbq',\n })\n self.assertEquals('bbq', doc_fields['foo'])",
"def test_update_o... | [
"0.66511786",
"0.6485349",
"0.64653414",
"0.6449369",
"0.6448642",
"0.63848275",
"0.6377677",
"0.6367727",
"0.63507116",
"0.6309077",
"0.63034683",
"0.6267018",
"0.6263446",
"0.6263446",
"0.6263446",
"0.6196465",
"0.617265",
"0.61683273",
"0.61044466",
"0.60929394",
"0.604220... | 0.0 | -1 |
Helper to persist updates fixture instance to both the cache and axdb. May raise AXIllegalOperationException if duplicate name is detected | def _persist_instance_updates(self, instance):
assert instance.id in _instance_locker.resource_locks, "update attempted without acquiring resource lock"
pre_update_doc = self.instances.find_one({'_id' : instance.id})
now = int(time.time() * 1e6)
instance.mtime = now
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_with_same_name(data_store_path):\n data_set = [\n {\"name\": \"Eric Idle\", \"phone\": \"123-456-7890\", \"address\": \"here\"},\n {\"name\": \"John Cleese\", \"phone\": \"111-222-3333\", \"address\": \"there\"},\n ]\n data_store_path.write_text(yaml.dump(data_set))\n data_store ... | [
"0.56453335",
"0.5638679",
"0.562441",
"0.551899",
"0.54881793",
"0.5471136",
"0.54626113",
"0.5439041",
"0.5436143",
"0.5416441",
"0.54127663",
"0.5400142",
"0.5376579",
"0.5373746",
"0.53714424",
"0.53673923",
"0.53653735",
"0.535895",
"0.53459835",
"0.53347355",
"0.5305739... | 0.64539367 | 0 |
Normalizes a fixture API query to mongodb query lowercases field names replaces 'id' search with '_id' replace 'name' with 'name_lower' if value is a list, change query to use $in | def _normalize_query(self, query):
if not query:
return {}
def _parse_value(value):
"""Checks and parses if supplied value is a float, bool, or int"""
# Check if it is a boolean, int, or float value
try:
value = json.loads(value.lower())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bulk(self):\n\n class BlogPost(Document):\n title = StringField()\n\n BlogPost.drop_collection()\n\n post_1 = BlogPost(title=\"Post #1\")\n post_2 = BlogPost(title=\"Post #2\")\n post_3 = BlogPost(title=\"Post #3\")\n post_4 = BlogPost(title=\"Post #4\"... | [
"0.5652842",
"0.54111284",
"0.5205573",
"0.5133935",
"0.5102323",
"0.508832",
"0.50550246",
"0.5027909",
"0.5022632",
"0.5020408",
"0.49917224",
"0.4956201",
"0.49088815",
"0.4906609",
"0.48816794",
"0.48648617",
"0.48380446",
"0.48306593",
"0.48206267",
"0.47830543",
"0.4770... | 0.6131159 | 0 |
Checks and parses if supplied value is a float, bool, or int | def _parse_value(value):
# Check if it is a boolean, int, or float value
try:
value = json.loads(value.lower())
return value
except ValueError:
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_float_or_int(value):\n if type(value) is float:\n return True\n elif type(value) is int:\n return True\n else:\n return False",
"def parse_value(self, value):\n\t\t\n\t\tif goodies.is_float(value):\n\t\t\treturn float(value)\n\t\telif goodies.is_int(value):\n\t\t\treturn int(... | [
"0.76513934",
"0.75379056",
"0.73210937",
"0.72933656",
"0.72184867",
"0.7101478",
"0.708445",
"0.70550215",
"0.7046273",
"0.70173186",
"0.7011511",
"0.70062846",
"0.7004121",
"0.69531006",
"0.6929172",
"0.6923828",
"0.691703",
"0.69161826",
"0.69118804",
"0.6898412",
"0.6888... | 0.670755 | 37 |
Returns a generator of fixtures based on kwarg filters | def query_fixture_instances(self, query=None):
query = self._normalize_query(query)
logger.debug("Fixture query: %s", query)
class_map = {}
for fix_class in self.get_fixture_classes():
class_map[fix_class.id] = fix_class.name
for fix_doc in self.instances.find(query):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixture_andy():\n yield Person(name=\"Andy\", age=12, hobbies=[\"Star Wars\", \"Bicycles\"])",
"def fixture_candy():\n yield Person(name=\"Candy\", age=13, hobbies=[\"Gardening\"])",
"def fixtures():",
"def fixture_sets(*args):\n return [os.path.join(*args, dir)\n for dir in os.listdi... | [
"0.63536245",
"0.6210793",
"0.61883974",
"0.6157608",
"0.6049546",
"0.60290885",
"0.5973234",
"0.59209627",
"0.58388215",
"0.57509035",
"0.56328565",
"0.5494378",
"0.54891187",
"0.5467853",
"0.5447769",
"0.5427338",
"0.5350275",
"0.5342818",
"0.5340783",
"0.5313422",
"0.53111... | 0.0 | -1 |
Delete a fixture instance | def delete_fixture_instance(self, instance_id, user=None):
try:
self.perform_fixture_instance_action(instance_id, InstanceAction.DELETE, user=user)
except AXApiResourceNotFound:
pass
except AXIllegalOperationException:
instance = self.get_fixture_instance(id=i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n try:\n os.remove(self.fixture_file)\n except OSError:\n pass",
"def tearDown(self):\n try:\n os.remove(self.fixtureFile)\n except OSError:\n pass",
"def unload_fixture(apps, schema_editor):\n\n objects = deserializ... | [
"0.6940621",
"0.692528",
"0.69055957",
"0.682422",
"0.6686394",
"0.6677909",
"0.6641366",
"0.66057193",
"0.66004485",
"0.6591869",
"0.65908605",
"0.6550908",
"0.6547031",
"0.6540931",
"0.653834",
"0.6536195",
"0.6519616",
"0.6490032",
"0.6481485",
"0.6466083",
"0.64228755",
... | 0.7225935 | 0 |
Retrieves list of fixture classes | def get_fixture_classes(self):
class_docs = self.axdb_client.get_fixture_classes()
return [FixtureClass.deserialize_axdbdoc(doc) for doc in class_docs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test___get_all_classes():\n config = {\"plugins\": [\"tests.mock_plugin\"]}\n classes = r._get_all_classes(config, r.DataSource)\n assert \"food\" in classes\n classes = r._get_all_classes(config, r.DataSink)\n assert \"food\" in classes",
"def classes(self):\n return list(self._classes... | [
"0.69747436",
"0.68032426",
"0.6723094",
"0.67205036",
"0.66684055",
"0.66140205",
"0.6590699",
"0.65699035",
"0.6460346",
"0.64232725",
"0.6349382",
"0.6337411",
"0.63094455",
"0.6287659",
"0.6227922",
"0.6225331",
"0.6224209",
"0.6224209",
"0.6224209",
"0.6224209",
"0.62242... | 0.8160155 | 0 |
Retrieves a FixtureClass by name or id | def get_fixture_class(self, name=None, id=None, verify_exists=True):
assert any([name, id]), "name or id must be specified"
if id:
class_doc = self.axdb_client.get_fixture_class_by_id(id)
else:
class_doc = self.axdb_client.get_fixture_class_by_name(name)
if not cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fixture_instance(self, id=None, name=None, verify_exists=True):\n query = {}\n if id:\n query['_id'] = id\n if name:\n query['name_lower'] = name\n if not query:\n raise AXIllegalArgumentException(\"No query filters supplied\")\n fix_doc =... | [
"0.68102133",
"0.63522667",
"0.6269279",
"0.62185544",
"0.5852546",
"0.5790573",
"0.56684893",
"0.56657773",
"0.5638562",
"0.5626019",
"0.56245923",
"0.5616098",
"0.5595591",
"0.55895376",
"0.5558115",
"0.5544552",
"0.54989797",
"0.54697937",
"0.54538095",
"0.5406854",
"0.540... | 0.7685728 | 0 |
Returns FixtureClass object from a template dictionary | def template_to_class(self, fix_template):
action_templates = {}
actions = fix_template.get('actions', {})
for action_name, action in actions.items():
if action['template'] not in action_templates:
service_template = self.axops_client.get_template(fix_template['repo']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_template(cls, template, fpath, defaults=defaults, **kwargs):\n\n try:\n #use defaults first and overwrite with user's specs\n inp = template.substitute(defaults, **kwargs)\n return cls(fpath, inp_string=inp)\n except (KeyError, ValueError) as error:\n ... | [
"0.5881686",
"0.56846297",
"0.5514073",
"0.543241",
"0.5410768",
"0.5402855",
"0.54024947",
"0.5372281",
"0.53655285",
"0.5360564",
"0.53439814",
"0.5325336",
"0.5324815",
"0.5289122",
"0.5269114",
"0.5266425",
"0.5260116",
"0.5245977",
"0.5245977",
"0.5230463",
"0.52099055",... | 0.6678587 | 0 |
Creates or updates a fixture class from a fixture template | def upsert_fixture_class(self, template_id):
logger.info("Creating fixture class from template %s", template_id)
fix_template = self.axops_client.get_fixture_template(template_id)
if not fix_template:
raise AXApiResourceNotFound("Fixture template with id {} not found".format(template... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_to_class(self, fix_template):\n action_templates = {}\n actions = fix_template.get('actions', {})\n for action_name, action in actions.items():\n if action['template'] not in action_templates:\n service_template = self.axops_client.get_template(fix_templa... | [
"0.65396756",
"0.62506515",
"0.59753823",
"0.5943368",
"0.58272135",
"0.5778742",
"0.5752988",
"0.5752593",
"0.5732679",
"0.56499195",
"0.5555245",
"0.5514245",
"0.5514245",
"0.55002886",
"0.54912806",
"0.5437936",
"0.54379094",
"0.5406374",
"0.5405126",
"0.5376389",
"0.53567... | 0.68192595 | 0 |
Periodic poller and API handler which is invoked by axops when they detect changes to the template yaml | def notify_template_updates(self):
logger.info("Checking for template updates")
for old_class in self.get_fixture_classes():
template = self.axops_client.get_fixture_template_by_repo(old_class.repo, old_class.branch, old_class.name)
if not template:
errmsg = "Temp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handleReload(self, confInfo=None):",
"def handler(event, context):\n log.debug('Running poller. Configuration: {}'.format(event))\n\n for account in get_historical_accounts():\n # Skip accounts that have role assumption errors:\n try:\n create_polling_event(account['id'], os.en... | [
"0.595979",
"0.5893373",
"0.570502",
"0.5563683",
"0.5554545",
"0.5543407",
"0.55336756",
"0.5495263",
"0.548974",
"0.54764193",
"0.5443948",
"0.5401321",
"0.5389379",
"0.53859013",
"0.53602356",
"0.534503",
"0.5324282",
"0.5312511",
"0.53094053",
"0.5298684",
"0.52981627",
... | 0.48561302 | 92 |
Detects schema differences between an existing/enabled class and a new class, and performs schema migration | def apply_class_changes(self, old_class, new_class):
new_class.id = old_class.id
if old_class.json() == new_class.json():
logger.info("No differences detected for %s", old_class)
return old_class
class_rename = bool(old_class.name != new_class.name)
_, modified_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def upgradeSchema(self) -> None:",
"def migrate(self):\n\tpass",
"def migration():",
"def migrate(cls)->None:\n pass",
"def run_migration_checks():\n check_model_state()\n check_migration_state()",
"def test_rename_table(self):\n name_column = Varchar()\n name_column._met... | [
"0.6485096",
"0.62964654",
"0.62357086",
"0.6202014",
"0.6036749",
"0.5846033",
"0.5809117",
"0.57921636",
"0.57222635",
"0.5719591",
"0.5644546",
"0.5415942",
"0.53654855",
"0.5353281",
"0.53493696",
"0.53360534",
"0.5309979",
"0.5306251",
"0.5306251",
"0.53041565",
"0.53006... | 0.6924647 | 0 |
Batch apply updates to a bunch of instances one by one | def _batch_update(self, query, mutation):
logger.info("Performing batch update on %s. Mutation: %s", query, mutation)
modified = 0
for doc in self.instances.find(query):
with lock_instance(doc['_id']):
pre_update_doc = self.instances.find_one({'_id' : doc['_id']})
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_batch(self, *args, **kwargs):\n pass",
"def _update_bulk(self, iterable):\n self.cursor.executemany(self.UPDATE, iterable)",
"def do_update(services):\n\n global running_update\n\n for service in services:\n feed = registry[service.name][0]\n try:\n if type(feed) is list:\... | [
"0.7189869",
"0.67823553",
"0.6594094",
"0.65462065",
"0.6333698",
"0.6327298",
"0.63183355",
"0.6301259",
"0.62568325",
"0.6213043",
"0.620062",
"0.61573243",
"0.60297054",
"0.60237336",
"0.6015194",
"0.5980684",
"0.59799725",
"0.5921715",
"0.59208184",
"0.59198505",
"0.5910... | 0.72539556 | 0 |
Rebases the class to a different template id, possibly renaming the class, changing repo/branch | def update_fixture_class(self, class_id, template_id):
fix_template = self.axops_client.get_fixture_template(template_id)
if not fix_template:
raise AXApiResourceNotFound("Fixture template with id {} not found".format(template_id))
with self._class_lock:
old_class = self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upsert_fixture_class(self, template_id):\n logger.info(\"Creating fixture class from template %s\", template_id)\n fix_template = self.axops_client.get_fixture_template(template_id)\n if not fix_template:\n raise AXApiResourceNotFound(\"Fixture template with id {} not found\".fo... | [
"0.60265285",
"0.548767",
"0.53971523",
"0.5313759",
"0.52969855",
"0.52776825",
"0.5181988",
"0.5159817",
"0.5146217",
"0.5131519",
"0.5125715",
"0.5116691",
"0.50743043",
"0.50523776",
"0.5018573",
"0.5015002",
"0.49250206",
"0.49166882",
"0.49112496",
"0.4904856",
"0.49042... | 0.6263676 | 0 |
Delete a fixture class | def delete_fixture_class(self, class_id):
with self._class_lock:
existing_fix = self.instances.find_one({'class_id': class_id, 'status': {'$ne': InstanceStatus.DELETED}})
if existing_fix:
raise AXIllegalOperationException("Fixtures belonging to class {} should be deleted ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDownClass(cls):\n cls.object.delete()",
"def tearDownClass(cls):\n cls.image1.delete()\n cls.image2.delete()\n cls.object.delete()\n cls.alone_object.delete()",
"def teardown_class(klass):",
"def teardown_class(klass):",
"def tearDown(self):\n try:\n ... | [
"0.76624334",
"0.7159592",
"0.6976561",
"0.6976561",
"0.69745296",
"0.6954003",
"0.69403875",
"0.6908376",
"0.69015247",
"0.6889659",
"0.6858757",
"0.6812754",
"0.6783995",
"0.67155194",
"0.67155194",
"0.67155194",
"0.6672961",
"0.6656083",
"0.6640979",
"0.6635113",
"0.660845... | 0.75745016 | 1 |
Get availability/total summary of instances | def get_summary(self, group_by=None, query=None):
if query:
query = self._normalize_query(query)
else:
query = {}
query['deleted'] = False
group = {'available': '$available'}
if group_by is not None:
for g in group_by.split(','):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_instance_summary(instance, use_color='auto'):\n\n colorize_ = partial(colorize, use_color=use_color)\n\n name = colorize_(instance.name, \"yellow\")\n instance_type = instance.extra['gonzo_size']\n\n if instance.state == NodeState.RUNNING:\n status_colour = \"green\"\n else:\n ... | [
"0.67294395",
"0.6531367",
"0.63594925",
"0.62042433",
"0.61958486",
"0.6144866",
"0.61127305",
"0.60415524",
"0.6023646",
"0.5973577",
"0.59683967",
"0.59578544",
"0.59206754",
"0.5883215",
"0.5829848",
"0.57911754",
"0.5772057",
"0.5769414",
"0.5760281",
"0.575405",
"0.5715... | 0.68932736 | 0 |
Reinitalize db cache and resync from persistence layers (axdb) Normalize the state of the world (e.g. after service restart) | def initdb(self):
logger.info("Initializing database")
self.instances.drop()
self.instances.create_index([('class_id', pymongo.HASHED)])
# Creates a unique index
self.instances.create_index(
'name',
unique=True,
partialFilterExpression={'delete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconstruct(self):\n if os.path.exists(self.dbname):\n with open(self.dbname, mode='rb') as db:\n self.cache = pickle.load(db)",
"def rebuild_db():\n delete_db()\n create_db()\n insert_db()",
"def flushCaches(self):\n self.rehabTreeCache = {} \n ... | [
"0.64022636",
"0.6315825",
"0.60372025",
"0.5987499",
"0.5940446",
"0.5909849",
"0.59016126",
"0.58962053",
"0.587622",
"0.5847522",
"0.5838182",
"0.58104885",
"0.5782484",
"0.57670027",
"0.57466567",
"0.57385695",
"0.5738331",
"0.57354355",
"0.5724611",
"0.5722691",
"0.57023... | 0.0 | -1 |
Handle the case when fixture is never released properly but job is no longer running, or deployment is terminated | def release_orphaned_reservations(self):
logger.info("Checking for orphaned jobs")
active_jobs = set()
active_services = set()
active_deployments = set()
for job_info in self.axops_client.get_services(task_only=True, is_active=True, fields='id'):
if not ServiceStatus.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_terminate_run(self):\n pass",
"def test_delete_deployment_run(self):\n pass",
"def fail(self):\n self.cleanup()\n self.runner.report_job_fail(self.id)",
"def stop_fixture(self):\n pass",
"def test_relaunch_deployment_run(self):\n pass",
"def test_delete_... | [
"0.652558",
"0.6300234",
"0.6198307",
"0.6101365",
"0.6088802",
"0.60680056",
"0.6022876",
"0.59791213",
"0.5966263",
"0.59630924",
"0.5929503",
"0.59255314",
"0.59086007",
"0.58892244",
"0.58752954",
"0.58706224",
"0.5866836",
"0.58491355",
"0.583954",
"0.5797036",
"0.578971... | 0.5462339 | 84 |
Ensures referrer field of a fixture instances and volumes is consistent with requestdb | def check_referrers_consistency(self):
logger.info("Checking for inconsistent referrers field")
assigned_fix_reqs = set()
# Get all assigned fixture requests. Ensure that the instance has the fixture request in it's list of referrers
# If instance does not have the referrer, add it.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_two_referrers(dumper, db):\n dumper.reader.load_db(\n db.create_sample(\n 5,\n fkeys=[\n (\"table1\", \"t2id\", \"table2\", \"id\"),\n (\"table1\", \"t3id\", \"table3\", \"id\"),\n (\"table2\", \"t24id\", \"table4\", \"id\"),\n ... | [
"0.5467652",
"0.54017663",
"0.5354186",
"0.53372955",
"0.5319541",
"0.52375287",
"0.52053463",
"0.519841",
"0.51736194",
"0.5166318",
"0.51587826",
"0.51434124",
"0.51431364",
"0.5142787",
"0.5140959",
"0.5132825",
"0.51286983",
"0.5115832",
"0.5107719",
"0.5107071",
"0.50780... | 0.6751544 | 0 |
Checks for fixtures which are currently performing an operation (create/delete/action) to see if the job is still active | def check_missed_job_completion_notifications(self):
logger.info("Checking for missed job completion notifications")
#ten_min_ago = int((time.time() - 600) * 1e6)
operating = self.instances.find({
#'mtime': {'$lt': ten_min_ago},
'operation' : {'$exists': True, '$ne': None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_jobs(self):\n # New/aborted jobs\n try:\n jobs = self.sm.get_job('%', phase = 'QUEUED')\n for job in jobs:\n self._launch_job(Job(job['job']))\n res = self.sm.get_aborted_jobs()\n aborts = [x['identifier'] for x in res]\n # Completed jobs\n for t in self.threads... | [
"0.66804624",
"0.6376223",
"0.62553483",
"0.61734724",
"0.61583143",
"0.61417216",
"0.599719",
"0.5960158",
"0.5951768",
"0.5909088",
"0.5898822",
"0.5890265",
"0.58543813",
"0.585026",
"0.5806526",
"0.57906103",
"0.57803774",
"0.57793826",
"0.5773517",
"0.57720876",
"0.57687... | 0.5394884 | 85 |
Checks for expired fixtures and deletes them from the database | def expire_deleted_fixtures(self):
logger.info("Purging instances deleted %s days ago", common.DELETED_INSTANCE_GC_DAYS)
n_days_ago_in_usec = int((time.time() * 1e6) - (common.DELETED_INSTANCE_GC_DAYS * common.NANOSECONDS_IN_A_DAY))
expired = self.instances.find({
'mtime': {'$lt': n_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_db():\n yest = datetime.utcnow() - timedelta(days=1)\n try:\n Load.query.filter(Load.time < yest).delete()\n db.session.commit()\n except:\n db.session.rollback()",
"def test_delete_expired_users(self):\n self.assertEqual(JenkinsUser.objects.count(), 2)\n Reg... | [
"0.72296244",
"0.6820401",
"0.6633651",
"0.6567142",
"0.6555037",
"0.6515077",
"0.6496617",
"0.63939756",
"0.6382256",
"0.6220373",
"0.62095785",
"0.62095785",
"0.62095785",
"0.62095785",
"0.61654776",
"0.6140848",
"0.6122539",
"0.61133766",
"0.6063629",
"0.6057618",
"0.60368... | 0.7687136 | 0 |
A quicker solution for giving the number of divisors without compute the actual divisors. This algorithm is based on the following property, | def getNumDivisors(n):
n = abs(int(n))
r = 1
i = 2
while i <= n:
a = 0
while n % i == 0:
n = n / i
a = a + 1
r = r * (a + 1)
i = i + 1
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_divisors_ii(n):\n set_pf = set(n)\n n_og = 2**(len(set_pf))\n n_div = n_og\n for pf in set_pf:\n x = n.count(pf)\n n_div += n_div//2 * (x - 1)\n return n_div",
"def getDivisors(n):",
"def num_divisors_iii(n):\n set_pf = set(n)\n n_div = 1\n for pf in set_pf:\n ... | [
"0.81711173",
"0.8110025",
"0.8055634",
"0.79362935",
"0.7912176",
"0.7884038",
"0.77960515",
"0.75008976",
"0.74831235",
"0.7414202",
"0.73680115",
"0.7367057",
"0.7349159",
"0.7332053",
"0.7308812",
"0.72335994",
"0.7197508",
"0.7117493",
"0.7087169",
"0.70828444",
"0.70751... | 0.77760154 | 7 |
Return all closed regions in image who's pixel satisfy test. | def closed_regions(self, image, test):
pixel = image.load()
xs, ys = map(xrange, image.size)
todo = set(xy for xy in product(xs, ys) if test(pixel[xy]))
while todo:
region = set()
edge = set([todo.pop()])
while edge:
region |= edge
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def region_of_interest(self, img):\n # get region vertices\n r1, r2, r3, r4 = self.region_filter_params[\"ratios\"]\n img_height, img_width = img.shape\n vertices = define_region_vertices(img_height, img_width, r1, r2, r3, r4)\n\n # defining a blank mask to start with\n ma... | [
"0.6369291",
"0.61883307",
"0.61683273",
"0.59781677",
"0.5959679",
"0.5878107",
"0.57691103",
"0.5762268",
"0.57292086",
"0.57239795",
"0.5704556",
"0.56894153",
"0.56618047",
"0.5644161",
"0.5634841",
"0.56319225",
"0.56288725",
"0.56288725",
"0.56288725",
"0.56288725",
"0.... | 0.84021664 | 0 |
Save a job object in the Redis database. | def _save_job(job_key, job_dict):
rd.hmset(job_key, job_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_job(self, job):\n data = {\n 'class': 'Job',\n 'id': job.id,\n 'attrs': {\n 'type': job.type,\n 'task': job.task,\n 'command': job.command,\n 'status': job.status.value,\n 'runner': job.runne... | [
"0.7564124",
"0.7246612",
"0.70645946",
"0.6932577",
"0.66958207",
"0.6400938",
"0.62616557",
"0.62616557",
"0.617907",
"0.608548",
"0.6047352",
"0.6018786",
"0.5983937",
"0.59713936",
"0.59553206",
"0.59167385",
"0.59167385",
"0.5908133",
"0.5908133",
"0.5908133",
"0.5908133... | 0.7021093 | 3 |
Add a job to the redis queue. | def _queue_job(jid):
q.put(jid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, job):\r\n self.jobs.put(job)",
"def add_job(self, job):\n with self._mutex:\n self._jobs.append(job)",
"def put(self, job):\n self.queue.put(job)",
"def put(self, job):\n self.queue.put(job)",
"def addJob(self, job):\n self.jobs.append(job)\n ... | [
"0.8060631",
"0.7569395",
"0.7535931",
"0.7535931",
"0.73715836",
"0.72734356",
"0.72216564",
"0.70732707",
"0.6956169",
"0.68874896",
"0.6801369",
"0.66678333",
"0.65982056",
"0.6591479",
"0.6559895",
"0.6531548",
"0.6531548",
"0.6529268",
"0.6517468",
"0.64900875",
"0.64302... | 0.71872586 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.