query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
If a hyperspy signal is given, it is transformed into a ModifiedSignal. In that case, additional args and kwargs are discarded. | def __init__(self, *args, **kwargs):
if len(args) > 0 and isinstance(args[0], BaseSignal):
# Pretend it is a hs signal, copy axes and metadata
sdict = args[0]._to_dictionary()
self.__class__.__init__(self, **sdict)
else:
BaseSignal.__init__(self, *args, **... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal(self, args):\n pass",
"def test_forwards_args(self):\n seen_kwargs = {}\n\n def callback(**kwargs):\n seen_kwargs.update(kwargs)\n\n SignalHook(self.test_extension, self.signal, callback)\n self.signal.send(sender=self, foo=1, bar=2)\n\n self.assert... | [
"0.58201706",
"0.5802816",
"0.5742859",
"0.5680142",
"0.5531176",
"0.5348851",
"0.5281184",
"0.52533114",
"0.5215119",
"0.5179791",
"0.51360905",
"0.5093725",
"0.50849617",
"0.50493014",
"0.50189066",
"0.5009883",
"0.50008637",
"0.49492764",
"0.493958",
"0.49378914",
"0.49291... | 0.59273946 | 0 |
If a hyperspy Signal2D is given, it is transformed into a ModifiedImage. In that case, additional args and kwargs are discarded. | def __init__(self, *args, **kwargs):
if len(args) > 0 and isinstance(args[0], Image):
# Pretend it is a hs signal, copy axes and metadata
sdict = args[0]._to_dictionary()
Image.__init__(self, **sdict)
else:
Image.__init__(self, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n if len(args) > 0 and isinstance(args[0], (Image, CImage)):\n # Pretend it is a hs signal, copy axes and metadata\n sdict = args[0]._to_dictionary()\n CImage.__init__(self, **sdict)\n else:\n CImage.__init__(self, *args... | [
"0.6233259",
"0.5859255",
"0.58262306",
"0.5785775",
"0.5682472",
"0.56448776",
"0.561343",
"0.5559629",
"0.5498418",
"0.54961455",
"0.54533714",
"0.54435664",
"0.54435664",
"0.54297704",
"0.5408063",
"0.5403812",
"0.5402164",
"0.5400834",
"0.5393468",
"0.5388425",
"0.538773"... | 0.62607485 | 0 |
Returns meshgrids for Fourier transforms of the image. Can be selected by choosing the parameter "retstr". Choosing from k2 = kx^2+ky^2, these vectors, or both. See below for more info. | def get_fourier_space(self, retstr='square'):
# Get scales
Nx, Ny = self.axes_manager.signal_shape
dx, dy = [axi.scale for axi in self.axes_manager.signal_axes]
# Calculate K-space
dky = 2.*np.pi / (Ny*dy)
dkx = 2.*np.pi / (Nx*dx)
ky1D = dky*(-np.floor(Ny/2.)+np.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getkGrid(self, scaled=True):\n if scaled:\n return np.meshgrid(fft.fftshift(self.k_axis_scaled),\n fft.fftshift(self.k_axis_scaled))\n else:\n return np.meshgrid(fft.fftshift(self.k_axis_unscaled),\n fft.fftshift(se... | [
"0.5996112",
"0.5166293",
"0.509505",
"0.50575054",
"0.50280195",
"0.49867755",
"0.49505532",
"0.49462128",
"0.49283844",
"0.48290855",
"0.4794119",
"0.47900182",
"0.47630283",
"0.47192663",
"0.46941283",
"0.46898642",
"0.46341336",
"0.46177945",
"0.4602217",
"0.45985743",
"0... | 0.61359316 | 0 |
If a hyperspy.signal is given, it is transformed into a ModifiedImage. In that case, additional args and kwargs are discarded. | def __init__(self, *args, **kwargs):
if len(args) > 0 and isinstance(args[0], (Image, CImage)):
# Pretend it is a hs signal, copy axes and metadata
sdict = args[0]._to_dictionary()
CImage.__init__(self, **sdict)
else:
CImage.__init__(self, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n if len(args) > 0 and isinstance(args[0], Image):\n # Pretend it is a hs signal, copy axes and metadata\n sdict = args[0]._to_dictionary()\n Image.__init__(self, **sdict)\n else:\n Image.__init__(self, *args, **kwargs)"... | [
"0.66465324",
"0.5652755",
"0.5575546",
"0.54421556",
"0.54421556",
"0.54044956",
"0.5362523",
"0.5332503",
"0.53049153",
"0.525668",
"0.52531075",
"0.5228889",
"0.5194865",
"0.51814127",
"0.51791483",
"0.51512146",
"0.51426876",
"0.51414084",
"0.51294863",
"0.5111185",
"0.51... | 0.6489429 | 1 |
Will retrieve the phase from a focal series in a deterministic fashion using the multifocus transport of intensity (MFTIE) method. The named parameters are passed to the __init__ method of module MFTIE. Anonymous parameters (erps and kwerps) are used to calculate the inverse Laplacian filters (more info in module MFTIE... | def multi_focus_TIE(fs, using_gpu=False, printing=False, *erps, **kwerps):
mftie = MFTIE(fs, using_gpu, *erps, **kwerps)
phase = mftie()
if printing:
mftie.print_k2_thres()
return phase | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_process_TIE(fs, *erps, **kwerps):\n gptie = GPTIE(fs, *erps, **kwerps)\n phase = gptie()\n return phase",
"def getPhase(phase):",
"def T(params, phi):\n\t# handle the base frame, eqn 3.9, p36\n\tt = np.array([\n\t\t[cos(phi), -sin(phi), 0.0, 0.0],\n\t\t[sin(phi), cos(phi), 0.0, 0.0],\n\t\... | [
"0.5387762",
"0.5230304",
"0.5211815",
"0.5198059",
"0.51977754",
"0.5130902",
"0.5115025",
"0.50400496",
"0.5024854",
"0.50156635",
"0.50012213",
"0.49933702",
"0.4982817",
"0.4942338",
"0.49365675",
"0.49344906",
"0.4928456",
"0.4909189",
"0.4909062",
"0.48921904",
"0.48724... | 0.5543668 | 0 |
Will retrieve the phase from a focal series in a deterministic fashion using the gaussianprocess transport of intensity (GPTIE) method. The anonymous parameters (erps and kwerps) are passed to the GPTIE module | def gaussian_process_TIE(fs, *erps, **kwerps):
gptie = GPTIE(fs, *erps, **kwerps)
phase = gptie()
return phase | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ETPA(omegap, E, edip, Te, g_idx=[0], e_idx=[], f_idx=[]):\n N = len(E)\n tdm = edip\n # gamma = np.zeros(nstates)\n # for j in range(1, N):\n # gamma[j] = sum(tdm[:j, j]**2) * 0.0005\n # gamma[1:] = 0.0001\n\n # print('lifetimes of polariton states = {} eV'.format(gamma * au2ev))\n\n ... | [
"0.5845086",
"0.5804024",
"0.5762294",
"0.57219493",
"0.5717423",
"0.5686649",
"0.56757325",
"0.5538305",
"0.5519094",
"0.55185133",
"0.5491932",
"0.5471413",
"0.54459774",
"0.5436331",
"0.542151",
"0.5375313",
"0.53742886",
"0.5355532",
"0.534618",
"0.52903897",
"0.5266585",... | 0.729517 | 0 |
Measure RMSE^2 in real and reciprocal space. Returns | def run_rmse_check(self):
# Shift the intensities to compare
obs = self.obs.data - self.obs.data.mean()
exp = self.exp.data - self.exp.data.mean()
# Experimental RMSE2 in real space
rmse_real = (obs - exp)
rmse_real = rmse_real**2
# Experimental RMSE2 in recipr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_RMSE(e):\n \"\"\"Corresponds to sqrt(2*MSE)\"\"\"\n \n return np.sqrt(2*compute_MSE(e))",
"def rrse(self) -> float:\n return float(np.sqrt(self.rse()))",
"def measure_rmse(self):\n try:\n assert self.residuals_forecast is not None\n except AssertionError:\n ... | [
"0.7872834",
"0.75949156",
"0.75894135",
"0.75683",
"0.7567819",
"0.75499594",
"0.75355643",
"0.7495896",
"0.7354617",
"0.72762173",
"0.72546834",
"0.72449005",
"0.72449005",
"0.72137094",
"0.7211572",
"0.72056526",
"0.71871936",
"0.71746224",
"0.7170366",
"0.7159166",
"0.715... | 0.7639022 | 1 |
port with the pins mirrored (pin order reversed) | def mirrored( self ):
return self._modifier(
self,
lambda x: mirror_bits( x, self.nr_of_pins )
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_mirror():\n mir = np.array([[1, 0, 0, 0],\n [0, 1, 0, 0],\n [0, 0, -1, 0],\n [0, 0, 0, -1]])\n return mir",
"def as_pin_out( self ):\n return _pin_out_from_port_out( self.as_port_out() )",
"def rotate(self):\n\n self.pins = sel... | [
"0.63303953",
"0.62193274",
"0.6186834",
"0.6178602",
"0.6171273",
"0.6046138",
"0.6041167",
"0.59468573",
"0.59202063",
"0.591281",
"0.5760961",
"0.57570535",
"0.57289064",
"0.57234144",
"0.5697887",
"0.5635463",
"0.5608617",
"0.55651623",
"0.55323",
"0.55020136",
"0.5475424... | 0.6741525 | 0 |
write the bits of value to the pins | def write( self, value ):
if self._slave is not None:
return self._slave.write( self._filter( value ) )
else:
for pin in self._pins:
pin.write( ( value & 0b1 ) == 0b1 )
value = value >> 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write( self, value ) -> None:\n if value:\n self._slave.write( invert_bits( 0, self._slave.nr_of_pins ) )\n else:\n self._slave.write( 0 )",
"def write_pin(self, pin: int, value: bool):\n RPi.GPIO.output(pin, value)",
"def write_pin(self, pin, value):\n\n p... | [
"0.78495234",
"0.7504562",
"0.74414784",
"0.7395239",
"0.7262851",
"0.7140203",
"0.7130395",
"0.7124521",
"0.70968735",
"0.7064257",
"0.7060789",
"0.6996407",
"0.699516",
"0.6973291",
"0.6937929",
"0.6908169",
"0.6867624",
"0.6866326",
"0.68377894",
"0.67781425",
"0.6763511",... | 0.7726761 | 1 |
write the (same) logical value to all pins of the port | def write( self, value ) -> None:
if value:
self._slave.write( invert_bits( 0, self._slave.nr_of_pins ) )
else:
self._slave.write( 0 ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self):\n mask = 0\n for pin in self.pins:\n if pin.mode == OUTPUT:\n if pin.value == 1:\n pin_nr = pin.pin_number - self.port_number * 8\n mask |= 1 << pin_nr\n msg = chr(DIGITAL_MESSAGE + self.port_number)\n msg ... | [
"0.7240842",
"0.6920575",
"0.690139",
"0.6894064",
"0.6853497",
"0.65947735",
"0.6579934",
"0.6460324",
"0.64549047",
"0.6408091",
"0.6316417",
"0.63026565",
"0.62829214",
"0.6256753",
"0.6181625",
"0.60312414",
"0.6027412",
"0.59957397",
"0.5962651",
"0.5957885",
"0.5955377"... | 0.7054283 | 1 |
Subroutine for applying subpattern rules | def apply_subpattern_rules(flags, input_tensors, output_tensors, tensor_list, tensor_map):
matched_subpattern = None
for rule, target_pattern in OP_SUBPATTERN_RULES.items():
if matched_subpattern is not None:
break
# One rule for multiple patterns
if i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_matches(self, subseq, startpos):\n \n raise TypeError, \"PatternBase is an abstract base class\"",
"def _apply_pattern_rules(flags, input_tensors, output_tensors, tensor_list, tensor_map):\n matched_pattern = OpPatterns.OPAQUE_PATTERN\n for rule, target_pattern in OP_PATTERN_R... | [
"0.6434507",
"0.63763183",
"0.6199745",
"0.5928653",
"0.5824095",
"0.5787754",
"0.5761005",
"0.57573086",
"0.5732588",
"0.56827784",
"0.5644048",
"0.5634137",
"0.56131506",
"0.56097287",
"0.5536995",
"0.5530733",
"0.5528591",
"0.551629",
"0.55046225",
"0.55040044",
"0.5489719... | 0.6615487 | 0 |
Subroutine for applying pattern rules | def _apply_pattern_rules(flags, input_tensors, output_tensors, tensor_list, tensor_map):
matched_pattern = OpPatterns.OPAQUE_PATTERN
for rule, target_pattern in OP_PATTERN_RULES.items():
if matched_pattern != OpPatterns.OPAQUE_PATTERN:
break
# One rule for multipl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_all_rules(self):\n\n def compatible(pattern1, pattern2, direction):\n \"\"\"Returns `True` if `pattern2` is compatible with `pattern1` in the `direction`,\n otherwise return `False`.\"\"\"\n if direction == 0:\n return pattern1[:-1] == pattern2[1:]\n ... | [
"0.6607034",
"0.6331576",
"0.61936057",
"0.61539346",
"0.6104869",
"0.60605973",
"0.60242015",
"0.5918051",
"0.5912361",
"0.58964044",
"0.58471686",
"0.5797584",
"0.578716",
"0.57432115",
"0.5734096",
"0.57248586",
"0.57193255",
"0.5674035",
"0.5663319",
"0.56371534",
"0.5598... | 0.6544536 | 1 |
Utility function for adding flag counter | def add_flag(flags, flag, tensor):
flags[flag]["count"] += 1
if tensor not in flags[flag]["tensors"]:
flags[flag]["tensors"].append(tensor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_flag(cls, flags: dict, flag: str, current_tensor: tvm.tensor.Tensor) -> None:\n # Always add 1 count for total_flag when there is a flag\n cls.add_flag(flags, \"total\", current_tensor)\n found_flag = False\n # Add 1 count for corresponding flag\n for key in flags:\n ... | [
"0.7070657",
"0.6882206",
"0.6743725",
"0.6578491",
"0.6578491",
"0.6481781",
"0.6415566",
"0.6393977",
"0.6263538",
"0.6221766",
"0.6202348",
"0.61847454",
"0.6164869",
"0.6120249",
"0.60633785",
"0.6045014",
"0.59618163",
"0.5893334",
"0.5882519",
"0.5877663",
"0.5868346",
... | 0.7199297 | 0 |
A property to return log_paths. | def log_paths(self): # pylint:disable=function-redefined
return self._log_paths | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_paths(self):\n return self.paths",
"def log_paths(self, value):\n self._log_paths = value",
"def paths(self):\r\n return self._paths",
"def GetPaths(self):\n return self.paths",
"def paths(self):\n return self._paths",
"def paths(self):\n return self._pat... | [
"0.7241188",
"0.718731",
"0.7094631",
"0.7089558",
"0.70627326",
"0.70627326",
"0.7046896",
"0.6880045",
"0.6797053",
"0.67431605",
"0.6721183",
"0.67190003",
"0.66607124",
"0.6591209",
"0.64323455",
"0.64323455",
"0.6427256",
"0.64155823",
"0.63583994",
"0.63488567",
"0.6318... | 0.8746435 | 0 |
A property to set log_paths. | def log_paths(self, value):
self._log_paths = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_paths(self): # pylint:disable=function-redefined\n return self._log_paths",
"def set_paths(self, paths):\n self.paths = paths",
"def set_paths(self, paths):\n self._paths = paths\n self._paths_set = True",
"def setOutputLogsPath(self, v):\n return self._set(outputL... | [
"0.7424064",
"0.6586969",
"0.6536365",
"0.6423552",
"0.63873285",
"0.63873285",
"0.63873285",
"0.6363168",
"0.6354402",
"0.6183567",
"0.61596334",
"0.60782665",
"0.60325825",
"0.5954191",
"0.5953772",
"0.59223956",
"0.5878773",
"0.58256054",
"0.5786079",
"0.57425016",
"0.5738... | 0.8344163 | 0 |
A property to set app_name. | def app_name(self, value):
self._app_name = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, application_name):\r\n self._name = application_name",
"def app_name(self): # pylint:disable=function-redefined\n return self._app_name",
"def app_name(self) -> str:\n return self._app_name",
"def app_name(self):\n return self._app_name",
"def get_app_name(self):... | [
"0.8052632",
"0.7475715",
"0.7391802",
"0.73524487",
"0.70498663",
"0.6980208",
"0.68868506",
"0.68658864",
"0.68388855",
"0.68288594",
"0.6658145",
"0.6656157",
"0.6442664",
"0.6341187",
"0.6341187",
"0.6341187",
"0.6341187",
"0.6313927",
"0.6284561",
"0.6284561",
"0.6255553... | 0.8609961 | 0 |
Make sure the log_paths is valid. | def is_log_path_valid(self):
if self.log_paths:
return self.path in self.log_paths
else:
# If .log_paths is empty, just assume all paths are legal
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_log_path_(self):\n try:\n # Ignore unbound loggers\n if not self. bound:\n return\n\n if (has_config('identifier')\n and config.get_config('identifier') != self.identifier) \\\n or (has_config('tag')\n ... | [
"0.76720685",
"0.69255793",
"0.6205545",
"0.6133858",
"0.60814065",
"0.6067519",
"0.60510397",
"0.60321003",
"0.5916517",
"0.5908021",
"0.58657277",
"0.584711",
"0.5846902",
"0.5838911",
"0.583103",
"0.5775026",
"0.5773689",
"0.5764788",
"0.5741561",
"0.5735054",
"0.5713828",... | 0.7524299 | 1 |
Send a HTTP 200 (OK) response. | def send_200_resp(self, response, content_type):
self.send_response(200)
self.send_header("Content-type", content_type)
if response is not None:
resplen = str(len(response))
else:
resplen = 0
self.send_header("Content-length", resplen)
self.send_he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping_response():\n\n return Response(\"ok\", status=200)",
"def ping():\n\treturn HTTPResponse(status=200)",
"def ping():\r\n return make_response(\"pong!\", 200)",
"def resp200(msg):\n return Resp({'message':msg, 'success':True})",
"def do_HEAD(self):\n self.send_response(200)",
"def... | [
"0.7362052",
"0.7235784",
"0.69941497",
"0.69638133",
"0.6640973",
"0.65795285",
"0.6556675",
"0.6544675",
"0.6529321",
"0.649762",
"0.64718014",
"0.6458459",
"0.64144427",
"0.6407312",
"0.63988185",
"0.63831747",
"0.6333662",
"0.631682",
"0.6305564",
"0.63042945",
"0.6288358... | 0.7594696 | 0 |
Handle HTTP/S POST requests. Attempts to interpret all HTTP POST requests as Log calls, which are forwarded to the server's _dispatch method for handling. | def do_POST(self): # pylint:disable=invalid-name
if not self.is_log_path_valid():
self.report_404()
return
try:
# Get arguments by reading body of request.
# We read this in chunks to avoid straining
# socket.read(); around the 10 or 15Mb mar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_POST(self):\n orig_request = ssl_proxy_log.Request(self.path, 'POST', self.headers,\n self.log, self.http_redirect_table, self.ssl_redirect_table)\n self.log.debug('do_POST called: %s' % self.path)\n request_log = self.fetch2(orig_request, self.wfile, self.rfile)\n\n# if not request_log:\... | [
"0.739907",
"0.71532553",
"0.6918774",
"0.6905046",
"0.6657345",
"0.66229856",
"0.64716846",
"0.64491993",
"0.6232748",
"0.62151057",
"0.62132615",
"0.61887",
"0.61622417",
"0.6134192",
"0.61262685",
"0.60622317",
"0.60325485",
"0.6027922",
"0.60274357",
"0.5982639",
"0.58840... | 0.7192824 | 1 |
Extract form fields from a POST. | def extract_form_fields(item):
# Strip off any trailing \r\n
formitems = item.value.rstrip('\r\n')
# Split the items by newline, this gives us a list of either 1, 3, 4
# or 5 items long
itemlist = formitems.split("\n")
# Setup some regular expressions to parse the items
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __extract_form_fields(self, soup):\n fields = OrderedDict()\n for input in soup.find_all('input', attrs={'name': True}):\n if 'type' not in input.attrs:\n input.attrs['type'] = 'text'\n # Single element name/value fields\n if input.attrs['type'].low... | [
"0.6987389",
"0.62677586",
"0.62300456",
"0.622636",
"0.62225604",
"0.6216249",
"0.6172808",
"0.6156348",
"0.6070796",
"0.6056136",
"0.60391474",
"0.5966653",
"0.5954807",
"0.5915768",
"0.58875513",
"0.5876883",
"0.5852987",
"0.58487827",
"0.5841717",
"0.5811782",
"0.57949716... | 0.63509625 | 1 |
Report a HTTP 404 error. | def report_404(self):
self.send_response(404)
response = 'No such page'
self.send_header("Content-type", "text/plain")
self.send_header("Content-length", str(len(response)))
self.end_headers()
self.wfile.write(response) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handleStatus_404(self):\n log.err('HTTP Error 404')",
"def send404(self):\n\t\tself.send_error(404, \"File not found\")",
"def not_found():\n return HttpError(404)",
"def not_found():\n raise cherrypy.HTTPError(404, \"Not Found.\")",
"def error_404(self):\n response = self.render_te... | [
"0.8227495",
"0.79841685",
"0.79239154",
"0.7835694",
"0.77372366",
"0.7725449",
"0.7706949",
"0.76740795",
"0.76229805",
"0.7611879",
"0.75713265",
"0.7533496",
"0.75207615",
"0.7462523",
"0.7457768",
"0.743638",
"0.74266726",
"0.7420685",
"0.7420685",
"0.7420685",
"0.742068... | 0.7986303 | 1 |
Handle n number of threading servers. For nonthreading servers simply use the native server_forever function. | def serve_forever(servers, poll_interval=0.5):
while True:
ready, wait, excep = select.select(servers, [], [], poll_interval)
for server in servers:
if server in ready:
server.handle_request() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_worker(num_worker, server_ip, server_port):\n for i in range(int(num_worker)):\n print \"-- worker initializing --\"\n dask_server = Worker('tcp://'+server_ip+\":\"+str(server_port), loop=loop)\n dask_server.start()",
"def serve(self):\r\n for i in range(self.threads):\r\n ... | [
"0.6301102",
"0.62995076",
"0.6279442",
"0.6155942",
"0.60497314",
"0.6036734",
"0.6036734",
"0.59322697",
"0.5926676",
"0.59228456",
"0.58840925",
"0.5878877",
"0.58675295",
"0.5863661",
"0.58074635",
"0.5786155",
"0.5771896",
"0.574939",
"0.5748238",
"0.57265776",
"0.571282... | 0.65191066 | 0 |
An upper bound on the number of invites sent in the last `days` days | def estimate_recent_invites(realms: Collection[Realm], *, days: int) -> int:
recent_invites = RealmCount.objects.filter(
realm__in=realms,
property="invites_sent::day",
end_time__gte=timezone_now() - datetime.timedelta(days=days),
).aggregate(Sum("value"))["value__sum"]
if recent_inv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remaining_days_in_current_period(self):\n try:\n return self.count_days_from_now(self.current_period_ends_at)\n except AttributeError:\n return 0",
"def last_days_results(self, days):\n return self.security['Date', 'Close', 'FinalDecision'][-days:]",
"def remainin... | [
"0.60058075",
"0.59577036",
"0.58903176",
"0.58417714",
"0.5803342",
"0.5769002",
"0.57686865",
"0.57513726",
"0.5716907",
"0.567923",
"0.5666582",
"0.5571618",
"0.55624706",
"0.55615324",
"0.5542534",
"0.5520669",
"0.5501939",
"0.54907006",
"0.54841435",
"0.54222095",
"0.541... | 0.69755816 | 0 |
Returns a list of dicts representing invitations that can be controlled by user_profile. This isn't necessarily the same as all the invitations generated by the user, as administrators can control also invitations that they did not themselves create. | def do_get_invites_controlled_by_user(user_profile: UserProfile) -> List[Dict[str, Any]]:
if user_profile.is_realm_admin:
prereg_users = filter_to_valid_prereg_users(
PreregistrationUser.objects.filter(referred_by__realm=user_profile.realm)
)
else:
prereg_users = filter_to_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInvitations(self, userid):\n\n ret = []\n\n u_id = EventId()\n u_id.setHashed(userid)\n user = User.getById(u_id)\n invitations = Invitation.getAllFromUser(user)\n\n for e in invitations:\n ret.append(e.getAsDict([\"event\", \"status\"]))\n\n retur... | [
"0.72110283",
"0.7118523",
"0.70208025",
"0.6678765",
"0.6428748",
"0.6380803",
"0.6378244",
"0.6316139",
"0.62661004",
"0.62473905",
"0.59582",
"0.5958072",
"0.5929813",
"0.59240234",
"0.58731234",
"0.58731234",
"0.5800201",
"0.56223017",
"0.5605944",
"0.55602694",
"0.553074... | 0.73981535 | 0 |
startup function for running a capitalize as a script | def main():
try:
infilename = sys.argv[1]
except IndexError:
print("you need to pass in a file name to process")
print(help)
sys.exit()
try:
outfilename = sys.argv[2]
except IndexError:
root, ext = os.path.splitext(infilename)
outfilename = root + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n BASIC.run(PROGRAM)",
"def main():\r\n print(\"JoJo\")",
"def main():\n\n args = get_args()\n input = args.input\n output = args.outfile\n howler = \"\"\n \n try:\n with open(input) as file:\n howler = file.read().rstrip().upper()\n \n if o... | [
"0.6289156",
"0.6202552",
"0.6198277",
"0.6037372",
"0.60237753",
"0.6020429",
"0.5983261",
"0.59613895",
"0.5952639",
"0.59255815",
"0.5807172",
"0.58061767",
"0.58045757",
"0.5801038",
"0.57932323",
"0.578153",
"0.5761975",
"0.5741547",
"0.5735257",
"0.57243663",
"0.5712989... | 0.7062514 | 0 |
Test if changing a state of a non existing entity is possible. | async def test_api_state_change_of_non_existing_entity(
hass: HomeAssistant, mock_api_client: TestClient
) -> None:
new_state = "debug_state_change"
resp = await mock_api_client.post(
"/api/states/test_entity.that_does_not_exist", json={"state": new_state}
)
assert resp.status == HTTPStatu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dont_save(self):\n self.assertFalse(State.objects.exists())",
"def _autooff_changed(hass, entity_id=None, old_state=None, new_state=None):\n PERSIST['states'][0] = new_state.state == 'on'\n _eval_state(hass)",
"def check_state(self):\n pass",
"def _see_state(self, new_state: Stat... | [
"0.65760297",
"0.636827",
"0.63109666",
"0.62768817",
"0.62587285",
"0.62456995",
"0.61341465",
"0.6120245",
"0.6048749",
"0.60183495",
"0.6002738",
"0.596916",
"0.5954868",
"0.5909773",
"0.5907267",
"0.5895356",
"0.5891054",
"0.58893496",
"0.5886826",
"0.5884904",
"0.5884904... | 0.6697195 | 0 |
Record that our service got called. Also test if our data came through. | def listener(service_call):
hass.states.async_set(
"test.data",
"on",
{"data": service_call.data["test"]},
context=service_call.context,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_called_anytime(self, method, url, data=None):\n expected = (method, url)\n\n assert self.http_client.callstack, \\\n \"Expected %s %s but no calls were made.\" % expected\n\n found = False\n for entry in self.http_client.callstack:\n if expected == entry... | [
"0.63716334",
"0.6112467",
"0.6070819",
"0.6070819",
"0.5935496",
"0.5902532",
"0.58543575",
"0.5838056",
"0.58244145",
"0.58009315",
"0.5760348",
"0.5716352",
"0.5665795",
"0.56533533",
"0.5622125",
"0.5622115",
"0.5580877",
"0.5569259",
"0.5561395",
"0.55273193",
"0.5517324... | 0.647186 | 0 |
Read the stream for next event while ignoring ping. | async def _stream_next_event(stream):
while True:
last_new_line = False
data = b""
while True:
dat = await stream.read(1)
if dat == b"\n" and last_new_line:
break
data += dat
last_new_line = dat == b"\n"
conv = data.de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_next_event(self) :\n status = HexDataIO.read_next_event(self)\n\n if not status : \n self.event_status = 0 # to break the event loop\n return False\n\n self.proc_event()\n return True",
"def __next__(self):\n event = self.read_event()\n if ... | [
"0.6780876",
"0.6351053",
"0.63324374",
"0.617332",
"0.6111588",
"0.60884035",
"0.6070319",
"0.6070262",
"0.6005217",
"0.5990271",
"0.5966589",
"0.59360445",
"0.59317565",
"0.58942956",
"0.5889433",
"0.58865315",
"0.5882397",
"0.5873395",
"0.5873288",
"0.58730227",
"0.5872984... | 0.7825474 | 0 |
Return number of event listeners. | def _listen_count(hass: HomeAssistant) -> int:
return sum(hass.bus.async_listeners().values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_events(self):\n return len(self.events)",
"def event_count(self):\n\n with self.lock:\n return self.num_events",
"def numberOfEvents(self):\n raise NotImplementedError",
"def num_3d_listeners(self):\n num = c_int()\n ckresult(_dll.FMOD_System_Get3DNum... | [
"0.8018706",
"0.77799207",
"0.77062494",
"0.73112774",
"0.7212103",
"0.71466094",
"0.70992625",
"0.7047763",
"0.69849074",
"0.68710184",
"0.6865093",
"0.6845122",
"0.68334305",
"0.6593289",
"0.6527675",
"0.6413405",
"0.63643587",
"0.6299609",
"0.62892675",
"0.62865716",
"0.62... | 0.8022714 | 0 |
Test user needs to be admin to access event stream. | async def test_event_stream_requires_admin(
hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser
) -> None:
hass_admin_user.groups = []
resp = await mock_api_client.get("/api/stream")
assert resp.status == HTTPStatus.UNAUTHORIZED | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_events_route_logged_in(self):\n resp = self.request_with_role('/admin/events', role='user')\n self.assertEqual(resp.status_code, 200)",
"def test_get_event_admin(self):\n self.seed_static_data()\n params = {'id': 1, 'event_id': 1}\n response = self.app.get('/api/v1/tag... | [
"0.70730346",
"0.6959161",
"0.6870599",
"0.66410094",
"0.6631298",
"0.65784353",
"0.6574641",
"0.6474893",
"0.64655334",
"0.6443081",
"0.64427704",
"0.6381175",
"0.6366477",
"0.6363954",
"0.63463306",
"0.63291526",
"0.6314314",
"0.63118106",
"0.62957346",
"0.629212",
"0.62687... | 0.79320186 | 0 |
Test filtering only visible states. | async def test_states_view_filters(
hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser
) -> None:
hass_admin_user.mock_policy({"entities": {"entity_ids": {"test.entity": True}}})
hass.states.async_set("test.entity", "hello")
hass.states.async_set("test.not_visible_entity", "invi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_boolean_filter(self):\n self.assertEqual(len(self.collection.results()), 6)\n\n result = get_filter_items(\n self.collection_uid, \"exclude_from_nav\", cache_enabled=False\n )\n\n self.assertEqual(len(result), 3)\n self.assertEqual(get_data_by_val(result, \"al... | [
"0.6707309",
"0.6451592",
"0.6409653",
"0.63921297",
"0.6389251",
"0.63496274",
"0.6348325",
"0.6313418",
"0.6254344",
"0.6232021",
"0.6082868",
"0.6073991",
"0.6039246",
"0.60312223",
"0.59810877",
"0.59078944",
"0.5906765",
"0.5905636",
"0.5895089",
"0.5889864",
"0.58688813... | 0.69330275 | 0 |
Test getting a state requires read permission. | async def test_get_entity_state_read_perm(
hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser
) -> None:
hass_admin_user.mock_policy({})
resp = await mock_api_client.get("/api/states/light.test")
assert resp.status == HTTPStatus.UNAUTHORIZED | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_can_read(self):\n\t\tif not self.can_read:\n\t\t\tself.build_permissions()\n\t\treturn self.can_read",
"def test_get_node_state_readonly(self):\n pass",
"def canread(self):\n return False",
"def test_user_can_read(app, resource):\n with app.user():\n # Read resource\n a... | [
"0.67237556",
"0.6717974",
"0.6488697",
"0.6446202",
"0.6357362",
"0.6330123",
"0.62867",
"0.62222505",
"0.62222505",
"0.6218612",
"0.61773396",
"0.6174927",
"0.6167444",
"0.61451876",
"0.6085963",
"0.6051952",
"0.6030258",
"0.6030258",
"0.6029359",
"0.5968338",
"0.59593654",... | 0.7533625 | 0 |
Test rendering a template with legacy API password. | async def test_rendering_template_legacy_user(
hass: HomeAssistant,
mock_api_client: TestClient,
aiohttp_client: ClientSessionGenerator,
legacy_auth: LegacyApiPasswordAuthProvider,
) -> None:
hass.states.async_set("sensor.temperature", 10)
client = await aiohttp_client(hass.http.app)
resp = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_template_feedback(self):\r\n pass",
"def test_correct_template_is_used(self):\n login = self.client.login(username='test_user1', password='test_user1_test')\n response = self.client.get('/search/result/?q=apples')\n \n self.assertEqual(response.context['user'].username... | [
"0.6235193",
"0.60883623",
"0.60546345",
"0.5986847",
"0.59567076",
"0.59498054",
"0.5855256",
"0.5832086",
"0.5822064",
"0.5749635",
"0.5733779",
"0.5725278",
"0.5699009",
"0.56965846",
"0.5681967",
"0.5678695",
"0.56480163",
"0.5632714",
"0.56296164",
"0.56262475",
"0.56251... | 0.7625439 | 0 |
Generates link and filename strings to given day | def generatelinkandname(day_minus=None):
global args
if day_minus == None:
day = date.today().strftime("%Y-%m-%d")
else:
day = (date.today() - timedelta(days = day_minus)).strftime("%Y-%m-%d")
link = '{}{}{}.xlsx'.format(args.root_link, args.prefix, day)
name = './{}{}.xls... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_zip_file_url_for_specific_date(date):\n date_format = date.strftime('%d%m%y')\n return __class__.href_pattern.format(date_format)",
"def get_today_url():\n\n lines, numlst = get_items()\n if not lines:\n return ''\n month = time.localtime().tm_mon\n day = time.localtime()... | [
"0.65585816",
"0.65574384",
"0.61271703",
"0.6113579",
"0.60778224",
"0.60665023",
"0.6029519",
"0.59859705",
"0.59810865",
"0.59277725",
"0.58923703",
"0.58849955",
"0.5883099",
"0.58484054",
"0.58324665",
"0.5776711",
"0.57467675",
"0.5738119",
"0.57259405",
"0.57066894",
"... | 0.7593797 | 0 |
Gets file from link and prints the status of the process | def getfile(link):
global args
file_data = None
trying_count = 1
print('')
while file_data == None and trying_count <= args.try_limit:
try:
print('\rTrying to get {}... ({}/{})'
.format(link, trying_count, args.try_limit), end='')
back_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def t_getfile(self, link, filename, session):\n\n self.sema.acquire()\n\n filepath = os.path.join(os.getcwd() + '/Downloads/' + str(filename))\n os.makedirs(os.path.dirname(filepath), exist_ok=True)\n\n if not os.path.isfile(filepath):\n self.download_new_file(link, filepath,... | [
"0.65434134",
"0.6188203",
"0.6021775",
"0.5991127",
"0.5950387",
"0.59072536",
"0.5892946",
"0.58916056",
"0.58296704",
"0.5745383",
"0.5718854",
"0.57025456",
"0.56996423",
"0.5674766",
"0.5653579",
"0.5642692",
"0.5598064",
"0.5593359",
"0.5586392",
"0.5573468",
"0.5568049... | 0.65308017 | 1 |
Prints summary and text | def printsummary(text):
print('Summary:')
print('--------')
print(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printSummary(self):\n pass",
"def print_summary(self):\n #outcomes = self.get_outcomes()\n #passes = 'Passes: %i' % sum(1 for outcome in outcomes if outcome == Result.PASS)\n #untested = 'Untested: %i' % sum(1 for outcome in outcomes if outcome == Result.UNTESTED)\n #er... | [
"0.8318454",
"0.7980596",
"0.76172924",
"0.756329",
"0.7450223",
"0.7426687",
"0.74204826",
"0.7371308",
"0.73710257",
"0.7349337",
"0.7313019",
"0.7286175",
"0.7283446",
"0.7251422",
"0.71614695",
"0.7157122",
"0.71306276",
"0.7098288",
"0.7034655",
"0.7009345",
"0.69661987"... | 0.84355104 | 0 |
Generates a set of samples from the given generator and applies the given transformation. The outputs of the generator are centered and rescaled, if the corresponding statistics are available. Same for the transformation. | def get_samples(
device,
P,
generator,
generator_mean=None,
teacher=None,
transformation=None,
transformation_mean=None,
):
with torch.no_grad():
cs = torch.randn(P, generator.N_in).to(device)
# propagate latent variables through the generator
xs = generator.tran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generator(samples, batch_size=32, is_training=True):\n num_samples = len(samples)\n\n #vertical, horizontal range for random translation\n x_translate_range = 100\n y_translate_range = 10\n\n while 1: # Loop forever so the generator never terminates\n #shuffle the samples once the whole d... | [
"0.60224885",
"0.58547485",
"0.58525455",
"0.5796969",
"0.5784097",
"0.5770003",
"0.5644783",
"0.56155056",
"0.55738884",
"0.5562732",
"0.5490929",
"0.54908144",
"0.547882",
"0.54485327",
"0.54390806",
"0.54188913",
"0.5395706",
"0.53845555",
"0.5383145",
"0.53690684",
"0.536... | 0.63473403 | 0 |
Generates a set of samples from the generator and transformation with the given names. The outputs of the generator are centered and rescaled, if the corresponding statistics are available. Same for the transformation. | def get_inputs_by_name(
device, P, generator_name, transformation_name,
):
# Find the right generator for the given scenario
generator = get_generator(generator_name, device)
# transformation of the inputs
transformation = get_transformation(transformation_name, generator, device)
model_desc = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self):\n self.training_data.gen_x(self.x_func)\n self.training_data.gen_a(self.a_func)\n self.training_data.gen_y(self.y_func)\n \n self.testing_data.gen_x(self.x_func)\n self.testing_data.gen_ys(self.y_func)\n self.testing_data.gen_azero(self.ytotal_fu... | [
"0.5946869",
"0.59112626",
"0.58949316",
"0.5753713",
"0.5734045",
"0.5722666",
"0.56942326",
"0.56448734",
"0.5636334",
"0.5636123",
"0.55923116",
"0.55923116",
"0.5563399",
"0.55401",
"0.55366707",
"0.55152845",
"0.5511322",
"0.55043995",
"0.5497834",
"0.54810655",
"0.54726... | 0.63186747 | 0 |
Returns a new instance of the generator with the given name. | def get_generator(name, device):
if name == "dcgan_rand":
generator = transformations.dcgan_cifar10(device, random=True)
elif name == "dcgan_cifar10":
generator = transformations.dcgan_cifar10(device)
elif name == "dcgan_cifar100_grey":
generator = transformations.dcgan_cifar100_grey... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self, name):\n raise NotImplementedError()",
"def get_instance(self, name):\n klass = self.get_class(name)\n return klass()",
"def new(name=None):",
"def new_generator(self):\n return self.generator_function(*self.args, **self.kwargs)",
"def make_rng(self, name: str... | [
"0.67438066",
"0.66791904",
"0.66047007",
"0.64927286",
"0.62310225",
"0.6223543",
"0.6199213",
"0.61183614",
"0.60630685",
"0.6002545",
"0.59170157",
"0.5912291",
"0.58919317",
"0.58739626",
"0.58009124",
"0.58009124",
"0.57575244",
"0.57546234",
"0.57410485",
"0.5718856",
"... | 0.67784727 | 0 |
Returns a new instance of the transformation with the given name. | def get_transformation(name, generator, device):
transformation = None
if name is None:
transformation = None
elif name.startswith("rand_proj_gauss_sign"):
temp = re.findall(r"\d+", name)
[N_in, N_out] = list(map(int, temp))
# create the random transformation
transfor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transform(self, name):\n return self._handlers_by_name[name].get_transform_instance()",
"def with_transforms(self: TDataWTransform, group_name: str) -> TDataWTransform:\n datacopy = self._shallow_clone_dataset()\n datacopy._frozen_transform_groups.with_transform(group_name)\n ... | [
"0.72957146",
"0.61331624",
"0.6122498",
"0.6105759",
"0.6056436",
"0.60378855",
"0.58359975",
"0.5805107",
"0.5772465",
"0.5734033",
"0.5708399",
"0.56826663",
"0.5678532",
"0.5658105",
"0.5631155",
"0.56002825",
"0.5556288",
"0.55493873",
"0.5538025",
"0.55364925",
"0.55166... | 0.66518956 | 1 |
Given a vector mean and covariance matrix of a distribution in N dimensions, returns the scalar mean and standard deviation of data drawn from that distribution. | def get_scalar_mean_std(mean, cov):
N = cov.shape[0]
mean_scalar = torch.mean(mean)
var_scalar = torch.mean(cov[np.diag_indices(N)] + mean ** 2) - torch.mean(mean) ** 2
return mean_scalar, torch.sqrt(var_scalar) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MeanAndStandardDeviation(data):\n n = len(data)\n if n == 0:\n return 0.0, 0.0\n mean = float(sum(data)) / n\n variance = sum([(element - mean)**2 for element in data]) / n\n return mean, math.sqrt(variance)",
"def mean_cov(X):\n if not isinstance(X, np.ndarray) or len(X.shape) != 2:\n rais... | [
"0.69571626",
"0.6857151",
"0.6781143",
"0.6749944",
"0.6704417",
"0.66870916",
"0.66848916",
"0.66563874",
"0.66454536",
"0.6589735",
"0.6558502",
"0.64964044",
"0.6496252",
"0.642613",
"0.6410069",
"0.6410069",
"0.64019996",
"0.6370109",
"0.6355448",
"0.635201",
"0.6345564"... | 0.7294634 | 0 |
This method when sync message arrives and prepares the window handler for displaying properly on GUI. | def on_sync_message(self, _, msg):
message_name = msg.get_structure().get_name()
print(message_name)
if message_name == "prepare-window-handle":
win_id = self.window_id
assert win_id
imagesink = msg.src
imagesink.set_window_handle(win_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_loop(self):\n if self.message_counter:\n if not self.msg:\n self.showdialog()\n else:\n self.msg.setText(\n \"COMET encounterd {} error(s)\".format(self.message_counter).ljust(\n 70\n )... | [
"0.65455043",
"0.6346855",
"0.6279635",
"0.60636854",
"0.60628414",
"0.6017681",
"0.59413826",
"0.58798623",
"0.577929",
"0.57425565",
"0.57300234",
"0.5712851",
"0.57022697",
"0.5681794",
"0.56317794",
"0.5628675",
"0.56248564",
"0.56072944",
"0.55959505",
"0.5586139",
"0.55... | 0.7002181 | 0 |
Stops the player and destroys the player object. | def stop(self):
self.set_state_null()
self.player = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n self.stopped = True\n # FIXME?: Why is this not doing anything? Shouldn't it be calling into the player API?",
"def stop(self):\n if self.player and self.player.is_playing():\n self.player.pause()\n super().stop()",
"def _control_stop(self):\n s... | [
"0.7495407",
"0.72363794",
"0.72135425",
"0.70176417",
"0.7017531",
"0.6868679",
"0.6810595",
"0.67968863",
"0.67196923",
"0.66897637",
"0.6644563",
"0.6587246",
"0.6582386",
"0.64925516",
"0.6466148",
"0.64212495",
"0.6382462",
"0.6382462",
"0.6350426",
"0.63449967",
"0.6334... | 0.7740178 | 0 |
Used for getting media resolution using a sample from stream. | def get_resolution(self):
ret_val = False
width = 0
height = 0
try:
sink = self.player.get_by_name('sink')
sample = GstBase.BaseSink.get_last_sample(sink)
caps = Gst.Sample.get_caps(sample)
struct = Gst.Caps.get_structure(caps, 0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resolution(filename):\n cmd = ('ffprobe -v 0 -of flat=s=_ -select_streams v:0 -show_entries '\n 'stream=height,width ' + filename).split()\n pid = subprocess.run(cmd, stdout=subprocess.PIPE,\n universal_newlines=True)\n if pid.returncode != 0:\n return None... | [
"0.646399",
"0.60087603",
"0.5969253",
"0.5954537",
"0.590219",
"0.56904954",
"0.5665113",
"0.5597763",
"0.5594036",
"0.55798703",
"0.55705637",
"0.55515945",
"0.553239",
"0.55043125",
"0.54656255",
"0.54384637",
"0.54121894",
"0.53890985",
"0.5379376",
"0.530331",
"0.5300982... | 0.6750637 | 0 |
Set streaming source URL. | def set_url(self, source_url):
if utils.validate_url(source_url, "rtsp"):
self.url = source_url
self.set_state_null()
self.setup_pipeline()
self.play()
else:
print("Invalid URL") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_source(self, source):\n self.data['source'] = source",
"def set_stream_url(self, url, info=None):\n listitem = xbmcgui.ListItem(label='clip', path=url)\n xbmcplugin.setResolvedUrl(self.handle, True, listitem)",
"def src(self, src):\n\n self._src = src",
"def set_url(self, ... | [
"0.6712162",
"0.6592298",
"0.647681",
"0.6407756",
"0.6372209",
"0.635762",
"0.6356142",
"0.6350102",
"0.63494205",
"0.62204987",
"0.6213311",
"0.6206013",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.620283",
"0.61903834",
"0.6171611",
"0.6141... | 0.78246737 | 0 |
Read the instrumentlist and returns the list of available instruments | def __read_instrumentslist(self):
available_instruments = []
with open("instrumentslist.txt", "r") as file:
for line in file:
splited = line.split(" ")
name = ""
for j in splited[1:]:
name += j
available_inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_instrument_items(self, i):\n all_instruments = self.__read_instrumentslist()\n return [x for x in all_instruments[i * 8:i * 8 + 8]]",
"def instruments(self):\r\n return self.get_field('instrument')",
"def instrument_list(request):\n breadcrumbs = Breadcrumbs(\"home\", None)\n ... | [
"0.72788113",
"0.6994194",
"0.6680399",
"0.62496823",
"0.6186994",
"0.5795701",
"0.5685171",
"0.5648937",
"0.5602791",
"0.55970687",
"0.55795294",
"0.556428",
"0.5521486",
"0.55101776",
"0.55014545",
"0.54581416",
"0.54535055",
"0.5435083",
"0.54243535",
"0.5420092",
"0.54146... | 0.82584137 | 0 |
waits 7 seconds then check if lastline matches past iteration's lastline | def _check_completion(self):
sleep(SONG_OVER_CHECK_TIME) ###Wait 10 seconds
print("entering _check_completion")
csv_lastline = self._read_lastline()
print('system time = {}'.format(strftime("%H:%M:%S")))
print("csv_lastline = ", csv_lastline)
print("self._last_line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_recv_line(self):\n self.instance.sleep()\n for lans in self.file_lines:\n msg_flag, lres = self.instance.recv(timeout=self.timeout)\n assert(msg_flag)\n nt.assert_equal(lres, lans)\n msg_flag, lres = self.instance.recv()\n assert(not msg_flag)",... | [
"0.58198446",
"0.580545",
"0.5686041",
"0.56266075",
"0.5576705",
"0.55692023",
"0.5532898",
"0.5488862",
"0.54376894",
"0.54367375",
"0.5423209",
"0.5357156",
"0.5330643",
"0.53153884",
"0.52829564",
"0.5281526",
"0.5265003",
"0.52394867",
"0.5230492",
"0.52259403",
"0.52211... | 0.700952 | 0 |
sets the grip list for the past 30 seconds of the song | def _set_last_30_sec(self):
#print("entering set_last_30")
grip_list = read_csv(CSV_functions.MUSICGLOVE, test=True)
self._all_grips = parse_csv(grip_list)
#print("grip_list = ", grip_list)
if self._grip_count == 0:
self._grip_count = len(grip_list)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update():\n\tglobal songList\n\tglobal songs\n\tsongList=os.listdir(\"./music/\")\n\tsongs=['```']\n\tfor song in songList:\n\t\tif len(songs[-1])>1800:\n\t\t\tsongs[-1]+='```'\n\t\t\tsongs.append('```')\n\t\tif '.mp3' in song:\n\t\t\tsongs[-1]+=song.replace('.mp3','')\n\t\t\tsongs[-1]+='\\n'\n\tsongs[-1]+='``... | [
"0.54157674",
"0.53405726",
"0.5317972",
"0.5257763",
"0.5144258",
"0.5139769",
"0.51279414",
"0.5094557",
"0.5051587",
"0.50215524",
"0.501079",
"0.499168",
"0.49858606",
"0.48963735",
"0.48302227",
"0.4828999",
"0.48264942",
"0.4816952",
"0.48083523",
"0.47975463",
"0.47958... | 0.7477254 | 0 |
Returns the last line of the csv containing the user's grip information | def _read_lastline(self):
#print("entering _read_lastline()")
#print(read_csv(CSV_functions.MUSICGLOVE))
try:
last_line = parse_csv(read_csv(CSV_functions.MUSICGLOVE))[-1]
except IndexError:
return "Empty File"
return last_line | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last():\n users = get_data_from_csv('files/users.csv')\n return User(*last_row(users))",
"def get_csv_line(self):\n return \"{},{},{},{},{},{},{}\\n\".format(self.employee_id, self.gender,\n self.sales, self.bmi,\n ... | [
"0.6391869",
"0.60333467",
"0.59943587",
"0.59010094",
"0.5854792",
"0.5797717",
"0.5770353",
"0.5705069",
"0.5595599",
"0.5545027",
"0.55202806",
"0.54466856",
"0.53091663",
"0.5271451",
"0.5203575",
"0.5201268",
"0.51674443",
"0.5159241",
"0.5132848",
"0.5112787",
"0.509268... | 0.6832772 | 0 |
Chooses an appropriate response based upon user's performance. Returns a 2tuple where the first element is the string type of response and the second is that appropriate response string | def select_response(self):
print("RIVA msg number: ", self._RIVA_message_num)
overall_avg = self.user_stats.new_overall_avg()
scale_points = self.user_stats.get_scale_points(abs_val_list(grip_times(self._all_grips)))
#print("overall avg: {}\n scale point 1: {} scale point 2: {}".format(o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bot_response(response):\n\n # Response set 1 for Aang\n aang = [\n \"\\\"Harsh words won't solve problems, action will!\\\"\", # S1E11\n \"\\\"The past can be a great teacher.\\\"\", # S3E13\n \"\\\"It's easy to do nothing, but it's hard to forgive.\\\"\", # S3E16\n ]\n\n ... | [
"0.624096",
"0.6176012",
"0.59776336",
"0.58650833",
"0.585061",
"0.5705987",
"0.56702995",
"0.56180567",
"0.5612104",
"0.55950737",
"0.5505881",
"0.5502962",
"0.5489708",
"0.546095",
"0.54457444",
"0.5445005",
"0.5435877",
"0.54341555",
"0.5425992",
"0.5423421",
"0.53902596"... | 0.6225671 | 1 |
Analyzes user's last 30 seconds, returns string prompt suggesting a grip to work on (the worst grip) | def response_training_prompt(self):
self._last_response = "training_prompt"
print("Training Prompt")
self.user_stats.set_followup(self._last_worst_grip)
return Mglove_str_gen.training_prompt(self.user_stats.get_followup()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeleft(var, wrapper, message):\n cli, nick, chan, rest = wrapper.client, wrapper.source.name, wrapper.target.name, message # FIXME: @cmd\n\n if (wrapper.public and var.LAST_TIME and\n var.LAST_TIME + timedelta(seconds=var.TIME_RATE_LIMIT) > datetime.now()):\n cli.notice(nick, messages... | [
"0.55555415",
"0.5489019",
"0.5465575",
"0.5461834",
"0.5434844",
"0.5339962",
"0.5314979",
"0.53055173",
"0.53049266",
"0.52941054",
"0.5291508",
"0.52859485",
"0.52676785",
"0.5262727",
"0.5251476",
"0.5235185",
"0.5218309",
"0.51939255",
"0.5193117",
"0.518266",
"0.5178915... | 0.55030304 | 1 |
Append a new pathspec component to this pathspec. | def Append(self, component=None, **kwarg):
if component is None:
component = self.__class__(**kwarg)
if self.HasField("pathtype"):
self.last.nested_path = component
else:
for k, v in kwarg.items():
setattr(self, k, v)
self.SetRawData(component.GetRawData())
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path(self, new_path):\n if new_path == self.path:\n return\n\n self._path.append(new_path)",
"def append(self, path):\n self.paths.append(path)\n self.time += path.time",
"def extend_path(self, ext):\n ext = str(ext)\n self._path.append(e... | [
"0.6475366",
"0.646892",
"0.6289979",
"0.620486",
"0.614977",
"0.603944",
"0.5871561",
"0.58572716",
"0.581544",
"0.58070743",
"0.5806504",
"0.58058983",
"0.57017595",
"0.5656207",
"0.55844164",
"0.55844164",
"0.55248374",
"0.5494463",
"0.5440153",
"0.54182255",
"0.5415792",
... | 0.6493598 | 0 |
Returns the AFF4 URN this pathspec will be stored under. | def AFF4Path(self, client_urn):
# If the first level is OS and the second level is TSK its probably a mount
# point resolution. We map it into the tsk branch. For example if we get:
# path: \\\\.\\Volume{1234}\\
# pathtype: OS
# mount_point: /c:/
# nested_path {
# path: /windows/
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PathspecToURN(pathspec, client_urn):\n client_urn = rdfvalue.ClientURN(client_urn)\n\n if not isinstance(pathspec, rdfvalue.RDFValue):\n raise ValueError(\"Pathspec should be an rdfvalue.\")\n\n # If the first level is OS and the second level is TSK its probably a mount\n # point resolution. W... | [
"0.59959936",
"0.57585794",
"0.5757265",
"0.55726695",
"0.55363214",
"0.5520384",
"0.5514668",
"0.54821783",
"0.543625",
"0.542376",
"0.5363159",
"0.5353192",
"0.5350059",
"0.5290205",
"0.5246005",
"0.52058023",
"0.52011615",
"0.5170195",
"0.51669574",
"0.5164558",
"0.5114905... | 0.680058 | 0 |
Interpolate inline globbing groups. | def InterpolateGrouping(self, pattern):
components = []
offset = 0
for match in GROUPING_PATTERN.finditer(pattern):
components.append([pattern[offset:match.start()]])
# Expand the attribute into the set of possibilities:
alternatives = match.group(1).split(",")
components.append(_un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def glob_fmt(pattern: str, *templates: Strings) -> List[str]:\n results: List[str] = []\n for wildcards in glob_extract(pattern):\n for template in each_string(*templates):\n results.append(copy_annotations(template, template.format(**wildcards)))\n return results",
"def to_globs(self,... | [
"0.599184",
"0.54665947",
"0.54016477",
"0.5354282",
"0.5243976",
"0.5219615",
"0.51785034",
"0.5155968",
"0.5107413",
"0.508813",
"0.5063504",
"0.5054259",
"0.5042185",
"0.5013164",
"0.49759755",
"0.49616253",
"0.49451718",
"0.4893766",
"0.4888701",
"0.4883094",
"0.48675454"... | 0.60871595 | 0 |
test to dict method with Amenity and the type and content | def test_to_dictAmenity(self):
insta = Amenity()
dict_cont = insta.to_dict()
self.assertEqual(type(dict_cont), dict)
for attr in insta.__dict__:
self.assertTrue(attr in dict_cont)
self.assertTrue("__class__" in dict_cont) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_cases_for_dict(self):\n pass",
"def check_for_dict(check):",
"def test_dict_value(self):\n time_format = \"%Y-%m-%dT%H:%M:%S.%f\"\n insta = Amenity()\n dict_con = insta.to_dict()\n self.assertEqual(dict_con[\"__class__\"], \"Amenity\")\n self.assertEqual(t... | [
"0.6309913",
"0.6100255",
"0.6017125",
"0.6013033",
"0.5861453",
"0.5851398",
"0.5751937",
"0.57155645",
"0.5704528",
"0.5674443",
"0.5489831",
"0.5489222",
"0.5486378",
"0.5459682",
"0.54389507",
"0.5426274",
"0.54253966",
"0.53917867",
"0.5372596",
"0.53631514",
"0.5353716"... | 0.6718173 | 0 |
Encode a set of arguments as query parameters. | def queryparams(*args, **kwargs):
args = dict(args)
args.update(kwargs)
return urllib.urlencode(args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_args(self, args):\n result_str = \"?\"\n for k, v in args.iteritems():\n result_str = result_str + k + \"=\" + v + \"&\"\n return result_str",
"def smart_encode(**kwargs):\r\n args = dict(kwargs)\r\n for k, v in args.items():\r\n if v is None:\r\n ... | [
"0.6972559",
"0.6377523",
"0.6284413",
"0.6278043",
"0.62177527",
"0.6181711",
"0.614788",
"0.61409354",
"0.6094306",
"0.608261",
"0.6052283",
"0.60401416",
"0.5980932",
"0.59808296",
"0.59500444",
"0.5933375",
"0.59105206",
"0.58789176",
"0.5873813",
"0.5861324",
"0.5835321"... | 0.75121254 | 0 |
Decorator to ensure that the mutex is locked while calling a method. The method's object must have a mutex in a property named "mutex". | def locked(fn):
def locked_method(self, *args, **kwargs):
self.mutex.acquire()
try:
return fn(self, *args, **kwargs)
finally:
self.mutex.release()
return locked_method | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synchronized(func):\n @wraps(func)\n def decorator(*args, **kwargs):\n if not args or not isinstance(args[0], SynchronizedMixin):\n raise ValueError(\"method {} if not part of a Synchronized service\".format(func))\n with args[0].synchronized_mutex:\n return func(*args... | [
"0.747396",
"0.7078683",
"0.64988536",
"0.6423598",
"0.6181043",
"0.60996515",
"0.6053192",
"0.60422516",
"0.5907164",
"0.59065586",
"0.5890942",
"0.5792372",
"0.57086945",
"0.57063276",
"0.56977254",
"0.5688321",
"0.5678738",
"0.566474",
"0.5618551",
"0.55935305",
"0.557902"... | 0.7262485 | 1 |
Get the sequence of numbers stored in a parameter. The parameter should contain the numbers separated by commas. If invalid entries are found, raises an HTTP 400 error. | def getorderparam(name):
for num in cherrypy.request.params.get(name, '').split(','):
if num.strip() == '':
continue
try:
yield int(num)
except ValueError:
raise cherrypy.HTTPError(400) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_get_batch_sequence():\n sequence_start = 30000\n sequence_range = 10000\n try:\n n = int(request.args.get(\"n\", 1))\n except (TypeError, ValueError):\n return abort(400)\n\n rv = {\n \"sequence_list\": [\n (i - 1) % sequence_range + sequence_start\n ... | [
"0.6341547",
"0.6307575",
"0.5780648",
"0.5748245",
"0.5721855",
"0.5681584",
"0.5597511",
"0.553089",
"0.553089",
"0.553089",
"0.553089",
"0.553089",
"0.5478601",
"0.5462856",
"0.541831",
"0.53941196",
"0.53821325",
"0.5249708",
"0.5219198",
"0.5209926",
"0.5100126",
"0.50... | 0.6358029 | 0 |
compares backed vs. memory | def test_backed_vs_memory():
from pathlib import Path
# get location test h5ad file in datasets
HERE = Path(sc.__file__).parent
adata_file = HERE / "datasets/10x_pbmc68k_reduced.h5ad"
adata_backed = sc.read(adata_file, backed='r')
adata = sc.read_h5ad(adata_file)
# use non-sequential list ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_to_same_memory(a, b):\n return a.data == b.data",
"def test_inmemory(self):\n\n\t\tself.assertEqual(self.inmemory, self.tracker.inmemory)",
"def test_by_ref_no_copy(self):\n self.init()\n # Test with something that really shouldn't be copied.\n ptr = get_memptr(self.ff64_1)\n ... | [
"0.68159366",
"0.62367666",
"0.6113018",
"0.5872939",
"0.5870131",
"0.5845475",
"0.58343357",
"0.5777668",
"0.57403",
"0.5727625",
"0.57104295",
"0.56647545",
"0.56384593",
"0.5634684",
"0.5609971",
"0.5609111",
"0.5606924",
"0.5601757",
"0.55781984",
"0.55555457",
"0.55273",... | 0.62653196 | 1 |
uses a larger dataset to test column order and content | def test_column_content():
adata = pbmc68k_reduced()
# test that columns content is correct for obs_df
query = ['CST3', 'NKG7', 'GNLY', 'louvain', 'n_counts', 'n_genes']
df = sc.get.obs_df(adata, query)
for col in query:
assert col in df
np.testing.assert_array_equal(query, df.colum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_overall_report_columns():\n assert (len(overall_data['columns']) == 31)",
"def test_metadata_filter_general(self):\n metadata = pd.DataFrame({'foo': {'haib18CEM5332_HMGTJCCXY_SL342402': 1}})\n table_factory = DataTableFactory(PACKET_DIR, metadata_tbl=metadata)\n tbl = table_facto... | [
"0.61706156",
"0.6071806",
"0.59842885",
"0.59619904",
"0.5905596",
"0.59021425",
"0.58017594",
"0.5796593",
"0.57806224",
"0.5778132",
"0.5770337",
"0.57441795",
"0.5682358",
"0.56763804",
"0.56584436",
"0.56478804",
"0.56360537",
"0.56323856",
"0.56250155",
"0.56172955",
"0... | 0.65384835 | 0 |
storage_client = storage.Client() bucket = storage_client.get_bucket(os.environ.get('CLOUD_STORAGE_BUCKET')) Create a new blob and upload the file's content to Cloud Storage. blob = bucket.blob("data/imgsrc/{0}{1}.png".format(callnum,query)) blob.upload_from_string( photo.read(), content_type=photo.content_type) | def imageUpload(query,callnum):
source_file_name = "data/imgsrc/{0}-{1}.png".format(callnum,query)
destination_blob_name = "{0}-{1}.png".format(callnum,query)
storage_client = storage.Client()
bucket = storage_client.get_bucket(os.environ.get('CLOUD_STORAGE_BUCKET'))
blob = bucket.blob(destination_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_to_gcs():\n client = storage.Client(project=\"filmreccommendations\")\n bucket = client.get_bucket(\"filmreccommendations.appspot.com\")\n blob = bucket.blob(os.path.basename(PICKLE_FILENAME))\n blob.upload_from_filename(PICKLE_FILENAME)",
"def upload_blob(bucket_name, src_file, dst_file_n... | [
"0.7131283",
"0.7102576",
"0.69331807",
"0.68578637",
"0.68509537",
"0.6745912",
"0.6713672",
"0.66916",
"0.667625",
"0.66582566",
"0.66516244",
"0.66018075",
"0.6550635",
"0.6464661",
"0.6358169",
"0.6358007",
"0.63572675",
"0.634092",
"0.63153684",
"0.62662184",
"0.6210849"... | 0.83783364 | 0 |
unittest classes can get access to rse_factory fixture via this fixture | def rse_factory_unittest(request, vo, class_scope_prefix):
from .temp_factories import TemporaryRSEFactory
with TemporaryRSEFactory(vo=vo, name_prefix=class_scope_prefix) as factory:
request.cls.rse_factory = factory
yield factory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpFixture(self):\n pass",
"def scene_fixture(scene_factory):\n return scene_factory('Test Scene')",
"def setUp(self):\n self.factory = RequestFactory()",
"def setUp(self):\n self.factory = RequestFactory()",
"def setUp(self):\n self.factory = RequestFactory()",
"def ... | [
"0.6923604",
"0.67980206",
"0.6489142",
"0.6489142",
"0.6489142",
"0.6447893",
"0.643282",
"0.6371821",
"0.62180984",
"0.6211886",
"0.61795783",
"0.61584795",
"0.61516243",
"0.60849744",
"0.6066643",
"0.6048318",
"0.60425305",
"0.6014712",
"0.6014712",
"0.6014712",
"0.6014712... | 0.69328827 | 0 |
Create an inmemory temporary table using the sqlite memory driver. Make sqlalchemy aware of that table by registering it via a declarative base. | def __create_in_memory_db_table(name, *columns, **kwargs):
import datetime
from sqlalchemy import Column, DateTime, CheckConstraint
from sqlalchemy.pool import StaticPool
from sqlalchemy.schema import Table
from sqlalchemy.orm import registry
from rucio.db.sqla.models import ModelBase
from r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_sqlite_memory():\n global engine\n if engine is None:\n engine = create_engine(\"sqlite://\")\n Session.configure(bind=engine)\n _populate()",
"def setupTempTables(self):\n cur = self.cursor()\n cur.execute(\"PRAGMA temp_store = MEMORY\")\n for table... | [
"0.72185934",
"0.69393677",
"0.685504",
"0.6638255",
"0.6633624",
"0.6379129",
"0.628769",
"0.6187717",
"0.6132853",
"0.6114666",
"0.610305",
"0.6090174",
"0.60765433",
"0.6054707",
"0.6054707",
"0.6053742",
"0.60411364",
"0.59569556",
"0.5951424",
"0.59396255",
"0.59396255",... | 0.75651777 | 0 |
Fixture to allow having pertest core.config tables without affecting the other parallel tests. This override works only in tests which use core function calls directly, not in the ones working via the API, because the normal config table is not touched and the rucio instance answering API calls is not aware of this moc... | def core_config_mock(request):
from unittest import mock
from sqlalchemy import Column
from rucio.common.utils import generate_uuid
from rucio.db.sqla.models import String, PrimaryKeyConstraint
from rucio.db.sqla.session import get_session
# Get the fixture parameters
table_content = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config():\n from .. import config\n\n _old_fs = os.getenv('FREESURFER_HOME')\n if not _old_fs:\n os.environ['FREESURFER_HOME'] = mkdtemp()\n\n filename = Path(pkgrf('fmriprep', 'data/tests/config.toml'))\n settings = loads(filename.read_text())\n for sectionname, configs in settin... | [
"0.6748329",
"0.6531168",
"0.6353294",
"0.62790483",
"0.62598306",
"0.6240023",
"0.6174493",
"0.611571",
"0.60569674",
"0.60124356",
"0.58899754",
"0.5880241",
"0.58654696",
"0.58421725",
"0.58381003",
"0.58184004",
"0.57922375",
"0.5792105",
"0.57893586",
"0.5770912",
"0.576... | 0.73936003 | 0 |
Fixture which overrides the different internal caches with inmemory ones for the duration of a particular test. This override works only in tests which use core function calls directly, not in the ones working via API. The fixture acts by by mock.patch the REGION object in the provided list of modules to mock. | def caches_mock(request):
from unittest import mock
from contextlib import ExitStack
from dogpile.cache import make_region
caches_to_mock = []
expiration_time = 600
params = __get_fixture_param(request)
if params:
caches_to_mock = params.get("caches_to_mock", caches_to_mock)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_local_cache():",
"def local_memory_cache():\n with mock.patch.dict(\n settings.CACHES['default'],\n {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'},\n ):\n cache_handler = django_cache.CacheHandler()\n\n with mock.patch.object(django_cache, 'caches', cache_... | [
"0.64528155",
"0.6154406",
"0.6103808",
"0.5986139",
"0.59815836",
"0.58541846",
"0.5849203",
"0.5818465",
"0.57292086",
"0.57067186",
"0.56926477",
"0.567808",
"0.56709236",
"0.5647826",
"0.5628556",
"0.5624195",
"0.5624187",
"0.55843544",
"0.5555388",
"0.5532626",
"0.553116... | 0.69867086 | 0 |
Set the current porcentage | def _set_percentage(self):
step = float(self.step)
end = float(self.end)
self.percentage = format((100 * step / end), '.1f') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetProportion(self, p):\r\n\r\n self.proportion = p",
"def set_ratio(self, value):\n scene = self.scenes[self.current_scene]\n scene.set_perspective(ratio=value)\n self.redraw()",
"def SetPercentage( self, percent, total ):\n self.percentageView = percent\n self.to... | [
"0.64167905",
"0.61639315",
"0.6094924",
"0.6022297",
"0.5988166",
"0.59432715",
"0.58724904",
"0.58572924",
"0.57609844",
"0.57023203",
"0.5698069",
"0.5692947",
"0.5677451",
"0.5677451",
"0.5670534",
"0.56523913",
"0.56253463",
"0.5585602",
"0.5560715",
"0.55550313",
"0.551... | 0.62164897 | 1 |
Find the earliest time a monkey can jump across a river. | def earliest_arrival(jump_distance, stones):
#jump_distance of 3 means they skip 2 stones and land on 3rd
stone = ''
#based on jump_distance, what are all the stone nums within that distance
#when jump_distance is 5, can jujp to stones[4]
stone = min(stones[:(jump_distance - 1)]) #stone = 2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probing_time(self):\r\n earliest_launch = (time.time() * 1000)**2\r\n latest_completion = 0\r\n for probe in self.__probes.values():\r\n if probe.complete():\r\n earliest_launch = min(earliest_launch, probe.launch_time)\r\n latest_completion = max(latest_... | [
"0.5745872",
"0.56657726",
"0.5574333",
"0.5569236",
"0.54608685",
"0.5431501",
"0.5426729",
"0.53497094",
"0.5315338",
"0.53116536",
"0.53097105",
"0.5303282",
"0.5294817",
"0.5279624",
"0.52618533",
"0.5254996",
"0.5250051",
"0.52369374",
"0.5227946",
"0.52158654",
"0.52093... | 0.5979008 | 0 |
Loops over a series containing row indices and returns a list of RUID strings. | def createRUID_List(rowIdxList, headerStr):
RUID_List = []
for aRowIdx in rowIdxList:
workingRUID=df[headerStr].iloc[aRowIdx]
RUID_List.append(workingRUID)
return RUID_List | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_RSOPuids_in_RIS(seg):\n \n rsopuids = [] \n \n sequences = seg.ReferencedSeriesSequence[0]\\\n .ReferencedInstanceSequence\n \n for sequence in sequences:\n uid = sequence.ReferencedSOPInstanceUID\n \n rsopuids.append(uid)\n \n return rsopu... | [
"0.61830646",
"0.57689166",
"0.56448036",
"0.56144553",
"0.5480247",
"0.5425637",
"0.5419428",
"0.5416224",
"0.53751045",
"0.5372293",
"0.5192723",
"0.51913315",
"0.5185259",
"0.51786697",
"0.5169981",
"0.5103185",
"0.5096104",
"0.50520396",
"0.5026998",
"0.5024384",
"0.50224... | 0.6128861 | 1 |
database settings variable configuration check | def test_databases_variable_exists(self):
self.assertTrue(settings.DATABASES, f"{flag}settings module does not have a databases variable{flag}")
self.assertTrue('default' in settings.DATABASES, f"{flag}default database configuration correct{flag}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_db():",
"def check_settings(self):\r\n pass",
"def check_settings(self):\n pass",
"def validateDbConfig(config):\n if getattr(config, 'CoreDatabase', None) is None:\n return False, \"Configuration problem: Core Database section is missing. \"\n return True, 'Ok'",
"def... | [
"0.7424129",
"0.6821875",
"0.6816555",
"0.6731501",
"0.66543466",
"0.65069836",
"0.6390466",
"0.634808",
"0.62685215",
"0.6239921",
"0.6238833",
"0.61508465",
"0.61221683",
"0.6101618",
"0.60655457",
"0.60396117",
"0.60385364",
"0.596589",
"0.59582657",
"0.59206635",
"0.59076... | 0.72970396 | 1 |
Sets AWS default region globally | def set_default_region(profile=None):
if os.getenv('AWS_DEFAULT_REGION'):
return os.getenv('AWS_DEFAULT_REGION')
elif profile is not None:
return awscli_region(profile_name=profile)
return awscli_region(profile_name='default') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_region(self, aws_region):\n self._aws_region = aws_region\n return self",
"def default_zone(self, region):\n if region == 'us-east-1':\n return region + 'b'\n else:\n return region + 'a'",
"def set_environment():\n # status\n\n logger.info('setting global environment... | [
"0.7337903",
"0.6978483",
"0.6913252",
"0.673321",
"0.65030354",
"0.6460333",
"0.64479446",
"0.64394736",
"0.64317596",
"0.6173606",
"0.6020383",
"0.6018033",
"0.59741384",
"0.59741384",
"0.59741384",
"0.5970148",
"0.59253097",
"0.59253097",
"0.59253097",
"0.59253097",
"0.588... | 0.76276314 | 0 |
Sets global environment variables for testing | def set_environment():
# status
logger.info('setting global environment variables')
# set all env vars
os.environ['DBUGMODE'] = 'False'
os.environ['AWS_DEFAULT_REGION'] = set_default_region() or 'us-east-1'
logger.info('AWS_DEFAULT_REGION determined as %s' % os.environ['AWS_DEFAULT_REGION']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setup_env(self):\n\n os.environ['GIT_NAME'] = statiki.GIT_NAME\n os.environ['GIT_EMAIL'] = statiki.GIT_EMAIL\n os.environ['GH_TOKEN'] = 'this-is-a-bogus-token:password'\n os.environ['TRAVIS_REPO_SLUG'] = TEST_REPO\n\n return",
"def environment_vars_set():\n os.environ[\... | [
"0.761664",
"0.74059635",
"0.7350931",
"0.7292421",
"0.7289598",
"0.7256863",
"0.72523034",
"0.7229309",
"0.72010165",
"0.7198395",
"0.7139497",
"0.7131175",
"0.7026046",
"0.69873434",
"0.69697994",
"0.6956086",
"0.6937549",
"0.69222546",
"0.69166696",
"0.6912648",
"0.6904731... | 0.75063795 | 1 |
CMAQ PA Master presents a single interface for CMAQ PA, IRR, and Instantaneous concentration files. paths_and_readers iterable of iterables (n x 2) where each element of the primary iterable is an iterable containing a file path and a reader for that path. The reader is expected to present the Scientific.IO.NetCDF.NetC... | def cmaq_pa_master(paths_and_readers,tslice=None,kslice=None,jslice=None,islice=None):
from ..pappt.kvextract import tops2shape,pblhghts2tops
files=[]
iprf = None
concf = None
for p,r in paths_and_readers:
if not os.path.exists(p):
raise ValueError, "File at %s does not exist" % ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_netcdf_files(rlzn_path_list,name_prefix): #{{{\n\n fopen_list = []\n for path in rlzn_path_list:\n netcdf_name = glob.glob(path+'/'+name_prefix)\n fopen_list.append(netCDF4.Dataset(netcdf_name[0],'r'))\n\n return fopen_list #}}}",
"def process(self):\n\n if len(self.files) ... | [
"0.5421409",
"0.5130424",
"0.5103049",
"0.5059436",
"0.5057716",
"0.50419617",
"0.4975474",
"0.49636874",
"0.48937297",
"0.48205236",
"0.478941",
"0.4788244",
"0.47660458",
"0.47560987",
"0.4738994",
"0.46989864",
"0.46953392",
"0.46837544",
"0.46670833",
"0.46629408",
"0.466... | 0.7248957 | 0 |
Convert an astropy unit to a FITS format string. uses the to_string() method builtin to astropy Unit() Notes | def units_to_fits(unit):
if unit is None:
unit = Unit('')
return unit.to_string("fits").upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode_of_unit(quant):\n return quant.dimensionality.unicode",
"def to_unit(self, unit):\n unit = _find_unit(unit)\n self.value = _convert_value(self.value, self.unit, unit)\n self.unit = unit",
"def raw_unit_of_measurement(self) -> str:\n if len(self._node.uom) == 1:\n ... | [
"0.6260546",
"0.6204777",
"0.6175992",
"0.61548734",
"0.6128645",
"0.61167",
"0.60747516",
"0.6035215",
"0.60141885",
"0.59913385",
"0.5966789",
"0.59561276",
"0.5942218",
"0.5875363",
"0.5875164",
"0.5864095",
"0.5853759",
"0.5820853",
"0.5785682",
"0.57848775",
"0.57770944"... | 0.7634108 | 0 |
Take db FILE and fill 2 arrays with its data | def get_vend_data(db_file, vend_array_to_fill, buy_array_to_fill):
#открываем файл с сжатой базой
_shop = compress_json.local_load(db_file)
if not isinstance(_shop, dict):
#конвертируем в дикт
_shop = json.loads(_shop)
_shop = _shop['shops']
#with open(db_file, encoding="utf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadDb(self,dbContent,base):\n \n db = utilities.db2bitarray(dbContent,self.dbSize,1,1,base)\n db = np.array(db).reshape(self.dbSize,-1)\n # track the size of each file\n fileSize = db.shape[-1]\n \n return (db,fileSize)",
"def load_data(db_file):\n con = s... | [
"0.6791058",
"0.59622383",
"0.58491826",
"0.5807415",
"0.5802011",
"0.5794971",
"0.57807547",
"0.5769846",
"0.5747667",
"0.5732948",
"0.5696196",
"0.5690361",
"0.567016",
"0.5658856",
"0.564647",
"0.56253934",
"0.56235147",
"0.5620141",
"0.56099135",
"0.558745",
"0.5570421",
... | 0.65294665 | 1 |
Iterate through all available databases and compress them one by one | def compress_all_db():
#взять все файлы, которые есть в папке с дб,
#и всем сделать compress_data, по их порядку создания
_db_files = sorted(glob.iglob('{}\\jsons\\DB_*.json'.format(db_folder_path)), key=os.path.getctime)
#iterate through all dbs
for _n in range(len(_db_files)):
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sync_databases(self):\n host, port = self._src.client().address\n log.info('sync databases from %s:%d' % (host, port))\n for dbname in self._src.client().database_names():\n if dbname in self._ignore_dbs:\n log.info(\"skip database '%s'\" % dbname)\n ... | [
"0.7129909",
"0.6637266",
"0.65461916",
"0.64949363",
"0.6465453",
"0.63064724",
"0.6207744",
"0.611546",
"0.6086961",
"0.6086638",
"0.60798156",
"0.6018917",
"0.5940772",
"0.5939117",
"0.59159523",
"0.5910437",
"0.589049",
"0.5876924",
"0.585962",
"0.5850626",
"0.5835088",
... | 0.80722123 | 0 |
function to get demand data from file | def get_demand_data():
with open("{}DEMAND.txt".format(db_folder_path), "r", encoding="utf8") as demand_file:
return eval(demand_file.read(), {'__builtins__':None}, {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_data(filename):",
"def readDemandFile(self, demandFileName):\n try:\n with open(demandFileName, \"r\") as demandFile:\n fileLines = demandFile.read().splitlines()\n self.totalDemand = 0\n\n # Set default parameters for metadata, then read\n se... | [
"0.7019878",
"0.64281434",
"0.63534486",
"0.6285446",
"0.6239602",
"0.6237105",
"0.61515397",
"0.61269003",
"0.6108679",
"0.60838485",
"0.6079148",
"0.6078576",
"0.60710984",
"0.6016122",
"0.6015671",
"0.5973863",
"0.5933098",
"0.5862542",
"0.5854474",
"0.5836018",
"0.5829553... | 0.71445185 | 0 |
Make api call, save new db, compare new db with old one and save demand | def api_db_load(vend, buy, db_compare=False, compressed=True):
#находим последнюю сжатую базу
if compressed:
db_conv_time = last_db_time_get()
if not db_compare:
if convert_time(db_conv_time, 'm') > 9: #9
print("Old database...")
#собираем ссылк... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_db():\n pass",
"def save_db(self) -> None:",
"def syncDB(self):\n self.evAPI.clear()\n self.evSyncDB.set()",
"def db_sync(db_url=None):\n return IMPL.db_sync(db_url)",
"def update_database():\n\n # We obtain the data from the official database\n df = getData.extractData()\n\n ... | [
"0.677077",
"0.63384706",
"0.6261931",
"0.6258742",
"0.6211199",
"0.6152762",
"0.59370285",
"0.59200627",
"0.5910349",
"0.58567894",
"0.58532375",
"0.584045",
"0.58263266",
"0.58226395",
"0.5789347",
"0.578354",
"0.57725835",
"0.5761899",
"0.5759041",
"0.57459736",
"0.5741778... | 0.678962 | 0 |
Modifies status response to make it verbose. Gets status message related to response code. | def explain_status(response):
verbose = STATUS_LIST[response['code']]
response['verbose'] = verbose
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self, value):\r\n if isinstance(value, (int, long)):\r\n if 100 <= value <= 999:\r\n st = _RESPONSE_STATUSES.get(value, '')\r\n if st:\r\n self._status = '%d %s' % (value, st)\r\n else:\r\n self._status ... | [
"0.69887984",
"0.69007736",
"0.6653848",
"0.65020436",
"0.65020436",
"0.64779925",
"0.6313701",
"0.6249612",
"0.6249612",
"0.6216472",
"0.6166904",
"0.6150416",
"0.6143187",
"0.6122659",
"0.61217445",
"0.6104094",
"0.6091284",
"0.6090497",
"0.60658073",
"0.6064409",
"0.605649... | 0.7970568 | 0 |
Gets extended information about a node. In case the node has not been booted yet, NIS will return a JSON error object. | def extended_info(self):
return self.client.call('GET', self.name + 'extended-info') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request, nnid, wfver, desc):\n try:\n return_data = NNCommonManager().get_nn_node_info(nnid, wfver, desc)\n return Response(json.dumps(return_data))\n except Exception as e:\n return_data = {\"status\": \"404\", \"result\": str(e)}\n return Re... | [
"0.6660078",
"0.65021825",
"0.6235549",
"0.6029446",
"0.58012617",
"0.5699112",
"0.56304234",
"0.5602254",
"0.5584174",
"0.55677825",
"0.555768",
"0.55195814",
"0.5497358",
"0.54894817",
"0.5472727",
"0.54255664",
"0.5396422",
"0.537486",
"0.5364025",
"0.5353654",
"0.5339366"... | 0.65434945 | 1 |
Requests the chain height from every node in the active node list and returns the maximum height seen. In case the node has not been booted yet, NIS will return a JSON error object. | def max_chain_height(self):
return self.client.call('GET',
self.name + 'active-peers/max-chain-height') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _height(self, node):\n if node.value is not None and not node.nodes:\n return node.height\n elif node.value is not None and node.nodes:\n return max(flatten([node.height, ] +\n map(self._height, node.nodes.values())))\n elif node.value is... | [
"0.68319684",
"0.6465309",
"0.6297922",
"0.6203093",
"0.614153",
"0.61317945",
"0.61278087",
"0.6122855",
"0.6043672",
"0.60223407",
"0.60080594",
"0.59487",
"0.59428215",
"0.5899491",
"0.58711404",
"0.57808805",
"0.57459044",
"0.57323635",
"0.57300353",
"0.57110506",
"0.5690... | 0.72689503 | 0 |
Gets an array of node experiences from another node. In case the node has not been booted yet, NIS will return a JSON error object. | def experiences(self):
return self.client.call('GET',
self.name + 'experiences') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNodeBeans(self,node):\n data = self.connect('get','nodes/%s/ubfailcnt' % (node),None)\n return data",
"def get_target_nodes(self):\n url = 'https://raw.githubusercontent.com/ChandlerBang/Pro-GNN/master/nettack/{}_nettacked_nodes.json'.format(self.name)\n json_file = osp.join(se... | [
"0.5117448",
"0.50173837",
"0.49288344",
"0.4921128",
"0.488679",
"0.48692638",
"0.47888082",
"0.47887495",
"0.4783707",
"0.4716792",
"0.46871993",
"0.46523735",
"0.46356001",
"0.46347505",
"0.46334207",
"0.46175465",
"0.4607349",
"0.45971555",
"0.458495",
"0.45714545",
"0.45... | 0.5599594 | 0 |
Boots the local node and thus assign an account (the identity) to the local node. In case the node has already been booted, NIS will return a JSON error object. | def boot(self, boot_node_request):
return self.client.call('POST',
self.name + 'boot', payload=boot_node_request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reboot(self, node):",
"def boot(self):\n\t\tmesslen, received = self.socket.send('bootm\\r', 25)\t\t\n\t\treturn None",
"def get_bootstrap_node(self):\n self.clear_screen()\n default = 'bootstrap'\n bootstrap_name = input('enter the bootstrap node name\\n'\n ... | [
"0.56767833",
"0.563203",
"0.55201155",
"0.54065555",
"0.5341833",
"0.5202964",
"0.51330847",
"0.51300466",
"0.50703657",
"0.5026765",
"0.49834353",
"0.49789014",
"0.49730033",
"0.4930734",
"0.48860893",
"0.4873858",
"0.48642904",
"0.48475266",
"0.48128572",
"0.48125234",
"0.... | 0.63321984 | 0 |
Gets the mosaic definitions for a given namespace. | def mosaic_definition_page(self, namespace, _id=None, pagesize=25):
return self.client.call('GET',
self.name + 'mosaic/definition/page',
params={'namespace': namespace, 'id': _id,
'pagesize': pagesize}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_by_namespace(context, namespace_name, session):\n\n # namespace get raises an exception if not visible\n namespace = namespace_api.get(\n context, namespace_name, session)\n\n db_recs = (\n session.query(models.MetadefResourceType)\n .join(models.MetadefResourceType.associ... | [
"0.57161474",
"0.5348535",
"0.51656383",
"0.5053677",
"0.4914318",
"0.4831727",
"0.4793421",
"0.47827056",
"0.47570306",
"0.4742961",
"0.47328997",
"0.4731177",
"0.47172228",
"0.47118232",
"0.4691641",
"0.46705756",
"0.465321",
"0.46424088",
"0.46331793",
"0.46294153",
"0.461... | 0.59891266 | 0 |
Gets an array of time synchronization results. You can monitor the change in network time with this information. | def time_synchronization(self):
return self.client.call('GET', self.name + 'time-synchronization') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_array(self) -> np.ndarray:\n return np.array([r[\"time\"] for r in self.profile_result])",
"def timings(self):\r\n return self._timings",
"def get_times(self):\n times = []\n for i in range(1, len(self.events)):\n times.append(self.events[i-1].elapsed_time(self.eve... | [
"0.6488706",
"0.6295666",
"0.6248829",
"0.6247177",
"0.62049365",
"0.62049365",
"0.62049365",
"0.61829036",
"0.6131571",
"0.61148036",
"0.6109351",
"0.60732055",
"0.6019051",
"0.5968587",
"0.5906922",
"0.59041935",
"0.58985007",
"0.58977073",
"0.5870661",
"0.5811159",
"0.5761... | 0.73049825 | 0 |
Gets an audit collection of outgoing calls. You can monitor the outstanding and recent outgoing requests with this information. | def connections_outgoing(self):
return self.client.call('GET', self.name + 'connections/outgoing') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_auditlogs(self):\n res = self.get_object(\"/integrationServices/v3/auditlogs\")\n return res.get(\"notifications\", [])",
"def calls(self):\r\n return calls.Calls(self)",
"def getOutageHistory(self):\n return self._OutageHistory",
"def outgoing_caller_ids(self):\r\n ... | [
"0.5880125",
"0.5739649",
"0.5694943",
"0.56410474",
"0.55779296",
"0.552998",
"0.5406403",
"0.5326707",
"0.52545446",
"0.52218795",
"0.5213842",
"0.51800615",
"0.51409405",
"0.51348984",
"0.5015265",
"0.50151485",
"0.5012773",
"0.5002334",
"0.49872288",
"0.49606916",
"0.4957... | 0.58743024 | 1 |
GET state of HttpProxy | def getHttpProxyState(self, kwargs):
try:
exp_params = []
check_arguments(exp_params, kwargs)
except Exception as ex:
return HttpErrorResponse("%s" % ex)
with self.httpproxy_lock:
return self._get(kwargs, self.httpproxy_file, self.HttpProxy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n request = urllib.request.Request(self.url)\n if self.proxy:\n request.set_proxy(self.proxy, 'http')\n logger.info(\"Attempt to do GET request: url=%s, proxy=%s\",\n self.url, self.proxy)\n response = urllib.request.urlopen(request)\n ... | [
"0.6421434",
"0.62202215",
"0.61088204",
"0.6093173",
"0.6060972",
"0.6051053",
"0.6031893",
"0.60026574",
"0.5994774",
"0.5994774",
"0.59914345",
"0.59550333",
"0.59423137",
"0.58981866",
"0.5886309",
"0.585958",
"0.58346224",
"0.58289933",
"0.5825179",
"0.58123755",
"0.5812... | 0.7270524 | 0 |
GET state of Tomcat | def getTomcatState(self, kwargs):
try:
exp_params = []
check_arguments(exp_params, kwargs)
except Exception as ex:
return HttpErrorResponse("%s" % ex)
with self.tomcat_lock:
return self._get(kwargs, self.tomcat_file, role.Tomcat) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_GET(self):\n self.log.debug('do_GET called')\n self.HeadGet('GET')",
"def do_GET(self):\r\n self._send_handler_response('GET')",
"def do_GET(self):\n self.http_method = 'GET'\n self.response()",
"def get(self, url):\r\n print(f\"GET {url}\")\r\n response = self... | [
"0.637408",
"0.61814106",
"0.6000447",
"0.59790075",
"0.59443545",
"0.591256",
"0.5840415",
"0.57981306",
"0.5789769",
"0.5765345",
"0.5730917",
"0.57132006",
"0.5665296",
"0.5638341",
"0.562595",
"0.562112",
"0.5580805",
"0.55697966",
"0.55190706",
"0.54758614",
"0.5474336",... | 0.7057364 | 0 |
Method to call decode message and pass datagram and address | def datagram_received(self, data, addr):
self.decode_msg(data, self.state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_message(datagram, connection):",
"def decode(self,buf):\n eth = dpkt.ethernet.Ethernet(buf)\n pkt_len = len(buf)\n if(eth.type== dpkt.ethernet.ETH_TYPE_IP):\n ip = eth.data\n dst_ip = socket.inet_ntoa(ip.dst)\n src_ip = socket.inet_ntoa(ip.src)\n ... | [
"0.68869746",
"0.6623922",
"0.62035763",
"0.60647553",
"0.6049381",
"0.59432435",
"0.5930527",
"0.5922012",
"0.5886124",
"0.5872814",
"0.58549213",
"0.5790237",
"0.57687056",
"0.576501",
"0.57565933",
"0.5733635",
"0.5710519",
"0.56922716",
"0.56672436",
"0.56662637",
"0.5655... | 0.7067808 | 0 |
Method if connection lost, this function is not used. | def connection_lost(self, exc):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectionLost(self,reason):\n pass",
"def connectionLost(reason):",
"def handle_connection_lost(self, exc: Optional[Exception]) -> None:",
"async def connection_lost(self):\n logging.info('connection dropped')",
"def __connection_lost(self):\n print(\"Error: connection lost.\")\n ... | [
"0.8508406",
"0.8213209",
"0.8203684",
"0.81575125",
"0.80016416",
"0.7959189",
"0.7818627",
"0.7812391",
"0.78063464",
"0.7803431",
"0.77926713",
"0.7677541",
"0.76621383",
"0.7661407",
"0.76586294",
"0.7654748",
"0.7625265",
"0.7624131",
"0.7619221",
"0.7603999",
"0.7533861... | 0.83723193 | 1 |
Get the json file then editing the path of the experiments folder, creating the dir and return the config | def process_config(json_file):
config, _ = get_config_from_json(json_file)
print(" THE Configuration of your experiment ..")
pprint(config)
print(" *************************************** ")
try:
config.summary_dir = os.path.join("experiments", config.exp_name, "summaries/")
config.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config():\n config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), \"config.json\")\n with open(config_file, \"r\") as read_file:\n conf = json.load(read_file)\n\n if conf[\"use_dev_config\"]:\n print(\"Dev Setup: dev_config.json will be used\")\n config_file =... | [
"0.6612955",
"0.64641136",
"0.6278629",
"0.62562484",
"0.6255496",
"0.61134475",
"0.60716355",
"0.5988994",
"0.5946703",
"0.593988",
"0.59357256",
"0.59330505",
"0.5932068",
"0.58953905",
"0.5877053",
"0.5873151",
"0.5861984",
"0.5851229",
"0.5848458",
"0.58336425",
"0.582086... | 0.81028223 | 0 |
AddressTxs a model defined in OpenAPI | def __init__(self, address_txs: List[AddressTx]=None, next_page: str=None):
self.openapi_types = {
'address_txs': List[AddressTx],
'next_page': str
}
self.attribute_map = {
'address_txs': 'address_txs',
'next_page': 'next_page'
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def site_address_etl():\r\n with arcetl.ArcETL(\"Site Addresses\") as etl:\r\n etl.extract(dataset.SITE_ADDRESS.path(\"maint\"))\r\n # Clean maintenance values.\r\n transform.clear_nonpositive(etl, field_names=[\"house_nbr\"])\r\n transform.clean_whitespace(\r\n etl,\r\n ... | [
"0.57096714",
"0.55062914",
"0.5496484",
"0.54938596",
"0.54218805",
"0.54082596",
"0.5378746",
"0.5357338",
"0.5301924",
"0.527657",
"0.52230495",
"0.5172102",
"0.51573515",
"0.51486653",
"0.51459736",
"0.5123913",
"0.5122486",
"0.5097537",
"0.50649405",
"0.50470746",
"0.504... | 0.5651204 | 1 |
Gets the address_txs of this AddressTxs. | def address_txs(self):
return self._address_txs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_addr_txo(self, addr) -> Set[str]:\n return self.txo_byaddr.get(addr, set())",
"def address_tags(self):\n return self._address_tags",
"def symbol_table_addresses(self):\n all_address = []\n for node in self.all_nodes[0]:\n all_address.extend(node['addresses'])\n ... | [
"0.7036344",
"0.68626004",
"0.677266",
"0.6440875",
"0.6379488",
"0.6379488",
"0.6379488",
"0.6336632",
"0.6181056",
"0.6127058",
"0.597582",
"0.5940792",
"0.59098506",
"0.5875603",
"0.5756019",
"0.5694489",
"0.56922615",
"0.56600934",
"0.5566928",
"0.555155",
"0.5528333",
... | 0.91682494 | 0 |
Sets the address_txs of this AddressTxs. | def address_txs(self, address_txs):
if address_txs is None:
raise ValueError("Invalid value for `address_txs`, must not be `None`")
self._address_txs = address_txs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_txs(self):\n return self._address_txs",
"def addresses(self, addresses: \"List[str]\"):\n self._attrs[\"addresses\"] = addresses",
"def addresses(self, addresses: \"List[str]\"):\n self._attrs[\"addresses\"] = addresses",
"def addresses(self, addresses: \"List[str]\"):\n ... | [
"0.67103106",
"0.627279",
"0.627279",
"0.627279",
"0.58619",
"0.563561",
"0.56108737",
"0.55193025",
"0.53204703",
"0.52825093",
"0.5198595",
"0.5196371",
"0.5188511",
"0.5182996",
"0.5091491",
"0.50475854",
"0.50410074",
"0.5034687",
"0.4995494",
"0.4987398",
"0.4955234",
... | 0.8438663 | 0 |
Gets the next_page of this AddressTxs. | def next_page(self):
return self._next_page | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_page(self):\n return min((self.get_page() + 1), self.get_last_page())",
"def next_page_token(self):\n return self._next_page_token",
"def next_page_token(self):\n return self._next_page_token",
"def next_num(self):\n return self.page + 1",
"def nextPage(self):\n ... | [
"0.7067162",
"0.66411906",
"0.66411906",
"0.65460753",
"0.65415114",
"0.6517272",
"0.64830554",
"0.6468212",
"0.642163",
"0.637417",
"0.6330661",
"0.6279175",
"0.6273147",
"0.6216764",
"0.61757267",
"0.6166563",
"0.6163094",
"0.61517274",
"0.61517274",
"0.6089374",
"0.6046776... | 0.743467 | 1 |
Sets the next_page of this AddressTxs. | def next_page(self, next_page):
self._next_page = next_page | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_page_url(self, next_page_url):\n\n self._next_page_url = next_page_url",
"def next_page_token(self, next_page_token):\n\n self._next_page_token = next_page_token",
"def next_page_token(self, next_page_token):\n\n self._next_page_token = next_page_token",
"def setNext(self, next)... | [
"0.7219447",
"0.71530163",
"0.71530163",
"0.71018225",
"0.6745028",
"0.66674113",
"0.6584043",
"0.6584043",
"0.65468717",
"0.6441516",
"0.63742745",
"0.62788",
"0.6275367",
"0.62519586",
"0.6180144",
"0.61524653",
"0.6144712",
"0.5994668",
"0.5881517",
"0.5686179",
"0.5635909... | 0.7985471 | 1 |
Just extends the default reaction_check to use owner_ids | def reaction_check(self, payload):
if payload.message_id != self.message.id:
return False
if payload.user_id not in (*self.bot.owner_ids, self._author_id):
return False
return payload.emoji in self.buttons | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def owner(c, m):\n if not m.id in ids:\n await c.send('You must be an owner to use this command.')\n raise Exception()\n return True",
"async def cog_check(self, ctx:utils.Context):\n\n if ctx.author.id in self.bot.config['owners']:\n return True\n raise command... | [
"0.6081681",
"0.60427636",
"0.5522264",
"0.5521075",
"0.546714",
"0.54281026",
"0.539481",
"0.53263474",
"0.5270159",
"0.5203903",
"0.51887876",
"0.5171225",
"0.51699257",
"0.51359004",
"0.50977296",
"0.50574934",
"0.5050487",
"0.5009937",
"0.49913508",
"0.49794465",
"0.49767... | 0.60503805 | 1 |
go to the next page | async def go_to_next_page(self, payload):
await self.show_checked_page(self.current_page + 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def next_page(self):\n await self.checked_show_page(self.current_page + 1)",
"def next_page():\n\tprint('-> \\nClicking next page')\n\told_html = driver.find_element_by_tag_name('html').text\n\tlink = driver.find_element_by_xpath(XPATHS['next_page']) \n\tlink.click()\n\treturn wait_for(old_html)",
... | [
"0.78312886",
"0.77221954",
"0.76888263",
"0.76687986",
"0.7646403",
"0.7624802",
"0.7548946",
"0.7524892",
"0.7478211",
"0.7427636",
"0.7220601",
"0.7183752",
"0.70250136",
"0.70238024",
"0.7008027",
"0.6966757",
"0.69374335",
"0.69066745",
"0.69066745",
"0.67980814",
"0.679... | 0.77267194 | 1 |
go to the first page | async def go_to_first_page(self, payload):
await self.show_page(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def first_page(self):\n await self.show_page(1)",
"def get_first_page(self):\n return 1",
"def first_page(self):\n if self._start == 0:\n raise ValueError('Already at the first page.')\n self._start = 0",
"def test_first_page_passes(self):\n\n self.page.ope... | [
"0.8124453",
"0.757861",
"0.7448942",
"0.7334367",
"0.6904852",
"0.6837108",
"0.67754245",
"0.65908957",
"0.6514685",
"0.6514685",
"0.648985",
"0.63904554",
"0.6384999",
"0.6368812",
"0.6266762",
"0.6246366",
"0.61889887",
"0.6170708",
"0.61516196",
"0.6107086",
"0.6086522",
... | 0.82532895 | 0 |
Update the progress bar with the new amount (with min and max values set at initialization; if it is over or under, it takes the min or max value as a default. | def updateAmount(self, newAmount = 0):
if newAmount and self.starting_amount is None:
self.starting_amount = newAmount
self.starting_time = time.time()
if newAmount < self.min: newAmount = self.min
if newAmount > self.max: newAmount = self.max
self.prev_amount = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateAmount(self, newAmount=0):\n\n if newAmount <= self.min:\n newAmount = self.min\n if newAmount >= self.max:\n newAmount = self.max\n\n self.amount = newAmount\n\n # Figure out the new percent done, round to an integer\n diffFromMin = float(self.amo... | [
"0.81444263",
"0.8055253",
"0.80018425",
"0.74270576",
"0.70937634",
"0.70410943",
"0.70247483",
"0.7020443",
"0.7002356",
"0.6974016",
"0.69505423",
"0.68986005",
"0.684882",
"0.68441993",
"0.6825717",
"0.67352104",
"0.6724981",
"0.6724981",
"0.67151386",
"0.6707617",
"0.668... | 0.8072242 | 1 |
Updates the amount, and writes to stdout. Prints a carriage return first, so it will overwrite the current line in stdout. | def __call__(self, value):
self.updateAmount(value)
if self.progBar_last == self.progBar and self.comment==self.comment_last:
return
print '\r',
sys.stdout.write(self.prefix + str(self) + str(self.comment) + ' ')
sys.stdout.flush()
self.progBar_last = self.pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, value):\n\n print('\\r', end='')\n self.updateAmount(value)\n writec(str(self), self.color, self.style)\n sys.stdout.flush()",
"def update(self, value, every=1, suffix=''):\n if value % every == 0 or value >= self.max:\n self.update_amount(newAmoun... | [
"0.762545",
"0.6610195",
"0.6492391",
"0.64584005",
"0.6391145",
"0.6297665",
"0.6245245",
"0.61903924",
"0.6185342",
"0.6158732",
"0.61420435",
"0.6093406",
"0.6072768",
"0.6070518",
"0.59700406",
"0.5969873",
"0.59611136",
"0.5960584",
"0.5960584",
"0.5959093",
"0.59544796"... | 0.7512267 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.