query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Retreieve timestamp for this container.
def timestamp(self): return self.__timestamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timestamp(self):\n raise NotImplementedError", "def get_stamp(self):\n return self.timestamp", "def timestamp(self):\n return self._timestamp", "def timestamp(self):\n return self._timestamp", "def timestamp(self):\n return self._timestamp", "def timestamp(self)...
[ "0.80881375", "0.7677491", "0.7647235", "0.7647235", "0.7647235", "0.7647235", "0.7647235", "0.7647235", "0.7647235", "0.7640128", "0.75546765", "0.7543545", "0.7504992", "0.73876035", "0.7381383", "0.73782563", "0.7354852", "0.7343286", "0.7310443", "0.72791576", "0.7256032"...
0.7642295
9
Gets the last completed order placed from the host and returns that date as an datetime object
def last_order_date(): last_order = woo.fetch_last_order('completed') order_date = last_order[0]['date_created'].replace('T', ' ') order_datetime_object = ut.datetime.strptime(order_date, '%Y-%m-%d %H:%M:%S') print('Last completed order:', order_datetime_object, 'is of type', type(order_datetime_object)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_order_date():\n all_completed_orders = woo.fetch_all_orders('completed')\n order_date = all_completed_orders[0]['date_created'].replace('T', ' ')\n first_order_datetime_object = ut.datetime.strptime(order_date, '%Y-%m-%d %H:%M:%S')\n print('First completed order:', first_order_datetime_object...
[ "0.6536291", "0.6186755", "0.5795035", "0.57812345", "0.56554884", "0.5634876", "0.562118", "0.55577594", "0.5545278", "0.5533255", "0.54844326", "0.54518455", "0.54200506", "0.54075253", "0.5383949", "0.53831035", "0.53605646", "0.5359958", "0.5359541", "0.53583366", "0.5347...
0.78496575
0
Get the StackOutput object that holds this CfnOutput's value in this pipeline. ``StackOutput`` can be used in validation actions later in the pipeline.
def stack_output(self, cfn_output: aws_cdk.core.CfnOutput) -> "StackOutput": return jsii.invoke(self, "stackOutput", [cfn_output])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_frame(self):\n if self._pipeline:\n frame = self._pipeline[-1].frame\n if not isinstance(frame, str):\n frame = frame.name\n return getattr(self, frame)\n else:\n return None", "def get_stack_output(name: Optional[pulumi.Input[st...
[ "0.65397376", "0.638205", "0.6357826", "0.6246987", "0.62197644", "0.6091926", "0.6088984", "0.6088984", "0.6088984", "0.6088984", "0.60769296", "0.60208875", "0.60208875", "0.5989248", "0.593176", "0.5929026", "0.58691335", "0.5858505", "0.5784105", "0.5784105", "0.5784105",...
0.7867236
0
Artifact ids of the artifact this stack artifact depends on. stability
def dependency_stack_artifact_ids(self) -> typing.List[str]: return jsii.get(self, "dependencyStackArtifactIds")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependency_stack_artifact_ids(self) -> typing.Optional[typing.List[str]]:\n return self._values.get(\"dependency_stack_artifact_ids\")", "def get_artifacts(self): # noqa\n return []", "def get_dependencies(self):\n return [[\"uuid\", \"ossp-uuid\"]]", "def additional_artifacts(\n ...
[ "0.72691715", "0.6290392", "0.6125184", "0.5872462", "0.58218217", "0.5762439", "0.56844926", "0.56844926", "0.56844926", "0.56844926", "0.568201", "0.561038", "0.56081355", "0.5579714", "0.55571055", "0.5542359", "0.5437167", "0.5408803", "0.54084086", "0.537252", "0.537062"...
0.7398607
0
Additional artifacts to use as input for the CodeBuild project. You can use these files to load more complex test sets into the shellscript build environment. The files artifact given here will be unpacked into the current working directory, the other ones will be unpacked into directories which are available through t...
def additional_artifacts( self, ) -> typing.Optional[typing.List[aws_cdk.aws_codepipeline.Artifact]]: return self._values.get("additional_artifacts")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_install_artifact_files():\n # Temporary directory to unzip the drop file into.\n tmp_dir = Path(mkdtemp())\n fig_dir = tmp_dir / \"figures\"\n fig_dir.mkdir()\n # cwd should be the parent directory of the tests/ directory.\n subrepo_dir = find_subrepo_directory()\n cwd = Path.cwd()\n ...
[ "0.5560894", "0.54928625", "0.5466143", "0.5261282", "0.522758", "0.52014333", "0.5179792", "0.5111493", "0.50836635", "0.5064454", "0.49854892", "0.49793285", "0.4972865", "0.49527463", "0.49389592", "0.4925521", "0.4923901", "0.49213648", "0.49207842", "0.49162236", "0.4912...
0.5499438
1
Create a standard Yarn synth action. Uses ``yarn install frozenlockfile`` to install dependencies and ``npx cdk synth`` to synthesize.
def standard_yarn_synth( cls, *, build_command: typing.Optional[str] = None, install_command: typing.Optional[str] = None, synth_command: typing.Optional[str] = None, cloud_assembly_artifact: aws_cdk.aws_codepipeline.Artifact, source_artifact: aws_cdk.aws_codepipe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standard_npm_synth(\n cls,\n *,\n build_command: typing.Optional[str] = None,\n install_command: typing.Optional[str] = None,\n synth_command: typing.Optional[str] = None,\n cloud_assembly_artifact: aws_cdk.aws_codepipeline.Artifact,\n source_artifact: aws_cdk.a...
[ "0.6879207", "0.48962367", "0.48847836", "0.4700812", "0.46315747", "0.4566909", "0.4505575", "0.44857824", "0.4466076", "0.44554296", "0.44528747", "0.4437628", "0.44294474", "0.44234598", "0.4379099", "0.43504727", "0.4327021", "0.4318552", "0.42928928", "0.42913115", "0.42...
0.7798978
0
Build a StackOutput from a known artifact and an output name.
def __init__( self, artifact_file: aws_cdk.aws_codepipeline.ArtifactPath, output_name: str ) -> None: jsii.create(StackOutput, self, [artifact_file, output_name])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack_output_artifact(\n self, stack_artifact_id: str\n ) -> typing.Optional[aws_cdk.aws_codepipeline.Artifact]:\n ...", "def stack_output_artifact(\n self, stack_artifact_id: str\n ) -> typing.Optional[aws_cdk.aws_codepipeline.Artifact]:\n return jsii.invoke(self, \"stackOu...
[ "0.7238093", "0.71386063", "0.6145249", "0.5928054", "0.57297945", "0.56829995", "0.55917084", "0.54596764", "0.5438652", "0.53737164", "0.52452224", "0.5164888", "0.5122732", "0.5117584", "0.5110983", "0.51023734", "0.509085", "0.50850993", "0.50850993", "0.50850993", "0.508...
0.71786094
1
Split a code statement into a list by conserving tailing newlines e.g. tmpl2list('line 1\\nline 2\\nline 3\\n') > ['line 1\\n', 'line 2\\n', 'line 3\\n', '\\n']
def stmt2list(self, stmt): temp = ['%s\n' % line for line in stmt.split('\n')] return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitlines(self) -> List[String]:\n pass", "def newline_list(value):\n return value.strip().splitlines()", "def _get_multiline(self):\n lines = []\n line = self._get_line()\n lines.append(line)\n if line[3:4] == \"-\":\n code = line[:3]\n while 1:\n ...
[ "0.670812", "0.65087885", "0.636279", "0.62716734", "0.6222171", "0.61382824", "0.6080598", "0.602109", "0.59996814", "0.5994081", "0.59313875", "0.59283394", "0.5885597", "0.583633", "0.57313144", "0.5713366", "0.56950265", "0.56937873", "0.5693046", "0.5669202", "0.5668267"...
0.6348806
3
Returns a list of event handlers defined for the given object (CodeObject instance).
def get_event_handlers(self, obj): ret = [] if not obj.events: return ret events = [(name,handler) for name, handler in obj.events if handler.strip()] if not events: return ret try: default_event = self.config['events']['default']['type'] except KeyError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_handlers(self):\n # TODO(eric.cousineau): Consider just using `OrderedDict`.\n return map(self._handlers.get, self._frame_names)", "def getSimulationEventHandlers(self): \r\n return self.__eventHandlers.values()", "def get_registered_handlers(self):\n return list(self._regis...
[ "0.6546502", "0.6474016", "0.6473531", "0.64269596", "0.64245796", "0.640051", "0.6351428", "0.6225964", "0.6179672", "0.6173571", "0.6041907", "0.5966236", "0.590395", "0.5902057", "0.5852003", "0.5828646", "0.5822516", "0.5796398", "0.57779044", "0.5745389", "0.5721911", ...
0.77092576
0
Factory function that adds the headers necessary for Crossdomain calls.
def request_factory(environ): request = Request(environ) _LOG.debug('trunctated request body: {b}'.format(b=request.body[:1000])) return request
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers[\"Access-Control-Allow-Origin\"] = \"*\"\n return response", "def add_header(response):\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Credentials'] = True\n response.headers['Access-Control-Allow-Method...
[ "0.7143466", "0.70181596", "0.68069255", "0.6795806", "0.6609109", "0.65431607", "0.6487679", "0.6464441", "0.6434146", "0.643167", "0.63983136", "0.63965094", "0.6395157", "0.63833845", "0.6357092", "0.6322372", "0.63044524", "0.6296122", "0.6287792", "0.6270755", "0.6228759...
0.0
-1
Decorator for views that checks that the user is student, redirecting to the login page if necessary.
def student_required(view_func=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None): actual_decorator = user_passes_test( BaseUser.is_student, login_url=login_url, redirect_field_name=redirect_field_name ) if view_func: return actual_decorator(view_func) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_restricted(function):\n @wraps(function)\n def decorated(*args, **kwargs):\n if is_setup():\n user = get_current_user()\n if user is not None and user.type == User.STUDENT:\n return function(*args, **kwargs)\n return redirect('/')\n return dec...
[ "0.82914144", "0.8117436", "0.77864337", "0.70429796", "0.69824237", "0.69799453", "0.6957657", "0.69545084", "0.69183606", "0.6907927", "0.68822753", "0.68725085", "0.6871822", "0.6871822", "0.6858893", "0.6857358", "0.6807119", "0.68045485", "0.67395777", "0.6656187", "0.66...
0.80613977
2
Decorator for views that checks that the user is employee, redirecting to the login page if necessary.
def employee_required(view_func=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None): actual_decorator = user_passes_test( BaseUser.is_employee, login_url=login_url, redirect_field_name=redirect_field_name ) if view_func: return actual_decorator(view_func) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def employee_required(fn):\n @wraps(fn)\n def wrapper(*args, **kwargs):\n verify_jwt_in_request()\n user_id = get_jwt_identity()\n target_user = User.query.filter_by(id=user_id).first()\n\n if target_user is None:\n return redirect('admin/login.html', code=403)\n\n ...
[ "0.7644161", "0.719595", "0.70616484", "0.69400984", "0.68991584", "0.68760085", "0.68370706", "0.682452", "0.68174565", "0.67803574", "0.6773391", "0.6744806", "0.670757", "0.670757", "0.66833115", "0.6670779", "0.6657728", "0.66535753", "0.6640055", "0.66349876", "0.6617133...
0.8029253
0
Returns an HTML table as an iterator.
def _gen_html(self): yield "\n<table border=%r summary='a table'>\n" % self.border header = self.header for row in self: yield "<tr>\n " for el in row: if header: yield "<th>%s</th> " % el else: yiel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Iterator():\n return _table.Iterator()", "def _repr_html_(self):\n return html_table(self)", "def _html_repr(self):\n html = '<table id=%s>' % (self._id,)\n\n for row in range(self.rows):\n html += '<tr>'\n for col in range(self.columns):\n if row == 0 and self.header_row o...
[ "0.7502347", "0.6866452", "0.67777157", "0.6730487", "0.6604962", "0.6577296", "0.6466574", "0.6440531", "0.6419215", "0.63335806", "0.6309176", "0.6249988", "0.61952907", "0.61913353", "0.6190692", "0.61787504", "0.6171232", "0.6169583", "0.616084", "0.6111468", "0.6081547",...
0.6927267
1
Generates an HTML table.
def to_html(self, header = False): self.header = header return "".join(self._gen_html())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _gen_html(self):\n yield \"\\n<table border=%r summary='a table'>\\n\" % self.border\n header = self.header\n for row in self:\n yield \"<tr>\\n \"\n for el in row:\n if header:\n yield \"<th>%s</th> \" % el\n else:\n ...
[ "0.8026575", "0.7591776", "0.7567255", "0.72545326", "0.7236654", "0.72127455", "0.7134308", "0.7084482", "0.70551914", "0.7004152", "0.70018345", "0.6983542", "0.6956146", "0.69424593", "0.6942297", "0.6935835", "0.69322395", "0.69282573", "0.69082344", "0.6903103", "0.68995...
0.0
-1
Predict binary labels for each sample in X, using a 0.5 threshold. Outputs a POSITIVE_CLASS/NEGATIVE_CLASS labels vector.
def predict(self, X): res = self.predict_proba(X) positive_mask = res >= 0.5 negative_mask = res < 0.5 res[positive_mask] = self.POSITIVE_CLASS res[negative_mask] = self.NEGATIVE_CLASS return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, threshold=0.5):\n probabilities = self.probability_array()\n classes = np.zeros(self.N)\n classes[probabilities > threshold] = 1\n return classes", "def predict(self, X, p_thresh=0.5):\n proba = self.predict_proba(X)\n # check out the documentation for ...
[ "0.7652478", "0.75816154", "0.7474808", "0.7402312", "0.7303921", "0.72909087", "0.7204888", "0.7186723", "0.71679455", "0.71629083", "0.7139296", "0.7129836", "0.710376", "0.70986944", "0.7081686", "0.7059521", "0.70578593", "0.70393467", "0.70216274", "0.70009613", "0.70000...
0.755881
2
Test we get nothing when nothing is in ZooKeeper
def test_start_empty(self): z = ZkFarmExporter(self.client, "/services/db", self.conf) z.loop(2, timeout=self.TIMEOUT) self.conf.write.assert_called_with({}) return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_expiredUnknown(self):\n disco = create_disco()\n node = create_node(\"somewhere\")\n disco.onMessage(None, NodeExpired(node))\n self.assertEqual(knownNodes(disco, \"myservice\", \"sandbox\"), [])", "def test_ensure_exists(self):\n # with data\n client = kazoo.cl...
[ "0.63214934", "0.6105583", "0.6102444", "0.59096754", "0.5881586", "0.58467233", "0.5755672", "0.5737874", "0.571416", "0.57031614", "0.5643269", "0.56215245", "0.5606141", "0.55610543", "0.5534905", "0.55066943", "0.54752105", "0.546851", "0.54284704", "0.5425977", "0.542158...
0.5151897
81
Sets the _user attribute. A user object is needed for validation. This method has to be called before is_valid() is called to allow us to validate if a email address given in account belongs to the same user.
def set_user(self, user): self._user = user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user(self, user: User):\n self.__user = user", "def set_user(self, user):\r\n self.user = user", "def set_user(self, user_model):\n\n self.user_model = user_model\n return self", "def user(self, user):\n\n self._user = user", "def user(self, user):\n\n self...
[ "0.7737714", "0.7617895", "0.73148245", "0.7230377", "0.7230377", "0.7230377", "0.7230377", "0.7230377", "0.7230377", "0.7230377", "0.7230377", "0.7230377", "0.6997955", "0.6870113", "0.66602147", "0.65622747", "0.6561295", "0.65504503", "0.64524555", "0.6402611", "0.62993854...
0.7363035
2
Helper returning a string of random bytes of given length.
def _random_bytes(n): return ''.join(map(chr, (random.randrange(256) for i in xrange(n))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_str(len):\n return base64.urlsafe_b64encode(os.urandom(len))[0:len]", "def random_string(length):\n # this conservatively gets 8*length bits and then returns 6*length of\n # them. Grabbing (6/8)*length bits could lose some entropy off the ends.\n return urlsafe_b64encode(os.urandom(len...
[ "0.8670452", "0.86600834", "0.8614691", "0.84062463", "0.833677", "0.83200914", "0.83086944", "0.8220126", "0.8199334", "0.81379706", "0.81350684", "0.81068856", "0.80998856", "0.80960995", "0.808688", "0.80533993", "0.8051482", "0.8021092", "0.80173206", "0.8010817", "0.8007...
0.73487157
65
//description Gets/Sets an issue's description. Used by upload.py or similar scripts.
def description(request): if request.method != 'POST': description = request.issue.description or "" return HttpTextResponse(description) if not request.issue.edit_allowed: if not IS_DEV: return HttpTextResponse('Login required', status=401) issue = request.issue issue.description = request.PO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self, description) :\n\t\ttry :\n\t\t\tself._description = description\n\t\texcept Exception as e:\n\t\t\traise e", "def description(self, description):\n if description is None:\n raise ValueError(\"Invalid value for `description`, must not be `None`\")\n\n self._descrip...
[ "0.78110486", "0.7719359", "0.77010083", "0.77010083", "0.7644476", "0.7644476", "0.760939", "0.760939", "0.760939", "0.760939", "0.760468", "0.7603084", "0.75988793", "0.75988793", "0.75988793", "0.75988793", "0.75776166", "0.7552404", "0.7528036", "0.7502163", "0.7502163", ...
0.7217959
68
//patch// View a raw patch.
def patch(request): return patch_helper(request)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(self):\n return self._get(\"patch\")", "def patch_helper(request, nav_type='patch'):\n _add_next_prev(request.patchset, request.patch)\n request.patch.nav_type = nav_type\n parsed_lines = patching.ParsePatchToLines(request.patch.lines)\n if parsed_lines is None:\n return HttpTextResponse(...
[ "0.67000836", "0.65868145", "0.6518518", "0.64399576", "0.6363925", "0.6178472", "0.61600274", "0.6126409", "0.6076045", "0.60431945", "0.60422283", "0.6014399", "0.60054797", "0.6000284", "0.5998863", "0.59665835", "0.5934909", "0.5930298", "0.5930298", "0.5930298", "0.59236...
0.6038363
11
Returns the context setting for a user. The value is validated against models.CONTEXT_CHOICES. If an invalid value is found, the value is overwritten with django_settings.DEFAULT_CONTEXT.
def _get_context_for_user(request): get_param = request.GET.get('context') or None if 'context' in request.GET and get_param is None: # User wants to see whole file. No further processing is needed. return get_param if request.user: account = models.Account.current_user_account default_context = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_context(self, extra_ctx=None, **kwargs):\n ctx = {\n 'user': self.user,\n }\n if extra_ctx:\n ctx.update(extra_ctx)\n ctx.update(kwargs)\n return ctx", "def context_or_settings(context, name):\n if name in context:\n return context[name]\...
[ "0.59225595", "0.5921223", "0.58996725", "0.58719546", "0.5744914", "0.5714082", "0.5681708", "0.5681178", "0.5650444", "0.5636944", "0.56178945", "0.5576094", "0.54802835", "0.54787105", "0.5448423", "0.5419284", "0.53989184", "0.539145", "0.53791237", "0.5362797", "0.535963...
0.7498166
1
Remove control chars other than \r\n\t from a string to be put in XML.
def _strip_invalid_xml(s): if _badchars_re.search(s): return ''.join(c for c in s if c >= ' ' or c in '\r\n\t') else: return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_control_chars(json_string):\n return re.sub('[\\x00-\\x1f]', '',json_string)", "def safe(self, string):\n if sys.version_info.major >= 3 and isinstance(string, bytes):\n string = string.decode('utf8')\n elif sys.version_info.major < 3:\n if not isinstance(str...
[ "0.7087268", "0.6831735", "0.66091347", "0.6537698", "0.65153325", "0.6500246", "0.6463212", "0.6442503", "0.6408627", "0.6394706", "0.62945247", "0.6222547", "0.6211024", "0.61732936", "0.6157662", "0.612993", "0.61210096", "0.60657114", "0.6057351", "0.60438573", "0.6037395...
0.66834563
3
Helper to turn a unicode string into 8bit bytes.
def _encode_safely(s): if isinstance(s, unicode): s = s.encode('utf-8') return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unicode2utf8(s):\n return s.encode(encoding='utf-8', errors='ignore')", "def _encode_to_utf8(s):\n return s.encode('utf-8')", "def give_me_bytes(string):\n return string.encode('utf8') if isinstance(string, str) else string", "def to_bytes(string):\n assert isinstance(string, basestring)\n ...
[ "0.73470974", "0.70944417", "0.70463693", "0.69863045", "0.6947016", "0.6893256", "0.67903465", "0.67711526", "0.6763625", "0.6741012", "0.67372686", "0.67371225", "0.6686542", "0.667001", "0.6648873", "0.6599519", "0.6578914", "0.6557802", "0.654903", "0.6534082", "0.6514486...
0.0
-1
Helper to return objects to put() and a list of draft comments. If preview is True, the list of objects to put() is empty to avoid changes to the datastore.
def _get_draft_comments(request, issue, preview=False): comments = [] tbd = [] # XXX Should request all drafts for this issue once, now we can. for patchset in issue.patchsets: ps_comments = list(models.Comment.query( models.Comment.author == request.user, models.Comment.draft == True, ances...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_draft_comments(request):\n try:\n def sanitize(comment):\n patch = models.Patch.get_by_id(int(comment.patch_id),\n parent=request.patchset.key)\n assert not patch is None\n message_id = str(comment.message_id) if message_id in comment else None,\n ...
[ "0.5961487", "0.58654416", "0.55798465", "0.5332614", "0.51287365", "0.5100907", "0.50504154", "0.5032014", "0.50249255", "0.5021608", "0.4997695", "0.49810854", "0.49804017", "0.48766726", "0.48738325", "0.4838518", "0.4788224", "0.47702613", "0.4767966", "0.47546077", "0.47...
0.6633048
0
Helper that converts return value of ParsePatchToLines for caching. Each line in patchlines is (old_line_no, new_line_no, line). When comment is on the left we store the old_line_no, otherwise new_line_no.
def _patchlines2cache(patchlines, left): if left: it = ((old, line) for old, _, line in patchlines) else: it = ((new, line) for _, new, line in patchlines) return dict(it)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _collect_lines( self, diffs ):\n\n\t\tfromlist, tolist, flaglist = [], [], []\n\t\t# pull from/to data and flags from mdiff style iterator\n\t\tfor fromdata, todata, flag in diffs:\n\t\t\ttry:\n\t\t\t\t# store HTML markup of the lines into the lists\n\t\t\t\tfromlist.append( self._format_line( 0, flag, *fromda...
[ "0.6652859", "0.6465227", "0.63774097", "0.59211504", "0.5903729", "0.5852003", "0.58275306", "0.5823793", "0.57426924", "0.573186", "0.57025135", "0.565802", "0.56378937", "0.5629356", "0.55975884", "0.55868965", "0.5574778", "0.55647933", "0.5514326", "0.5498986", "0.549683...
0.6658525
0
Create a directed path graph of length n A convenience constructor, mainly for ease of use to pass as a lambda and because it's too easy to just use `directed=True` by accident.
def directed_path_graph(n): return nx.path_graph(n, create_using=nx.DiGraph)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnected_graph(n):\n g = nx.DiGraph()\n for i in range(0, n):\n g.add_node(i)\n return g", "def build_triangle_graph_with_costs(directed=False):\n if directed:\n graph = DirectedGraph()\n else:\n graph = UndirectedGraph()\n\n graph.new_node()\n graph.new_node()\n...
[ "0.62655723", "0.619524", "0.61409754", "0.59677345", "0.5912754", "0.58619857", "0.580544", "0.56773865", "0.5665193", "0.56303877", "0.5622251", "0.5611494", "0.5590827", "0.554269", "0.5537473", "0.549015", "0.5464962", "0.5454921", "0.5445214", "0.5440324", "0.5428103", ...
0.7730273
0
Get the front element.
def peek(self) -> int: tmp_list = ArrayStack(10) for i in range(self.data.get_size()): if self.data.get_size() == 1: res = self.data.pop() tmp_list.push(res) else: tmp_list.push(self.data.pop()) self.data = ArrayStack(10) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.0
-1
Returns whether the queue is empty.
def empty(self) -> bool: return self.data.get_size() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.9270249", "0.92506766", "0.923635", "0.923635", "0.9155843", "0.9098441", "0.9095006", "0.90922606", "0.90731245", "0.9053733", "0.89205354", "0.89137155", "0.8877591", "0.88436323", "0.88436323", "0.8835949", "0.88038146", "0.8758203", "0.87577534", "0.87310195", "0.86462...
0.0
-1
This method swaps out the default for ModelMultipleChoiceField, which by default just calls __string__ on the object. In the case of a user object, this would normally be the username, which for COMSC has no relation to the actual name of the person. If first or last name are empty, we revert to the username (but this ...
def label_from_instance(obj): if len(obj.first_name) > 0 and len(obj.last_name) > 0: return "{} {}".format(obj.first_name, obj.last_name) else: return "<{}>".format(obj.username)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_field(self):\n\n if 'phone' in self.initial_data:\n return 'phone'\n if 'user_name' in self.initial_data:\n return 'user_name'\n return get_username_field()", "def __str__(self) -> str:\n return self.name or self.username", "def __str__(self):\n ...
[ "0.6458757", "0.62930816", "0.6244813", "0.62168217", "0.6207836", "0.6136375", "0.6087484", "0.6012785", "0.60124004", "0.6010782", "0.6006394", "0.598917", "0.59536874", "0.5922701", "0.5893618", "0.58863354", "0.58862513", "0.58862513", "0.5857749", "0.58394754", "0.581580...
0.56506
37
Checks if an IP address is valid_ip
def valid_ip(ip_addr): try: inet_aton(ip_addr) return True except error: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_ip(ip):\n ...", "def _is_valid_ip(self, address):\r\n try:\r\n # Is this an valid ip address?\r\n ipaddr.IPNetwork(address)\r\n except ValueError:\r\n return False\r\n return True", "def validIPAddress(ip):\n try:\n socket.inet_ato...
[ "0.8788866", "0.8643154", "0.847893", "0.84176743", "0.8414608", "0.84130836", "0.83910894", "0.83453107", "0.83429843", "0.83269805", "0.81883335", "0.8187151", "0.81761545", "0.8101587", "0.8080452", "0.80172515", "0.8004289", "0.7958583", "0.7925622", "0.78388196", "0.7804...
0.8642605
2
Fetch the projects owned by the user.
def get_projects(self): return self._gitlab.owned_projects(per_page=1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects_of_user(self, user_id):\n res = self.conn.cursor().execute(\"\"\"SELECT * FROM projects p JOIN users_projects up \n ON p.id = up.project_id \n WHERE owner=? OR up.user_id=?\n GROUP BY p.id\n ORDER BY last_update DESC\"\"\", (user_id, user_id,))\n return re...
[ "0.7949967", "0.7864142", "0.7472023", "0.74375963", "0.73811096", "0.73742294", "0.70902073", "0.7052204", "0.70082676", "0.7002907", "0.6844756", "0.6823138", "0.6822262", "0.67505366", "0.6717337", "0.6677379", "0.6675373", "0.6662964", "0.6630164", "0.66060114", "0.658497...
0.73000604
6
Tinh toan 13 he so MFCC dau tien + delta (12 he so) va delta & delta (14 he so) = 39 he so
def create_weka_mfcc_13(): global ARGS ## ten thu muc can trich chon vector dac trung (RLS, LMS, NLMS, Kalman, Non) name = ''; fout = open('weka/MFCC78_TUNNING_{}_dataset.arff'.format(name), 'w') fout.write('@RELATION {}_dataset\n\n'.format(name)) fout.write('@ATTRIBUTE MEAN_MFCC1 REAL\n') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mcc(self):\n tp = self.tp\n tn = self.tn\n fp = self.fp\n fn = self.fn\n return tp * tn / np.sqrt((tp + fp) * (tp + fn) * (tn + fp) * (tn + fn))", "def Mo96(self,dc,nu):\n return 1. + (nu**2.-1.)/dc", "def f2c(t):\r\n return round(5/9 * (t-32))", "def m2f(note):\n...
[ "0.6168721", "0.5944499", "0.59130716", "0.5867983", "0.5847796", "0.5843194", "0.58149666", "0.5807609", "0.58073646", "0.57989436", "0.5763735", "0.5705264", "0.56746817", "0.56224364", "0.5594686", "0.55850685", "0.5576668", "0.5562141", "0.55291146", "0.55107003", "0.5504...
0.0
-1
Fetch dataset by `name`
def get_dataset(name): from ._ids import _datasets if name in _datasets: return read_drive_data(*_datasets[name]) else: raise IndexError( f"Uknown company name. {name} was given. Available datasets are {_datasets.keys()}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_by_name(name):\n return _datasets[name.lower()]", "def get(self, name):\n assert name, \"Must input a valid dataset name.\"\n return self.manager.get_data(name)", "def get_by_name(self, name: str) -> Optional[\"Dataset\"]:\n raise NotImplementedError", "def get_data(self, ...
[ "0.80699867", "0.8062106", "0.8053193", "0.77994764", "0.742339", "0.7414992", "0.74137646", "0.7407203", "0.7291326", "0.71872944", "0.71409565", "0.70937485", "0.6897206", "0.6868761", "0.6801467", "0.6728015", "0.6683693", "0.6659733", "0.66476035", "0.6637579", "0.6578376...
0.78054494
3
Compute softmax values for each sets of scores in x.
def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7797116", "0.77627903", "0.7760451", "0.7757387", "0.7658399", "0.7658399", "0.7658399", "0.7658399", "0.7587644", "0.7433347", "0.7409716", "0.73956805", "0.73604953", "0.7319298", "0.72706646", "0.72645944", "0.7263417", "0.72585905", "0.7231768", "0.7216702", "0.7203891...
0.7175595
22
Apply scatter operation on input data using specified root and scatter_data.
def exec(self, data=None, scatter_data=None): return self.scatter_op(self.root, data, *scatter_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter(args):\n prism.scatter.run(\n input_fp=args.input,\n output_fp=args.output,\n width=args.width,\n height=args.height,\n scale=args.scale,\n font_family=args.font_family,\n )", "def scatter(self, scatter):\n\n if scatter is None:\n self...
[ "0.6041208", "0.6008654", "0.5903399", "0.5840719", "0.5598227", "0.5552449", "0.546685", "0.54189706", "0.541332", "0.5365131", "0.5283065", "0.5273687", "0.52680576", "0.5265316", "0.5181001", "0.5163181", "0.5155929", "0.5097137", "0.509628", "0.5082195", "0.5078108", "0...
0.77398664
0
Set the origin id in a packet, so the packet can be tracked. All endpoint classes should use this for passing packets further.
def update_listeners(self, packet): packet.module_id = self.id self._notify_listeners(packet)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def origin_id(self, origin_id):\n\n self._origin_id = origin_id", "def set_id(self, player_id):\n pass", "def _set_id(self):\n raise NotImplementedError()", "def for_origin_stream(self, origin_stream_id):\n if not isinstance(origin_stream_id, str):\n raise TypeError('Or...
[ "0.74704087", "0.6206297", "0.600978", "0.5987041", "0.5958155", "0.5938467", "0.5856864", "0.5809487", "0.57974374", "0.5771269", "0.57405525", "0.5717702", "0.5710059", "0.5681008", "0.56733155", "0.56534827", "0.5583766", "0.5575671", "0.55745983", "0.5573191", "0.5571177"...
0.0
-1
Get the postprocessed output of the given state.
def get_state_output(self, state: str) -> Dict[str, Any]: return read_yaml(self._dir_path / f'{state}.yaml')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(self, state):\n h, t = state\n\n return h", "def process_state(self, state):\n return torch.tensor(state, dtype=torch.float, device=self.device)", "def get_output(self, state: NestedMap) -> NestedMap:\n raise NotImplementedError('Abstract method')", "def _get_output(self):\...
[ "0.66730475", "0.6018711", "0.6010726", "0.58573234", "0.58573234", "0.58573234", "0.58573234", "0.58573234", "0.58573234", "0.58283436", "0.57614267", "0.57537675", "0.5640639", "0.5630592", "0.56224805", "0.5538781", "0.5538781", "0.55384886", "0.5509997", "0.55078715", "0....
0.6103959
1
Returns the data directory path for the given measurement.
def get_data_dir(self, dsn_name: str, meas_type: str) -> Path: return self._root_dir.joinpath(dsn_name, meas_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_path(dataset, work_dir=consts.WORK_DIR):\r\n return join_path(work_dir, consts.DATA_DIR, dataset)", "def get_data_folder():\n data_folder = './MedData/'\n\n if not os.path.isdir(data_folder):\n os.makedirs(data_folder)\n\n return data_folder", "def get_sample_data_dir():\n \n ...
[ "0.69714224", "0.69661665", "0.69080025", "0.6898069", "0.68550664", "0.6834466", "0.6829885", "0.6813854", "0.67971146", "0.67942923", "0.6790493", "0.67518944", "0.67347854", "0.67285895", "0.67275155", "0.67199266", "0.6705296", "0.6635025", "0.65847003", "0.6566443", "0.6...
0.7290949
0
Returns a list of valid sweep variable values. Parameter
def get_swp_values(self, var: str) -> List[Any]: return self._sweep_params[var]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_vars_validity_constraint(self, output_prop):\n return []", "def get_list_vars(my_vars):\n lists = []\n for var in my_vars:\n try:\n temp = my_vars[var].getValue()\n #print var + '=' + str(temp)\n except ValueError:\n lists.append(var)\n ...
[ "0.6259837", "0.6005813", "0.58366203", "0.58016974", "0.5747502", "0.57386756", "0.57256407", "0.5689537", "0.5640568", "0.5636825", "0.5603753", "0.55786663", "0.5534839", "0.551313", "0.5511146", "0.55060375", "0.5496398", "0.54896486", "0.5487881", "0.5487881", "0.5487881...
0.7161371
0
This view should return the details of the clicked on project
def projectdetails(http_request, project_id=0): p = get_object_or_404(Project, pk=project_id) return render_to_response('project_detail.html', {'project': p})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_project():\n\n project_title = request.args.get('title')\n\n description, max_grade = hackbright.get_project_info(project_title)\n\n student_grades = hackbright.list_students_by_completed_project(project_title)\n\n return render_template(\"project_info.html\",\n titl...
[ "0.7520839", "0.75088644", "0.72007066", "0.7145585", "0.709296", "0.70759654", "0.6979045", "0.6933197", "0.6922431", "0.6893129", "0.6872643", "0.68558043", "0.6824157", "0.6801652", "0.67938805", "0.6753069", "0.6733425", "0.6668932", "0.66145647", "0.6568839", "0.65330714...
0.797493
0
Take the list of allowed permutations and build the symmetry operations allowed for the operation, modifying `symmetry` in place.
def build_symmetry_operations(symmetry: List[Any]) -> None: dim = len(symmetry[0][0]) unit = numpy.identity(dim, dtype=int) for permutation in symmetry: perm = unit[:, numpy.argsort(permutation[0])] permutation[0] = perm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_symmetry(self):\r\n self.command_stack.do(model.structure.ApplySymmetry(self._structure))", "def symmetry(m, reflect, rotate):\n\n def LR_reflect(m):\n return tuple(reversed(m))\n\n def UD_reflect(m):\n return tuple(tuple(reversed(m[x][:])) for x in range(len...
[ "0.6503778", "0.5792072", "0.5780069", "0.564733", "0.55899084", "0.54170614", "0.53754944", "0.5347642", "0.531617", "0.52893186", "0.52363664", "0.5220204", "0.5203415", "0.5188878", "0.51688164", "0.5160333", "0.51599336", "0.51452094", "0.51094013", "0.5107083", "0.507669...
0.83704025
0
return values along a specified column i.e., column = 0, return [1, 4, 7]
def get_vertical(self, column): start = self.VERTICAL_GROUP[column] end = start + 10 step = 3 return self.grid[start:end:step] # array[start:end:step]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_column_values(self, col: str) -> ndarray:\n dtype, loc = self._get_col_dtype_loc(col) # type: str, int\n return self._data[dtype][:, loc]", "def getColumn(self, column):\n returnvalue = list()\n for row in self._value:\n returnvalue.append(row[column])\n re...
[ "0.70178735", "0.6877587", "0.6764869", "0.66130155", "0.64246017", "0.6383252", "0.6379804", "0.6378404", "0.62872016", "0.62872016", "0.627957", "0.62494963", "0.62211233", "0.6195247", "0.6169044", "0.6116049", "0.610059", "0.6096069", "0.6096069", "0.6096069", "0.6000891"...
0.0
-1
Compute the KL divergence KL(dist1, dist2) between two Gaussians. The KL is factorised into two terms `kl_mean` and `kl_cov`. This factorisation is specific to multivariate gaussian distributions and arises from its analytic form. Specifically, if we assume two multivariate Gaussian distributions with rank k and means,...
def factorised_kl_gaussian(dist1_mean, dist1_covariance_or_scale, dist2_mean, dist2_covariance_or_scale, both_diagonal=False): if both_diagonal: dist1_mean_rank = dist1_mean.get_shape().ndims dist1_cova...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_kl(mu1, mu2, sigma1, sigma2):\n k = len(mu1)\n try:\n term1 = np.trace(np.matmul(np.linalg.inv(sigma2), sigma1))\n term2 = np.matmul(np.matmul((mu2 - mu1).T,\n np.linalg.inv(sigma2)),\n (mu2 - mu1))\n det_sigma1 = co...
[ "0.7555137", "0.7541546", "0.7307189", "0.7146576", "0.706692", "0.706692", "0.6981758", "0.6952957", "0.6952957", "0.6885862", "0.68184644", "0.67867994", "0.67211604", "0.6714059", "0.66621876", "0.6659812", "0.6631165", "0.6611222", "0.65988135", "0.65978724", "0.6584791",...
0.8313713
0
Hide the spinner to allow for custom writing to the terminal.
def hide(self) -> None: thr_is_alive = self._spin_thread and self._spin_thread.is_alive() if self._hide_spin is None: raise RuntimeError("hide_spin is None") if thr_is_alive and not self._hide_spin.is_set(): with self._stdout_lock: # set the hidden spinne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self) -> None:\n thr_is_alive = self._spin_thread and self._spin_thread.is_alive()\n if self._hide_spin is None:\n raise RuntimeError(\"hide_spin is None\")\n\n if thr_is_alive and self._hide_spin.is_set():\n with self._stdout_lock:\n # clear the h...
[ "0.7670902", "0.69344175", "0.67467153", "0.666301", "0.6641358", "0.6528165", "0.64071685", "0.63921535", "0.6347983", "0.62813294", "0.61500007", "0.60965544", "0.60659087", "0.5928634", "0.587604", "0.58676946", "0.5849713", "0.5832292", "0.58265", "0.58175707", "0.5803010...
0.78274095
0
Set up the Sense HAT sensor platform.
def setup_platform(hass, config, add_entities, discovery_info=None): try: envirophat = importlib.import_module("envirophat") except OSError: _LOGGER.error("No Enviro pHAT was found") return False data = EnvirophatData(envirophat, config.get(CONF_USE_LEDS)) display_options = con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate_sensors(self):\n self._sense_hat = SenseHat()\n\n # Scroll Init message over HAT screen\n self._show_message('Init Sensors', (255, 255, 0), (0, 0, 255))\n\n # Init sensors, to be sure first effective run uses correct sensors values\n self._sense_hat.get_humidity()\n ...
[ "0.71746033", "0.7131173", "0.6977677", "0.6932417", "0.68636554", "0.6752213", "0.6712316", "0.6710212", "0.6699971", "0.6668581", "0.663625", "0.6583184", "0.65720475", "0.6562509", "0.65424454", "0.6501312", "0.64917994", "0.6474022", "0.64402205", "0.6421672", "0.6414937"...
0.70362663
2
Get a dictionary of the class parameters. This is useful for checkpointing.
def get_state(self) -> Dict: return { "patience": self.patience, "cooldown": self.cooldown, "cooldown_counter": self.cooldown_counter, "mode": self.mode, "threshold": self.threshold, "threshold_mode": self.threshold_mode, "best"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_params(self):\n return {'classifier': self.classifier,\n 'grid_param': self.grid_param,\n 'n_param_comb': self.n_param_comb,\n 'top_bagging': self.bagging,\n 'bagging_param': self.bagging_param,\n 'comb_seed': self.comb_seed}...
[ "0.75779", "0.72351277", "0.7176595", "0.71378803", "0.710437", "0.70930046", "0.7037302", "0.7034231", "0.69965476", "0.6991677", "0.6989277", "0.68902266", "0.68827075", "0.6839028", "0.68168473", "0.68164754", "0.679379", "0.6788686", "0.678755", "0.67795855", "0.67620134"...
0.0
-1
reduce the amount of channels to prevent final embeddings overwhelming shallow feature maps out_ch could be 512, 256, 128
def __init__(self, in_ch=2048, out_ch=256): super(ChannelCompress, self).__init__() num_bottleneck = 1000 add_block = [] add_block += [nn.Linear(in_ch, num_bottleneck)] add_block += [nn.BatchNorm1d(num_bottleneck)] add_block += [nn.ReLU()] add_block += [nn.Linear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n in_channels=128,\n aux_channels=128,\n channels=64,\n out_channels=1,\n num_embs=100,\n num_spk_embs=128,\n spk_emb_dim=128,\n concat_spk_emb=False,\n kernel_size=9,\n dilation=2,\n bias=True,\n noise...
[ "0.6237221", "0.5925426", "0.58344674", "0.5801917", "0.5762518", "0.5760416", "0.5757824", "0.5731919", "0.5731234", "0.57279295", "0.57170784", "0.5715821", "0.5707814", "0.5689758", "0.56811297", "0.56678456", "0.5659796", "0.5626509", "0.5617514", "0.56143296", "0.5612925...
0.59050995
2
Set whether to trace transforms.
def set_tracing(self, tracing: bool) -> None: self.tracing = tracing
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace_transform(self, to_trace: bool):\n prev = self.tracing\n self.tracing = to_trace\n yield\n self.tracing = prev", "def set_transform(self, transform):\n self._transform = transform", "def _set_trace_on(trace_on):\n AceQLHttpApi.set_trace_on(trace_on)", "def ...
[ "0.6861118", "0.6440577", "0.6141075", "0.60119647", "0.58907974", "0.5662466", "0.55978405", "0.55971104", "0.55454814", "0.55315375", "0.55033636", "0.5488744", "0.54184145", "0.54135126", "0.5377368", "0.53588504", "0.53340125", "0.53179204", "0.53148067", "0.5293111", "0....
0.7146517
0
Return a date object from an ORM date string value
def orm2date(value, tformat=ORM_DATE_FORMAT, default=None): if not value: return default return datetime.strptime(value, tformat).date()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_from_string(date):\n _type = type(date)\n try:\n if _type == datetime.date:\n return date\n elif _type == datetime.datetime:\n return datetime.datetime.date(date)\n else:\n return datetime.datetime.date(datetime.datetime.strptime(date, '%Y-%m-%d'...
[ "0.6831481", "0.67224175", "0.67156255", "0.6658647", "0.6647625", "0.66400206", "0.6627768", "0.66248477", "0.6579367", "0.6563045", "0.65532774", "0.65484756", "0.64829266", "0.6469934", "0.64355284", "0.64017427", "0.6391011", "0.6386152", "0.6378269", "0.6371653", "0.6361...
0.67417675
1
Return an int timestamp from a datetime (with or without millisecond)
def datetime2timestamp(value, millis=False): if millis: return int(time.mktime(value.timetuple())) else: return int(round((time.mktime(value.timetuple()) + value.microsecond / 1E6) * 1000))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_to_timestamp(datetime_value: datetime) -> int:\n # Use calendar.timegm because the time.mktime assumes that the input is in your\n # local timezone.\n return calendar.timegm(datetime_value.timetuple())", "def get_timestamp():\n\n # Convert timestamp to int after multiply by 1000 to g...
[ "0.7509812", "0.7329008", "0.7322407", "0.7307471", "0.728801", "0.7248286", "0.724126", "0.7173804", "0.7125151", "0.7080407", "0.70256644", "0.70042866", "0.6994447", "0.69616383", "0.68958694", "0.6880351", "0.68778443", "0.6874275", "0.68356675", "0.68139106", "0.6810356"...
0.7285113
5
Return a datetime from a int timestamp (with or without millisecond)
def timestamp2datetime(value, millis=False): return datetime.fromtimestamp(value / (millis and 1000. or 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp_to_datetime(timestamp: int) -> datetime:\n return datetime.fromtimestamp(timestamp, tz=timezone.utc)", "def timestamp_to_datetime(value):\n if not isinstance(value, (int, long, float)):\n raise ValueError(\n 'Expecting a number, got %s instead' % type(value).__name__)\n return EPOCH ...
[ "0.76783377", "0.7367238", "0.7330841", "0.7202563", "0.70727855", "0.70551383", "0.7045366", "0.6999372", "0.6974602", "0.6889763", "0.68086857", "0.6621983", "0.6606532", "0.6589143", "0.6556031", "0.6545194", "0.65261626", "0.6519245", "0.65168583", "0.6510207", "0.6496882...
0.7373631
1
True if string looks like a valid package instance tag.
def is_valid_tag(tag): if not tag or ':' not in tag or len(tag) > TAG_MAX_LEN: return False # Care only about the key. Value can be anything (including empty string). return bool(TAG_KEY_RE.match(tag.split(':', 1)[0]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValidTagName(s):\n if s.lower().startswith(\"xml\"):\n return False\n return re.match(\"[^\\W\\d][\\w\\-_.]*\", s)", "def is_valid_instance(instance):\n return re.match(r'^[a-z0-9\\-_]+$', instance)", "def is_valid_package_name(package_name):\n return (\n package_name and\n bool(...
[ "0.6406384", "0.61601585", "0.6154608", "0.598311", "0.5982821", "0.59686965", "0.58920383", "0.58079845", "0.56722105", "0.5651788", "0.5645807", "0.5644239", "0.56165916", "0.5589895", "0.55282813", "0.551523", "0.5501837", "0.54960585", "0.54737246", "0.5467853", "0.546376...
0.626691
1
Returns True if |version| is an instance_id. I.e. it is either a 40char long hex strings (for legacy SHA1 ids), or a sufficiently long urlsafe base64encoded unpadded string (for newer ids, in particular SHA256 ones).
def is_valid_instance_id(version): return bool(INSTANCE_ID_RE.match(version))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_app_id(self, app_id):\n try:\n uuid_hex = UUID(app_id)\n regex = APP_SECRET_REGEX_LIST[0]\n m = regex.search(app_id)\n if not m:\n return False\n elif uuid_hex or m:\n return True\n except ValueError:\n...
[ "0.5955192", "0.58531183", "0.5785968", "0.5747305", "0.5564219", "0.55364764", "0.55073184", "0.55073184", "0.5500049", "0.5494151", "0.5491942", "0.5420474", "0.54116887", "0.5402278", "0.53982353", "0.53625035", "0.53603745", "0.5358079", "0.5352393", "0.5302176", "0.52303...
0.796884
0
Returns True if |version| is pinned.
def is_pinned_version(version): return is_valid_instance_id(version) or is_valid_tag(version)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pinned(self):\n sql = \"SELECT is_pinned FROM hive_posts WHERE id = :id\"\n return bool(DB.query_one(sql, id=self.post_id))", "def has_pinned_content(self):\n if \"query\" in self.query:\n q = self.query[\"query\"]\n else:\n q = self.query\n if \"pinn...
[ "0.68700564", "0.62286377", "0.6044816", "0.5729679", "0.5567676", "0.55376637", "0.547604", "0.5406997", "0.5394052", "0.53202367", "0.51067346", "0.50909615", "0.5082229", "0.5074023", "0.50581986", "0.50308985", "0.5023997", "0.50119734", "0.4988513", "0.4987271", "0.49844...
0.78000677
0
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.83695436", "0.8280479", "0.82485795", "0.8139178", "0.8114118", "0.80985415", "0.80940944", "0.80797124", "0.80677074", "0.80673695", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.80569947", "0.80545217", "0.80448323", "0.804...
0.7951494
38
Creates a pipeline of primitives.
def create_pipeline(self, primitives, hyperparameters=None): self.primitive = self.check_path(primitives) if hyperparameters is not None: hyperparameters = self.check_path_hyperparameters(hyperparameters) pipeline = MLPipeline(self.primitive, hyperparameters) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_numerical_pipeline(self) -> Pipeline:\n pipeline = Pipeline([\n ('extract_data', FunctionTransformer(self.get_numerical_features)),\n ('impute', SimpleImputer(missing_values=np.nan)),\n ('standard_scaler', CustomStandardScaler())\n ])\n return pipelin...
[ "0.61798215", "0.61173534", "0.5997139", "0.58952326", "0.5893748", "0.58808076", "0.5872877", "0.5810411", "0.58073366", "0.5719939", "0.56979126", "0.5693223", "0.569222", "0.5669602", "0.56535953", "0.56421936", "0.5639609", "0.5572614", "0.55566245", "0.55338943", "0.5524...
0.6683296
0
Translates a rgb tuple to the same tuple from the range 01 to the range 0255.
def translate_rgb(rgb_tuple): mapped_rgb_value = [] for component in rgb_tuple: mapped_rgb_value.append(translate(component, 0, 1, 0, 255)) return tuple(mapped_rgb_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int2color_tuple(x):\n red_val = int(1000 * x % 255)\n green_val = int(10000 * x % 255)\n blue_val = int(100000 * x % 255)\n return red_val, green_val, blue_val", "def convert_to_RGB_255(colors):\n return (colors[0]*255.0, colors[1]*255.0, colors[2]*255.0)", "def hex_to_rgb(self,value):\n ...
[ "0.7705764", "0.73138994", "0.706653", "0.7000178", "0.69928914", "0.6973792", "0.6963842", "0.6931905", "0.6929159", "0.68408823", "0.6829972", "0.6828486", "0.6754302", "0.67361355", "0.67361355", "0.67361355", "0.67361355", "0.67156404", "0.67156404", "0.67156404", "0.6715...
0.8059268
0
Calculates the euclidean distance between two colors
def color_distance(color1, color2): dist_h = color1[0] - color2[0] dist_s = color1[1] - color2[1] dist_v = color1[2] - color2[2] return sqrt(dist_h * dist_h + dist_s * dist_s + dist_v * dist_v)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_dist(c1, c2):\n return sum((a - b) ** 2 for a, b in zip(to_ycc(c1), to_ycc(c2)))", "def colorDistance(color1, color2):\n intColor1 = np.array(color1, dtype=int)\n intColor2 = np.array(color2, dtype=int)\n return sqrt(2 * (intColor1[0] - intColor2[0])**2 + 4 * (intColor1[1] - intColor2[1])**...
[ "0.86011326", "0.8484401", "0.829997", "0.8252177", "0.8199349", "0.8190325", "0.8000533", "0.7919303", "0.7651752", "0.7431277", "0.70807165", "0.7004771", "0.69348663", "0.68690914", "0.6844022", "0.6757201", "0.6732118", "0.67291284", "0.67271715", "0.67157966", "0.6667949...
0.8426169
2
Finds all words and figures in string `s`, strips diacritics from them, lowercases them and returns them as a list.
def get_words(s): return tokenize(lower_without_diacritics(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_without_diacritics(s):\n return filter(lambda u: not combining(u), normalize('NFKD', s)).lower()", "def extract_words(s):\n\n if has_dashdash(s):\n s = myreplace(\"--\",\" \", s)\n\n s = s.lower().split()\n word_list = []\n\n for word in s:\n\n word_list.append(cleanword(wo...
[ "0.6988526", "0.6872961", "0.64936674", "0.64372414", "0.63879293", "0.63436854", "0.6306243", "0.63019013", "0.60846066", "0.6064704", "0.60423464", "0.6023796", "0.5970452", "0.5944302", "0.59092796", "0.58806944", "0.5867269", "0.58281916", "0.5806929", "0.5806929", "0.577...
0.73699296
0
Get data from yaml files (nonrecursively) from target_directory Skip files that throw YAML Parsing exceptions
def get_yaml_files(target_directory): import os import yaml result = {} for file in os.listdir(target_directory): file_path = os.path.join(target_directory, file) try: with open(file_path) as f: yaml_data = yaml.load(f) result[file] = yaml_data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fork_and_get_files(path) -> dict:\n advisory_dirs = path / \"vulns\"\n for file in advisory_dirs.glob(\"**/*.yaml\"):\n with open(file) as f:\n yield saneyaml.load(f.read())", "def process_yamls(folder):\n for item in iglob(folder + \"/*.yaml\"):\n data_file = os.path.join(f...
[ "0.65056974", "0.63148654", "0.6114606", "0.6090967", "0.60024095", "0.5967427", "0.59651536", "0.59386647", "0.59229004", "0.59107566", "0.5898885", "0.58953834", "0.5871489", "0.57461804", "0.5670247", "0.5640978", "0.56377107", "0.5629801", "0.56153256", "0.56035024", "0.5...
0.683706
0
Get the theoretical spouting velocity for a turbine.
def turbine_spout_velocity(p_o, p_e, T_o, gamma, c_p): dh_turb = turbine_enthalpy(p_o, p_e, T_o, gamma, c_p) c_o = ((2 * dh_turb)**0.5) return c_o
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_velocity(self):\n return self.momentum/self.mass", "def getVelocity(self):\n return self.v", "def get_velocity(self):\n return (self._I85_msg_from_device(self.node.sdo[0x606c].phys)) / 10 # rad/s", "def orbitalVelocity( self ): # returns [m/s]...
[ "0.67023915", "0.6370546", "0.63463503", "0.62100834", "0.6199746", "0.6172964", "0.60821986", "0.6058657", "0.6058657", "0.604352", "0.59885174", "0.5954467", "0.58171827", "0.5805677", "0.5750838", "0.5735915", "0.5733193", "0.5728575", "0.5710927", "0.57105345", "0.5709628...
0.6990736
0
Return a random album selected from the library.
def get_random_album(self): lib = self.ctrl.library artist, album = lib.get_random_album() return self.resp_from_data({ "artist": artist, "album": album, "path": lib.get_path(artist, album) })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def random_album_popularity():\n center_popularity = 0.8\n\n curvature = 40\n lower_bound = -1\n upper_bound = erf(math.sqrt(curvature) * (1 - center_popularity))\n x = random.uniform(lower_bound, upper_bound)\n y = erfinv(x) / math.sqrt(curvature) + center_popularit...
[ "0.6916328", "0.6749973", "0.6617715", "0.6394853", "0.6393976", "0.6377687", "0.6252139", "0.6071143", "0.6010934", "0.59721214", "0.5936897", "0.5918393", "0.5895841", "0.5895841", "0.58860755", "0.58859646", "0.58753175", "0.58413947", "0.5838833", "0.5824986", "0.58041847...
0.8329697
0
Test that when events are created without both of end_date and end_time, end_datetime() returns None.
def test_event_end_datetimes_none_with_incomplete_data(self): e = Event(title=self.TITLE, creator=self.USER, end_date=self.END.date()) self.assertIsNone(e.end_datetime()) f = Event(title=self.TITLE, creator=self.USER, end_time=self.END.time()) self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_event_end_datetimes(self):\n e = Event(title=self.TITLE, creator=self.USER,\n end_date=self.END.date(),\n end_time=self.END.time())\n self.assertEqual(e.end_datetime(), self.END)", "def test_event_start_datetimes_none_with_incomplete_data(self):\n e...
[ "0.76450753", "0.751534", "0.7167959", "0.6886683", "0.6881873", "0.6838561", "0.6762366", "0.6731533", "0.67256707", "0.66983646", "0.65614927", "0.6417475", "0.6349643", "0.63006175", "0.6267911", "0.62460816", "0.6207779", "0.62029594", "0.6191031", "0.60991603", "0.609837...
0.8692231
0
Test that when the `/admin/events/publish/` routeis POSTed to by a nonpublisher an error is thrown.
def test_publish_as_editor(self): e = self.make_event() e.save() event_id = e.id resp = self.request_with_role('/admin/events/publish/%s' % event_id, role='editor', method='POST') self.assertEqual(resp.status_code, 401) self.assertEqual(Even...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_publish_event_as_publisher_when_event_does_not_exist(self):\n e = self.make_event()\n e.save()\n other_id = ObjectId()\n resp = self.request_with_role('/admin/events/publish/%s' % other_id, role='publisher',\n method='POST', follow_redirects=True)\...
[ "0.7952381", "0.7566972", "0.73306483", "0.71861696", "0.6695914", "0.6489431", "0.6459664", "0.64445794", "0.6430859", "0.6391497", "0.63351536", "0.6309055", "0.62898", "0.62731737", "0.6268083", "0.62196976", "0.6172309", "0.61555916", "0.61272013", "0.6126173", "0.6077381...
0.67065763
4
Return true if the binary_sensor is on.
def is_on(self): return self.coordinator.data.get("title", "") == "foo"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n return self._sensor_state()", "def is_on(self):\n return getattr(self.coordinator.data[0], self._sensor) is True", "def is_on(self):\n data = self.sensor_data\n if data and data[\"model\"] == \"SML\" and data[\"changed\"]:\n return data[\"state\"] == ST...
[ "0.7884619", "0.7740934", "0.74744123", "0.7355086", "0.711196", "0.7103455", "0.70885575", "0.70885575", "0.70885575", "0.70857835", "0.70182335", "0.70182335", "0.70131624", "0.6916831", "0.6902558", "0.6866156", "0.68592364", "0.68461555", "0.6827404", "0.68255574", "0.681...
0.0
-1
Sets the learning rate to the initial LR decayed by 10 at every specified step
def adjust_learning_rate(optimizer, gamma, step): lr = args.lr * (gamma ** (step)) for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(optimizer, epoch, args, step):\n lr = args.lr * (0.1 ** (epoch // step))\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr", "def adjust_learning_rate(optimizer, lr, step, args):\n # decay = 0.1**(sum(epoch >= np.array(lr_steps)))\n lr = lr * (0.95*...
[ "0.76771075", "0.7676736", "0.7549009", "0.7542777", "0.75322485", "0.7501413", "0.7474216", "0.7464822", "0.74627334", "0.7447572", "0.74462754", "0.74462754", "0.74231374", "0.74231374", "0.74188375", "0.74147916", "0.73997957", "0.7390569", "0.7386777", "0.7375202", "0.736...
0.7350159
22
class constructor that creates the layers attributes for fc_block
def __init__(self, h_units, weight_decay, dropout_rate): # inherit class constructor attributes from tf.keras.layers.Layer super(fc_block, self).__init__() # add dense layer attribute with L2 Regulariser self.dense = tf.keras.layers.Dense(h_units, use_bias = False, kern...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n base.Layer.__init__(self, **kwargs)\n self._group = self.spec['group']\n self._conv_args = dict(self.spec)\n self._conv_args['name'] = self.spec['name'] + '_sub'\n del self._conv_args['group']\n self._bottom_sub = [base.Blob() for _ in range...
[ "0.7007447", "0.7000033", "0.6898863", "0.6715587", "0.66981447", "0.6684075", "0.66690004", "0.6645492", "0.66444635", "0.6621342", "0.66101295", "0.6539464", "0.65268224", "0.648005", "0.6467482", "0.6453752", "0.6450583", "0.64445084", "0.63873464", "0.6372524", "0.6314705...
0.69783986
2
class constructor that creates the layers attributes for fully connected model
def __init__(self, model, h_units, weight_decay, dropout_rate, num_of_outputs, training_name): # inherit class constructor attributes from tf.keras.Model super(fc_model, self).__init__() # model name self.model_name = None # type of model architecture ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, layers):\n\n\t\tself.layers = layers", "def __init__(self, layerNeurons, numberOfLayers, initialWeights = None, lowerBound = None, upperBound = None):\r\n \r\n # Ensure that there is at-least one input and one output layer in the network\r\n assert len(layerNeu...
[ "0.73490006", "0.70959204", "0.7080801", "0.70626026", "0.7043414", "0.70004934", "0.6997669", "0.6987128", "0.6958773", "0.68995047", "0.6890252", "0.68599576", "0.6845717", "0.68412167", "0.68173575", "0.67875355", "0.67715716", "0.6763323", "0.6721514", "0.6714114", "0.671...
0.0
-1
Returns sum of residuals squared for all data points.
def get_S_r(self): S_r = np.sum((self.eta_model - self.eta_exp) ** 2.) return S_r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normsq(self):\n return sum(x**2 for x in self.data)", "def sumsquares(self):\n return np.dot((self.demeaned ** 2).T, self.weights)", "def residuals(self) -> npt.NDArray[np.float64]:\n return self.data - self.theory", "def ssr(self):\n return (self.resid * self.resid).sum(0)", ...
[ "0.7260284", "0.7104986", "0.70855296", "0.69749516", "0.6850986", "0.6681976", "0.6676204", "0.6665276", "0.6624208", "0.6594622", "0.6576358", "0.6576358", "0.65492713", "0.6489132", "0.6483268", "0.64332604", "0.63574106", "0.6350852", "0.63213056", "0.6260967", "0.6221822...
0.0
-1
Write the given input texts and (optionally) labels to the file pointed to by ``input_path``.
def _write_input( self, X: List[str], labels: Optional[Union[List[str], List[List[str]]]], input_path: Path, ): df = pd.DataFrame({"Text": X}) if labels is not None: df["Label"] = labels df.to_csv(input_path, sep="\t", index=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_input(\n self, X: List[str], labels: Optional[List[List[str]]], input_path: Path\n ):\n df = pd.DataFrame({\"Text\": X})\n\n if labels is not None:\n df[\"Label\"] = labels\n\n df.to_csv(input_path, sep=\"\\t\", index=False)", "def _write_labels(self, labels: ...
[ "0.6839173", "0.6668793", "0.6668793", "0.635559", "0.6217582", "0.6160168", "0.577795", "0.576962", "0.5678321", "0.55674744", "0.5549849", "0.5538833", "0.55052674", "0.54890496", "0.5488365", "0.5448648", "0.543804", "0.542459", "0.53980565", "0.5387054", "0.5384514", "0...
0.684504
0
Returns True if s is a valid numerical string; it returns False otherwise. A valid numerical string is one with only digits and commas, and commas only appear at every three digits. In addition, a valid string only starts with a 0 if it has exactly one character. Pay close attention to the precondition, as it will help...
def valid_format(s): if len(s) > 7: return False elif '0' in s and len(s) == 1: return True elif s[0] == '0' and len(s) > 1: return False elif introcs.isalpha(s): return False elif (len(s) > 3) and (introcs.count_str(s, ',') == 0): return False elif introc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isNumber(s):\n\ttry:\n\t\tfloat(s)\n\t\treturn True\n\texcept ValueError:\n\t\treturn False", "def is_number(self,s):\n try:\n float(s.replace(\" \", \"\"))\n return True\n except ValueError:\n return False", "def isNumber(self, s):\n try:\n ...
[ "0.7657637", "0.76408625", "0.7621778", "0.75774306", "0.75520647", "0.75507283", "0.7514705", "0.7499453", "0.7474801", "0.7470164", "0.7470164", "0.7470164", "0.7439354", "0.74321604", "0.7375063", "0.7337118", "0.7260752", "0.7191079", "0.71780807", "0.70994633", "0.707099...
0.75005597
7
Reads each item type in ItemTypes.txt and builds a dictionary of ITypeNode objects keyed by itype code.
def parse_itypes(item_types_txt): itype_nodes = {} parent_codes = {} for item_type in item_types_txt: code = item_type["Code"] if not code: continue if code in itype_nodes: raise KeyError(f"Duplicate itype code '{code}' found") node = itype_nodes[co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readTypes(self):\r\n types = {}\r\n for m in re.finditer(\"TYPE (.*) = (.*);\", self.data):\r\n typename, typetype = m.groups() \r\n if typetype in self.SIMPLETYPES:\r\n types[typename] = typetype\r\n else:\r\n types[typename] = \"#\"...
[ "0.6651521", "0.61460525", "0.5919965", "0.5877177", "0.5852831", "0.5707935", "0.56872416", "0.55287296", "0.55161977", "0.54911435", "0.54846144", "0.5477757", "0.5425206", "0.5380841", "0.53064394", "0.5279703", "0.52651685", "0.52185273", "0.5201807", "0.5188381", "0.5183...
0.7792256
0
Given code, returns a sequence of Tokens.
def tokenize(code): # pylint: disable=too-many-branches tokens = [] token = Token() for c in code: # pylint: disable=invalid-name is_whitespace = c in string.whitespace is_and = (c == '&') is_or = (c == '|') is_oparen = (c == '(') is_cparen = (c == ')') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_for_bleu_eval(self, code):\n code = re.sub(r'([^A-Za-z0-9_])', r' \\1 ', code)\n code = re.sub(r'([a-z])([A-Z])', r'\\1 \\2', code)\n code = re.sub(r'\\s+', ' ', code)\n code = code.replace('\"', '`')\n code = code.replace('\\'', '`')\n tokens = [t for t in co...
[ "0.7328229", "0.716463", "0.7139289", "0.7052186", "0.6861001", "0.6613604", "0.6529043", "0.64652187", "0.64321333", "0.6351658", "0.6172038", "0.6071586", "0.60517174", "0.6022528", "0.59974664", "0.5972395", "0.5971003", "0.5965546", "0.5963339", "0.5941569", "0.59030056",...
0.74279535
0
Sets up the testing environment
def setUpClass(cls): Base._Base__nb_objects = 0 cls.b1 = Base() cls.b2 = Base() cls.b3 = Base(22) cls.b4 = Base(2.2) cls.b5 = Base("two") cls.r1 = Rectangle(10, 7, 2, 8) cls.r2 = Rectangle(2, 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n self.setup_beets()", "def SetupEnvironment(self):\n pass", "def setUp(self) -> None:\n\n self.helper = Enviro...
[ "0.84215105", "0.7873159", "0.7873159", "0.7567148", "0.7552537", "0.75011325", "0.74919206", "0.748369", "0.7463765", "0.7463765", "0.7421059", "0.74175394", "0.74058324", "0.7382671", "0.7381207", "0.73785275", "0.7347812", "0.732771", "0.7314868", "0.73102283", "0.7307878"...
0.0
-1
Tests if the JSON string representation is working
def test_15_0_toJsonString(self): dictionary = self.r1.to_dictionary() json_dictionary = Base.to_json_string([dictionary]) self.assertTrue(type(dictionary), dict) self.assertTrue(type(json_dictionary), str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __valid_json(string):\n try:\n obj = json.loads(string)\n except ValueError:\n return False\n else:\n return json.dumps(obj)", "def is_correct_json(string):\n if len(string) == 0:\n return False\n\n if string[0] is not '{' and string[0] is no...
[ "0.78802836", "0.77933025", "0.7716961", "0.7647663", "0.74915034", "0.7471144", "0.74005824", "0.7377683", "0.73771983", "0.73279905", "0.73137385", "0.73077095", "0.7301245", "0.7272826", "0.7266663", "0.72648877", "0.72640103", "0.7239499", "0.71751946", "0.7163578", "0.71...
0.66619647
47
Initialize cards, decks, players for game
def prepare_game( decks_count: int, auto_mode: bool, player_one_name: str, players_count: int ) -> List[Player]: # define list of random names for bot-players random_names = RANDOM_NAMES shuffle(random_names) if player_one_name: names = [player_one_name] + random_names[: players_count - 1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializeGame(self):\n # Fill deck with cards and shuffle it\n self.deck.fill(104)\n self.deck.shuffle()\n #print \"Deck initialized\"\n\n # Initialize the field\n self.field.initialize(self.deck.draw(4))\n self.field.sortField()\n #self.field.printField...
[ "0.7737999", "0.76391125", "0.7360046", "0.73220366", "0.7267212", "0.72554815", "0.72282505", "0.7198225", "0.7194274", "0.71909773", "0.717267", "0.7153211", "0.7148592", "0.70615304", "0.70490485", "0.7040893", "0.70309526", "0.70241433", "0.6956643", "0.6941083", "0.69406...
0.63367677
72
Escalation email will be visible if proctortrack is the proctoring provider, and there is an escalation email provided.
def test_proctortrack_provider_with_email(self): self.setup_course_with_proctoring_backend('proctortrack', 'foo@bar.com') self.instructor.is_staff = True self.instructor.save() self._assert_escalation_email_available(True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_proctortrack_provider(self, proctoring_provider, escalation_email):\n self.setup_course_with_proctoring_backend(proctoring_provider, escalation_email)\n\n self.instructor.is_staff = True\n self.instructor.save()\n self._assert_escalation_email_available(False)", "def get_...
[ "0.6877295", "0.6027823", "0.58905375", "0.5660323", "0.5529722", "0.55204546", "0.5512198", "0.54833275", "0.5448476", "0.5448476", "0.53752875", "0.5364299", "0.53391045", "0.530013", "0.52827674", "0.5230018", "0.52141845", "0.5198444", "0.518013", "0.51746964", "0.5157717...
0.68462604
1
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: unload_ok = await hass.config_entries.async_unload_platforms( entry, SUPPORTED_PLATFORMS ) if unload_ok: matter_entry_data: MatterEntryData = hass.data[DOMAIN].pop(entry.entry_id) matter_entry_data.listen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.69729054", "0.688811", "0.6779906", "0.67475253", "0.6689114", "0.6657885", "0.66162664", "0.6603484", "0.65926456", "0.65596145", "0.6541213", "0.65076923", "0.65076923", "0.65076923", "0.65076923", "0.6497813", "0.6493226", "0.6486651", "0.6486651", "0.6486651", "0.64866...
0.55235124
97
Checks if two values are equal. The operation can be performed over values of any type.
def are_equal(value1, value2): if value1 == None or value2 == None: return True if value1 == None or value2 == None: return False return value1 == value2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_eq(self, a, b):\r\n return a == b", "def values_equal(t : Type, v1, v2) -> bool:\n return compare_values(t, v1, v2) == EQ", "def _equal_values(self, val1, val2):\n if self.f_supports(val1) != self.f_supports(val2):\n return False\n\n if not self.f_supports(val1) an...
[ "0.81308645", "0.7778836", "0.77097344", "0.72997165", "0.7186668", "0.71511114", "0.71174115", "0.7062709", "0.705435", "0.70398104", "0.7029143", "0.69358814", "0.68888134", "0.68493885", "0.68417853", "0.6813937", "0.68024653", "0.67398846", "0.67343354", "0.6661131", "0.6...
0.75891024
3
Checks if two values are NOT equal. The operation can be performed over values of any type.
def are_not_equal(value1, value2): return not ObjectComparator.are_equal(value1, value2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, values):\n self = self.__eq__(values)\n return self.__invert__()", "def test_not_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_b, enums.OpaqueDataType.NONE)\n self.asser...
[ "0.7947506", "0.7776476", "0.77183795", "0.7694495", "0.7588671", "0.74666506", "0.74621", "0.74038714", "0.7367064", "0.7334391", "0.73289937", "0.73280066", "0.7310195", "0.7301686", "0.7289725", "0.7287741", "0.7287741", "0.7287741", "0.7285617", "0.72851324", "0.72851324"...
0.8256167
0
Redirect user to homepage.
def homepage_redirect(): return redirect('/upload_file')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage():\n if g.user:\n return redirect(f\"/user/{g.user.id}\")\n else:\n return redirect(\"/landing\")", "def home_page():\n return redirect('/users')", "def home_page():\n return redirect(url_for(_DEFAULT_ROUTE, _external=True))", "def homepage():\n return redirect('inde...
[ "0.85024", "0.79325074", "0.7915098", "0.78631073", "0.7602217", "0.7551001", "0.7411325", "0.7262429", "0.7262429", "0.7217574", "0.720093", "0.71057284", "0.7104039", "0.70794016", "0.7072314", "0.7011575", "0.6956946", "0.6940536", "0.69288236", "0.6921044", "0.6880167", ...
0.6972406
16
Sets the id of this ClusterNodeTypeExt.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_node_id(self, node_id):\n self._node_id = node_id", "def node_id(self, node_id: int):\r\n self._node_id = node_id", "def node_id(self, node_id):\n\n self._node_id = node_id", "def setNodeId(self, recId):\n if self.cursor:\n self.cursor.nodeId = recId", "def se...
[ "0.7051521", "0.6915476", "0.6738046", "0.641449", "0.6372802", "0.6310869", "0.6310869", "0.6310869", "0.6310869", "0.6310869", "0.6310869", "0.63044417", "0.63044417", "0.63044417", "0.63044417", "0.63044417", "0.63044417", "0.62787855", "0.6263974", "0.62579685", "0.618361...
0.0
-1
Sets the name of this ClusterNodeTypeExt.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_name(self, value: str):\n self._properties[\"nodeName\"] = value", "def set_name(self, name):\r\n self.stream.set_node_name(self.node, name)", "def setName(self, name):\n libxml2mod.xmlNodeSetName(self._o, name)", "def set_name(self, name):\n self.name = name\n sel...
[ "0.74600965", "0.738636", "0.68940526", "0.67724484", "0.6585441", "0.6585441", "0.6580282", "0.65797925", "0.65734583", "0.6568306", "0.6548846", "0.6548846", "0.6548846", "0.6548846", "0.6548846", "0.64733064", "0.64645076", "0.6446455", "0.64342356", "0.6425983", "0.642598...
0.0
-1
Sets the description of this ClusterNodeTypeExt.
def description(self, description): self._description = description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self, description: ConfigNodePropertyString):\n\n self._description = description", "def set_description(self, description):\n self.__description = description", "def set_description(self, description):\r\n self.__description = description", "def cluster_type(self, cluste...
[ "0.62267756", "0.5760493", "0.5745829", "0.5738135", "0.57222444", "0.5673848", "0.5663078", "0.5645218", "0.55802816", "0.5547709", "0.55310875", "0.5493465", "0.5463977", "0.5454126", "0.5443208", "0.539936", "0.53808105", "0.53808105", "0.53808105", "0.53808105", "0.537310...
0.5423449
43
Sets the number_of_nodes of this ClusterNodeTypeExt.
def number_of_nodes(self, number_of_nodes): self._number_of_nodes = number_of_nodes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_count(self, node_count):\n\n self._node_count = node_count", "def set_node_variable_number(self, number):\n if number == 0: # pragma: no cover\n return\n\n self._f.dimensions[\"num_nod_var\"] = number\n\n self._f.create_variable(\n \"name_nod_var\", (\"...
[ "0.7291631", "0.6504585", "0.6363424", "0.608234", "0.6053881", "0.60215235", "0.5928358", "0.5919301", "0.58629084", "0.58415383", "0.58327425", "0.5832642", "0.58317924", "0.58317924", "0.58317924", "0.58317924", "0.58317924", "0.58317924", "0.57976985", "0.5781155", "0.577...
0.80338645
0
Sets the cores_per_node of this ClusterNodeTypeExt.
def cores_per_node(self, cores_per_node): self._cores_per_node = cores_per_node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cores(self, cores):\n self.cores = cores\n return", "def set_cpus(self, num_cpus: int) -> None:\n if self.batch:\n if self.launcher in [\"pbs\", \"cobalt\"]:\n if hasattr(self, \"batch_settings\") and self.batch_settings:\n if hasattr(self...
[ "0.68911874", "0.6468362", "0.629136", "0.601545", "0.598136", "0.59321094", "0.5842676", "0.5802815", "0.5773071", "0.57560277", "0.5735677", "0.57267785", "0.5688703", "0.55844986", "0.55470073", "0.5494605", "0.5459274", "0.5454222", "0.53781134", "0.5355706", "0.53498286"...
0.87283945
0
Sets the projects of this ClusterNodeTypeExt.
def projects(self, projects): self._projects = projects
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projects(self, projects):\n if (self.local_vars_configuration.client_side_validation and\n projects is not None and not isinstance(projects, int)):\n raise ValueError(\"Parameter `projects` must be an integer\") # noqa: E501\n\n self._projects = projects", "def num_pr...
[ "0.6651427", "0.6174502", "0.5456987", "0.5429296", "0.5398397", "0.5382199", "0.53765255", "0.5374092", "0.53731316", "0.5337573", "0.53000635", "0.52953625", "0.5290864", "0.5257576", "0.51513475", "0.51491076", "0.50772727", "0.50395334", "0.50132835", "0.5010245", "0.4987...
0.72606957
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ClusterNodeTypeExt): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Refresh parcel information. For CM API versions without support for the REST endpoint, this will simply sleep.
def refresh_parcel_repos(self): if self.api_client.api_version < 'v16': logger.warning('Detected API version without support ' 'for refreshParcelRepos (%s). Sleeping instead ...', self.api_client.api_version) sleep(30) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refresh(self):\n resp = self._cb.get_object(self._build_api_request_uri())\n self._info = resp\n self._last_refresh_time = time.time()\n return True", "def _refresh(self):\n resp = self._cb.get_object(self._build_api_request_uri())\n self._info = resp\n self....
[ "0.6602508", "0.6602508", "0.6191611", "0.6191611", "0.6191611", "0.61795735", "0.61657506", "0.61194515", "0.5994885", "0.5947069", "0.59129643", "0.59129643", "0.59129643", "0.59097993", "0.59094274", "0.5906419", "0.5882981", "0.5868612", "0.58388704", "0.58388704", "0.582...
0.71351945
0
Get a list of all services in the cluster.
def get_cluster_services(self, cluster_name, view='summary'): return self.api_client.get_cluster_services(cluster_name=cluster_name, view=view)['items']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_services(self):\r\n return get_service_list()", "def get_cluster_services(self, cluster_name, view='summary'):\n return self._get(endpoint='{}/clusters/{}/services'.format(self.api_version,\n cluster_name),\n ...
[ "0.7930092", "0.7710456", "0.7576366", "0.7547326", "0.74353623", "0.73736095", "0.7348278", "0.73317814", "0.7238655", "0.723498", "0.72269535", "0.7198663", "0.71666217", "0.70819306", "0.7049139", "0.7006544", "0.7004622", "0.69799525", "0.6965898", "0.692149", "0.6907456"...
0.7990671
0
This function adds all spots that a specific knight is threatening to it's correct 'boardThreat' list based on color. It also adds all possible moves of a knight to the correct color move list, either "blackMoves" or "whiteMoves."
def knightThreat(self, color, fromRow, fromCol): if color == "black": boardThreat = self.blackThreat else: boardThreat = self.whiteThreat potential_spots = [[1, 2], [1, -2], [-1, 2], [-1, -2], [2, 1], [-2, 1], [2, -1], [-2, -1]] move_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kingThreat(self, color, fromRow, fromCol):\n if color == \"black\":\n boardThreat = self.blackThreat\n opponentThreat = self.whiteThreat\n else:\n boardThreat = self.whiteThreat\n opponentThreat = self.blackThreat\n\n move_list = []\n\n po...
[ "0.7595879", "0.75084245", "0.74657094", "0.717769", "0.71558434", "0.7092006", "0.6876316", "0.67519677", "0.6491278", "0.643525", "0.63885033", "0.63552976", "0.62486285", "0.6217798", "0.6153114", "0.61202824", "0.60848093", "0.6067523", "0.60082424", "0.59673965", "0.5896...
0.78540707
0
This function adds all spots that a specific rook is threatening to it's correct 'boardThreat' list based on color. It also adds all possible moves of a rook to the correct color move list, either "blackMoves" or "whiteMoves."
def rookThreat(self, color, fromRow, fromCol): if color == "black": boardThreat = self.blackThreat else: boardThreat = self.whiteThreat move_list = [] possible_dirs = [[1, 0], [0, 1], [-1, 0], [0, -1]] for direction in possible_dirs: emptySpa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addMoves(self, moveList, boardThreat, color, fromRow, fromCol):\n threatList = []\n for move in moveList:\n # If the move has a same color piece, add it to threat but not move list\n if self.pieces.piece_color(self.board.squares[move[0]][move[1]]) == color:\n ...
[ "0.74368006", "0.7140955", "0.70608765", "0.7001164", "0.69477445", "0.692461", "0.66382354", "0.6613016", "0.6513307", "0.64287746", "0.6416538", "0.63329566", "0.63019055", "0.61429566", "0.6114337", "0.6105798", "0.60194975", "0.5995588", "0.59851027", "0.5898062", "0.5875...
0.7662325
0
This function adds all spots that the queen is threatening to it's correct 'boardThreat' list based on color. It also adds all possible moves of the queen to the correct color move list, either "blackMoves" or "whiteMoves."
def queenThreat(self, color, fromRow, fromCol): if color == "black": boardThreat = self.blackThreat else: boardThreat = self.whiteThreat move_list = [] possible_dirs = [[1, 0], [0, 1], [-1, 0], [0, -1], [1, 1], [-1, 1], [-1, -1], [1, -1]] for direction i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addMoves(self, moveList, boardThreat, color, fromRow, fromCol):\n threatList = []\n for move in moveList:\n # If the move has a same color piece, add it to threat but not move list\n if self.pieces.piece_color(self.board.squares[move[0]][move[1]]) == color:\n ...
[ "0.72192377", "0.71610683", "0.7143938", "0.69613636", "0.69304377", "0.6914719", "0.667094", "0.66395825", "0.6487746", "0.6440213", "0.63892585", "0.6365279", "0.62765074", "0.62414324", "0.61076206", "0.6019843", "0.60192627", "0.5961828", "0.5900985", "0.5899532", "0.5894...
0.78746355
0
This function adds all spots that the king is threatening to it's correct 'boardThreat' list based on color. It also adds all possible moves of the king to the correct color move list, either "blackMoves" or "whiteMoves."
def kingThreat(self, color, fromRow, fromCol): if color == "black": boardThreat = self.blackThreat opponentThreat = self.whiteThreat else: boardThreat = self.whiteThreat opponentThreat = self.blackThreat move_list = [] possible_dirs = [[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rookThreat(self, color, fromRow, fromCol):\n if color == \"black\":\n boardThreat = self.blackThreat\n else:\n boardThreat = self.whiteThreat\n\n move_list = []\n\n possible_dirs = [[1, 0], [0, 1], [-1, 0], [0, -1]]\n for direction in possible_dirs:\n ...
[ "0.7548627", "0.7468794", "0.7364418", "0.7237601", "0.7223278", "0.71354675", "0.7062136", "0.67925566", "0.6791472", "0.66947573", "0.66032565", "0.6597939", "0.65907973", "0.6512205", "0.64479977", "0.64268255", "0.641909", "0.6271571", "0.6271571", "0.6271571", "0.6219263...
0.7776547
0
Checks the board to see if there's enough pieces left to win. Pawns can be promoted, so the presence of a pawn, queen, or rook automatically returns False. If there are fewer than 2 bishops or knights, there is insufficient material
def insufficient_material(self): piece_set = set() for row in range(8): for col in range(8): piece = self.board.squares[row][col] if piece is None: continue # Any pawn, queen or rook means there is sufficient material ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def board_tiles_availability(self):\n for row in range(GameData.rows):\n for col in range(GameData.columns):\n if self.board[row][col] == 0:\n return False\n # Game is draw, no more moves left!\n return True", "def __check_board_is_valid(self, boa...
[ "0.70218146", "0.701897", "0.688691", "0.6836031", "0.67937773", "0.67550886", "0.6714514", "0.668451", "0.6676716", "0.66749626", "0.66699153", "0.6668765", "0.66402584", "0.66359913", "0.6624023", "0.65983933", "0.6593862", "0.6556356", "0.654139", "0.6515111", "0.65092564"...
0.7671263
0
A list of lists of specified population size.
def populationList(self, popSize): popList = [] while popSize > 0: popList.append(self.newList()) popSize -= 1 return popList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePopulation(self,size):\n return [ self._individual(self._individualSize) for x in range(size) ]", "def generate_population(population_size, member_size):\n population = []\n\n for i in range(population_size):\n population.append(generate_individual(member_size))\n\n return popu...
[ "0.73682225", "0.7036232", "0.7034892", "0.6946159", "0.6802049", "0.67953455", "0.6762997", "0.6670901", "0.6574322", "0.65217537", "0.64555347", "0.6442852", "0.6382579", "0.6368306", "0.6312928", "0.6294945", "0.6276508", "0.6261121", "0.62043214", "0.6160766", "0.61595553...
0.78915256
0
Converts one image/segmentation pair to tf example
def image_to_tfexample(image_data, img_name, height, width, class_label, class_desc): return tf.train.Example(features=tf.train.Features(feature={ 'image/encoded': _bytes_list_feature(image_data), 'image/filename': _bytes_list_feature(img_name), 'image/height': _int64_list_feature(height), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_example(past_traj, future_traj):\n # img = cv2.imread('temp.png')\n # cv2.imshow('img', img)\n # cv2.waitKey(1)\n\n img_bytes = open('temp.png', 'rb').read()\n example = tf.train.Example(features=tf.train.Features(feature={\n 'image/encoded': _bytes_feature(img_bytes),\n ...
[ "0.68263364", "0.66693515", "0.65681934", "0.65612555", "0.6532016", "0.6515011", "0.6479861", "0.6446259", "0.6420206", "0.6377717", "0.6347156", "0.63123596", "0.6303564", "0.6270331", "0.6216305", "0.6214322", "0.6204555", "0.62044835", "0.6193902", "0.6149134", "0.6147339...
0.5987154
41
Test error handling of a file id that isn't in the OVF.
def test_id_nonexistent(self): self.command.package = self.input_ovf self.command.file_id = "e-dad" self.assertRaises(InvalidInputError, self.command.run)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exc(self):\n g = h5g.open(self.fid, '/')\n g._close()\n self.assertRaises(ValueError, h5i.get_file_id, g)", "def test_read_with_file_id_that_doesnt_exist(self):\n\n url = reverse('file', kwargs={'file_id': '3efcd977-184d-4124-acb4-d5c50cdffc79'})\n\n data = {}\n\n ...
[ "0.669916", "0.6672789", "0.6394868", "0.6376446", "0.6274202", "0.6270715", "0.6269701", "0.6262398", "0.62503344", "0.61936915", "0.61718446", "0.6150319", "0.6146174", "0.6120413", "0.61140424", "0.6110164", "0.6104394", "0.6084722", "0.6047298", "0.59929436", "0.5987996",...
0.7053955
0
Return an instance of the Database class.
def __getattr__(self, dbname): if dbname == "__name__": return super(Seriesly, self).__name__ else: return self.__getitem__(dbname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db(self) -> Database:\n return self.impl.db", "def db(self):\n return DbManager(self)", "def get_database(self, database, instance=None):\n return self._get(_database.Database, database)", "def get(cls) -> SqliteDatabase:\n if cls.database_instance is None:\n cls.da...
[ "0.8304717", "0.81511277", "0.8004637", "0.80035734", "0.7900513", "0.788104", "0.7828194", "0.77566564", "0.772421", "0.76034975", "0.75110656", "0.75013053", "0.74948174", "0.7488735", "0.74659693", "0.7462993", "0.74615395", "0.74420714", "0.74136084", "0.7413051", "0.7310...
0.0
-1