query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
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
pin_out that writes to all pins in the port
def as_pin_out( self ): return _pin_out_from_port_out( self.as_port_out() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_output_pins(gpio_pi, pins):\n for pin in pins:\n gpio_pi.set_mode(pin, pigpio.OUTPUT)", "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\...
[ "0.71709764", "0.70465505", "0.64870757", "0.63452595", "0.63271827", "0.60583866", "0.6036965", "0.5992383", "0.59910786", "0.59280807", "0.59232086", "0.5853139", "0.5850353", "0.5772595", "0.57007766", "0.5698433", "0.5629161", "0.5624989", "0.5614748", "0.56102836", "0.56...
0.67650765
2
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
demo shows kitt display
def demo( self, interval: int = 200_000, iterations = None ) -> None: import godafoss.gf_pin_port_demos print( "port_out demo: kitt" ) godafoss.gf_pin_port_demos.kitt( self, interval = interval, iterations = iterations )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self) -> None:", "def show(self):", "def show_data():", "def show(self):\n pass", "def show(self):\n\n pass", "def should_show():", "def tftDisplay(libtft):\n tempMsg = getTemperature()\n print(\"%s\" % tempMsg)\n\n timeMsg = getTime()\n print(\"%s\" % timeMsg)\n\n ...
[ "0.63316137", "0.63038826", "0.63033175", "0.61862296", "0.6065349", "0.59661084", "0.59485614", "0.5922758", "0.58787566", "0.58072877", "0.5801849", "0.5801849", "0.5798121", "0.5739324", "0.5739324", "0.5739324", "0.5739324", "0.5734465", "0.57225084", "0.5717846", "0.5681...
0.5917347
8
Match pattern based on defined rules and received compute statistics
def get_pattern(flags: dict, input_tensors: list, output_tensors: list, tensor_list: list, tensor_map: dict): # If nothing matches, default pattern would be opaque pattern matched_pattern = OpPatternRecognizer._apply_pattern_rules(flags, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run():\n matching_terms = {'a', 'b'}\n source_counts = {'a': 10, 'b': 50, 'c': 25}\n target_counts = {'a': 4, 'b': 73, 'c': 15}\n source_chunk = ['a', 'b']\n target_chunk = ['a', 'c', 'b']\n source_distance = score.find_distance(\n matching_terms, source_chunk, source_counts)\n tar...
[ "0.6095742", "0.60096246", "0.5962735", "0.58151025", "0.5796939", "0.578615", "0.5762361", "0.57406014", "0.5712139", "0.5667876", "0.5647051", "0.5634473", "0.5610246", "0.5609339", "0.5603194", "0.55865884", "0.5541069", "0.5531322", "0.55265236", "0.55177", "0.55121946", ...
0.0
-1
Subroutine for applying special type rules
def apply_spec_rules(flags, input_tensors, output_tensors, tensor_list, tensor_map): matched_special_op = None for rule, target_pattern in OP_SPEC_RULES.items(): if matched_special_op is not None: break # One rule for multiple patterns if isinstance(ta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_type(self, value, schema_type, **kwargs):", "def _propagate_types(self):\n pass", "def _cast_types(args):\n\targs.x_val = None if args.x_val == 'None' else int(args.x_val)\n\targs.test_size = float(args.test_size)\n\targs.alpha = float(args.alpha)\n\targs.fit_prior = (args.fit_prior in ['True', ...
[ "0.6286985", "0.6221901", "0.62004143", "0.608138", "0.60503507", "0.5913506", "0.587129", "0.58575636", "0.5853704", "0.5821425", "0.5740827", "0.56813943", "0.5657443", "0.5623969", "0.56235874", "0.5619551", "0.56180817", "0.55545413", "0.55241966", "0.55051523", "0.549803...
0.0
-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
Get statistics of all compute tensors
def get_compute_statistics(cls, all_tensors): flags = { "total": {"count": 0, "tensors": []}, None: {"count": 0, "tensors": []}, "unknown": {"count": 0, "tensors": []}, } for index in OpFlags: index = index.value flags[index] = {"count"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_statistics(self):\n # log to file\n output_dir = self.params['output_dir']\n if not os.path.exists(output_dir):\n os.mkdir(output_dir)\n output_dir = os.path.join(output_dir, 'statistics.log')\n log = logging.getLogger('tensorflow')\n handle = logging.FileHandler(output_dir)\n ...
[ "0.6896035", "0.6734368", "0.6356326", "0.6356326", "0.6168476", "0.5995364", "0.5981508", "0.59488803", "0.59247106", "0.59044653", "0.5894307", "0.5865655", "0.5863105", "0.5845484", "0.5807434", "0.57744706", "0.5748653", "0.5732462", "0.5728341", "0.5724605", "0.57161015"...
0.6526259
2
Helper function for counting compute tensor flag
def count_flag(cls, flags: dict, flag: str, current_tensor: tvm.tensor.Tensor) -> None: # Always add 1 count for total_flag when there is a flag cls.add_flag(flags, "total", current_tensor) found_flag = False # Add 1 count for corresponding flag for key in flags: if f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_nonzero(tensor):\n raise NotImplementedError", "def get_compute_statistics(cls, all_tensors):\n flags = {\n \"total\": {\"count\": 0, \"tensors\": []},\n None: {\"count\": 0, \"tensors\": []},\n \"unknown\": {\"count\": 0, \"tensors\": []},\n }\n ...
[ "0.7164073", "0.65937597", "0.6221445", "0.6179423", "0.6086435", "0.59578943", "0.5864529", "0.5826228", "0.58197576", "0.58160955", "0.57890755", "0.5785489", "0.57764506", "0.57712066", "0.5752412", "0.57249606", "0.57245696", "0.57219183", "0.5675649", "0.56144977", "0.56...
0.5822157
8
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
The main solver function.
def isNumber(self, s): try: tmp = float(s) return True except: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n ...", "def main():\n # Instantiate the data problem.\n data = create_data_model()\n solve_cvrp(data)", "def solve(self, solver):\n solver.solve()", "def solve(self):\n pass", "def solve(self):\n pass", "def main():\n input_s...
[ "0.7355868", "0.728571", "0.7248974", "0.7179402", "0.70334715", "0.70334715", "0.70306325", "0.6999481", "0.6973416", "0.6939496", "0.69042695", "0.6881003", "0.6881003", "0.6881003", "0.6878449", "0.6875395", "0.6868447", "0.6842138", "0.67984587", "0.67931056", "0.66750985...
0.0
-1
Initialize a SimpleLogDispatcher instance.
def __init__(self, allow_none=False, excludes=None, request_types=None): self.funcs = {} self.instance = None self.allow_none = allow_none if excludes is None: self.excludes = [] else: self.excludes = excludes if request_types is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init():\n global logger\n logger = logging.getLogger(\"Log\")", "def __init__(self):\n\n self._logger = logging.getLogger(__name__)", "def __init__(self):\n\n self.__logger = logging.getLogger()\n\n formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: ' +\n ...
[ "0.69557637", "0.6704932", "0.66293734", "0.6602351", "0.6574081", "0.65642864", "0.650957", "0.6508366", "0.64980406", "0.6478567", "0.6454027", "0.644025", "0.64357096", "0.6422545", "0.64074576", "0.63940537", "0.6379964", "0.6357676", "0.634506", "0.63040847", "0.62802374...
0.0
-1
Register an instance of a class to dispatch to.
def register_instance(self, instance): self.instance = instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(cls):\n register(cls, cls.provided_class)", "def register(cls, class_):\n cls._registered[class_.tag()] = class_", "def register_class(cls):\n if cls is RegisteredType:\n raise \"Please do _not_ register RegisteredType!\"\n \n cid = RegisteredType....
[ "0.7980741", "0.7646988", "0.7239509", "0.7193919", "0.7167936", "0.6967461", "0.6834956", "0.681304", "0.67749226", "0.67427456", "0.67337704", "0.6691231", "0.66477597", "0.6646944", "0.65943336", "0.6586143", "0.65335065", "0.65229607", "0.65229607", "0.6480342", "0.645054...
0.64103204
22
Register a function to respond to Log requests. The optional name argument can be used to set a Unicode name for the function.
def register_function(self, function, name=None): if name is None: name = function.__name__ self.funcs[name] = function
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(name, func):\n WebSocketRouter.funcmap[name] = func", "def Register(self, name, fn):\n name = normalizeStr(name)\n Logger.Debug(\"Registering Formatter:\", name)\n self._formatters[name] = fn", "def register(name, fn=None):\n def _hook_add(func):\n if name not in _hooks:\...
[ "0.68627095", "0.6736186", "0.6606089", "0.62367135", "0.6040817", "0.60370785", "0.5956595", "0.5904946", "0.5886029", "0.5884976", "0.58757544", "0.587306", "0.5847061", "0.577952", "0.56742984", "0.5665378", "0.5657041", "0.56326526", "0.55729103", "0.55494535", "0.5543154...
0.6001361
6
Internal method to exclude certain types of log messages.
def _excludes(self, method, url): if method != 'GET': return False # maybe change to a dict? for excl in self.excludes: if excl == "topInfo" and "info.json" in url: return True if str(excl) + ".json" in url: return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testIgnoreMessage(self):\n\n self.logger.accept('c',self.logger.foo)\n self.logger.accept('c',self.logger.bar)\n self.logger.ignore('c')\n messager.send('c')\n # No methods should have been called.\n self.assertEqual(self.logger.log,[])", "def test_filter_messages_no...
[ "0.6682708", "0.6394851", "0.62242866", "0.6212891", "0.6151829", "0.60943025", "0.6036191", "0.6024305", "0.6001694", "0.5973105", "0.5924731", "0.5893811", "0.58637863", "0.5815056", "0.57359725", "0.57179654", "0.56997544", "0.56767374", "0.56477344", "0.56451577", "0.5638...
0.0
-1
Extract object count if any.
def _get_total_count(response_dict): try: return response_dict['total_count'] except KeyError: # bug return '0'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nsobj_to_extract(self):\n\n if len(self.sobjs_obj) > 0:\n return len(self.sobjs_obj) if self.return_negative else np.sum(self.sobjs_obj.sign > 0)\n else:\n return 0", "def count(self):\n return len(self.objects)", "def get_count_value(obj):\n # Passed None valu...
[ "0.6713019", "0.6572193", "0.6534952", "0.652695", "0.647242", "0.64505243", "0.6422198", "0.63887364", "0.63649666", "0.6347715", "0.6340477", "0.63076407", "0.6294354", "0.6275815", "0.6275815", "0.6275815", "0.6275815", "0.6273388", "0.6263004", "0.6239559", "0.6217316", ...
0.0
-1
Extract the respone if any.
def _get_response(**params): try: response = params['data']['response'] response_dict = json.loads(response) except KeyError: response = "None" response_dict = {} return response, response_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_response(self):\n pass", "def _parse_response(self, response):\n if response is not None:\n return response.string\n return response", "def get_response(self, response, pack):\n\n pass", "def process_response(self, response):\n return response", "def ...
[ "0.6913572", "0.6852424", "0.67195433", "0.6579594", "0.6576109", "0.6562072", "0.65063745", "0.64516217", "0.6436927", "0.6430862", "0.6403828", "0.64019436", "0.6380864", "0.6338252", "0.63095325", "0.6230811", "0.6230811", "0.6200445", "0.6186573", "0.6159366", "0.6139321"...
0.62089694
17
Extract the payload if any.
def _get_payload(self, method, **params): try: payload = params['data']['payload'] if self.prettyprint: payload = "\n" + json.dumps(json.loads(payload), indent=self.indent) except KeyError: payload = "N/A" if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_payload(self):\n if self.payload == '':\n return {}\n\n return json.loads(self.payload)", "def getPayload(self):\n return self.__payload", "def payload(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:\n return pulumi.get(self, \"payload\")", "de...
[ "0.7484761", "0.7033911", "0.6935318", "0.6856083", "0.6845236", "0.6844084", "0.67925775", "0.6787271", "0.6780884", "0.6638879", "0.6585124", "0.65445477", "0.64154", "0.63886696", "0.63759714", "0.6372858", "0.63373107", "0.62971956", "0.62667906", "0.62571067", "0.6253898...
0.61503696
23
Extract the HTTP method (verb).
def _get_method(**params): try: return params['data']['method'] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Method(self):\n if self._method is None:\n return \"GET\"\n if len(self._method) == 0:\n return \"GET\"\n return self._method", "def derive_http_method(method, data):\n d_method = method\n # Method not provided: Determine method from params\n if d_method is...
[ "0.7052383", "0.70282394", "0.69070685", "0.68064755", "0.6790538", "0.67193097", "0.66884536", "0.6649832", "0.6584823", "0.6567419", "0.65616393", "0.65538675", "0.6433594", "0.63127154", "0.6285363", "0.6224932", "0.614173", "0.61409837", "0.6097039", "0.6093583", "0.60785...
0.6191887
16
Exract the loglevel if any.
def _get_loglevel(self, **params): try: preamble = params['data']['preamble'] return self.loglevel[preamble.split(" ")[1]] except KeyError: return logging.DEBUG
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_level(self) -> str:\n return self._log_level", "def get_log_level(self) -> int:\n logging.debug(self.args)\n return getattr(logging, self.args.loglevel.upper(), None)", "def log_level(self) -> LogLevel:\n if self.is_quiet:\n return LogLevel.NONE\n return Lo...
[ "0.71440595", "0.7115335", "0.70547235", "0.7044677", "0.6965893", "0.689958", "0.6778168", "0.66731536", "0.6649942", "0.66494226", "0.6648323", "0.66457236", "0.66069865", "0.6597975", "0.6559364", "0.6517581", "0.6471883", "0.6426118", "0.63355327", "0.63347626", "0.630757...
0.6218874
30
Strip out the imdata.
def _strip_imdata(self, json_dict): if 'imdata' not in json_dict.keys(): return "None" if self.strip_imdata: # Yeah we knowingly return an invalid json string return self._pretty_print(json_dict['imdata']) else: return self._pretty_print(json_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip(self):\n result = library.MagickStripImage(self.wand)\n if not result:\n self.raise_exception()", "def strip_exif(self,img):\n data = list(img.getdata())\n image_without_exif = PIL.Image.new(img.mode, img.size)\n image_without_exif.putdata(data)\n re...
[ "0.7089703", "0.68966424", "0.6474587", "0.6422354", "0.6333561", "0.6311985", "0.62845373", "0.62800926", "0.62040955", "0.62040955", "0.6166882", "0.6166882", "0.616568", "0.6080322", "0.6010894", "0.59254485", "0.5836555", "0.5801532", "0.57980746", "0.57641506", "0.574886...
0.67127514
2
Pretty print the logging message.
def _pretty_print(self, json_dict): if self.prettyprint: return "\n" + json.dumps(json_dict, indent=self.indent) return json.dumps(json_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printer(message):\n if VERBOSITY:\n pprint(message)", "def format(self, record):\n message = record.getMessage()\n asctime = self.formatTime(record, self.datefmt)\n name = yellow(record.name)\n\n s = \"%(timestamp)s %(levelname)s %(name)s \" % {\n \"timestamp\...
[ "0.7030913", "0.70149416", "0.69856346", "0.6895858", "0.68126464", "0.67499876", "0.6710198", "0.6692776", "0.66856873", "0.66485876", "0.6586611", "0.65642756", "0.6531447", "0.65304494", "0.64997715", "0.64877", "0.6476526", "0.64417416", "0.64263153", "0.6415851", "0.6361...
0.0
-1
Initialize an instance of this class.
def __init__(self, request, client_address, server, app_name='SimpleAciUiLogServer'): # Instantiate the base class BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request, client_address, server) self._log_paths = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def initialize(self) -> None:\n pass", "def init(self) -> None:\n ...", "def initialize(self):\n pass", "def initialize(self):\n pass", "def initialize(self):\n pass", "de...
[ "0.82067156", "0.81032854", "0.7868342", "0.7867912", "0.7867912", "0.7867912", "0.7867912", "0.7867912", "0.78678274", "0.78678274", "0.78678274", "0.78678274", "0.78678274", "0.78678274", "0.78678274", "0.78678274", "0.78265774", "0.7810364", "0.7796368", "0.7796368", "0.77...
0.0
-1
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 get app_name.
def app_name(self): # pylint:disable=function-redefined return self._app_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_name(self):\n return self._app_name", "def get_app_name(self):\n return getattr(self, '_app_name', None)", "def app_name(self) -> str:\n return self._app_name", "def app_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"app_name\")", "def _get_app_n...
[ "0.8461145", "0.83975774", "0.8362276", "0.8137533", "0.80653477", "0.80430937", "0.794933", "0.7917377", "0.78962976", "0.77739835", "0.77739835", "0.75463516", "0.7408752", "0.7396903", "0.736828", "0.7339389", "0.7303341", "0.7224766", "0.7214806", "0.7214806", "0.7214806"...
0.83528364
3
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 GET requests. Simply returns a small amount of info so you can tell the server is functioning.
def do_GET(self): # pylint:disable=invalid-name if not self.is_log_path_valid(): self.report_404() return scheme = "https" if self.server.cert is not None else "http" resp = '<html>' resp += '<head>\n' resp += ' <title>{0}</title>\n'.format(self.app_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_GET(self):\n global st_point, cur_request\n if time.time() - st_point < 1 and cur_request > args.MAX_REQ:\n self.send_response(429)\n self.send_header(\"Content-type\",\"text/html\")\n self.end_headers()\n time.sleep(0.2)\n return\n ...
[ "0.73889714", "0.7278289", "0.7232613", "0.7217837", "0.71969336", "0.7042507", "0.6994154", "0.69575816", "0.6881604", "0.68778926", "0.67896116", "0.67402244", "0.67303276", "0.6704588", "0.6696467", "0.66956717", "0.66331416", "0.6630781", "0.6592124", "0.6591389", "0.6586...
0.6411807
42
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
Decode the request content based on contenttype.
def decode_request_content(self, datafile): content_type = self.headers.get("Content-Type", "notype").lower() if 'application/x-www-form-urlencoded' in content_type: # The data is provided in a urlencoded format. Unencode it into # cgi FieldStorage/MiniFieldStorage objects in a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decoder(self, contentType, decoder):\n pass", "def decode_content(request):\n # print(request.content)\n decoded = request.content.decode('utf8')\n return json.loads(decoded)", "def decode_input_data(self, rawdata):\n return self.get_content_type().loads(rawdata, self)", "def from_...
[ "0.7089273", "0.6995105", "0.66544175", "0.6479413", "0.6451445", "0.6285152", "0.5958153", "0.5880995", "0.58419335", "0.5821185", "0.57807356", "0.57744586", "0.57322174", "0.5710194", "0.56627536", "0.56613815", "0.5646299", "0.56304824", "0.56280833", "0.5624702", "0.5605...
0.65679413
3
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
Selectively log an accepted request.
def log_request(self, code='-', size='-'): if self.server.log_requests: BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_request(self):\n log = self.server.log\n if log:\n if hasattr(log, \"info\"):\n log.info(self.format_request() + '\\n')\n else:\n log.write(self.format_request() + '\\n')", "def log_request(self, r):\n\n token = r.headers.get(self.header, None)\n r.token = token\n ...
[ "0.6384393", "0.6187195", "0.6067121", "0.5983546", "0.59761465", "0.59761465", "0.59761465", "0.592563", "0.589417", "0.58253133", "0.5776788", "0.57753474", "0.57748187", "0.5764546", "0.5634329", "0.55829906", "0.55825245", "0.55383056", "0.5465083", "0.5452275", "0.544527...
0.6145024
2
Initialize an instance of this class.
def __init__(self, addr, cert=None, request_handler=SimpleLogRequestHandler, log_requests=False, allow_none=False, bind_and_activate=True, location=None, excludes=None, app_name='SimpleAciUiLogServer', request_types=None): self.log_requests = l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def initialize(self) -> None:\n pass", "def init(self) -> None:\n ...", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n ...
[ "0.82068706", "0.8102939", "0.7868248", "0.78676504", "0.78676504", "0.78676504", "0.78676504", "0.78676504", "0.78676504", "0.78676504", "0.78676504", "0.7867509", "0.7867509", "0.7867509", "0.7867509", "0.7867509", "0.78263575", "0.7810427", "0.7795919", "0.7795919", "0.777...
0.0
-1
The name of the file containing the server certificate for https.
def cert(self): return self._cert
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cert_file(self):\n return self._get('cert_file')", "def server_certificate(self) -> Optional[str]:\n return pulumi.get(self, \"server_certificate\")", "def get_ssl_certificate():", "def get_ssl_certificate() :", "def certificate(self) -> str:\n return pulumi.get(self, \"certificate...
[ "0.7533781", "0.71045476", "0.70616204", "0.69438076", "0.6773122", "0.66809416", "0.6613291", "0.6600827", "0.65371007", "0.65245694", "0.6502903", "0.6497274", "0.64818394", "0.64485586", "0.6386614", "0.6386614", "0.63321996", "0.6331141", "0.62976456", "0.62976456", "0.62...
0.57537544
50
Set the name of the file with the server certificate for https.
def cert(self, value): self._cert = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setCertfile(self, certfile):\r\n if not os.access(certfile, os.R_OK):\r\n raise IOError('No such certfile found: %s' % (certfile))\r\n self.certfile = certfile", "def https_download_file(**data):\n import os\n import requests\n\n ##minimal data inputs payload\n server_url = data.get('s...
[ "0.6518484", "0.6161404", "0.59017366", "0.579723", "0.5749973", "0.5722308", "0.569965", "0.56470346", "0.56323254", "0.56177276", "0.5610678", "0.55645514", "0.5522693", "0.5518055", "0.5510998", "0.54869485", "0.5461296", "0.54565024", "0.54525274", "0.54438835", "0.540760...
0.57965386
4
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
The main function for when this is run as a standalone script.
def main(): # This is used to store the certificate filename cert = "" # Setup a signal handler to catch control-c and clean up the cert temp file # No way to catch sigkill so try not to do that. # noinspection PyUnusedLocal def sigint_handler(sig, frame): # pylint:disable=unused-argument ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n return", "def main():\n pass", "def main() -> None:", "def main() -> None:", "def main() -> None:", "def main() -> None:", "def main():\n\tpass", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():...
[ "0.8493333", "0.8449836", "0.83411217", "0.83411217", "0.83411217", "0.83411217", "0.82505375", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", "0.82460314", ...
0.0
-1
Send the confirmation/welcome email to an invited user.
def do_send_confirmation_email( invitee: PreregistrationUser, referrer: UserProfile, email_language: str, invite_expires_in_minutes: Union[Optional[int], UnspecifiedValue] = UnspecifiedValue(), ) -> str: activation_url = create_confirmation_link( invitee, Confirmation.INVITATION, validity_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invite_user(request):\n moderator = request.user\n site = get_current_site(request)\n\n invitation_form = InviteMemberForm(request.POST)\n\n if invitation_form.is_valid():\n\n # Invite user\n full_name = invitation_form.cleaned_data['full_name']\n email = invitation_form.cleane...
[ "0.7346516", "0.72446835", "0.70171934", "0.6960602", "0.6957098", "0.6936659", "0.6883166", "0.6844213", "0.68284136", "0.67969984", "0.67891234", "0.67865217", "0.67692316", "0.6737126", "0.6736438", "0.66549635", "0.66490686", "0.66337293", "0.6633354", "0.66317874", "0.66...
0.60488564
94
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
Discourage using invitation emails as a vector for carrying spam.
def check_invite_limit(realm: Realm, num_invitees: int) -> None: msg = _( "To protect users, Zulip limits the number of invitations you can send in one day. Because you have reached the limit, no invitations were sent." ) if not settings.OPEN_REALM_CREATION: return if too_many_recent_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invite(self):\n pass", "def _filter_emails(emails):\n rv = []\n for email in emails:\n if _email_is_valid(email):\n rv.append(email)\n else:\n print 'WARNING: Not including %s (invalid email address)' % email\n return rv", "def get_available_invitees(self):\n return User.ob...
[ "0.57805264", "0.56573284", "0.5645649", "0.5603723", "0.55701005", "0.5520039", "0.54536515", "0.5433694", "0.54287547", "0.5418697", "0.53886265", "0.5381524", "0.53247523", "0.5281892", "0.5274612", "0.5257942", "0.5215694", "0.5215694", "0.5196725", "0.5179037", "0.516948...
0.0
-1
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
Checks whether word contains three consecutive doubleletter pairs.
def trifeca(word): if not word: return False for i in range(len(word)-1): if word[i]==word[i+1]: if len(word[i:])>=6: if word[i+2:i+6:2]==word[i+3:i+7:2]: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trifeca(word: str):\n last_letter = 'None'\n last_pair_matched = False\n consecutive_matching_pairs = 0\n\n for letter in word:\n if last_pair_matched:\n last_pair_matched = False\n last_letter = letter\n continue\n\n if letter == last_letter:\n ...
[ "0.7556592", "0.705484", "0.6772493", "0.66988", "0.66352355", "0.65096456", "0.6502828", "0.6489176", "0.6477368", "0.63907564", "0.63808095", "0.637711", "0.6303629", "0.6271563", "0.61748374", "0.61593944", "0.6158387", "0.6144913", "0.61036396", "0.60967505", "0.6096466",...
0.64603686
9
Start the Home Assistant HTTP component and return admin API client.
def mock_api_client( hass: HomeAssistant, hass_client: ClientSessionGenerator ) -> TestClient: hass.loop.run_until_complete(async_setup_component(hass, "api", {})) return hass.loop.run_until_complete(hass_client())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def __aenter__(self) -> \"HomeAssistantClient\":\n await self.connect()\n return self", "def cli(app, aiohttp_client):\n return asyncio.get_event_loop().run_until_complete(aiohttp_client(app.app))", "async def http_client(hass, hass_client_no_auth):\n await async_setup_component(hass,...
[ "0.64852047", "0.6091075", "0.6078906", "0.6062346", "0.59045804", "0.5802906", "0.57973075", "0.5742165", "0.571525", "0.57074326", "0.56535375", "0.562704", "0.56203413", "0.5612875", "0.5592464", "0.55758375", "0.55468106", "0.5520453", "0.551271", "0.55102605", "0.5498594...
0.55593723
16
Test if the debug interface allows us to list state entities.
async def test_api_list_state_entities( hass: HomeAssistant, mock_api_client: TestClient ) -> None: hass.states.async_set("test.entity", "hello") resp = await mock_api_client.get(const.URL_API_STATES) assert resp.status == HTTPStatus.OK json = await resp.json() remote_data = [ha.State.from_dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_state_list(self):\n\n mdp = MDP(5)\n state_list = mdp.get_state_list()\n\n self.assertEqual(len(state_list), 5)\n self.assertIn(mdp.get_state(0), state_list)", "def debug(state: bool, /) -> None:", "def show_state(self):\n print \"I don't know how to show_state.\...
[ "0.6574203", "0.6460083", "0.62203425", "0.6094165", "0.6055538", "0.6005429", "0.5935319", "0.5912842", "0.5896857", "0.5833285", "0.5820093", "0.580224", "0.5737685", "0.5700505", "0.56887746", "0.567879", "0.5656275", "0.5637772", "0.5633697", "0.56263274", "0.56079036", ...
0.5850946
9
Test if the debug interface allows us to get a state.
async def test_api_get_state(hass: HomeAssistant, mock_api_client: TestClient) -> None: hass.states.async_set("hello.world", "nice", {"attr": 1}) resp = await mock_api_client.get("/api/states/hello.world") assert resp.status == HTTPStatus.OK json = await resp.json() data = ha.State.from_dict(json) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(state: bool, /) -> None:", "def check_state(self):\n pass", "def check_device_state(self):", "def debug() -> bool:", "def the_user_should_be_able_to_get_the_state_of_the_connected_device():\n assert web_app.get_state()", "def is_debug(cls):\n return Traceable.debug & cls.DEBUG_...
[ "0.7322186", "0.7189192", "0.68020886", "0.6783162", "0.6779971", "0.6604574", "0.6580698", "0.65648186", "0.6502661", "0.64612377", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314", "0.638314...
0.0
-1
Test if the debug interface allows us to get a state.
async def test_api_get_non_existing_state( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.get("/api/states/does_not_exist") assert resp.status == HTTPStatus.NOT_FOUND
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(state: bool, /) -> None:", "def check_state(self):\n pass", "def check_device_state(self):", "def debug() -> bool:", "def the_user_should_be_able_to_get_the_state_of_the_connected_device():\n assert web_app.get_state()", "def is_debug(cls):\n return Traceable.debug & cls.DEBUG_...
[ "0.73237354", "0.7188738", "0.68014824", "0.6784864", "0.67794186", "0.66067964", "0.65804076", "0.6565692", "0.6502905", "0.646327", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0.63838094", "0...
0.0
-1
Test if we can change the state of an entity that exists.
async def test_api_state_change( hass: HomeAssistant, mock_api_client: TestClient ) -> None: hass.states.async_set("test.test", "not_to_be_set") await mock_api_client.post( "/api/states/test.test", json={"state": "debug_state_change2"} ) assert hass.states.get("test.test").state == "debug_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_state(self):\n pass", "def has_state_changed(self) -> bool:\r\n ...", "def is_valid_entity(self):\n return is_correct_cve_id(self.cve_id)", "async def test_api_state_change_of_non_existing_entity(\n hass: HomeAssistant, mock_api_client: TestClient\n) -> None:\n new_state ...
[ "0.6272142", "0.6245097", "0.6229423", "0.61476076", "0.6133624", "0.6095802", "0.6083134", "0.604094", "0.60329086", "0.60262144", "0.6024133", "0.6012543", "0.6009684", "0.59483826", "0.59457284", "0.59387285", "0.5935351", "0.5893522", "0.5865597", "0.5863711", "0.5813628"...
0.0
-1
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
Test if API sends appropriate error if we omit state.
async def test_api_state_change_with_bad_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.post( "/api/states/test_entity.that_does_not_exist", json={} ) assert resp.status == HTTPStatus.BAD_REQUEST
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_error(self):\r\n if self.status not in [STATUS_CODES['200'], ]:\r\n return True\r\n else:\r\n return False", "def _is_error_call(self, response):\n status = response.get('ResponseMetadata', {}).get('HTTPStatusCode')\n return status != 200", "def has_erro...
[ "0.6947443", "0.68729424", "0.6809689", "0.6797115", "0.6565347", "0.6531123", "0.6476586", "0.6476586", "0.6458344", "0.6451989", "0.6386208", "0.6346179", "0.6337888", "0.63098246", "0.6309757", "0.6283707", "0.6283667", "0.62418073", "0.62130076", "0.6201532", "0.61972225"...
0.6219101
18
Test if changing a state to a zero value is possible.
async def test_api_state_change_to_zero_value( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.post( "/api/states/test_entity.with_zero_state", json={"state": 0} ) assert resp.status == HTTPStatus.CREATED resp = await mock_api_client.post( "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_zero(self) -> bool:\n return self.field.zero == self", "def isZero(self):\n\t\treturn (self.p.isZero() & (self.q.isZero() == False))", "def is_zero(self, a):\n return not a", "def is_zero(self):\n return (self._num == 0)", "def is_zero(self):\n return self._express.is_zer...
[ "0.73544365", "0.7302472", "0.725837", "0.72285306", "0.71520877", "0.71436054", "0.7125217", "0.70954514", "0.708613", "0.7013169", "0.69824266", "0.69645005", "0.68737406", "0.68569106", "0.6801159", "0.67818016", "0.67705464", "0.67519456", "0.67096674", "0.6701111", "0.66...
0.0
-1
Test if we can push a change the state of an entity.
async def test_api_state_change_push( hass: HomeAssistant, mock_api_client: TestClient ) -> None: hass.states.async_set("test.test", "not_to_be_set") events = [] @ha.callback def event_listener(event): """Track events.""" events.append(event) hass.bus.async_listen(const.EVENT_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_state_changed(self) -> bool:\r\n ...", "def can_push(self) -> bool:\n return pulumi.get(self, \"can_push\")", "def can_be_modified(self):\n return self.state in {RequestState.pending, RequestState.accepted}", "def _autooff_changed(hass, entity_id=None, old_state=None, new_state=N...
[ "0.6654253", "0.62165374", "0.6056892", "0.5994065", "0.5990612", "0.5975458", "0.5970863", "0.59675306", "0.5931621", "0.59310573", "0.59257734", "0.5877497", "0.58769673", "0.5869271", "0.58513653", "0.5836437", "0.5801779", "0.5800511", "0.57824856", "0.5730898", "0.572208...
0.56942177
21
Test if the API allows us to fire an event.
async def test_api_fire_event_with_no_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: test_value = [] @ha.callback def listener(event): """Record that our event got called.""" test_value.append(1) hass.bus.async_listen_once("test.event_no_data", listener) awa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if self.what is None or event[\"target\"].startswith(self.what):\n return self.check(event)\n return False", "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if ...
[ "0.7078661", "0.6811742", "0.6658277", "0.6658277", "0.663849", "0.6378422", "0.63174886", "0.6300776", "0.62677115", "0.6261805", "0.6175138", "0.6154928", "0.6135001", "0.6112835", "0.61021614", "0.60935235", "0.60606897", "0.60437214", "0.6023821", "0.59878063", "0.5985215...
0.60393673
18
Record that our event got called.
def listener(event): test_value.append(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def triggered(self, *args, **kwargs): # real signature unknown\...
[ "0.70488125", "0.70488125", "0.6987602", "0.6711975", "0.6679374", "0.6630713", "0.66146904", "0.6530911", "0.6490194", "0.64609766", "0.6438264", "0.6413929", "0.63906115", "0.63716", "0.6326286", "0.63204086", "0.6314542", "0.631316", "0.6298612", "0.6276354", "0.6261436", ...
0.0
-1
Test if the API allows us to fire an event.
async def test_api_fire_event_with_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: test_value = [] @ha.callback def listener(event): """Record that our event got called. Also test if our data came through. """ if "test" in event.data: test_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if self.what is None or event[\"target\"].startswith(self.what):\n return self.check(event)\n return False", "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if ...
[ "0.7078681", "0.681177", "0.6658306", "0.6658306", "0.66385067", "0.63784355", "0.63174945", "0.6300821", "0.6267716", "0.6261865", "0.6175192", "0.61549485", "0.61350137", "0.61128575", "0.61022013", "0.60935706", "0.60607207", "0.6043776", "0.60393953", "0.60238796", "0.598...
0.5839056
28
Record that our event got called. Also test if our data came through.
def listener(event): if "test" in event.data: test_value.append(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def assert_called_anytime(self, method, url, data=None):\n ...
[ "0.63981915", "0.63981915", "0.63950586", "0.62338215", "0.62021124", "0.61751497", "0.607658", "0.5977161", "0.5896857", "0.58755517", "0.5850053", "0.58485335", "0.5837642", "0.5802658", "0.57939035", "0.57848406", "0.57622004", "0.5727332", "0.57091814", "0.57081497", "0.5...
0.0
-1
Test if the API allows us to fire an event.
async def test_api_fire_event_with_invalid_json( hass: HomeAssistant, mock_api_client: TestClient ) -> None: test_value = [] @ha.callback def listener(event): """Record that our event got called.""" test_value.append(1) hass.bus.async_listen_once("test_event_bad_data", listener) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if self.what is None or event[\"target\"].startswith(self.what):\n return self.check(event)\n return False", "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if ...
[ "0.7078661", "0.6811742", "0.6658277", "0.6658277", "0.663849", "0.6378422", "0.63174886", "0.6300776", "0.62677115", "0.6261805", "0.6175138", "0.6154928", "0.6135001", "0.6112835", "0.61021614", "0.60935235", "0.60606897", "0.60437214", "0.60393673", "0.6023821", "0.5987806...
0.5631213
68
Record that our event got called.
def listener(event): test_value.append(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def triggered(self, *args, **kwargs): # real signature unknown\...
[ "0.70488125", "0.70488125", "0.6987602", "0.6711975", "0.6679374", "0.6630713", "0.66146904", "0.6530911", "0.6490194", "0.64609766", "0.6438264", "0.6413929", "0.63906115", "0.63716", "0.6326286", "0.63204086", "0.6314542", "0.631316", "0.6298612", "0.6276354", "0.6261436", ...
0.0
-1
Test the return of the configuration.
async def test_api_get_config(hass: HomeAssistant, mock_api_client: TestClient) -> None: resp = await mock_api_client.get(const.URL_API_CONFIG) result = await resp.json() if "components" in result: result["components"] = set(result["components"]) if "whitelist_external_dirs" in result: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testConfigA(self):\n assert type(self.config) == dict, \"Read setting not returning a dictionary\"", "def _check_config(self):", "def test_configuration():\n config = Configuration()\n\n assert config.relay_pin is not None\n assert config.relay_pin >= 1\n assert config.relay_pin < 32\n ...
[ "0.76809233", "0.75791967", "0.74060875", "0.7401545", "0.7348508", "0.7253645", "0.7249849", "0.7228827", "0.7214926", "0.7179758", "0.71722007", "0.71161145", "0.71161145", "0.7108384", "0.7052856", "0.7030907", "0.7020463", "0.70155704", "0.7000886", "0.6932396", "0.692440...
0.64652145
67
Test the return of the components.
async def test_api_get_components( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.get(const.URL_API_COMPONENTS) result = await resp.json() assert set(result) == hass.config.components
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_component_list_ok(self):\n test_name = sys._getframe().f_code.co_name\n rv, output = self._execute('component list')\n self.assertEqual(0, rv)\n self.assertEqual(self.expected_results[test_name], output)", "def test_composition(self):", "def test_get_all_components(self):\n...
[ "0.6529114", "0.6077653", "0.6051078", "0.60256225", "0.59000653", "0.58989006", "0.58737195", "0.5864722", "0.585767", "0.5843915", "0.58260304", "0.5813778", "0.5773243", "0.57410634", "0.5653366", "0.56521636", "0.56510806", "0.5649441", "0.5649441", "0.5649441", "0.564944...
0.5352933
53
Test if we can get the list of events being listened for.
async def test_api_get_event_listeners( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.get(const.URL_API_EVENTS) data = await resp.json() local = hass.bus.async_listeners() for event in data: assert local.pop(event["event"]) == event["listener_coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event_list(self):\n pass", "def get_events(self):\n raise NotImplementedError", "def get_events(self):\n raise NotImplementedError", "def test_get_future_events(self):\n events = list(get_future_events())\n self.assertFalse(self.event_show1 in events)\n self....
[ "0.64899856", "0.6463681", "0.6463681", "0.6413326", "0.6376308", "0.63585865", "0.62744266", "0.6264869", "0.6228048", "0.6218273", "0.62029094", "0.6186927", "0.6180026", "0.6177452", "0.6176952", "0.61591804", "0.6148188", "0.6123882", "0.6061121", "0.603588", "0.6006439",...
0.64514524
3
Test if we can get a dict describing current services.
async def test_api_get_services( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.get(const.URL_API_SERVICES) data = await resp.json() local_services = hass.services.async_services() for serv_domain in data: local = local_services.pop(serv_domain["dom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _interesting_service(self, service: UpnpService) -> bool:\n service_type = service.service_type\n for service_types in self._SERVICE_TYPES.values():\n if service_type in service_types:\n return True\n\n return False", "def services(self) -> dict:\n return...
[ "0.64857364", "0.6413068", "0.6388093", "0.6225563", "0.61463857", "0.60966164", "0.6071297", "0.60499305", "0.5920541", "0.5881162", "0.5875727", "0.587004", "0.5850691", "0.5831912", "0.582195", "0.58088654", "0.5768645", "0.5746575", "0.5703557", "0.5699636", "0.5689888", ...
0.0
-1
Test if the API allows us to call a service.
async def test_api_call_service_no_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: test_value = [] @ha.callback def listener(service_call): """Record that our service got called.""" test_value.append(1) hass.services.async_register("test_domain", "test_service", l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoint_checker(url):\r\n if \"/arcgis/rest/services/\" and \"http\" in url:\r\n return True\r\n return False", "def test_api() -> bool:\r\n weather = False\r\n news = False\r\n covid = False\r\n if check_weather_version():\r\n logging.info(\"Weather API version i...
[ "0.6796046", "0.66621816", "0.65645784", "0.63419425", "0.6311406", "0.62949586", "0.62937754", "0.6259988", "0.62543386", "0.6220343", "0.62065935", "0.6206094", "0.61166227", "0.60882765", "0.6078033", "0.605715", "0.6048589", "0.604552", "0.6026452", "0.6026075", "0.602205...
0.55383754
87
Record that our service got called.
def listener(service_call): test_value.append(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triggered(self, *args, **kwargs): # real signature unknown\n pass", "def ServiceRequest(self):\n #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n pass", "def call(self, service, method, *args, **kwargs):\r\n start_time = time.time()\r\n result = ...
[ "0.62560964", "0.62399894", "0.61851966", "0.6035071", "0.6034497", "0.5820293", "0.5803535", "0.5747034", "0.57437754", "0.57354355", "0.5735068", "0.5715279", "0.5697639", "0.5684586", "0.5654761", "0.56509763", "0.5649211", "0.56485033", "0.5629041", "0.56265867", "0.56167...
0.61733574
3
Test if the API allows us to call a service.
async def test_api_call_service_with_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: @ha.callback def listener(service_call): """Record that our service got called. Also test if our data came through. """ hass.states.async_set( "test.data", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endpoint_checker(url):\r\n if \"/arcgis/rest/services/\" and \"http\" in url:\r\n return True\r\n return False", "def test_api() -> bool:\r\n weather = False\r\n news = False\r\n covid = False\r\n if check_weather_version():\r\n logging.info(\"Weather API version i...
[ "0.6795414", "0.6660291", "0.6564897", "0.6343904", "0.63125986", "0.6296138", "0.62948835", "0.62585366", "0.6253355", "0.62215495", "0.6207503", "0.62065345", "0.61150044", "0.60889614", "0.60785234", "0.6057026", "0.6048772", "0.6047114", "0.6027905", "0.60264635", "0.6022...
0.0
-1
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
Test the template API.
async def test_api_template(hass: HomeAssistant, mock_api_client: TestClient) -> None: hass.states.async_set("sensor.temperature", 10) resp = await mock_api_client.post( const.URL_API_TEMPLATE, json={"template": "{{ states.sensor.temperature.state }}"}, ) body = await resp.text() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_template_registration(self):\n pass", "def test_register_template(self):\n pass", "def test_template(self):\n\t\tself.assertTemplateUsed(self.resp, 'inicio.html')", "def test_template_feedback(self):\r\n pass", "def test_for_template(self):\n self.assertTemplat...
[ "0.77860975", "0.7640018", "0.75893956", "0.7576103", "0.75753534", "0.7515661", "0.75010586", "0.7365211", "0.73511386", "0.73266435", "0.72547156", "0.7207143", "0.7191492", "0.7191492", "0.7182878", "0.7055612", "0.70468473", "0.70328164", "0.6962909", "0.6951614", "0.6930...
0.6746616
32
Test the template API uses the cache.
async def test_api_template_cached( hass: HomeAssistant, mock_api_client: TestClient ) -> None: hass.states.async_set("sensor.temperature", 30) resp = await mock_api_client.post( const.URL_API_TEMPLATE, json={"template": "{{ states.sensor.temperature.state }}"}, ) body = await resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_local_cache():", "def test_cachefile_timestamp(self):\n data = EngineTest.testdata['test_cachefile']\n filenames = { 'layout': 'layout.pyhtml',\n 'page': 'account_create.pyhtml',\n 'form': 'account_form.pyhtml',\n }\n expe...
[ "0.7599137", "0.7276855", "0.7250283", "0.7121943", "0.7078639", "0.7060426", "0.70337284", "0.69873226", "0.69096833", "0.6794", "0.6771127", "0.67327815", "0.6670481", "0.6644663", "0.66326296", "0.6625457", "0.65670365", "0.6564156", "0.65619534", "0.6502899", "0.64912176"...
0.7137182
3
Test the template API.
async def test_api_template_error( hass: HomeAssistant, mock_api_client: TestClient ) -> None: hass.states.async_set("sensor.temperature", 10) resp = await mock_api_client.post( const.URL_API_TEMPLATE, json={"template": "{{ states.sensor.temperature.state"} ) assert resp.status == HTTPStat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieve_template_registration(self):\n pass", "def test_register_template(self):\n pass", "def test_template(self):\n\t\tself.assertTemplateUsed(self.resp, 'inicio.html')", "def test_template_feedback(self):\r\n pass", "def test_for_template(self):\n self.assertTemplat...
[ "0.77860975", "0.7640018", "0.75893956", "0.7576103", "0.75753534", "0.7515661", "0.75010586", "0.7365211", "0.73511386", "0.73266435", "0.72547156", "0.7207143", "0.7191492", "0.7191492", "0.7182878", "0.7055612", "0.70468473", "0.70328164", "0.6962909", "0.6951614", "0.6930...
0.65245914
55
Test the stream with restrictions.
async def test_stream_with_restricted( hass: HomeAssistant, mock_api_client: TestClient ) -> None: listen_count = _listen_count(hass) async with mock_api_client.get( f"{const.URL_API_STREAM}?restrict=test_event1,test_event3" ) as resp: assert resp.status == HTTPStatus.OK assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_streamable_subset(self):\n test_streamable_subset = False\n self.encoder._streamable_subset = test_streamable_subset\n self.assertEqual(self.encoder._streamable_subset, test_streamable_subset)", "def test_filter_function_all(self):\n self.es.register_filter(lambda x: True)\n ...
[ "0.65520847", "0.6385943", "0.6325205", "0.6317599", "0.62494093", "0.6177195", "0.6152619", "0.6062861", "0.60211027", "0.5995325", "0.59317195", "0.5822987", "0.58160114", "0.5762135", "0.5748843", "0.5702336", "0.5684151", "0.5595042", "0.5562813", "0.55497056", "0.5519421...
0.6308531
4
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 if we can fetch the error log.
async def test_api_error_log( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, hass_access_token: str, hass_admin_user: MockUser, ) -> None: hass.data[DATA_LOGGING] = "/some/path" await async_setup_component(hass, "api", {}) client = await hass_client_no_auth() resp = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_error_logs(self) -> bool:\n return pulumi.get(self, \"has_error_logs\")", "def has_error_logs(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"has_error_logs\")", "def has_errors(self) -> bool:", "def has_error(self):\n return self.error_found", "def has_faile...
[ "0.69528687", "0.6531575", "0.6395395", "0.6366534", "0.6256981", "0.622726", "0.6196494", "0.6188434", "0.61860985", "0.6116959", "0.6086877", "0.6033813", "0.60293216", "0.60204464", "0.5997344", "0.5991288", "0.5936558", "0.5929602", "0.5929434", "0.5910955", "0.5904339", ...
0.0
-1
Test if the API sets right context if we fire an event.
async def test_api_fire_event_context( hass: HomeAssistant, mock_api_client: TestClient, hass_access_token: str ) -> None: test_value = [] @ha.callback def listener(event): """Record that our event got called.""" test_value.append(event) hass.bus.async_listen("test.event", listener...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_status(self):\n pass", "def event_trigger(self, event):\n if event[\"event\"] == self.event:\n if self.what is None or event[\"target\"].startswith(self.what):\n return self.check(event)\n return False", "def event_trigger(self, event):\n if...
[ "0.6673849", "0.6567953", "0.6534089", "0.64921856", "0.63481665", "0.63481665", "0.6292587", "0.60812914", "0.60683197", "0.59510434", "0.5950629", "0.5919154", "0.5887884", "0.5876921", "0.5871695", "0.5846271", "0.5842258", "0.58224624", "0.58122146", "0.57996994", "0.5787...
0.5865485
15
Record that our event got called.
def listener(event): test_value.append(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def _event_receiver_side_effect(self, **kwargs): # pylint: disable=unused-argument\n self.receiver_called = True", "def triggered(self, *args, **kwargs): # real signature unknown\...
[ "0.7048756", "0.7048756", "0.698899", "0.6710765", "0.6679385", "0.6631265", "0.66151863", "0.6531444", "0.6490601", "0.64618206", "0.64384365", "0.6414328", "0.6390434", "0.6372296", "0.63255787", "0.6319641", "0.63146585", "0.6313117", "0.6298507", "0.62772787", "0.6261497"...
0.0
-1
Test if the API sets right context if we call a service.
async def test_api_call_service_context( hass: HomeAssistant, mock_api_client: TestClient, hass_access_token: str ) -> None: calls = async_mock_service(hass, "test_domain", "test_service") await mock_api_client.post( "/api/services/test_domain/test_service", headers={"authorization": f"Bear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _interesting_service(self, service: UpnpService) -> bool:\n service_type = service.service_type\n for service_types in self._SERVICE_TYPES.values():\n if service_type in service_types:\n return True\n\n return False", "def definition_of_services(self):\r\n ...
[ "0.6217192", "0.6176133", "0.6109094", "0.6087708", "0.60536885", "0.60228515", "0.5990126", "0.59593415", "0.5884003", "0.58795464", "0.58774424", "0.5848794", "0.5834352", "0.5814947", "0.57703525", "0.57098377", "0.5703472", "0.56996286", "0.5693392", "0.56808573", "0.5673...
0.58326364
13
Test if the API sets right context if we set state.
async def test_api_set_state_context( hass: HomeAssistant, mock_api_client: TestClient, hass_access_token: str ) -> None: await mock_api_client.post( "/api/states/light.kitchen", json={"state": "on"}, headers={"authorization": f"Bearer {hass_access_token}"}, ) refresh_token = aw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_request_context():\n from .application import Nereid\n\n return base_has_request_context() and \\\n isinstance(current_app._get_current_object(), Nereid)", "def __contains__(self, context):\n return context in self._contexts", "def check(self, context):\r\n return context.con...
[ "0.6379644", "0.6352101", "0.63459224", "0.62915343", "0.62915343", "0.62495375", "0.6237255", "0.622001", "0.6192893", "0.6192893", "0.6192893", "0.61657304", "0.6156559", "0.6144987", "0.61240023", "0.6110126", "0.6103588", "0.6019762", "0.5976787", "0.5959065", "0.5953793"...
0.5891592
26
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 updating state requires admin.
async def test_post_entity_state_admin( hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser ) -> None: hass_admin_user.groups = [] resp = await mock_api_client.post("/api/states/light.test") assert resp.status == HTTPStatus.UNAUTHORIZED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_state(self):\n pass", "def test_update_state2(self):\n pass", "def test_update_state1(self):\n pass", "def test_admin(self):\n assert(admin)", "def test_user_can_change_admin(self):\n self.assertTrue(self.story.user_can_change(self.admin_user))", "def te...
[ "0.75592774", "0.7341695", "0.73291236", "0.7311905", "0.7273735", "0.7233075", "0.72269845", "0.71967006", "0.7125841", "0.71137804", "0.71137804", "0.71137804", "0.70864534", "0.70577294", "0.7054079", "0.70386183", "0.7027657", "0.7020549", "0.6964108", "0.68992627", "0.68...
0.6683857
34
Test deleting entity requires admin.
async def test_delete_entity_state_admin( hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser ) -> None: hass_admin_user.groups = [] resp = await mock_api_client.delete("/api/states/light.test") assert resp.status == HTTPStatus.UNAUTHORIZED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_delete_admin(self):\n url = reverse('post-detail', kwargs={'pk': self.post.id})\n self.client.force_authenticate(user=self.superuser)\n response = self.client.delete(url)\n self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)", "def test_delete_permission(s...
[ "0.8010957", "0.7978443", "0.7942785", "0.76561344", "0.7652058", "0.76056474", "0.7561048", "0.75126225", "0.7502989", "0.7384451", "0.7265319", "0.7245068", "0.7245068", "0.7218333", "0.72085917", "0.71393", "0.71269125", "0.7120308", "0.7108695", "0.7106988", "0.7074238", ...
0.73196554
10
Test sending event requires admin.
async def test_post_event_admin( hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser ) -> None: hass_admin_user.groups = [] resp = await mock_api_client.post("/api/events/state_changed") assert resp.status == HTTPStatus.UNAUTHORIZED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_event_stream_requires_admin(\n hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser\n) -> None:\n hass_admin_user.groups = []\n resp = await mock_api_client.get(\"/api/stream\")\n assert resp.status == HTTPStatus.UNAUTHORIZED", "def test_admin(self):\n ass...
[ "0.7089269", "0.7011658", "0.7003394", "0.6900787", "0.6857657", "0.67954934", "0.6772854", "0.6598995", "0.6379327", "0.63549584", "0.6346208", "0.63351744", "0.6331693", "0.6264606", "0.6248772", "0.6238217", "0.6237759", "0.62180626", "0.62119085", "0.61435604", "0.6128294...
0.6823375
5
Test rendering a template requires admin.
async def test_rendering_template_admin( hass: HomeAssistant, mock_api_client: TestClient, hass_admin_user: MockUser ) -> None: hass_admin_user.groups = [] resp = await mock_api_client.post(const.URL_API_TEMPLATE) assert resp.status == HTTPStatus.UNAUTHORIZED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_can_access_admin(self):\n\n #Homepage\n self.browser.get(self.live_server_url + '/admin/')\n\n body = self.browser.find_element_by_tag_name('body')\n\n self.assertIn('Django administration',body.text,\"Cannot get to /admin/\")", "def test_admin(self):\n assert(admin)",...
[ "0.71257544", "0.7060566", "0.70277596", "0.69712096", "0.69663095", "0.6864882", "0.6861564", "0.6822149", "0.67747706", "0.67541516", "0.67307746", "0.6695211", "0.6692463", "0.665396", "0.65958214", "0.65807515", "0.6578207", "0.65718067", "0.6504925", "0.6496687", "0.6482...
0.6532346
18
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
Test if the API fails 400 if unknown service.
async def test_api_call_service_not_found( hass: HomeAssistant, mock_api_client: TestClient ) -> None: resp = await mock_api_client.post("/api/services/test_domain/test_service") assert resp.status == HTTPStatus.BAD_REQUEST
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bad_request():\n return HttpError(400)", "def test_unknown_service(self):\n raise NotImplementedError # FIXME", "def test_bad_request(self):\n self._error_test(fitbit_exceptions.HTTPBadRequest)", "def test_unknown_resource_under_service(self):\n raise NotImplementedError # FIXME...
[ "0.68837065", "0.6854463", "0.6836647", "0.6711121", "0.6697271", "0.6591661", "0.6569441", "0.65096295", "0.64941186", "0.647006", "0.6430915", "0.64174676", "0.63917804", "0.63644826", "0.6330154", "0.6326488", "0.6315322", "0.63026416", "0.6300717", "0.6293535", "0.6292228...
0.6843427
2
Test if the API fails 400 if unknown service.
async def test_api_call_service_bad_data( hass: HomeAssistant, mock_api_client: TestClient ) -> None: test_value = [] @ha.callback def listener(service_call): """Record that our service got called.""" test_value.append(1) hass.services.async_register( "test_domain", "test_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bad_request():\n return HttpError(400)", "def test_unknown_service(self):\n raise NotImplementedError # FIXME", "async def test_api_call_service_not_found(\n hass: HomeAssistant, mock_api_client: TestClient\n) -> None:\n resp = await mock_api_client.post(\"/api/services/test_domain/test_se...
[ "0.68834925", "0.68532723", "0.68430823", "0.68363065", "0.6709689", "0.6697629", "0.65906274", "0.65689635", "0.6509782", "0.6493042", "0.646856", "0.6431261", "0.6414697", "0.6390746", "0.6363637", "0.6331421", "0.63235366", "0.63149935", "0.6302825", "0.6298744", "0.629187...
0.0
-1
Record that our service got called.
def listener(service_call): test_value.append(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triggered(self, *args, **kwargs): # real signature unknown\n pass", "def ServiceRequest(self):\n #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n pass", "def call(self, service, method, *args, **kwargs):\r\n start_time = time.time()\r\n result = ...
[ "0.62560964", "0.62399894", "0.61851966", "0.6035071", "0.6034497", "0.5820293", "0.5803535", "0.5747034", "0.57437754", "0.57354355", "0.5735068", "0.5715279", "0.5697639", "0.5684586", "0.5654761", "0.56509763", "0.5649211", "0.56485033", "0.5629041", "0.56265867", "0.56167...
0.61733574
4
Test getting the api status.
async def test_api_status(hass: HomeAssistant, mock_api_client: TestClient) -> None: resp = await mock_api_client.get("/api/") assert resp.status == HTTPStatus.OK json = await resp.json() assert json["message"] == "API running."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_status(self):\n resp = self.build_api.getStatus().json()\n assert 'status' in resp\n assert 'message' in resp", "def test_get_status(self):\n pass", "def test_get_status(self):\n pass", "def test_get_status(self):\n response = self.client.open(\n ...
[ "0.8531217", "0.85079217", "0.85079217", "0.84739983", "0.8308396", "0.80181724", "0.79982257", "0.7725325", "0.7595629", "0.75001425", "0.74944407", "0.74850774", "0.7436202", "0.7435805", "0.7396988", "0.7370069", "0.7370069", "0.73265517", "0.72923476", "0.7289937", "0.728...
0.8170832
5
Test getting core status.
async def test_api_core_state(hass: HomeAssistant, mock_api_client: TestClient) -> None: resp = await mock_api_client.get("/api/core/state") assert resp.status == HTTPStatus.OK json = await resp.json() assert json["state"] == "RUNNING"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_status(self):\n pass", "def test_get_status(self):\n pass", "def getStatus():", "def status(self, core=None):\n params = {\"action\": \"STATUS\"}\n\n if core is not None:\n params.update(core=core)\n\n return self._get_url(self.url, params=params)", ...
[ "0.7651121", "0.7651121", "0.7074216", "0.6767926", "0.6747822", "0.66218555", "0.6553764", "0.652106", "0.64994633", "0.6494251", "0.6477099", "0.6425577", "0.64239115", "0.6406678", "0.6352838", "0.6259606", "0.62524474", "0.624386", "0.6238558", "0.6226324", "0.6206039", ...
0.7082368
2
Test Get Method Multiple Pages
async def test_get_multiple_pages(): writer = SimpleWriter() work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_TEMPLATE_PAYLOAD_ALL_PAGES) worker = tower_api_worker.TowerApiWorker(TestData.config, writer, work_queue) headers = {"Content-Type": "application/json"} with aioresponses()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_page(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, 200)", "def test_get_page(self):\n response = self.client.get(self.url)\n self.assertEqual(response.status_code, 200)", "def test_public_pages_load(self):\r\n pages = (\r\...
[ "0.7236698", "0.7236698", "0.71967596", "0.7186725", "0.70500124", "0.7016246", "0.69840664", "0.69768846", "0.6976075", "0.6970017", "0.69373244", "0.68801695", "0.68784326", "0.68606", "0.68576384", "0.684821", "0.6813617", "0.68098116", "0.6790393", "0.6789763", "0.6773067...
0.6394667
62
Test Get Method plus related
async def test_get_with_related(): writer = SimpleWriter("my_prefix") work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_TEMPLATE_PAYLOAD_FETCH_RELATED) worker = tower_api_worker.TowerApiWorker(TestData.config, writer, work_queue) headers = {"Content-Type": "application/json"} with a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n pass", "def test_gettem_using_get(self):\n pass", "def test_get2(self):\n pass", "def test_get1(self):\n pass", "def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)", "def test_listtem_using_get(self):\n pa...
[ "0.9093828", "0.85522884", "0.8508747", "0.84473723", "0.82940507", "0.82567394", "0.7600373", "0.7590163", "0.7590163", "0.7492131", "0.748286", "0.748286", "0.7478883", "0.7476835", "0.74452484", "0.74452484", "0.7436737", "0.74132097", "0.73361784", "0.72894907", "0.728334...
0.0
-1
Test Single Get Method plus related
async def test_single_get_with_related(): writer = SimpleWriter("my_prefix") work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_RELATED) worker = tower_api_worker.TowerApiWorker(TestData.config, writer, work_queue) headers = {"Content-Type": "application/json"} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get(self):\n pass", "def test_get1(self):\n pass", "def test_get2(self):\n pass", "def test_gettem_using_get(self):\n pass", "def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)", "def test_listtem_using_get(self):\n pa...
[ "0.8757846", "0.8321298", "0.827822", "0.82578814", "0.7985835", "0.79094017", "0.75963557", "0.7527724", "0.7420455", "0.73919696", "0.7382589", "0.7382589", "0.73093385", "0.73093385", "0.7275182", "0.7275182", "0.725448", "0.72396994", "0.7190973", "0.7179562", "0.71694976...
0.0
-1
test get method 400
async def test_get_400(): work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE) worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue) with aioresponses() as mocked: mocked.get(TestData.DEFAULT_JOB_TEMPLATES_LIST_URL, status=400, body="...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_fail(self):\n response = self.second_client.get(self.url)\n self.assertEquals(response.status_code, 400)", "def test_GET3(self):\n r = requests.get(self.address)\n self.assertEqual(r.status_code, 400)", "def test_two_legged_get(self):\n resp, content = self._two_...
[ "0.8090046", "0.80869406", "0.7970418", "0.79357815", "0.79357815", "0.7921583", "0.78648674", "0.786213", "0.7799408", "0.77980393", "0.77980393", "0.7777813", "0.7613449", "0.7579809", "0.7579809", "0.7561017", "0.7495695", "0.7489103", "0.74041486", "0.73891914", "0.738870...
0.0
-1
Test Post Method 400
async def test_post_400(): work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_TEMPLATE_POST_PAYLOAD) worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue) with aioresponses() as mocked: mocked.post( TestData.JOB_TEMPLATE_POST_URL, status=400, body="B...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_POST2(self):\n payload = {\n \"id\": \"222\",\n \"make\": \"Wolkswagen\",\n \"model\": \"Golf\",\n \"year\": 2011,\n \"price\": 8600\n }\n r = requests.post(self.address, json=payload)\n self.assertEqual(r.status_code, 400)...
[ "0.78783363", "0.7701792", "0.7605584", "0.75895816", "0.7517692", "0.7479943", "0.74356794", "0.74356794", "0.74164563", "0.73962384", "0.73636824", "0.7326245", "0.7314988", "0.7270846", "0.7253879", "0.7253861", "0.723646", "0.72305346", "0.7222394", "0.7218809", "0.721119...
0.0
-1
Test Launch Method 400
async def test_launch_400(): work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_TEMPLATE_LAUNCH_PAYLOAD) worker = tower_api_worker.TowerApiWorker(TestData.config, None, work_queue) with aioresponses() as mocked: mocked.post( TestData.JOB_TEMPLATE_POST_URL, status=400, bod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startTestRun(self):", "def runtest(self):", "def test_launch_failures_hw(self):\n self.test_launch_failures()", "def test_start(self):\n self.fail(\"write a test\")", "def test_get_run(self):\n pass", "def test_run_started(self):", "def runTests(self):\n \n pass", "...
[ "0.7440263", "0.7391212", "0.7326572", "0.7230349", "0.718317", "0.71733737", "0.6919697", "0.68637", "0.6859165", "0.68585366", "0.68317366", "0.67963594", "0.6743347", "0.6738005", "0.67119753", "0.67119753", "0.66881", "0.6669647", "0.66492194", "0.663831", "0.6635896", ...
0.0
-1