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
Sets the name of this Organization.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org_name(self, org_name):\n\n self._org_name = org_name", "def org_name(self, org_name):\n\n self._org_name = org_name", "def set_name(self, name):\n self._name = name", "def SetName(self, name):\n self.name = name", "def set_name(self, name: str):\n self._name = name...
[ "0.759724", "0.759724", "0.75542027", "0.755328", "0.7494422", "0.7469748", "0.7469748", "0.7469748", "0.7469748", "0.7469748", "0.74372435", "0.74372435", "0.73873687", "0.7347915", "0.7347915", "0.733082", "0.73160726", "0.7291633", "0.7268685", "0.72510606", "0.7188799", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Organization): 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
Unquote and fix hostname. Returns is_idn.
def url_fix_host(urlparts): # if not urlparts[1]: # urlparts[2] = urllib.unquote(urlparts[2]) # return False userpass, netloc = urllib.splituser(urlparts[1]) if userpass: userpass = urllib.unquote(userpass) netloc, is_idn = idna_encode(urllib.unquote(netloc).lower()) # a lead...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idna_encode(host):\n if host and isinstance(host, unicode):\n try:\n host.encode('ascii')\n return host, False\n except UnicodeError:\n uhost = host.encode('idna').decode('ascii')\n return uhost, uhost != host\n return host, False", "def test_sa...
[ "0.6449013", "0.6380736", "0.63365686", "0.6324431", "0.61450845", "0.605697", "0.6042931", "0.5928755", "0.589544", "0.58683395", "0.58616215", "0.58118397", "0.5743484", "0.56844443", "0.5675291", "0.56356144", "0.56274545", "0.561817", "0.56118816", "0.5569066", "0.5540591...
0.66974527
0
Fix common typos in given URL like forgotten colon.
def url_fix_common_typos(url): if url.startswith("http//"): url = "http://" + url[6:] elif url.startswith("https//"): url = "https://" + url[7:] return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_url(cls, url: str):\r\n ...", "def _fix_url(url):\n\n if not url.startswith('http'):\n url = 'http://' + url\n\n return url", "def correct_url(self, url: str) -> str:\n # check if url has \"http://\" prefix\n if \"http://\" not in url:\n if \"https://\" not ...
[ "0.770113", "0.73291516", "0.68543786", "0.6504218", "0.64858186", "0.6459376", "0.6437735", "0.63930553", "0.6289801", "0.6263048", "0.6251412", "0.62297577", "0.62242717", "0.613285", "0.61042875", "0.60988045", "0.60984194", "0.6093388", "0.606762", "0.60473937", "0.603849...
0.7982654
0
Split query part of mailto url if found.
def url_fix_mailto_urlsplit(urlparts): if "?" in urlparts[2]: urlparts[2], urlparts[3] = urlparts[2].split('?', 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _urlparse_splitquery(url):\r\n\r\n qpart = url.split(\"?\", 1)\r\n if len(qpart) == 2:\r\n query = qpart[1]\r\n else:\r\n query = \"\"\r\n\r\n return qpart[0], query", "def test_split_url_for_query_1(self):\n url = \"testurl.com\"\n\n output = split_url_for_query(url)\n\n self....
[ "0.67279136", "0.6404292", "0.6209104", "0.61731404", "0.6047626", "0.5870148", "0.5843502", "0.56338006", "0.55826217", "0.55750227", "0.5401481", "0.5397454", "0.5378606", "0.5351534", "0.53454334", "0.5219765", "0.5213521", "0.5209964", "0.5108182", "0.5093666", "0.5083529...
0.7407154
0
Same as urlparse.urlunsplit but with extra UNC path handling for Windows OS.
def urlunsplit(urlparts): res = urlparse.urlunsplit(urlparts) if os.name == 'nt' and urlparts[0] == 'file' and '|' not in urlparts[2]: # UNC paths must have 4 slashes: 'file:////server/path' # Depending on the path in urlparts[2], urlparse.urlunsplit() # left only two or three slashes. T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlparse(url):\n\tunquote_url=urllib.parse.unquote(url)\n\treturn unquote_url", "def _split_url(url):\n return url[1:].split('/')", "def split(path):\r\n if path.lower().startswith(\"smb://\"):\r\n if '/' not in path[6:]:\r\n path = path.replace(\"smb://\", \"smb:///\", 1)\r\n ...
[ "0.6627455", "0.65837115", "0.64844257", "0.64534926", "0.62631977", "0.6174686", "0.6172689", "0.6165752", "0.61646414", "0.61592484", "0.61030483", "0.610288", "0.60629", "0.6021757", "0.601455", "0.59292614", "0.5918131", "0.5909229", "0.58973026", "0.58960414", "0.5895975...
0.851646
0
Normalize the given URL which must be quoted. Supports unicode hostnames (IDNA encoding) according to RFC 3490.
def url_norm(url, encoding=None, strip=False, lowercase_path=False, remove_fragment=False): if strip: url = url.strip() if isinstance(url, unicode): # try to decode the URL to ascii since urllib.unquote() # handles non-unicode strings differently try: url = url.enco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_url(url):\r\n s = url\r\n url = url.encode('utf8')\r\n url = ''.join([urllib.quote(c) if ord(c) >= 127 else c for c in url])\r\n return url", "def normalize_url(self, url):\n pass", "def normalize_url(url):\n # print(url)\n if not url.startswith('http://') and not url...
[ "0.7231952", "0.71399534", "0.7058466", "0.7057212", "0.70551896", "0.70489985", "0.6984675", "0.68768114", "0.6773047", "0.66777515", "0.66775155", "0.66144353", "0.65716875", "0.65457124", "0.65359807", "0.6512017", "0.65024763", "0.6485514", "0.6482304", "0.64756083", "0.6...
0.6782342
8
Return True if host part of url matches an entry in given domain list.
def match_url(url, domainlist): if not url: return False return match_host(url_split(url)[1], domainlist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_host(host, domainlist):\n if not host:\n return False\n for domain in domainlist:\n if domain.startswith('.'):\n if host.endswith(domain):\n return True\n elif host == domain:\n return True\n return False", "def matches(self, url):\n ...
[ "0.8105381", "0.7370516", "0.7126605", "0.6921519", "0.6796388", "0.6785669", "0.67464596", "0.6718634", "0.6564882", "0.654149", "0.6427154", "0.636126", "0.6316495", "0.6279034", "0.62371093", "0.62335455", "0.62335455", "0.6123072", "0.6119781", "0.60940176", "0.6078012", ...
0.83841044
0
Return True if host matches an entry in given domain list.
def match_host(host, domainlist): if not host: return False for domain in domainlist: if domain.startswith('.'): if host.endswith(domain): return True elif host == domain: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_url(url, domainlist):\n if not url:\n return False\n return match_host(url_split(url)[1], domainlist)", "def matches_hostname(self, hostname):\n return hostname in self.hostnames", "def domain_in_ip_whois_match(self, domain, ip):\n try:\n domain_ip_desc = self.ge...
[ "0.718514", "0.7060217", "0.69207466", "0.6798229", "0.6687461", "0.6494838", "0.6165921", "0.61154306", "0.6060035", "0.6051432", "0.6046193", "0.60253114", "0.5941196", "0.59102017", "0.5872509", "0.5855687", "0.5823825", "0.5729784", "0.5715016", "0.5689225", "0.5683604", ...
0.83065116
0
Check if url needs percent quoting. Note that the method does only check basic character sets, and not any other syntax. The URL might still be syntactically incorrect even when it is properly quoted.
def url_needs_quoting(url): if url.rstrip() != url: # handle trailing whitespace as a special case # since '$' matches immediately before a end-of-line return True return not _safe_url_chars_ro.match(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unreserved_percentencoding():\n assert (normalize_url(\"http://www.example.com/%7Eusername/\") ==\n \"http://www.example.com/~username\")\n assert (normalize_url('http://example.com/foo%23bar') ==\n 'http://example.com/foo%23bar')\n assert (normalize_url('http://example.com/...
[ "0.7206755", "0.7197858", "0.70679295", "0.6783549", "0.66798353", "0.6624512", "0.65184194", "0.6379363", "0.6148199", "0.60375714", "0.59809166", "0.596141", "0.59491706", "0.59333074", "0.59282386", "0.5914704", "0.5908903", "0.5879197", "0.58755445", "0.58680904", "0.5833...
0.7765809
0
Rejoin URL parts to a string.
def url_unsplit(parts): if parts[2] == default_ports.get(parts[0]): return "%s://%s%s" % (parts[0], parts[1], parts[3]) return "%s://%s:%d%s" % parts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _url_join(self, *parts):\n return \"/\".join(map(lambda fragment: fragment.rstrip('/'), parts))", "def url_join(*parts):\n parts = parts or [\"\"]\n clean_parts = [part.strip(\"/\") for part in parts if part]\n if not parts[-1]:\n # Empty last element should add a trailing slash\n ...
[ "0.789799", "0.76372606", "0.7635184", "0.7324334", "0.7313276", "0.72960657", "0.72905284", "0.7280653", "0.72795635", "0.72734", "0.7244201", "0.7212807", "0.7209664", "0.7034434", "0.6943335", "0.69341743", "0.68809646", "0.6825387", "0.6815612", "0.6801993", "0.6796151", ...
0.6047936
40
Check if both URLs are allowed to point to the same content.
def is_duplicate_content_url(url1, url2): if url1 == url2: return True if url2 in url1: url1 = shorten_duplicate_content_url(url1) if not url2.endswith('/') and url1.endswith('/'): url2 += '/' return url1 == url2 if url1 in url2: url2 = shorten_duplicate_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urlEqual(url_1, url_2):\n parse_result_1 = urlparse(url_1)\n parse_result_2 = urlparse(url_2)\n\n return (parse_result_1[:4] == parse_result_2[:4] and\n parse_qs(parse_result_1[5]) == parse_qs(parse_result_2[5]))", "def same_origin(url1, url2):\n p1, p2 = urlparse.urlparse(url1), urlpa...
[ "0.71224326", "0.6801178", "0.64278007", "0.637694", "0.63402057", "0.63119143", "0.6286929", "0.62371063", "0.61779445", "0.61676055", "0.6156955", "0.6119644", "0.6043208", "0.60181797", "0.6006415", "0.599031", "0.5972156", "0.59510684", "0.59472144", "0.5881061", "0.58000...
0.7777119
0
Converts to numpy and squeezes out dummy batch dimension.
def to_numpy_squeeze(values: types.Nest) -> types.NestedArray: return tree_util.tree_map(lambda x: np.array(x).squeeze(axis=0), values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_dummy_batch_dim(x):\n return x.view(1, x.size()[0], x.size()[1], x.size()[2])", "def with_batch_dim(x: torch.Tensor) -> torch.Tensor:\n if x.dim() == 1:\n return x.unsqueeze(0)\n else:\n return x", "def trim_and_pad_batch(self, batch):\n\t\tmaxlength = min(self.MA...
[ "0.7421706", "0.6592234", "0.63858634", "0.6235317", "0.6215392", "0.6022636", "0.602108", "0.6016574", "0.6016574", "0.5995724", "0.59902906", "0.5960881", "0.5952256", "0.59430224", "0.5940777", "0.5935754", "0.5915034", "0.5908869", "0.59015334", "0.5898744", "0.5817364", ...
0.0
-1
Enqueues items from `iterable` on a given thread.
def producer(): try: # Build a new iterable for each thread. This is crucial if working with # tensorflow datasets because tf.Graph objects are thread local. for item in iterable: buffer.put(item) except Exception as e: # pylint: disable=broad-except logging.exception('Error in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _aiter_sync(iterable: Iterable[T]) -> AsyncIterator[T]:\n for item in iterable:\n yield item", "def queue_inputs(self, iterable):\n self.input_queue.extend(iterable)", "def imap(self, iterable):\n def get_results():\n \"\"\"Get a result from the worker output queue ...
[ "0.6482619", "0.6424396", "0.6024713", "0.5948052", "0.5816059", "0.57797146", "0.57494015", "0.5637934", "0.5492317", "0.54332095", "0.53467715", "0.5325421", "0.5254408", "0.52281237", "0.5205555", "0.5189476", "0.5170215", "0.5154162", "0.51500005", "0.51260334", "0.510404...
0.6857861
0
Sets the button_id of this ButtonChangeNotification.
def button_id(self, button_id): self._button_id = button_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetButton(self, button):\r\n if self._pButton:\r\n if not self.HasFlag(CP_USE_STATICBOX):\r\n self._sz.Replace(self._pButton, button)\r\n self.Unbind(wx.EVT_BUTTON, self._pButton)\r\n self._pButton.Destroy()\r\n\r\n self._pButton = button\r\n ...
[ "0.56377095", "0.5621892", "0.5578352", "0.5447032", "0.5347722", "0.53036946", "0.5280154", "0.51690286", "0.5168054", "0.51062906", "0.5094893", "0.50668573", "0.50315845", "0.5015618", "0.49925348", "0.49768975", "0.4969829", "0.49674788", "0.4931718", "0.49231914", "0.490...
0.79103726
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ButtonChangeNotification): return False return self.to_dict() == other.to_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): if not isinstance(other, ButtonChangeNotification): return True return self.to_dict() != other.to_dict()
{ "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.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Compact all maps in a frame to their default sparse representation. Optionally remove NaN values as well. Removing NaN values will reduce memory use, but will remove the distinction in unweighted (or weightremoved) maps between unobserved regions and regions with zero temperature.
def CompactMaps(frame, zero_nans=False): for s in ["T", "Q", "U", "Wunpol", "Wpol"]: if s in frame: m = frame.pop(s) m.compact(zero_nans=zero_nans) frame[s] = m return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_nans(dict_of_dfs):\n for key, df in dict_of_dfs.items():\n dict_of_dfs[key] = dict_of_dfs[key].fillna(-999)\n return dict_of_dfs", "def compact_dict(source_dict):\n return {k: v for k, v in source_dict.items() if v is not None}", "def compact(self):\n if self._memoized_compact...
[ "0.58548355", "0.5587488", "0.54499125", "0.5371619", "0.5353356", "0.5349373", "0.5292348", "0.52662545", "0.52164835", "0.52022105", "0.51015234", "0.508502", "0.5077335", "0.5072703", "0.5070282", "0.50612265", "0.50571525", "0.50527084", "0.504133", "0.5016694", "0.501108...
0.78470814
0
Validates an application description, making sure all required fields are present and of the correct type. If the description is not valid, an InvalidApplicationDescription exception is thrown. Uses a JSON schema definition.
def app_validate(data): schema = json.load(open('schemas/app_description_schema.json', 'r')) try: jsonschema.validate(data, schema) except jsonschema.ValidationError as e: raise InvalidApplicationDescription(str(e)) except jsonschema.SchemaError: log.exception('BUG: invalid sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_description(json_data: dict, manufacturer: dict):\n error_msg = ''\n if not json_data.get('description'):\n return ''\n desc = json_data.get('description')\n desc_man = manufacturer.get('description')\n if desc.get('manufacturer', '') != desc_man.get('manufacturer'):\n err...
[ "0.65155405", "0.591994", "0.58387893", "0.57241064", "0.56954294", "0.56712884", "0.55535734", "0.5547916", "0.5487829", "0.54671675", "0.5461422", "0.54116523", "0.5385446", "0.5357007", "0.5288694", "0.5253396", "0.5226772", "0.5218871", "0.5212015", "0.5206839", "0.519367...
0.7670873
0
Get the default QuerySet for read actions. Subclasses can override this method to work with other managers. Useful when working with default managers that filter some objects.
def read_queryset(self, using=None): return self.index_queryset(using=using)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all_queryset(self):\n return self.get_model()._default_manager.all()", "def get_queryset(self):\n if self.queryset is not None:\n queryset = self.queryset\n if hasattr(queryset, '_clone'):\n queryset = queryset._clone()\n elif self.model is not N...
[ "0.7399249", "0.7396451", "0.7388755", "0.7219012", "0.712535", "0.7071622", "0.7028743", "0.6935675", "0.69315505", "0.68410736", "0.6820464", "0.68038875", "0.6780891", "0.67414385", "0.6713969", "0.67115843", "0.6643043", "0.66420823", "0.6633574", "0.6633574", "0.6467329"...
0.63972527
23
Get the default QuerySet to index when doing an index update. Subclasses can override this method to take into account related model modification times. The default is to use ``SearchIndex.index_queryset`` and filter based on ``SearchIndex.get_updated_field``
def build_queryset(self, using=None, start_date=None, end_date=None): extra_lookup_kwargs = {} model = self.get_model() updated_field = self.get_updated_field() update_field_msg = ( "No updated date field found for '%s' " "- not restricting by age." ) % model.__name_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_queryset(self, **kwargs):\n\t\treturn self.get_model().objects.filter(last_modified__lte=datetime.datetime.now())", "def index_queryset(self, using=None):\n return self.get_model()._default_manager.all()", "def index_queryset(self, using=None):\n # return self.get_model().objects.filter...
[ "0.6930836", "0.6686042", "0.64084005", "0.6395709", "0.6310281", "0.6287713", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.6187853", "0.61523193", "0.6114657", "0.60792524", "0.600847", ...
0.6180968
17
Get the field name that represents the updated date for the model. If specified, this is used by the reindex command to filter out results from the QuerySet, enabling you to reindex only recent records. This method should either return None (reindex everything always) or a string of the Model's DateField/DateTimeField ...
def get_updated_field(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_date(self):\n return self._updated_date", "def updated_date(self):\n return self._updated_date", "def DateUpdated(self, default=None):\n return self.data.get('metadata', {}).get('_updated', default)", "def updated_at(self) -> str:\n return pulumi.get(self, \"update...
[ "0.6356923", "0.6356923", "0.61996776", "0.5959888", "0.59562856", "0.5786885", "0.5728659", "0.57244915", "0.57244915", "0.57244915", "0.57061845", "0.5685061", "0.5664035", "0.56450814", "0.56450814", "0.56450814", "0.5626085", "0.5595197", "0.55783296", "0.55563015", "0.55...
0.6181642
3
Provides the ability to override how objects get loaded in conjunction with ``SearchQuerySet.load_all``. This is useful for postprocessing the results from the query, enabling things like adding ``select_related`` or filtering certain data. By default, returns ``all()`` on the model's default manager.
def load_all_queryset(self): return self.get_model()._default_manager.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryset(cls):\n return cls.model._default_manager.all()", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__...
[ "0.66101956", "0.643561", "0.643561", "0.643561", "0.643561", "0.643561", "0.643561", "0.63397825", "0.6290898", "0.62837636", "0.6258117", "0.62498605", "0.6209671", "0.62085414", "0.6205274", "0.6167256", "0.6165007", "0.6142211", "0.61316377", "0.61313605", "0.61186314", ...
0.7823638
0
Returns the Haystack field type that would likely be associated with each Django type.
def index_field_from_django_field(f, default=CharField): result = default if f.get_internal_type() in ("DateField", "DateTimeField"): result = DateTimeField elif f.get_internal_type() in ("BooleanField", "NullBooleanField"): result = BooleanField elif f.get_internal_type() in ("CommaSep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self):\n return self._field.type", "def field_type(name):\n if name not in field_types:\n field_types[name] = records.fields_get([name], attributes=['type'])[name]['type']\n return field_types.get(name)", "def _full_type(self):\n namespaces = get_pare...
[ "0.7496962", "0.71214044", "0.7111604", "0.694556", "0.6833822", "0.669219", "0.66400373", "0.6566396", "0.6565787", "0.6565787", "0.6544925", "0.65435463", "0.65023047", "0.64165056", "0.64165056", "0.6410172", "0.6410172", "0.6410172", "0.6410172", "0.6410172", "0.6410172",...
0.0
-1
Given a Django field, return the appropriate index fieldname.
def get_index_fieldname(self, f): return f.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, field):\r\n\r\n try:\r\n index = self._field_names.index(unicode(field))\r\n except ValueError:\r\n raise KeyError(\"Field list has no field with name '%s'\" % unicode(field))\r\n\r\n return index", "def field_index(self, field):\r\n idx = self.fi...
[ "0.73228824", "0.72279114", "0.70474243", "0.6815128", "0.6683266", "0.6666094", "0.65193903", "0.64802706", "0.6409908", "0.64097255", "0.62970906", "0.6273589", "0.6263582", "0.623153", "0.6205761", "0.6205761", "0.61754113", "0.6119579", "0.6063708", "0.6039959", "0.597258...
0.76406515
0
Compute cosine distance between samples in X and Y
def cosine_distances_pure(X, Y=None): S = cosine_similarity_pure(X, Y) func = lambda x: _clip(-x + 1, 0, 2) S = apply_2d(S, func) if X is Y or Y is None: S = _set_diag(S) return S
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cosine_distances(X, Y):\n # should not need X_norm_squared because if you could precompute that as\n # well as Y, then you should just pre-compute the output and not even\n # call this function.\n if X is Y:\n X = Y = np.asanyarray(X)\n else:\n X = np.asanyarray(X)\n Y = np....
[ "0.8410079", "0.8057848", "0.75965375", "0.7270391", "0.72635317", "0.71993136", "0.7180712", "0.7104931", "0.70918214", "0.70614654", "0.70560646", "0.70345294", "0.6987847", "0.6978803", "0.6942545", "0.6941362", "0.6941362", "0.69142544", "0.68815243", "0.68585277", "0.685...
0.71411484
7
Returns byte with modified Least Significant Bit.
def modify_byte(byte: int, message_bit: bool) -> int: byte = bin(byte) byte_new_last_bit = int(message_bit) new_byte = int(byte[:-1] + str(byte_new_last_bit), base=2) return new_byte
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bytes__(self):\n value = (abs(self) << 1) | (1 if self < 0 else 0)\n octets = bytearray()\n while True:\n octet, value = value & 0x7f, value >> 7\n if value > 0:\n octets.append(octet | 0x80)\n else:\n octets.append(octet)\n...
[ "0.6063297", "0.60471183", "0.6013756", "0.5942794", "0.58645505", "0.5854527", "0.58462185", "0.58319616", "0.57620835", "0.57129794", "0.56720114", "0.56705105", "0.5654919", "0.56500417", "0.56211764", "0.5602921", "0.5602185", "0.5573649", "0.5519298", "0.5472581", "0.547...
0.5995095
3
Fast greatcircle path distance using Haversine formula (at least faster than geopy.distance.distance but less accurate)
def distance_great_circle(u, v, r=1.): lat_1, lon_1 = u lat_2, lon_2 = v lat_1, lon_1, lat_2, lon_2 = lat_1*np.pi/180, lon_1*np.pi/180, lat_2*np.pi/180, lon_2*np.pi/180 d_lon = np.abs(lon_1 - lon_2) A = np.power(np.cos(lat_2)*np.sin(d_lon), 2) B = np.power(np.cos(lat_1)*np.sin(lat_2) - np.sin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fast_distance(lat1, lon1, lat2, lon2):\n KM = 6371.393\n lat1, lon1, lat2, lon2 = map(np.deg2rad, [lat1, lon1, lat2, lon2])\n dlat = lat2 - lat1\n dlon = lon2 - lon1\n a = np.sin(dlat / 2) ** 2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon / 2) ** 2\n c = 2 * np.arcsin(np.sqrt(a))\n dist...
[ "0.7068269", "0.68903285", "0.684219", "0.6817696", "0.6753717", "0.67104316", "0.6710184", "0.66912365", "0.66236764", "0.66200423", "0.6617499", "0.65227574", "0.6513808", "0.64695984", "0.64506197", "0.64469194", "0.6444413", "0.6441296", "0.6436066", "0.64351505", "0.6413...
0.0
-1
Initialize the hidden states for the current network.
def init_hidden(self, batch_size: int, device: Device) -> AmbiguousHidden: hidden_zero = torch.zeros(batch_size, self.hidden_size).to(device) if self.rnn_type == "LSTM": return hidden_zero, hidden_zero.clone() else: return hidden_zero
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay...
[ "0.75942343", "0.7466821", "0.72039807", "0.6931248", "0.6904512", "0.6894318", "0.6894318", "0.68575823", "0.67992944", "0.67992944", "0.67992944", "0.67798567", "0.67798567", "0.6775739", "0.6775739", "0.67734337", "0.6669328", "0.66421", "0.6592369", "0.6459345", "0.645617...
0.63631785
24
If a filename was provided serialize to a JSON file
def dump(self): if self.jfile != None: with open("%s.json" % self.jfile, 'w') as fd: json.dump([self.buf_i, self.buf], fd) if self.cas != None: self.cas.dump()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json(self, filename, indent=2):\n d = self.to_dicts()\n if hasattr(filename, \"write\"):\n json.dump(d, filename, indent=indent)\n elif isinstance(filename, str):\n with open(os.path.expanduser(filename), \"w\") as f:\n json.dump(d, f, indent=indent)...
[ "0.70405793", "0.69626176", "0.689368", "0.68732774", "0.68117476", "0.67860675", "0.6766374", "0.67502034", "0.67290264", "0.6705512", "0.669348", "0.66919565", "0.66756034", "0.6640359", "0.660166", "0.6575211", "0.65578234", "0.65555125", "0.6552719", "0.6549573", "0.65294...
0.0
-1
Return the cost associated with an output ``a`` and desired output ``y``. Note that np.nan_to_num is used to ensure numerical stability. In particular, if both ``a`` and ``y`` have a 1.0 in the same slot, then the expression (1y)np.log(1a) returns nan. The np.nan_to_num ensures that that is converted to the correct val...
def fn(a, y): return np.sum(np.nan_to_num(-y*np.log(a)-(1-y)*np.log(1-a)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction_cost(a, y):\n return np.sum(-(y * np.log(a) + (1 - y) * np.log(1 - a)))", "def cost_(self, y_hat, y, eps=1e-15):\n\t\treturn -(1 / y.shape[0]) * np.sum((y * np.log(y_hat + eps)) + (1 - y) * np.log(1 - y_hat + eps))", "def compute_cost(AL, Y):\n m = AL.shape[1]\n cost = 1./m*(-Y*np.l...
[ "0.7182711", "0.68380564", "0.6739914", "0.6636367", "0.6560463", "0.65167016", "0.6497013", "0.64399683", "0.63970965", "0.63303626", "0.6320934", "0.6308933", "0.62933624", "0.62877995", "0.6272237", "0.62680584", "0.62132347", "0.62013257", "0.61974686", "0.6144221", "0.61...
0.65115833
6
Initialize each weight using a Gaussian distribution with mean 0 and standard deviation 1 over the square root of the number of weights connecting to the same neuron. Initialize the biases using a Gaussian distribution with mean 0 and standard deviation 1. Note that the first layer is assumed to be an input layer, and ...
def default_weight_initializer(self): self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]] self.weights = [np.random.randn(y, x)/np.sqrt(x) for x, y in zip(self.sizes[:-1], self.sizes[1:])]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n stddev = 1.0 / math.sqrt(self._hidden_size)\n for layer_id, param_id in itertools.product(\n range(self._num_layers * (self._bidirectional + 1)),\n range(self._num_gates * 2)):\n i = layer_id * 2 + (param_id // self._num_gates)...
[ "0.7445948", "0.72619236", "0.71563673", "0.712038", "0.69828767", "0.69530576", "0.6856005", "0.6765546", "0.6765546", "0.6765546", "0.67335904", "0.6733377", "0.67304456", "0.6724466", "0.6717513", "0.6706484", "0.6699434", "0.66928387", "0.66581494", "0.6652159", "0.665114...
0.68962634
6
Initialize the weights using a Gaussian distribution with mean 0 and standard deviation 1. Initialize the biases using a Gaussian distribution with mean 0 and standard deviation 1. Note that the first layer is assumed to be an input layer, and by convention we won't set any biases for those neurons, since biases are on...
def large_weight_initializer(self): self.biases = [np.random.randn(y, 1) for y in self.sizes[1:]] self.weights = [np.random.randn(y, x) for x, y in zip(self.sizes[:-1], self.sizes[1:])]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n stddev = 1.0 / math.sqrt(self._hidden_size)\n for layer_id, param_id in itertools.product(\n range(self._num_layers * (self._bidirectional + 1)),\n range(self._num_gates * 2)):\n i = layer_id * 2 + (param_id // self._num_gates)...
[ "0.7616491", "0.7581364", "0.7332636", "0.7293401", "0.7253358", "0.7228368", "0.7208877", "0.72082525", "0.7198473", "0.7185874", "0.7179477", "0.71789134", "0.7122161", "0.71221393", "0.71109015", "0.7076844", "0.7055743", "0.7055743", "0.7055743", "0.70391285", "0.70391244...
0.0
-1
Derivative of the sigmoid function.
def sigmoid_prime(z): return sigmoid(z)*(1-sigmoid(z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_der...
[ "0.84754366", "0.8450928", "0.8396931", "0.83485264", "0.83485264", "0.8298343", "0.80539966", "0.7753385", "0.77070266", "0.7498153", "0.7464916", "0.7454039", "0.7401582", "0.7385017", "0.73829913", "0.7346935", "0.7321687", "0.73094004", "0.7192053", "0.7113881", "0.709236...
0.0
-1
Retrieves product name for a given product_id from redsky.target.com
def fetch_name(self, product_id): product_url = urljoin(self.endpoint, str(product_id)) + "?excludes={}".format(self.excludes) + "&key={}".format(self.key) result = requests.get(product_url) if result.status_code != requests.codes["ok"]: raise ProductNotFoundError("could not find p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_product(conn, product_id: int) -> str:\n with conn.cursor() as cursor:\n cursor.execute(\"\"\"select name from products\n where id = {0}\"\"\".format(product_id))\n try:\n return cursor.fetchone()[0]\n except TypeError:\n raise er...
[ "0.7151575", "0.7073232", "0.68963957", "0.67611766", "0.6730489", "0.66617584", "0.66555005", "0.66206634", "0.6618648", "0.65587276", "0.6444305", "0.63914", "0.6256572", "0.62551016", "0.62208354", "0.6209725", "0.6200292", "0.6186337", "0.6170252", "0.61694807", "0.614141...
0.7573008
0
Turn on phase switching.
def pswitchon(chan) : s.phaseSwitching(True, chan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_on(self, **kwargs):\n self._state = True\n\n # Make initial update\n self.update_switch(self._initial_transition)\n\n self.schedule_update_ha_state()", "def turn_on(self, **kwargs):\n self.smartplug.turn_on()", "def turnOn(self):\n self.off = False\n se...
[ "0.6793064", "0.6698503", "0.6629485", "0.6605962", "0.64484453", "0.6447404", "0.64012665", "0.6358219", "0.6263478", "0.6257407", "0.6242577", "0.61970633", "0.619641", "0.61716014", "0.6151014", "0.6149689", "0.6095562", "0.6095158", "0.6083145", "0.6082343", "0.6059637", ...
0.73345774
0
Turn off phase switching.
def pswitchoff(chan) : s.phaseSwitching(False, chan)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def off_switch(self):\n self._switch_callback = None", "def turn_off(self, **kwargs):\n self.smartplug.turn_off()", "def lightning_turnoff(self):\n self.turnOff()", "def turn_off(self):\n self.robot.stop_simulation()", "def turnOff(self):\n self.off = True\n self.t...
[ "0.7479812", "0.74541664", "0.7239022", "0.7227539", "0.72216386", "0.71505696", "0.71325904", "0.7120933", "0.7108367", "0.70898795", "0.70524615", "0.7046064", "0.70034647", "0.7002755", "0.69903725", "0.6966109", "0.69656616", "0.69576687", "0.69566065", "0.6945246", "0.69...
0.7758828
0
Set the safe azimuth and elevation ranges over which an antenna cannot collide with a neighboring antenna (in closepacked array configurations).
def setSafeRange( azLow, azHigh, elLow, elHigh, ants, subarray=DEFAULT) : antlist = helpers.makeList(ants) multiSubarray('setSafeRange', subarray, azLow, azHigh, elLow, elHigh, antlist)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_limits(self):\n\n #Find the relative position of each leg vs. its \"zero\" position\n relpos = self.fixed_plate - self.fixed_plate_zero\n\n for leg in range(3):\n #Check that the leg is within allowable \"safe zone\"\n #Use the position of the leg (relative to 0...
[ "0.56387204", "0.5621987", "0.5555418", "0.54067415", "0.53795385", "0.53312033", "0.53200245", "0.52538556", "0.52425647", "0.52309364", "0.51850075", "0.5132379", "0.5102437", "0.5058169", "0.50323546", "0.5031172", "0.5028666", "0.5018337", "0.50181246", "0.50171715", "0.4...
0.628929
0
Set a user catalog. This is an alternate catalog of sources that will be searched BEFORE the system catalog. When a valid user catalog is set, the requested source is looked up in the user catalog; if not found, it is then looked up in the system catalog. The specified catalog must exist in /array/rt/catalogs/catalogNa...
def ucat(catalogName, subarray=DEFAULT) : stripCat = catalogName.strip() if stripCat == "": catalogName = 'NONE' else : catalogName = stripCat multiSubarray('ucat', subarray, catalogName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_catalog(self, catalog: cat.Catalog) -> None:\n self._catalog_interface = CatalogInterface(catalog)\n self._catalog = catalog", "def change_catalog_owner(self, catalog_name, user_name):\n if self.resource is None:\n self.resource = self.client.get_resource(self.hre...
[ "0.6265739", "0.58888656", "0.574895", "0.55605453", "0.5269142", "0.5153837", "0.51125604", "0.49451697", "0.4859712", "0.4859712", "0.4859712", "0.481668", "0.48010346", "0.47561952", "0.47073445", "0.46994063", "0.46190724", "0.4610505", "0.46100444", "0.44741526", "0.4439...
0.45529574
19
Retrieve last input elevation limit from the monitor system. This is used to restore state.
def restoreElevlimit(subarray=DEFAULT): subNo = subarrayNo if subarray == SCI2: subNo = 2 elevMpName = "Control.Subarray%d.elevLimit"%subNo elLimit = queryDouble( elevMpName, 24 ) # 24 retries (12 seconds) elevlimit( elLimit, subarray)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imu_get_elevation(self):\n return self.imu.get_elevation()", "def elevation(self):\n return self.container['elevation']", "def get_elevation(self):\n return self.elevation", "def elevation(self):\n return self.altitude - self.heightAboveGround", "def lastScreenPos(self):\n ...
[ "0.63437855", "0.6304508", "0.63028514", "0.5911443", "0.57675695", "0.57675695", "0.5743704", "0.56943744", "0.5655143", "0.5654373", "0.56200355", "0.56139714", "0.56070054", "0.5562385", "0.5558838", "0.5477564", "0.5463121", "0.5461484", "0.54551655", "0.54532886", "0.544...
0.0
-1
Return a list of strings describing the antenna composition of this subarray.
def currentAntennaNames(carmaOnly=False) : a=s.getAntennaAssignments() namelist = [] for i in a: cname = i.carmaAntennaName tname = i.typedAntennaName if (carmaOnly) : names = i.carmaAntennaName else : names = "%s(%s)" %(cname,tname) namelist.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_angles_description(self):\n s = []\n for ang in self.gonio_angles:\n s.append(\"%s\" % ang)\n if self.wavelength_control:\n for ang in self.wl_angles:\n s.append(\"%s\" % ang)\n return \"\\n\".join(s)", "def sequence(self):\n\n\t\tseq = \"\...
[ "0.6286726", "0.62035286", "0.6184644", "0.6024137", "0.59680384", "0.5864598", "0.57959837", "0.5792114", "0.5789277", "0.5789277", "0.57720536", "0.5771206", "0.5758274", "0.5749828", "0.57297117", "0.57262164", "0.57136923", "0.56989026", "0.56948435", "0.5694376", "0.5694...
0.5715939
16
Sets the rotation and field of view for the optical camera for a single antenna. The field of view is the full width. The nominal FOV ratio of el/az is 1.375.
def opticalRotationFOV(rot, azFOV, elFOV, ant, subarray=DEFAULT) : multiSubarray('setRotationAndFieldsOfView', subarray, rot, azFOV, elFOV,ant)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_camera(di):\n di.cam_mode = di.FIXED\n di.cam_target.cart = vec3(0.1,-0.2,0)\n di.cam_eye.spheric = spheric3(5,0.6,-1.0)", "def setupCamera(self) :\n\t\tbase.disableMouse()\n\t\tbase.camera.setPos(self.avatarNP.getPos())\n\t\tbase.camera.setZ(self.avatarNP.getZ()+1.5)\n\t\tbase.camera.setHpr(self.avat...
[ "0.6469186", "0.63863796", "0.63830477", "0.6373301", "0.6319561", "0.6253952", "0.62499654", "0.6211677", "0.6207787", "0.6159852", "0.6107865", "0.60797626", "0.5989717", "0.5949961", "0.59386706", "0.5873373", "0.5853966", "0.5833353", "0.57444894", "0.5738261", "0.5729511...
0.6156573
10
Set ending LST time for track.
def setLstEndTrack(t=None): if t == None: s.setScriptDouble(odi.INDX_DBL_LST_END_TRACK,0.0) s.setScriptBool(odi.INDX_BOOL_LST_END_TRACK,False) else: s.setScriptDouble(odi.INDX_DBL_LST_END_TRACK,helpers.convertHms(t)) s.setScriptBool(odi.INDX_BOOL_LST_END_TRACK,True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_end(self, ts):\n base_key = self.floor_time(ts)\n if self.last_timestamp is None or base_key > self.last_timestamp:\n self.last_timestamp = base_key", "def end_time(self, end_time):\n self._end_time = end_time", "def end_time(self, end_time):\n self._end_time = en...
[ "0.74154687", "0.72433025", "0.72433025", "0.71079034", "0.71079034", "0.71079034", "0.70267683", "0.6757662", "0.65875345", "0.6584512", "0.65775084", "0.6564674", "0.64220506", "0.6307276", "0.6306432", "0.62606716", "0.6236364", "0.6166708", "0.61591816", "0.61591816", "0....
0.69917494
7
Set ending LST time for track.
def endtrack(lst=None, ut=None): if lst == None and ut == None: s.setScriptBool(odi.INDX_BOOL_ENDTRACK,True) printInColor("\nWarning: If you are running the queue() program, the next\nscript in the queue file will still be executed unless\nyou comment or remove the remaining scripts!\n\n", color='bl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_end(self, ts):\n base_key = self.floor_time(ts)\n if self.last_timestamp is None or base_key > self.last_timestamp:\n self.last_timestamp = base_key", "def end_time(self, end_time):\n self._end_time = end_time", "def end_time(self, end_time):\n self._end_time = en...
[ "0.74154687", "0.72433025", "0.72433025", "0.71079034", "0.71079034", "0.71079034", "0.70267683", "0.69917494", "0.6757662", "0.65875345", "0.6584512", "0.65775084", "0.6564674", "0.64220506", "0.6307276", "0.6306432", "0.62606716", "0.6236364", "0.6166708", "0.61591816", "0....
0.6104503
25
End source/phasecalibrator cycles after observing next observation of the phase calibrator. If there are multiple phase calibrators in the track, stopAfterNextCal() will only end the current phase calibrator cycle.
def stopAfterNextCal(): s.setScriptBool(odi.INDX_BOOL_STOPNEXTCAL,True) trackMessage('stopAfterNextCal() command issued')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_phase():\n pass", "def stop_cb(evt): \n speech_recognizer.stop_continuous_recognition()\n nonlocal done\n done = True", "def stop_cb(evt):\n # print('CLOSING on {}'.format(evt))\n speech_recognizer.stop_continuous_recognition()\n global done\n done = True", ...
[ "0.5738766", "0.5522346", "0.5416902", "0.5297352", "0.5296612", "0.5261284", "0.5194817", "0.5191342", "0.5082681", "0.50724125", "0.50649804", "0.50312734", "0.5026157", "0.50197494", "0.4967035", "0.49494922", "0.4924713", "0.4866965", "0.4864145", "0.4863429", "0.48568004...
0.60340816
0
Set the name for the current configuration, e.g E07a.
def configName(name): s.setConfigName(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n self.settings[\"name\"] = name", "def set_name(self, name):\n self.options['name'] = name", "def set_name(self,name):\r\n self._name = __name", "def set_name(self, newname=\"\"):\n self.name = newname", "def set_name(self, application_name):\r\n se...
[ "0.75990784", "0.72593856", "0.71909016", "0.71906376", "0.7132947", "0.7092127", "0.7087652", "0.70426255", "0.70426255", "0.70426255", "0.70426255", "0.70426255", "0.70295274", "0.70295274", "0.70191246", "0.70191246", "0.70191246", "0.70191246", "0.6998889", "0.69505775", ...
0.7444697
1
Even though name is unique, slug may be not unique. For example,
def save(self, *args, **kwargs): if not self.id: slug = slugify(self.name) i = 2 while Ingredient.objects.filter(slug=slug): slug = '{slug}-{i}' i += 1 self.slug = slug self.name = capwords(self.name) return sup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_unique_slug(self):\n set_unique_slug(self, based_on_field='name')", "def unique_slug(manager, slug_field, slug):\n max_length = manager.model._meta.get_field(slug_field).max_length\n slug = slug[:max_length]\n i = 0\n while True:\n if i > 0:\n if i > 1:\n ...
[ "0.79414505", "0.74106187", "0.74045104", "0.73895246", "0.72333616", "0.7183754", "0.71767503", "0.7139916", "0.7104856", "0.7050976", "0.7008507", "0.69925237", "0.6925943", "0.6914099", "0.685582", "0.6850271", "0.6848184", "0.6817208", "0.6798435", "0.6795192", "0.6773986...
0.68454707
17
Returns if the word is in the trie.
def search(self, word: str) -> bool: node = self.root for char in word: if char not in node: return False node = node[char] if "#" not in node: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_trie(self, trie, word):\n current_dict = trie\n for letter in word:\n if letter in current_dict:\n current_dict = current_dict[letter]\n else:\n return False\n else:\n if '_end_' in current_dict:\n return curr...
[ "0.838632", "0.8150416", "0.8123471", "0.7856802", "0.7830664", "0.77935004", "0.7792806", "0.77642965", "0.7753436", "0.7747724", "0.7711298", "0.76816714", "0.7677101", "0.7664614", "0.76506114", "0.76338875", "0.7628353", "0.76114196", "0.7577657", "0.75695884", "0.756079"...
0.713551
54
Returns the parameter if it's a valid scratch config entry, otherwise raises an exception. Key path is optional, nonempty string.
def validate_scratch(scratch) -> str: if not isinstance(scratch, str): raise TypeError(validation_error_message( label='scratch', value=scratch, expected=VALID_SCRATCH_DESCRIPTION, regex=VALID_SCRATCH_REGEX)) if not __COMPILED.match(scratch): rais...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_path(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"check_path\")", "def check_path(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"check_path\")", "def __getitem__(self, key):\n if key not in self.config:\n print('WARNING: Key %s i...
[ "0.567993", "0.567993", "0.56599975", "0.55387414", "0.55180293", "0.54735005", "0.54085237", "0.5316587", "0.5315691", "0.5297647", "0.5280478", "0.5252933", "0.5237608", "0.5224583", "0.520088", "0.51881564", "0.5168797", "0.51563096", "0.5152865", "0.5152865", "0.5152865",...
0.53174263
7
Tests encoded_defaults for default content availability.
def test_encoded_defaults(self): self.assertEquals( {'availability': courses.AVAILABILITY_UNAVAILABLE}, self.TCT.encoded_defaults())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encoded_defaults(self):\n # Some milestone value *must* be supplied as a keyword argument.\n self.assertEquals(None, self.TMT.encoded_defaults())\n\n expected = {\n 'availability': availability_options.AVAILABILITY_NONE_SELECTED,\n }\n\n for km in self.TMT.KNO...
[ "0.6882404", "0.6022345", "0.5952608", "0.59206825", "0.59206825", "0.59206825", "0.5800904", "0.5745019", "0.57314473", "0.5730746", "0.5709854", "0.57065046", "0.56951386", "0.56719714", "0.56630874", "0.56560576", "0.5653553", "0.56516874", "0.56444764", "0.5638715", "0.56...
0.71467835
0
Sets start/end dates in the env dict and save Course settings.
def set_course_start_end_dates(cls, start_date, end_date, env, course): courses.Course.set_named_course_setting_in_environ( constants.START_DATE_SETTING, env, start_date) courses.Course.set_named_course_setting_in_environ( constants.END_DATE_SETTING, env, end_date) course...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_course_start_end_dates(cls, env, course):\n courses.Course.clear_named_course_setting_in_environ(\n constants.START_DATE_SETTING, env)\n courses.Course.clear_named_course_setting_in_environ(\n constants.END_DATE_SETTING, env)\n course.save_settings(env)", "def...
[ "0.76056725", "0.6693804", "0.6623653", "0.596774", "0.5526295", "0.53793997", "0.5373826", "0.5316276", "0.53008837", "0.52950966", "0.52711564", "0.52555025", "0.52297807", "0.5215605", "0.5172544", "0.50916505", "0.49732736", "0.49320087", "0.4926757", "0.4919198", "0.4901...
0.85006946
0
Clears start/end dates in the env dict and save Course settings.
def clear_course_start_end_dates(cls, env, course): courses.Course.clear_named_course_setting_in_environ( constants.START_DATE_SETTING, env) courses.Course.clear_named_course_setting_in_environ( constants.END_DATE_SETTING, env) course.save_settings(env)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_course_start_end_dates(cls, start_date, end_date, env, course):\n courses.Course.set_named_course_setting_in_environ(\n constants.START_DATE_SETTING, env, start_date)\n courses.Course.set_named_course_setting_in_environ(\n constants.END_DATE_SETTING, env, end_date)\n ...
[ "0.7170265", "0.5950432", "0.5559638", "0.5531477", "0.5512223", "0.5477832", "0.54643327", "0.5199673", "0.50414866", "0.50282294", "0.5017112", "0.50159776", "0.50101876", "0.50023746", "0.49994445", "0.49873328", "0.4944921", "0.49434495", "0.49427646", "0.49107668", "0.49...
0.84702414
0
Get preferred executor for ability Will return None if the agent is not capable of running any executors in the given ability.
async def get_preferred_executor(self, ability): potential_executors = ability.find_executors(self.executors, self.platform) if not potential_executors: return None preferred_executor_name = self._get_preferred_executor_name() for executor in potential_executors: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def executor(self, name):\n return Registry.require(Executor, name)", "def executor_object():\n try:\n return ExecutorThread.local_thread.executor_object\n except AttributeError:\n pass\n return None", "def get_executor(max_workers: int) -> Executor:\n retur...
[ "0.638568", "0.6196815", "0.5967114", "0.59295124", "0.5148409", "0.5088872", "0.5082672", "0.5080718", "0.50478846", "0.50345725", "0.50103617", "0.49430525", "0.49265295", "0.49049777", "0.49015915", "0.48791605", "0.4863712", "0.4825056", "0.48142576", "0.48113245", "0.480...
0.89876074
0
Initializes, configures and returns Flask App Instance object.
def create_app(): # create and configure the app app = Flask(__name__) app.config.from_object('DiamondCaseWeb.config.DevelopmentConfig') # Register SCSS assets assets.register_assets(app) # Set up mail mail = dc_mail.setup_mail(app) # Setup Database from DiamondCaseWeb.model.prod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app(self):\n\n ## set flask specific things that are non-optional\n error = lambda k: 'Fatal: You need to specify a \"flask\" section ' + \\\n 'with an entry like \"'+k+'=...\" in your .ini file'\n try: app_name = self['flask.app']\n except KeyError: raise SystemExit...
[ "0.79638827", "0.7958517", "0.79187816", "0.7831396", "0.7783478", "0.7758661", "0.77425784", "0.7640233", "0.76298624", "0.7626029", "0.7606407", "0.7552399", "0.7545732", "0.7537301", "0.7490981", "0.74586934", "0.74462163", "0.7430262", "0.74128616", "0.7409069", "0.740801...
0.0
-1
Finds leg lengths L such that the platform is in position defined by a = [x, y, z, alpha, beta, gamma]
def ik(bPos, pPos, a, ik=True): phi = a[3] th = a[4] psi = a[5] #Must translate platform coordinates into base coordinate system #Calculate rotation matrix elements cphi = math.cos(phi) sphi = math.sin(phi) cth = math.cos(th) sth = math.sin(th) cpsi = math.cos(psi) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linelength(l):\n return dist(l[0],l[1])", "def get_duct_length(l_duct_r: np.ndarray, a_a: float) -> np.ndarray:\n\n a_a_r = 120.08\n\n return l_duct_r * np.sqrt(a_a / a_a_r)", "def get_length_of_LV_cavity(horiz_2ch_a, horiz_2ch_b, horiz_4ch_a, horiz_4ch_b, lowest_pt_2ch, lowest_pt_4ch):\n top_c...
[ "0.5850614", "0.58472407", "0.5738114", "0.5685303", "0.56820154", "0.56550467", "0.56530106", "0.5629573", "0.5560763", "0.5513427", "0.5506751", "0.5496852", "0.54153", "0.54111063", "0.53832495", "0.5378905", "0.53501225", "0.5344257", "0.5285661", "0.5278475", "0.5275552"...
0.0
-1
This function creates distance matrix based on Euclidean distance between each data points
def create_dist_matrix(matrix): #Convert input data matrix to numpy matrix matrix = np.array(matrix) n = matrix.shape[0] #Iterate through number of samples to create distance matrix for i in range(n): dist_array = euclidean_distance(matrix[i,:], matrix) if i == 0: di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_matrix(data):\n D = numpy.zeros( (data.shape[0], data.shape[0]) )\n for i in xrange(data.shape[0]):\n for j in xrange(i):\n D[i,j] = numpy.linalg.norm(data[i,:]-data[j,:])\n D[j,i] = D[i,j]\n\n return D", "def _derive_euclidean_dm(self, cat_mat, dim):\r\n ...
[ "0.77092516", "0.74066657", "0.69956774", "0.6976134", "0.69391745", "0.689667", "0.68290097", "0.6808925", "0.68028307", "0.6777758", "0.6771038", "0.67688423", "0.67643416", "0.67508024", "0.6700348", "0.66910106", "0.6671188", "0.66511667", "0.66438985", "0.6616614", "0.66...
0.7373828
2
This function calculates Euclidean distance between data1 and data2
def euclidean_distance(data1, data2): #Convert data into numpy array array1 = np.array(data1) array2 = np.array(data2) #Create distance array dist_array = np.sqrt(np.sum((array2-array1)**2, axis=1)) #Reshape array before return results return np.reshape(dist_array, [len(dist_array)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclideanDistance(data1, data2):\n distance = 0\n for x in range(14):\n data1[x] = truncate(data1[x], 3)\n data2[x] = truncate(data2[x], 3)\n dist = truncate((data1[x] - data2[x]) ** 2, 3)\n distance = truncate(distance + dist, 3)\n\n # Final Euclidean distance between trai...
[ "0.85524786", "0.8366913", "0.8059013", "0.7997354", "0.7976146", "0.79569393", "0.7779689", "0.7755199", "0.7751564", "0.7729782", "0.7728699", "0.7724675", "0.7715573", "0.7703966", "0.7702208", "0.76962894", "0.75868785", "0.75775486", "0.75720084", "0.7547875", "0.7535825...
0.84898156
1
The home page for news_site.
def index(request): if request.method != "POST": #No data submitted: render home page form = SearchForm() #Display a blank form context = { "form": form, } return render(request, "news_site/index.html", context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_page(wagtail_site):\n return wagtail_site.root_page", "def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")", "def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")", "def home():\n\n\treturn render_tem...
[ "0.77112705", "0.7618075", "0.7589709", "0.75023735", "0.74955976", "0.74815565", "0.74758005", "0.74758005", "0.74521255", "0.7448393", "0.7447882", "0.7437015", "0.7422505", "0.73441136", "0.73429143", "0.7338662", "0.7338662", "0.7338662", "0.7338662", "0.7338662", "0.7338...
0.0
-1
Hidden Tensor Initializer. Start hidden tensor full of zeros by created size
def init_hidden(self): return Variable(torch.randn(1, self.hidden_size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initHidden(self, batch_size):\n zero_hidden = torch.zeros(self.n_layers, batch_size, self.hidden_size)\n return zero_hidden", "def init_hidden(self, batch_size):\n return torch.zeros(()), torch.zeros(())", "def initialize_hidden_state(self, batch_size):\n return tf.zeros((batch_...
[ "0.8190234", "0.79255444", "0.7924486", "0.77253634", "0.7683984", "0.76203763", "0.75142246", "0.74821234", "0.741953", "0.741953", "0.7415746", "0.7415746", "0.7415746", "0.7415746", "0.7415746", "0.7415746", "0.7415746", "0.7415746", "0.7329116", "0.71974355", "0.7174794",...
0.7422839
8
This method calculates the sigmoid
def sigmoid(z): return 1 / (1 + (np.exp(-z)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))", "def sigmoid(x):\r\n #pred_x = (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\r\n pred_x = 1.0 / (1.0 + np.exp(-x))\r\n return pred_x\r\n pass", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", ...
[ "0.8340938", "0.8299354", "0.8263224", "0.8263224", "0.82382685", "0.8222776", "0.8220394", "0.81881106", "0.8182516", "0.81802285", "0.81802285", "0.81752795", "0.8165987", "0.8163658", "0.8163658", "0.8163658", "0.8163658", "0.8163658", "0.8163658", "0.8154532", "0.81391674...
0.78263307
66
Generate random account name.
def account_name_generator(): return 'jdoe-' + str(uuid()).lower()[:16]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name(self):\n letters = string.ascii_letters\n random_name = ''.join(random.choice(letters) for _ in range(10))\n assert isinstance(random_name, str)\n return random_name", "def random_username():\n return str(uuid.uuid4().hex.upper())", "def create_random_username()...
[ "0.8303968", "0.8120217", "0.8100042", "0.77641845", "0.7753038", "0.76790786", "0.76534474", "0.76172715", "0.7595423", "0.75660664", "0.75545484", "0.7548045", "0.75479037", "0.7371235", "0.7327479", "0.7317477", "0.7268474", "0.7216197", "0.7207971", "0.71842176", "0.71314...
0.87259203
0
Return all characteristic values as a numpy array in the order presented in `pylidc._all_characteristics_`.
def all_characteristics_as_array(self): return np.array([getattr(self,char) for char in _all_characteristics_])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array(self):\n return array(self.get_values())", "def tovector(self):\n return np.hstack(self.values())", "def get_characteristic_vals(self):\n\n # Characteristic quantity of x\n x = scutils.qv2x(self.dyn_sys.tpwl_dict['q'], self.dyn_sys.tpwl_dict['v'])\n x_char = np.abs(...
[ "0.658936", "0.6133145", "0.61247593", "0.60914385", "0.60115767", "0.598908", "0.59529126", "0.5922147", "0.5917438", "0.5913722", "0.58510214", "0.5841785", "0.5768531", "0.57629716", "0.57280236", "0.5700412", "0.5694716", "0.5689029", "0.56782", "0.5669914", "0.5669728", ...
0.82255787
0
Verify that MAX_RANGE is respected.
def test_sense_max_distance(self): measurements = [682, 681, 682] self.driver.us_dist.side_effect = lambda x: measurements.pop() expected_measurement = int(ultrasonic_sensor_error(self.s.MAX_RANGE)) self.assertEqual(self.s.sense_distance(60), expected_measurement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_valid_range(val, max_val):\n if val < 0:\n val = 0\n elif val > max_val:\n val = max_val\n else:\n pass\n return val", "def __verify_range(value, minimum, maximum):\n if value in range(minimum, maximum):\n return True\n ...
[ "0.7301762", "0.7076014", "0.69999665", "0.69903356", "0.688435", "0.6852546", "0.67921376", "0.6782766", "0.67262405", "0.6694337", "0.6664958", "0.662481", "0.6619724", "0.66177267", "0.6616714", "0.66074955", "0.6572099", "0.6544127", "0.6521212", "0.6501114", "0.64981514"...
0.0
-1
Resets all parameters in a network.
def reset_all_weights(model: nn.Module) -> None: @torch.no_grad() def weight_reset(m: nn.Module): # - check if the current module has reset_parameters & if it's callabed called it on m reset_parameters = getattr(m, "reset_parameters", None) if callable(reset_parameters): m.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_parameters(self) -> None:\n for gnn_block in self.gnn_blocks:\n gnn_block.reset_parameters()", "def reset_parameters(self):\n\n for layer in self.layers:\n layer.reset_parameters()", "def reset_parameters(self):\n self.lin.reset_parameters()\n self.at...
[ "0.80343693", "0.79820913", "0.7937079", "0.7756223", "0.77396476", "0.76309854", "0.7530589", "0.75222486", "0.7480688", "0.7480688", "0.7480688", "0.7468137", "0.74494785", "0.7409514", "0.73138964", "0.7312042", "0.73108065", "0.7296458", "0.7288982", "0.72201043", "0.7196...
0.0
-1
r"""Takes integer with n dims and converts it to 1hot representation with n + 1 dims. The n+1'st dimension will have zeros everywhere but at y'th index, where it will be equal to 1.
def to_one_hot(y, depth=None): y_flat = y.to(torch.int64).view(-1, 1) depth = depth if depth is not None else int(torch.max(y_flat)) + 1 y_one_hot = torch.zeros(y_flat.size()[0], depth, device=y.device).scatter_(1, y_flat, 1) y_one_hot = y_one_hot.view(*(tuple(y.shape) + (-1,))) return y_one_hot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(y_):\n y_ = y_.reshape(len(y_))\n n_values = int(np.max(y_)) + 1\n n_values = 6\n return np.eye(n_values)[np.array(y_, dtype=np.int32)] # Returns FLOATS", "def one_hot_encode(y, out_size):\n n = len(y)\n oh = np.zeros((n, out_size))\n oh[range(n), y] = 1\n return oh", "def ...
[ "0.796441", "0.7948282", "0.7860178", "0.77373374", "0.7719808", "0.77065057", "0.7700409", "0.7636841", "0.76207334", "0.7578422", "0.7576558", "0.7504232", "0.7483239", "0.7472513", "0.7464411", "0.7456884", "0.7439735", "0.74243283", "0.7359619", "0.734951", "0.7348022", ...
0.7197611
31
Returns a normalized version of a numpy vector
def normalize(vec): return vec / length(vec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized(v):\n norm = np.linalg.norm(v)\n if norm:\n return np.array(v) / norm\n else:\n return v", "def normalize(v):\n return np.array(v) / np.linalg.norm(v)", "def get_normalized_vector(vector):\n # WARN: Zero length may cause problems!\n vector_lenght = get_vector_leng...
[ "0.8382922", "0.82990193", "0.8259853", "0.8214056", "0.8172827", "0.80436724", "0.7969755", "0.7895023", "0.78783345", "0.78408086", "0.78408086", "0.78408086", "0.77938575", "0.77938575", "0.77938575", "0.77938575", "0.77938575", "0.77938575", "0.77938575", "0.77938575", "0...
0.7703704
30
Blur a binary image of onehot points into blobs
def binary_to_blobs(binary, sigma=1, peakval=1, dtype='float32'): smooth = gaussian(binary, sigma=sigma, preserve_range=True) blobs = peakval*(smooth/smooth.max()) return blobs.astype(dtype)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binarize(img):\n image = cv.cvtColor(img, cv.COLOR_BGR2GRAY)\n image = cv.GaussianBlur(image, (3, 3), 0)\n ret, image = cv.threshold(image, 0, 255, cv.THRESH_BINARY_INV | cv.THRESH_OTSU)\n return image", "def blur_ground(X):\n return img_conv(X, kernel_blur)", "def blur(image, kernel_size=(7...
[ "0.69813436", "0.6756291", "0.6524612", "0.6524612", "0.6470922", "0.64067423", "0.63896084", "0.63352126", "0.63303584", "0.62229973", "0.619533", "0.6192017", "0.6188834", "0.618121", "0.61782444", "0.617698", "0.617533", "0.6171011", "0.61460197", "0.6121013", "0.6078705",...
0.0
-1
Serializes and optimizes `obj`.
def pickle(obj): return pickletools.optimize(cPickle.dumps(obj))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(obj):\n return serialization_manager.serialize(obj)", "def serialize(self, obj):\n pass", "def serialize(obj):\n return pickle.dumps(obj)", "def serialize_forstorage(cls, obj):\n return misc.serialize_forstorage(obj)", "def serialize(self, obj):\n return obj", "def ...
[ "0.7497463", "0.72954184", "0.72607034", "0.7084962", "0.68679386", "0.6842404", "0.66578233", "0.66539603", "0.6605147", "0.6605147", "0.65930146", "0.6498019", "0.6478875", "0.6396613", "0.63773865", "0.6370594", "0.63476485", "0.6312579", "0.6238561", "0.6238561", "0.62066...
0.7735133
0
Get production image create it's testable version. For now, it adds just a coverage library as additional requirements, so our image tests can enable it in order to obtain coverage information of the docker/k8s related code.
def build_test_version_of_container_image( image_type: ImageType, image_builder_cls: Type[ContainerisedAgentBuilder], architecture: CpuArch, result_image_name: str, ready_image_oci_tarball: pl.Path = None, install_additional_test_libs: bool = True, ): image_builder = image_builder_cls() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_image(runtime):\n return \"{}:{}\".format(LambdaContainer._IMAGE_REPO_NAME, runtime)", "def _ensure_image(testkit_path, branch_name, artifacts_path):\n # Construct Docker image name from branch name\n image_name = \"runner:%s\" % branch_name\n image_path = os.path.join(testkit_path, \"ru...
[ "0.60722476", "0.60149956", "0.5801076", "0.56776553", "0.5626107", "0.5608371", "0.5608036", "0.54736507", "0.5470767", "0.5428152", "0.5400544", "0.5348892", "0.5346526", "0.53116447", "0.52694076", "0.5261629", "0.52526265", "0.5247445", "0.5245241", "0.5218683", "0.519586...
0.64492244
0
function will return the number of days between two dates
def days_in_between(year1, month1, day1, year2, month2, day2): if (datetime.date(year2, month2, day2)) > (datetime.date(year1, month1, day1)): return (datetime.date(year2, month2, day2)) - datetime.date(year1, month1, day1) elif (datetime.date(year1, month1, day1)) != \ (dateti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_days(start: date, end: date) -> int:\n delta = end - start\n return delta.days + 1", "def diff_dates(date1, date2):\n\n return abs(date2 - date1).days", "def days_between(start_date, end_date):\n start_date = datetime.strptime(start_date, \"%Y-%m-%d\")\n end_date = datetime.strptime(...
[ "0.8254007", "0.8174084", "0.8101539", "0.809075", "0.8048821", "0.8044719", "0.8033608", "0.79297876", "0.7919733", "0.7839554", "0.78374386", "0.77742183", "0.7701619", "0.7645565", "0.7637051", "0.7622217", "0.7554301", "0.7496069", "0.7484374", "0.73402756", "0.7333817", ...
0.68101245
31
make a grid of cells with the specified limits. limits is a list of pairs, [[lowx, lowy], [highx, highy]]
def make_cells(self, limits): low, high = limits xs = range(low[0], high[0]) ys = range(low[1], high[1]) for x in xs: col = [] for y in ys: indices = (x, y) self.cells[indices] = Patch(self, indices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grid(xlim, ylim, step):\n x_range = np.arange(xlim[0], xlim[1], step)\n y_range = np.arange(ylim[0], ylim[1], step)\n return x_range, y_range", "def make_grid(data=None, xmin=-5, xmax=5, ymin=-5, ymax=5, n_points = 400):\n if data is not None:\n xmin, ymin = np.min(data, axis = 0)\n...
[ "0.7732495", "0.7290888", "0.7176541", "0.704265", "0.70399666", "0.70399666", "0.70263743", "0.6990715", "0.67124534", "0.6641184", "0.6620352", "0.65798974", "0.6560937", "0.65129614", "0.6507297", "0.6446217", "0.6444136", "0.6407571", "0.6394874", "0.6387809", "0.6359436"...
0.7728064
1
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`
def queryset(self, request, queryset): return ( queryset if self.value() is None else queryset.filter(instrument__id=self.value()) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queryset(self, request, queryset):\n # Compare the requested value (either '80s' or 'other')\n # to decide how to filter the queryset.\n\n if self.value() is None:\n return queryset.all()\n\n return queryset.filter(firm__pk=self.value())", "def queryset(self, request, q...
[ "0.75333345", "0.74641174", "0.7260013", "0.7143524", "0.7085953", "0.7018582", "0.68391055", "0.6833029", "0.6815648", "0.6728348", "0.661668", "0.6576189", "0.6504282", "0.645309", "0.6451229", "0.6448983", "0.64226824", "0.63882715", "0.6335274", "0.63232267", "0.6298416",...
0.70646197
5
Initialize a dataset instance for repeat copy task. Arguments
def __init__(self, task_params): self.seq_width = task_params["seq_width"] self.min_seq_len = task_params["min_seq_len"] self.max_seq_len = task_params["max_seq_len"] self.min_repeat = task_params["min_repeat"] self.max_repeat = task_params["max_repeat"] self.in_dim = tas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(*args):\n global dataset\n dataset = args[0]", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self):\n self.args = self._prepare_args(locals())\n self.requires_full_dataset_in...
[ "0.6871292", "0.6721774", "0.66915625", "0.6545516", "0.6436493", "0.64204156", "0.6417703", "0.63900226", "0.63114876", "0.62611425", "0.6261136", "0.6203277", "0.6097892", "0.6090949", "0.60590017", "0.6045299", "0.60280675", "0.60096794", "0.6000488", "0.5997948", "0.59872...
0.0
-1
Get an existing Application resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'Application': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = ApplicationArgs.__new__(ApplicationArgs) __props__.__dict__["descript...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n application_name: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi.Input[str]] = None,\n resource_group_id: Optional[pulumi.Input[str]] = ...
[ "0.65782505", "0.63077", "0.59393466", "0.59080184", "0.58678406", "0.5844928", "0.58177084", "0.58115256", "0.57609415", "0.5708011", "0.5665527", "0.5596877", "0.55864096", "0.5508775", "0.5489902", "0.5462991", "0.54588956", "0.54408705", "0.54064363", "0.5389303", "0.5389...
0.6209207
2
set the name of the variable containing the integrated vapor transport(IVT) magnitude field.
def set_ivt_variable(self, var): self.set_input_variable(var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_invvar(self, filename):\n\tself._properties[\"var\"] = 1.0/pf.getdata(filename)", "def name(self):\n return '{} {} {}'.format(self.var_period, self.var_type,\n self.var_detail)", "def name(self, value):\n self.mol.SetProp('_Name', str(value))", "def var(s...
[ "0.5955025", "0.58421874", "0.57337844", "0.5727621", "0.5685497", "0.5685497", "0.5685497", "0.5636607", "0.56248283", "0.55566645", "0.5508442", "0.5508442", "0.54744375", "0.5441381", "0.5437144", "0.54133207", "0.5346642", "0.53418773", "0.53166014", "0.52996147", "0.5281...
0.5783567
2
convert the tensor to a numpy array and extract the output data from the padded tensor. padding was added during preprocess.
def postprocess(self, out_tensor): event = teca_time_py_event('teca_deeplab_ar_detect::postprocess') # normalize the output tmp = torch.sigmoid(out_tensor) # move to the CPU if running on a GPU if self.device != 'cpu': tmp = tmp.to('cpu') # convert from tor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _prepare_onnx_paddings__tensorrt(g, input, pad):\n ctx = FUNCTION_REWRITER.get_context()\n torch_version = version_parse(torch.__version__)\n if torch_version.major == 1 and torch_version.minor < 10:\n return ctx.origin_func(g, input, pad)\n # The desired order of paddings is\n # dim_0_be...
[ "0.60632575", "0.6023878", "0.59870327", "0.591887", "0.59053355", "0.5826971", "0.57423776", "0.57330006", "0.57089823", "0.56877285", "0.56666565", "0.5595239", "0.5593678", "0.55928946", "0.5576657", "0.55558366", "0.5523875", "0.552349", "0.5473608", "0.5455306", "0.54364...
0.5863331
5
Returns whether the queried particletype operator is supported by this mapping.
def supports_particle_type(self, particle_type: ParticleOp) -> bool: return isinstance(particle_type, SpinOp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_supported_type(self) -> bool:\n t = self.type.strip()\n return t in self.SUPPORTED_LABELS or t.lower() in self.SUPPORTED_LABELS", "def is_psionic(self) -> bool:\n return ATTRIBUTE.Psionic.value in self.type_data.attributes", "def isOp(self):\n return True", "def is_P(self):...
[ "0.6209507", "0.60236984", "0.58755344", "0.5867701", "0.5861172", "0.5797319", "0.57950944", "0.5729426", "0.5701224", "0.5694179", "0.5689202", "0.5671311", "0.56394696", "0.56170326", "0.56170326", "0.5593421", "0.5587711", "0.55781263", "0.55294603", "0.547905", "0.545724...
0.6716687
0
If true, this qtree inherits the export policy of the parent volume.
def is_export_policy_inherited(self): return self._is_export_policy_inherited
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_parent(self):\n return False", "def ignore_parent(self) -> bool:\n return self._strategy.ignore_parent", "def allow_volume_expansion(self) -> Optional[bool]:\n return pulumi.get(self, \"allow_volume_expansion\")", "def allow_volume_expansion(self) -> Optional[bool]:\n retu...
[ "0.58578163", "0.5827211", "0.5741612", "0.5741612", "0.5741612", "0.5741612", "0.5741612", "0.5637727", "0.55808127", "0.55249184", "0.5512349", "0.55097127", "0.5490801", "0.54336846", "0.53777486", "0.53055096", "0.52935666", "0.52821714", "0.52658117", "0.5245743", "0.521...
0.7056977
0
Name of the vfiler which owns this qtree. This value will be returned only if the request is coming to vfiler0 and MultiStore is licensed.
def owning_vfiler(self): return self._owning_vfiler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moc_vnet_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"moc_vnet_name\")", "def vnet_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vnet_name\")", "def get_name_owner(self): # real signature unknown; restored from __doc__\n return \"\"", "def ge...
[ "0.60422754", "0.58420116", "0.5792644", "0.5778097", "0.57292646", "0.5698643", "0.5697503", "0.5656808", "0.5650505", "0.5641572", "0.5641572", "0.55996424", "0.5584626", "0.55674624", "0.55426574", "0.5531291", "0.55137247", "0.54894155", "0.5482504", "0.5482504", "0.54761...
0.6453278
0
Checks whether this doer has started shutting down already.
def shutting_down(self): return self._shutdown.is_set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_shutdown(self):\n return self._in_shutdown", "def running(self):\n return not self._kill_event.is_set()", "def is_fully_stopped(self) -> bool:\n\t\treturn self.is_disconnected() and self.recorder.is_stopped() and not self.__flag_auto_restart", "def is_alive(self):\n\n return no...
[ "0.74359566", "0.71504325", "0.7065761", "0.7055656", "0.6903392", "0.6894518", "0.68753225", "0.67805177", "0.67737854", "0.67309123", "0.6729409", "0.6692879", "0.6688958", "0.668652", "0.6674662", "0.6674662", "0.6674662", "0.6674662", "0.6673122", "0.66613835", "0.6659753...
0.82734495
0
Counts the number of automorphisms that are present in the graph G.
def count_automorphisms(g: Graph) -> int: def generate_mapping(g: Graph, h: Graph): """ Generates the corresponding mapping from vertex to vertex for the isomorphism between graphs g and h. We map g to h. :param g: A graph :param h: A graph :return: A permutation wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_pathologies(graph):\n return Counter(_pathology_iterator(graph))", "def count_relations(graph):\n return Counter(\n data[RELATION]\n for _, _, data in graph.edges_iter(data=True)\n )", "def count_unique_relations(graph):\n return Counter(itt.chain.from_iterable(get_edge_rela...
[ "0.690151", "0.68574446", "0.66638315", "0.6161389", "0.61542135", "0.6107411", "0.60706353", "0.60482836", "0.600044", "0.5969042", "0.59673154", "0.5964259", "0.59581065", "0.59419197", "0.5926216", "0.5883015", "0.58650196", "0.5862715", "0.58529586", "0.58438826", "0.5836...
0.73623633
0
Load a YAML configuration file.
def load_cfg(yaml_filepath): # Read YAML experiment definition file with open(yaml_filepath, 'r') as stream: cfg = yaml.load(stream) cfg = make_paths_absolute(os.path.dirname(yaml_filepath), cfg) return cfg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(path):\n return yaml.load(open('config.yaml', 'r'), Loader=yaml.SafeLoader)", "def load_config_file(path):\n with open(path) as file:\n return yaml.load(file, Loader=yaml.FullLoader)", "def load_config(path):\n return yaml.load(open(path, 'r'), Loader=yaml.SafeLoader)", "def l...
[ "0.814296", "0.8103789", "0.79987746", "0.7985093", "0.79837126", "0.79620045", "0.7931559", "0.7924978", "0.79169375", "0.79069126", "0.7890046", "0.78393507", "0.7829682", "0.77664226", "0.7753482", "0.7661323", "0.7639789", "0.75922006", "0.7551304", "0.74810594", "0.74744...
0.74139476
27
Initialize the LinkedList here
def __init__(self): self.head = None self.tail = self.head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n try:\n self.head=None\n\n except Exception as error:\n print (f\"There is error in __init__ of LinkedList, the error {error}\")", "def __init__(self, lst=[]):\n self.__length = 0 # current length of the linked list\n self.__head = None # p...
[ "0.79814774", "0.7727187", "0.7706039", "0.7640208", "0.7629128", "0.76036906", "0.7596818", "0.7596818", "0.7596818", "0.75814563", "0.7575526", "0.7575512", "0.7575512", "0.75573826", "0.75573826", "0.7550369", "0.753677", "0.7535548", "0.7535548", "0.7528727", "0.7497972",...
0.75931615
9
Internal method for getting layer from model
def _get_model_and_layer(self, model_name, layer, model_path): if model_name == "resnet-18": model = models.resnet18() model.load_state_dict(torch.load(model_path)) if layer == "default": layer = model._modules.get("avgpool") self.layer_output_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_layers(self) :\n \n return self._layers", "def get_layer(model, layer_name=None, layer_idx=None):\n\n _validate_args(layer_name, layer_idx, layer=None)\n if layer_idx is not None:\n return model.layers[layer_idx]\n\n layer = [layer for layer in model.layers if layer_name in...
[ "0.7012858", "0.67027503", "0.66968244", "0.6680103", "0.66642064", "0.66558564", "0.66346604", "0.6583788", "0.6583224", "0.65142715", "0.64148736", "0.63179916", "0.6306704", "0.62477165", "0.6193528", "0.61811453", "0.6172382", "0.61646074", "0.6153398", "0.6145659", "0.61...
0.67539865
1
Initialize a Battle Simulator object with the given two characters.
def __init__(self, character_1, character_2): self.character_1 = character_1 self.character_2 = character_2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n character1 = generate_random_character(\"Dr. Bones\", 100, 60, 15, 5)\n character2 = generate_random_character(\"Mr. Meeseeks\", 100, 60,\n 15, 5)\n battle = BattleSimulator(character1, character2)\n battle.simulate()", "def __init__(self, playe...
[ "0.6387656", "0.61199796", "0.5862212", "0.56728464", "0.5633514", "0.5492498", "0.54009104", "0.53709", "0.5341678", "0.5341678", "0.532014", "0.5287973", "0.52810705", "0.527881", "0.5228554", "0.5223448", "0.5220337", "0.521714", "0.5204622", "0.5186126", "0.51500547", "...
0.6858176
0
Uses random module to set all the character stats and returns a Character object.
def generate_random_character(name, max_health, min_health, max_strength, min_strength): return Character(random.randint(min_strength, max_strength), random.randint(min_health, max_health), name, random.random(), random.random())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getRandChar(self):\n return self.letterbag[random.randint(0,25)]", "def __init__(self, _gameBeingPlayed, _charcter):\n self.name = \"random\"\n random.seed(2)\n self.game = _gameBeingPlayed\n self.character = _charcter\n self.neutralCharacter = self.game.neutralCharact...
[ "0.6978008", "0.6883214", "0.68403435", "0.66532755", "0.6509252", "0.6502714", "0.6381731", "0.62692136", "0.62538266", "0.62515855", "0.62462306", "0.6210672", "0.6135978", "0.60445887", "0.59788424", "0.5954294", "0.59287107", "0.59248483", "0.59083915", "0.58917", "0.5877...
0.72781706
0
Reshape x so that the last dimension becomes two dimensions. The first of these two dimensions is n.
def split_last_dim(self, x, n): old_shape = list(x.size()) last = old_shape[-1] new_shape = old_shape[:-1] + [n] + [last // n if last else None] ret = x.view(new_shape) return ret.permute(0, 2, 1, 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_last_dimension(x, n):\n x_shape = shape_list(x)\n m = x_shape[-1]\n if isinstance(m, int) and isinstance(n, int):\n assert m % n == 0\n return tf.reshape(x, x_shape[:-1] + [n, m // n])", "def split_last_dimension(x, n):\n old_shape = x.get_shape().dims\n last = old_shape[-1]\n ...
[ "0.73021156", "0.72806466", "0.727416", "0.72017586", "0.7137547", "0.7065171", "0.70424175", "0.69658244", "0.69242", "0.6820341", "0.6561438", "0.6518949", "0.6497071", "0.6470221", "0.6422806", "0.6359682", "0.6277855", "0.62476885", "0.62466705", "0.6239059", "0.623731", ...
0.74958134
2
Reshape x so that the last two dimension become one.
def combine_last_two_dim(self, x): old_shape = list(x.size()) a, b = old_shape[-2:] new_shape = old_shape[:-2] + [a * b if a and b else None] ret = x.contiguous().view(new_shape) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x):\n return reshape(x, (x.shape[0], -1))", "def reshape(x, shape):\n return Reshape(shape)(x)", "def _reshape_channels(x):\n assert x.dim() == 4\n batch_size, nc, h, w = x.size()\n x_t = x.view(batch_size, nc, -1).transpose(1, 2).contiguous()\n x_t = x_t.view(batc...
[ "0.7624362", "0.7361735", "0.7356254", "0.73524576", "0.7211992", "0.71524197", "0.70263374", "0.69711345", "0.69283223", "0.6908497", "0.67825496", "0.6772853", "0.67166173", "0.67037886", "0.66884685", "0.66884685", "0.6648974", "0.6637822", "0.660816", "0.658997", "0.65652...
0.5980656
64
Sets the error_count of this AutodetectDocumentValidationResult.
def error_count(self, error_count): self._error_count = error_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_count(self):\n return len(self.errors)", "def getNumErrors(self, *args):\n return _libsbml.SBMLDocument_getNumErrors(self, *args)", "def setErrorMax(self, error_max):\n\t\tself.error_max = error_max", "def getNumErrors(self):\n return _libsbml.XMLErrorLog_getNumErrors(self)", ...
[ "0.6081048", "0.5987648", "0.5690299", "0.55666184", "0.54826427", "0.5481803", "0.5442737", "0.5439933", "0.5439933", "0.5394178", "0.53693044", "0.5346391", "0.5328946", "0.5287597", "0.52519226", "0.52452815", "0.5237477", "0.52228737", "0.52036804", "0.51751804", "0.51453...
0.7866384
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, AutodetectDocumentValidationResult): 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
returns the ith element in the sequence, otherwise returns an empty string
def index(sequence, i): try: return sequence[i] except IndexError: return u""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getitem(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)", "def _silent_get(x, i):\n if i < len(x):\n return x[i]\n else:\n return ''", "def return_first(x):\r\n if x == []:\r\n return ''\r\n else:\r\n return x[0]", "def index(item, i):\...
[ "0.6512861", "0.6484922", "0.6476134", "0.634842", "0.6315457", "0.63108003", "0.6219168", "0.61819625", "0.6060573", "0.6046717", "0.60024315", "0.58221686", "0.58175415", "0.5717458", "0.57147264", "0.5701671", "0.5693254", "0.56161135", "0.5613445", "0.5589253", "0.5582843...
0.74435055
0
gets a list of fields from a form based on their names
def get_fields_by_names(form, field_names): fields = [] for field_name in field_names.split(','): field = get_field_by_name(form, field_name) if field: fields.append(field) return fields
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields(form, args):\n bound_fields = {}\n fields = []\n for field in form:\n bound_fields.update({field.name: field})\n for field_name in args.split(','):\n if field_name in bound_fields:\n fields.append(bound_fields[field_name])\n return fields", "def getFormField...
[ "0.7999815", "0.72664", "0.7148749", "0.6959313", "0.6893017", "0.679975", "0.67761", "0.6736716", "0.67148304", "0.65763026", "0.64540225", "0.64517975", "0.64014566", "0.63794136", "0.63665617", "0.63384515", "0.6324435", "0.6305355", "0.6302783", "0.6288462", "0.6283588", ...
0.8055306
0
gets a list of forms from a formset based on a field_name/field_value pair
def get_forms_by_field(formset, field_info): field_name, field_value = field_info.split('|') return formset.get_forms_by_field(field_name, field_value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_form_by_field(formset, field_info):\n field_name, field_value = field_info.split('|')\n return formset.get_form_by_field(field_name, field_value)", "def get_formset(self, **kwargs):\n return self.formsets[kwargs.get('prefix')](\n data=self.get_form_kwargs().get('data'),\n ...
[ "0.7737669", "0.6752881", "0.67076665", "0.64571047", "0.6230185", "0.6196658", "0.6161314", "0.6159796", "0.5969113", "0.59087384", "0.5892944", "0.58924574", "0.5766631", "0.576133", "0.5720887", "0.56406283", "0.5543609", "0.5515373", "0.55145144", "0.55031633", "0.5446175...
0.86300886
0
Represents a cored spherical isothermal density distribution, which is equivalent to the elliptical powerlaw
def __init__( self, centre: Tuple[float, float] = (0.0, 0.0), einstein_radius: float = 1.0, core_radius: float = 0.01, ): super().__init__( centre=centre, einstein_radius=einstein_radius, slope=2.0, core_radius=core_ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_density_2d(self):\n # almost spherical case\n x = 1.\n y = 1.\n e1, e2 = 5e-5, 0.\n sigma = 1.\n amp = 2.\n f_ = self.gaussian_kappa_ellipse.density_2d(x, y, amp, sigma, e1, e2)\n f_sphere = amp / (2.*np.pi*sigma**2) * np.exp(-(x*x+y*y)/2./sigma**2)\...
[ "0.6664183", "0.64580435", "0.62347794", "0.6172197", "0.6137241", "0.6082191", "0.5902708", "0.5891326", "0.5886598", "0.586953", "0.581738", "0.581738", "0.581738", "0.581402", "0.578542", "0.578542", "0.57518727", "0.57191616", "0.5706903", "0.57064813", "0.57047015", "0...
0.0
-1
Update an existing post.
def update_post(prev_data, data, db_conn): schema = get_post_schema(data) post_kind = prev_data['kind'] if post_kind is 'post' or post_kind is 'proposal': data = pick(data, ('body',)) elif post_kind is 'vote': data = pick(data, ('body', 'response',)) data, errors = update_document(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_post(post_id):\n\n post = Post.query.get_or_404(post_id)\n post.title = request.form[\"edit_post_title\"]\n post.content = request.form[\"edit_post_content\"]\n tag_ids = [int(num) for num in request.form.getlist(\"tags\")]\n post.tags = Tag.query.filter(Tag.id.in_(tag_ids)).all()\n\n ...
[ "0.77233607", "0.7450944", "0.7264696", "0.7071551", "0.70528066", "0.6966255", "0.6850572", "0.67310226", "0.6657074", "0.66340834", "0.6580428", "0.6550912", "0.6476071", "0.6458061", "0.64543605", "0.64482594", "0.6400658", "0.63880545", "0.63092726", "0.62942237", "0.6276...
0.59455967
31
Get a list of names of currently connected clients.
def available_clients(self, user_id: int) -> List[str]: return list(self.clients[user_id])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_available_clients(self):\n connected_clients = self.all_clients.keys()\n return connected_clients", "def list_clients(self):\n\n return self.clients_info", "def redis_client_list(self):\n def func(server):\n return server.server.client_list()\n self.__run_...
[ "0.7828835", "0.76664424", "0.7529242", "0.7455028", "0.7432652", "0.74147576", "0.7352863", "0.7346966", "0.72434473", "0.72434473", "0.72185737", "0.71213275", "0.6920311", "0.6882118", "0.68740314", "0.6811941", "0.6792427", "0.6690458", "0.66842914", "0.66598445", "0.6620...
0.6789289
17
``RegistrationProfile.send_activation_email`` sends an email.
def test_activation_email(self): new_user = UserModel().objects.create_user(**self.user_info) profile = self.registration_profile.objects.create_profile(new_user) profile.send_activation_email(Site.objects.get_current()) self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_activation_email(self):\n ctx_dict = {\n 'activation_key': self.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'user': self.user,\n 'SITE_URL': settings.SITE_URL,\n ...
[ "0.7949695", "0.79065245", "0.74792427", "0.73209125", "0.71521664", "0.71488476", "0.7118745", "0.6992142", "0.6942355", "0.6844352", "0.66829264", "0.6604554", "0.65535015", "0.65181637", "0.65029484", "0.64943045", "0.6489618", "0.6449097", "0.6443088", "0.64343107", "0.63...
0.7295338
4
``RegistrationProfile.send_activation_email`` sends an email.
def test_activation_email_missing_template(self): new_user = UserModel().objects.create_user(**self.user_info) profile = self.registration_profile.objects.create_profile(new_user) profile.send_activation_email(Site.objects.get_current()) self.assertEqual(len(mail.outbox), 1) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_activation_email(self):\n ctx_dict = {\n 'activation_key': self.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'user': self.user,\n 'SITE_URL': settings.SITE_URL,\n ...
[ "0.7949695", "0.79065245", "0.74792427", "0.73209125", "0.7295338", "0.71521664", "0.71488476", "0.7118745", "0.6992142", "0.6942355", "0.6844352", "0.66829264", "0.6604554", "0.65535015", "0.65029484", "0.64943045", "0.6489618", "0.6449097", "0.6443088", "0.64343107", "0.639...
0.65181637
14