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
For a given file, return whether it's an allowed type or not
def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1] in APP.config['ALLOWED_EXTENSIONS']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_file_type(file_name):\n\treturn file_name.lower().endswith(ALLOWED_FILE_TYPES)", "def check_file_type(fname):\n ext = path.splitext(fname)[1]\n return ext in allowed_extensions", "def secure_filetype(file):\n ext_list = ['png', 'jpg', 'jpeg']\n ext_valid = file.filename.split('.')[-1] i...
[ "0.8261494", "0.8156615", "0.7785007", "0.7743022", "0.7712795", "0.7351481", "0.7300726", "0.72518766", "0.7231298", "0.7231298", "0.72218883", "0.7214557", "0.7211013", "0.7211013", "0.7211013", "0.7211013", "0.7211013", "0.7211013", "0.7211013", "0.7211013", "0.7211013", ...
0.69851446
45
Initializes weights using Kaiming He et al. (2015). Only convolution layers have learnable weights. All convolutions use a leaky relu activation function (negative_slope = 0.1) except the last which is just a linear output.
def init_weights(self): with torch.no_grad(): self._init_weights()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(module, negative_slope=0):\n if isinstance(module, (nn.Conv2d, nn.ConvTranspose2d)):\n nn.init.kaiming_normal_(module.weight.data, negative_slope)\n module.bias.data.zero_()", "def init_weight(self):\n init_layer(self.conv1)\n init_layer(self.conv2)\n init_b...
[ "0.7530922", "0.7115809", "0.70792145", "0.6918258", "0.68732697", "0.6850686", "0.6803812", "0.6799815", "0.6769556", "0.6758403", "0.6749095", "0.6749095", "0.6749095", "0.6725107", "0.67078733", "0.6699106", "0.6634279", "0.66204095", "0.6601775", "0.65797615", "0.65797615...
0.6725825
13
Generate an input image that maximizes the final Dense layer output corresponding to some class class.
def visualize_dense_layers(self, last_layer='fc', savefig_path="", nof_times=3, class_number=20): layer_idx = [idx for idx, layer in enumerate(self.model.layers) if layer.name == last_layer][0] # Generate three different images of the same output index. vis_images = [] # Print class n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(self, input_image, num_class):\n x = build_resnet(101)\n # add classifier\n x = Conv2D(num_class, (1, 1), kernel_initializer='he_normal', activation='linear', padding='valid', strides=(1, 1), kernel_regularizer=l2(weight_decay))(x)", "def build(input_shape, classes):\n model...
[ "0.6708983", "0.6171949", "0.61025274", "0.59712255", "0.596562", "0.59621865", "0.5889845", "0.582567", "0.5824334", "0.58145535", "0.5776591", "0.577273", "0.57447594", "0.5727517", "0.5683086", "0.5658841", "0.5658407", "0.56465864", "0.5634805", "0.5631828", "0.5623851", ...
0.0
-1
Associate the specified route table to the specified subnet
async def associate(self, rtb_id, subnet_id): self._client.associate_route_table( RouteTableId=rtb_id, SubnetId=subnet_id, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_route_table(route_table_id, subnet_id):\n response = EC2.associate_route_table(\n RouteTableId=route_table_id,\n SubnetId=subnet_id\n )\n return response", "def _link_route_table():\n if dry:\n print(\"Would link the VPC and subnet in the route table.\")\n re...
[ "0.7980144", "0.71845025", "0.6899577", "0.6548851", "0.616238", "0.6066488", "0.6058821", "0.5992398", "0.59419805", "0.5936496", "0.5929731", "0.5908266", "0.5905303", "0.5875463", "0.5871839", "0.58340645", "0.58267415", "0.58092064", "0.57885087", "0.57583785", "0.5719695...
0.8255521
0
Check if the specified route table using the name exists
async def exists(self, tag_name): try: if await self.get_id(tag_name): return True except RtbDoesntExists: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_check(tablename, path):\n instance = arcno(path)\n tablelist = [i for i,j in instance.actual_list.items()]\n return True if tablename in tablelist else False", "def existsTable(self, dbUrl:str, tableName:str) -> bool:\n return self.run(\"existsTable('%s','%s')\" % (dbUrl,tableName))", ...
[ "0.7161614", "0.6733002", "0.6658079", "0.661979", "0.66126657", "0.6576453", "0.65729344", "0.65590614", "0.6552416", "0.65392077", "0.6531865", "0.65291053", "0.6525369", "0.6516566", "0.64875996", "0.64805526", "0.64751875", "0.64390045", "0.64074206", "0.64074206", "0.638...
0.0
-1
Get the main route table id attached to a specified vpc
async def get_main_rtb_id_from_vpc(self, vpc_id): main_route_table = self._client.describe_route_tables( Filters=[ { 'Name': 'vpc-id', 'Values': [vpc_id] }, { 'Name': 'association.main', 'Values': ["true"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rt_lookup(session, vpc_id, rt_name):\n if session is None:\n return None\n\n client = session.client('ec2')\n response = client.describe_route_tables(Filters=[{\"Name\": \"vpc-id\", \"Values\": [vpc_id]},\n {\"Name\": \"tag:Name\", \"Values\":...
[ "0.7193369", "0.64152586", "0.6398741", "0.6395726", "0.6395726", "0.6395726", "0.6395726", "0.6395726", "0.6395726", "0.6299454", "0.6299454", "0.6299454", "0.6299454", "0.6299454", "0.6299454", "0.6299454", "0.6299454", "0.6299454", "0.6295589", "0.6295589", "0.6240656", ...
0.8638846
0
Sets the container_name of this Options.
def container_name(self, container_name): self._container_name = container_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self, name):\n\n self.container['name'] = name", "def name(self, name):\n\n self.container['name'] = name", "def set_name(self, name):\n self.options['name'] = name", "def container_name(self):\n pass", "def update_container_name(self, backup, container):\n retur...
[ "0.68004715", "0.68004715", "0.6698704", "0.6679226", "0.63754743", "0.6177963", "0.6028596", "0.5975322", "0.59642506", "0.5952842", "0.5949729", "0.5949729", "0.5932253", "0.5932253", "0.5932253", "0.5932253", "0.5916452", "0.5892692", "0.58421427", "0.58270925", "0.5827092...
0.81974286
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Options): 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.80891633", "0.80891633", "0.8055254", "0.7983334", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", "0.7967544", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, Options): 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
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.8371822", "0.8281945", "0.82500875", "0.8140755", "0.81153977", "0.81001383", "0.80954826", "0.80812496", "0.80692154", "0.8068952", "0.8064015", "0.8064015", "0.8064015", "0.8064015", "0.8064015", "0.8064015", "0.8064015", "0.80585384", "0.80561507", "0.8041909", "0.80267...
0.8046439
28
conversion unix timestamp to str format
def conv_time(stamp): value = datetime.fromtimestamp(stamp) return value.strftime('%Y-%m-%d %H:%M:%S')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts2str(self,ts):\n dttime = datetime.datetime.fromtimestamp(ts)\n return self.format_datetime(dttime)", "def adapt_timestamp(data):\n return str(time.mktime(data.timetuple()))", "def timestamptostr(ts):\n return datetimetostr(utcfromtimestamp(ts))", "def timestamp2str(t, fmt='%Y-%m-%d...
[ "0.7505882", "0.73331577", "0.73180467", "0.7237942", "0.7237942", "0.72325796", "0.7208728", "0.7102412", "0.70655805", "0.7041109", "0.70340234", "0.69867146", "0.6976715", "0.69738454", "0.69706464", "0.6947854", "0.69362104", "0.6929564", "0.6919992", "0.68995273", "0.686...
0.67716634
26
The humanreadable name of the language. Use for self.get_info_dict() Raises an NotImplementedError if not overwritten.
def name(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_name(self):\n return self.language_name", "def get_language(self) -> str:\n return self.language", "def englishName(self):\n if self.enName:\n return self.enName\n return self.name", "def GetLanguageName(*args, **kwargs):\n return _gdi_.Locale_Ge...
[ "0.83590657", "0.7469342", "0.74398685", "0.74336946", "0.740388", "0.7354294", "0.7354294", "0.7339188", "0.7313449", "0.73072755", "0.72624296", "0.72363585", "0.72198087", "0.7186301", "0.709679", "0.709679", "0.7094334", "0.706892", "0.70568806", "0.70482373", "0.7041437"...
0.0
-1
The name of the language in its localized version. This returns self.language() by default but can be overwritten in subclasses.
def name_local(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_name(self):\n return self.language_name", "def get_language(self) -> str:\n return self.language", "def language(self) -> str:\n return self._language", "def language(self) -> str:\n return self._language", "def get_language(self):\n return self.lang", ...
[ "0.8891806", "0.852259", "0.83891976", "0.83891976", "0.83420074", "0.8172584", "0.8166991", "0.8166991", "0.80996853", "0.8051275", "0.8017129", "0.8017129", "0.8017129", "0.8017129", "0.8005064", "0.79708767", "0.7907234", "0.79026175", "0.7898901", "0.7866133", "0.7829279"...
0.0
-1
Convert time to string formatted to to locale's default date/time.
def formatDate(value): return time.strftime('%c',time.localtime(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_time_display(dtime):\r\n if dtime is None:\r\n return u\"\"\r\n if dtime.tzinfo is not None:\r\n try:\r\n timezone = u\" \" + dtime.tzinfo.tzname(dtime)\r\n except NotImplementedError:\r\n timezone = dtime.strftime('%z')\r\n else:\r\n timez...
[ "0.7677523", "0.7362637", "0.6986561", "0.6952355", "0.6942945", "0.66350526", "0.66325575", "0.6590962", "0.6589478", "0.6537305", "0.65306735", "0.65160406", "0.65082526", "0.64657295", "0.6426139", "0.64222014", "0.6410087", "0.6397695", "0.639609", "0.63525814", "0.634404...
0.58020633
88
Returns a data accessor for column.
def getColumn(self,column): return TableColumn(self,column)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accessor(self):\r\n return self.column.accessor or A(self.name)", "def get_data_column ( self, object ):\n return getattr( object, self.name )", "def _get_column(self, name):\r\n return self.column(name)", "def _get_column(cls, name):\r\n return cls._columns[name]", "def __g...
[ "0.78067195", "0.74959177", "0.6950187", "0.67827857", "0.66103107", "0.64918023", "0.64521646", "0.64137155", "0.63880247", "0.63789606", "0.63674843", "0.6363852", "0.6327106", "0.63044393", "0.6233944", "0.6227115", "0.6211959", "0.62066215", "0.61935747", "0.61376065", "0...
0.6482259
6
Convert cstring (nullterminated string) to python string.
def cstrip(inString): zeroDex = inString.find('\x00') if zeroDex == -1: return inString else: return inString[:zeroDex]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c_str(string):\n return ctypes.c_char_p(string.encode('utf-8'))", "def read_c_string(fd: BinaryIO) -> bytes:\n string = bytearray()\n while True:\n byte = fd.read(1)\n if not byte or byte == b'\\0':\n return bytes(string)\n string += byte", "def getStr_c(s):\n tr...
[ "0.8101468", "0.6951169", "0.6903813", "0.68005097", "0.6789319", "0.6671728", "0.64522445", "0.6438888", "0.63993275", "0.63708085", "0.6347318", "0.6252298", "0.6238433", "0.61751384", "0.61609167", "0.6122366", "0.6109058", "0.6105692", "0.61002207", "0.59915334", "0.59629...
0.0
-1
Returns the match or an empty string.
def getMatch(reMatch,group=0): if reMatch: return reMatch.group(group) else: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_match_str(self, match):\n return \"\"", "def test_empty_string_is_also_a_match(self):\n pattern = \"\"\n s = \"abcdef\"\n self.assertEqual(__, re.search(pattern, s).group())", "def test_empty_string_is_also_a_match(self):\n empty_string = \"\"\n s = \"abcdef\"\...
[ "0.79507387", "0.64764625", "0.6466959", "0.6319046", "0.6317875", "0.6210361", "0.616529", "0.6061667", "0.58991545", "0.58730906", "0.5867399", "0.58345383", "0.582758", "0.58266807", "0.58242995", "0.58020985", "0.5771622", "0.5743972", "0.5742049", "0.57385296", "0.572899...
0.76447314
1
Return size of self.data, after, if necessary, packing it.
def getSize(self): if not self.changed: return self.size #--StringIO Object out = Tes3Writer(cStringIO.StringIO()) self.dumpData(out) #--Done self.data = out.getvalue() data.close() self.size = len(self.data) self.setChanged(False) return s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(self):\n return self._data_size", "def size(self):\n return self.data.size", "def getSize(self):\n if not self.changed: return self.size\n #--Pack data and return size.\n out = Tes3Writer(cStringIO.StringIO())\n self.dumpData(out)\n self.data = out....
[ "0.79109526", "0.7802156", "0.777342", "0.7666639", "0.7624621", "0.7624621", "0.7624621", "0.7624621", "0.7624621", "0.76233584", "0.7544752", "0.7540108", "0.75384873", "0.7537705", "0.75085723", "0.74740255", "0.7428007", "0.74055505", "0.7371733", "0.73297143", "0.7321144...
0.7001552
51
Return size of self.data, after, if necessary, packing it.
def getSize(self): if not self.changed: return self.size #--Pack data and return size. out = Tes3Writer(cStringIO.StringIO()) self.dumpData(out) self.data = out.getvalue() out.close() self.size = len(self.data) self.setChanged(False) return self.si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_size(self):\n return self._data_size", "def size(self):\n return self.data.size", "def pack_size(self) -> int:\n return self._pack_size", "def size(self):\n return len(self.data)", "def size(self):\n return len(self.data)", "def size(self):\n return len(s...
[ "0.791279", "0.7803657", "0.7666002", "0.76257974", "0.76257974", "0.76257974", "0.76257974", "0.76257974", "0.7624669", "0.7545911", "0.7541531", "0.75397", "0.7538813", "0.75085735", "0.7475736", "0.742872", "0.7407118", "0.7372853", "0.7331235", "0.7322147", "0.7278654", ...
0.77750313
2
Return True if object is a temp object.
def isTemp(self,object): return (object in self.tempObjects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_object(self, name: str) -> bool:\r\n return os.path.exists(self._path_for_pickle(name))", "def bool(self, obj):\n return True", "def bool(self, obj):\n return True", "def is_object(obj):\n return (isinstance(obj, object) and\n type(obj) is not type and\n t...
[ "0.6585963", "0.64631236", "0.64631236", "0.63785005", "0.6301376", "0.6285813", "0.6240615", "0.62181836", "0.6160513", "0.61474115", "0.6085642", "0.60410786", "0.60282105", "0.6014119", "0.59407514", "0.58731616", "0.5765552", "0.5722132", "0.5684896", "0.5676765", "0.5664...
0.87039113
0
Draw rectangle of specified color.
def drawRect(self,color,x1,y1,x2,y2): if not self.changed: self.edit() wmap = 512 mapd = self.mapd for y in xrange(y1,y2): ymoff = wmap*y for x in xrange(x1,x2): mapd[x+ymoff] = color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawRectangle(img, rect, color):\n \n if len(rect) is not 4:\n # TODO throw error\n return;\n rect = rect * DISPLAY_SCALE;\n x1, y1, x2, y2 = rect.astype(numpy.int32);\n cv2.rectangle(img, (x1, y1), (x2, y2), color, 2);", "def draw_rect(self, color, po...
[ "0.77119595", "0.751639", "0.7331997", "0.72960854", "0.7203873", "0.71435416", "0.7140063", "0.7057411", "0.69646674", "0.6940525", "0.6921079", "0.6918698", "0.6904941", "0.68767667", "0.68513477", "0.6826486", "0.68209034", "0.67911476", "0.6752047", "0.6716133", "0.670798...
0.6996527
8
Draw's a border rectangle of specified thickness.
def drawBorder(self,color,x1,y1,x2,y2,thick): self.drawRect(color,x1,y1,x2,y1+thick) self.drawRect(color,x1,y1,x1+thick,y2) self.drawRect(color,x2-thick,y1,x2,y2) self.drawRect(color,x1,y2-thick,x2,y2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawBorder(self):\n\t\t# horizontal lines\n\t\tself.wts(0, 0, '╭' + '─' * (self.width - 2) + '╮', self._borderColor)\t\t\t\t\t\t# Top\n\t\tself.wts(self.height - 2, 0, '└' + '─' * (self.width - 2) + '╯', self._borderColor)\t\t\t# Bottom\n\t\t# vertical lines\n\t\tfor yPos in range(1, self.height - 2):\n\t\t\ts...
[ "0.71188384", "0.70126176", "0.6929818", "0.6718227", "0.66622007", "0.6635933", "0.6588754", "0.6530003", "0.6508044", "0.64947903", "0.6355176", "0.63386136", "0.6332063", "0.63249457", "0.6287606", "0.628658", "0.62021995", "0.6193314", "0.617658", "0.6039158", "0.6038586"...
0.75119376
0
True if modFile is in load list.
def isLoaded(self,modFile): return (modFile in self.loadFiles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLoaded(self,fileName):\n return mwIniFile.isLoaded(fileName)", "def is_loaded_module(self, module_name):\n\n for (module, ea, name, ord) in self.rt_import_table.values():\n if module == module_name:\n return True\n return False", "def can_load(cls, filen...
[ "0.72510654", "0.7220901", "0.6949726", "0.64905375", "0.63691705", "0.63691705", "0.63617396", "0.6360658", "0.6359112", "0.6249636", "0.6232187", "0.6219556", "0.6188836", "0.6176873", "0.6134634", "0.60979486", "0.60872066", "0.6082824", "0.60674137", "0.6066154", "0.60543...
0.86566865
0
Sets description to specified text and then writes hedr.
def writeDescription(self,description): description = description[:min(255,len(description))] self.tes3.hedr.description = description self.tes3.hedr.setChanged() self.writeHedr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDescription(self, description):\n url = G.api + self.testId + '/snapshots/' + self.hash\n self.info = requests.put(url, auth=(G.username, G.authkey), data={'description':description})", "def set_description(self, data):\n self._description = self._uni(data)", "def SetDescription(sel...
[ "0.64111924", "0.6370797", "0.6362023", "0.63107014", "0.62497413", "0.62397426", "0.6228479", "0.6212276", "0.61864495", "0.61308736", "0.6123549", "0.6123549", "0.6123549", "0.6123549", "0.61095864", "0.60835516", "0.60835516", "0.60835516", "0.60835516", "0.60835516", "0.6...
0.8167504
0
True if fileName is in the the load list.
def isLoaded(self,fileName): return mwIniFile.isLoaded(fileName)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_load(cls, filename):\n return False", "def isLoaded(self,modFile):\n return (modFile in self.loadFiles)", "def checkForFile(self, filename:str):\n\t\tfor item in os.listdir(self.getPath()):\n\t\t\tif filename in item:\n\t\t\t\treturn True\n\t\treturn False", "def exists(self, filename):...
[ "0.724537", "0.71412885", "0.71269864", "0.6977991", "0.6932028", "0.68382", "0.6799403", "0.6674898", "0.6663756", "0.6586046", "0.6546176", "0.64733523", "0.6429546", "0.63843304", "0.6329842", "0.6315099", "0.62874025", "0.6276312", "0.6271743", "0.6245755", "0.62091804", ...
0.74375594
0
Returns map of real to ghosted files in mods directory.
def getGhosted(): dataDir = dirs['mods'] ghosts = [x for x in dataDir.list() if x.cs[-6:] == '.ghost'] return dict((x.root,x) for x in ghosts if not dataDir.join(x).root.exists())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forge_files(self) -> Dict[str, BaseForge]:\n\t\treturn self._forge_files", "def localmod_paths(root_dir, parent_dir):\n return {\n 'F1' : os.path.join(root_dir, \"F1\"),\n 'F' : os.path.join(parent_dir, \"F\"),\n 'F2' : os.path.join(parent_dir, \"F2-local\"),\n 'D1' : os.path.join(root_dir, ...
[ "0.6672134", "0.6244158", "0.59795296", "0.59374934", "0.59366405", "0.592153", "0.5905381", "0.58584255", "0.58526814", "0.5842469", "0.5839313", "0.58322704", "0.5823074", "0.56830454", "0.568261", "0.5663049", "0.5649142", "0.5620803", "0.559837", "0.55753934", "0.5536636"...
0.67132413
0
Returns the number of synchronized controllers. an integer corresponding to the number of synchronized controllers On failure, throws an exception or returns YMultiAxisController.NAXIS_INVALID.
def get_nAxis(self): # res if self._cacheExpiration <= YAPI.GetTickCount(): if self.load(YAPI._yapiContext.GetCacheValidity()) != YAPI.SUCCESS: return YMultiAxisController.NAXIS_INVALID res = self._nAxis return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_control_count(cmd):\n return len(cmd.control_qubits)", "def dispatch_count(self) -> int:\n return pulumi.get(self, \"dispatch_count\")", "def get_num_joysticks(self) -> int:\n return self._pygame.joystick.get_count()", "def num_servos(self) -> int:\n return self._num_servos", ...
[ "0.619233", "0.60119426", "0.5963663", "0.59550816", "0.59049064", "0.58648944", "0.58528495", "0.58372545", "0.582305", "0.57541937", "0.5753122", "0.5753122", "0.57439953", "0.56580514", "0.5651148", "0.561711", "0.561378", "0.5590282", "0.5576778", "0.55757374", "0.5566395...
0.6530266
0
test that nobody can create a product listing without auth
def test_security_on_post(self): url = '/product/xml/' response = self.client.post(url,{'description':'my new description'}) self.failUnlessEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_only_admin_can_create_product(self):\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n )\n ...
[ "0.7960845", "0.76032835", "0.7385757", "0.73341733", "0.72847015", "0.7257508", "0.72551584", "0.72313315", "0.72014314", "0.7152841", "0.7113371", "0.70674574", "0.70522344", "0.702054", "0.6988015", "0.6940775", "0.6892139", "0.68841934", "0.6819123", "0.6786343", "0.67745...
0.70973486
11
test that nobody can modify an existing product without auth
def test_security_on_put(self): # test the update url product = Product.objects.all()[0] url = '/product/xml/%s/' % product.item_number response = self.client.put(url,{'description':'my new description'}) self.failUnlessEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unauthorized_product_update(self):\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n product_update = dict(\n prod_name='NY_jeans',\n category='denims',\n stock=50,\n price=180\n )\n ...
[ "0.7836434", "0.7741535", "0.77172345", "0.759511", "0.7338387", "0.73073435", "0.72424406", "0.7194128", "0.706966", "0.70480245", "0.7029451", "0.70166636", "0.69850487", "0.68859285", "0.6885113", "0.68846375", "0.6837389", "0.67560273", "0.6751412", "0.67499226", "0.67290...
0.7822307
1
test that nobody can delete an existing product without auth
def test_security_on_delete(self): # test the delete product url product = Product.objects.all()[0] url = '/product/xml/%s/' % product.item_number response = self.client.delete(url) self.failUnlessEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_not_my_product(self):\n self._require_login(self.user1)\n response = self.client.delete('/api/1.0/products/2/')\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def test_non_admin_cannot_delete_product(self):\n resp = self.admin_register()\n ...
[ "0.8797145", "0.8246856", "0.81133246", "0.7989509", "0.79883975", "0.79554987", "0.7902811", "0.7887529", "0.7776524", "0.7751724", "0.76756126", "0.7585028", "0.7563168", "0.75324357", "0.7508863", "0.7457899", "0.7440487", "0.73995256", "0.7399106", "0.73594016", "0.732811...
0.877179
1
test that nobody can retrieve the complete product list without the correct credidential
def test_security_on_get(self): # test the listing url product = Product.objects.all()[0] url = '/product/xml/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 401) # test the product detail url url = '/product/xml/%s/' % product.item_nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_available_product(self):\n view = AvailableProductListView.as_view({'get': 'list'})\n uri = reverse('products:list-available-products')\n request = self.factory.get(uri, HTTP_AUTHORIZATION='Token {}'.format(self.token_user.key))\n request.user = self.user['user']\n ...
[ "0.71448547", "0.7104924", "0.7048587", "0.7037518", "0.7035228", "0.69407725", "0.69278264", "0.69031703", "0.6888261", "0.68730485", "0.68618673", "0.6771843", "0.67529726", "0.669686", "0.6633077", "0.65858436", "0.6567495", "0.65665793", "0.6556243", "0.6546642", "0.65459...
0.7604344
0
Initialize the parameters of the layer, either by using sparse initialization or small isotropic noise.
def _init_params(self): self.W_ems = [] self.b_ems = [] if self.rank_n_approx: W_em1 = self.init_fn[0](self.n_in, self.rank_n_approx, self.sparsity[0], self.scale[0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_layer(layer):\n \n if layer.weight.ndimension() == 4:\n (n_out, n_in, height, width) = layer.weight.size()\n n = n_in * height * width\n \n elif layer.weight.ndimension() == 2:\n (n_out, n) = layer.weight.size()\n\n std = math.sqrt(2. / n)\n scale = std * math.sqrt...
[ "0.716163", "0.7136903", "0.7069152", "0.68276066", "0.6772616", "0.67636126", "0.6740026", "0.66746503", "0.66323656", "0.6631897", "0.6605512", "0.65971637", "0.6591617", "0.65872365", "0.6580605", "0.657975", "0.6546712", "0.6537283", "0.65184796", "0.6507062", "0.64842767...
0.0
-1
Returns the first item of the Queue
def peek(self): return self.first
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Queue is empty')\n\t\treturn self._head._element", "def first(self):\r\n if self.is_empty():\r\n raise Empty(\"Queue is empty\")\r\n return self._head._element", "def first(self):\n if self.head is None:\n ...
[ "0.8702278", "0.86236244", "0.85479504", "0.8490896", "0.84425616", "0.83485395", "0.8345703", "0.83136916", "0.82134175", "0.82134175", "0.81876904", "0.8145613", "0.8112181", "0.8078956", "0.80502397", "0.80120635", "0.7998008", "0.79267305", "0.78532416", "0.78217995", "0....
0.69136715
82
Given a discrete distribution (may have not been normalized to 1), smooth it by replacing zeros with eps multiplied by a scaling factor and taking the corresponding amount off the nonzero values.
def _smooth_distribution(p, eps=0.0001): is_zeros = (p == 0).astype(np.float32) is_nonzeros = (p != 0).astype(np.float32) n_zeros = is_zeros.sum() n_nonzeros = p.size - n_zeros if not n_nonzeros: raise ValueError('The discrete probability distribution is malformed. All entries are 0.') e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _smooth(values, std):\n width = std * 4\n x = np.linspace(-width, width, min(2 * width + 1, len(values)))\n kernel = np.exp(-(x / 5)**2)\n\n values = np.array(values)\n weights = np.ones_like(values)\n\n smoothed_values = np.convolve(values, kernel, mode='same')\n smoothed_weights = np.convolve(weights,...
[ "0.619303", "0.599787", "0.57301944", "0.5693864", "0.5693163", "0.5686192", "0.5684507", "0.56833947", "0.56658393", "0.5663905", "0.56597185", "0.5639174", "0.5591923", "0.5536933", "0.5520846", "0.5501997", "0.5474872", "0.54531705", "0.5435398", "0.5434047", "0.5426548", ...
0.7445933
0
Given a dataset, find the optimal threshold for quantizing it.
def _get_optimal_threshold(arr, num_bins=1001, num_quantized_bins=255): if not isinstance(arr, np.ndarray): raise TypeError('get_optimal_threshold only supports input type of np.ndarray,' ' while received type=%s' % (str(type(arr)))) min_val = np.min(arr) max_val = np.max(arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_threshold(y, y_hat, step_size, score_func, maximize=True):\n best_thres, best_score = 0.0, 0.0 if maximize else 1.0\n for thres in np.arange(0, 1, step_size):\n score = score_for_threshold(y, y_hat, score_func, thres)\n if (maximize and (score > best_score)) or (not maximize and (...
[ "0.639031", "0.63328415", "0.62595606", "0.6156397", "0.6144371", "0.6098109", "0.60654205", "0.606497", "0.6051026", "0.6025029", "0.5901674", "0.5898532", "0.58839", "0.58134365", "0.57301223", "0.5717562", "0.5661646", "0.565874", "0.56428444", "0.5632944", "0.5612439", ...
0.57394457
14
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i : i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8040086", "0.79256725", "0.7923959", "0.78855336", "0.78781366", "0.7816429", "0.7766289", "0.7756418", "0.7744994", "0.77324396", "0.77295053", "0.77257586", "0.77034765", "0.7690202", "0.7690202", "0.7664886", "0.7657751", "0.7656609", "0.7656609", "0.7646568", "0.764656...
0.7453906
35
Precision at rank k
def ranking_precision_score(y_true, y_score, k=10): unique_y = np.unique(y_true) if len(unique_y) > 2: raise ValueError("Only supported for two relevance levels.") n_relevant = 0 n_pos = 0 for relevance_score in y_true: if relevance_score == 1: n_pos += 1 for index...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\n return np.mean(r)", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance sco...
[ "0.7249937", "0.72204053", "0.7163338", "0.7148408", "0.7115376", "0.7072892", "0.6917101", "0.6874991", "0.67599165", "0.66663283", "0.6532125", "0.6491568", "0.648943", "0.6441465", "0.6430751", "0.6415166", "0.6390798", "0.63762665", "0.63743824", "0.63681585", "0.6279463"...
0.64314383
14
We enforce certain behavior on the "special" methods. Anyone who overrides this class can override the 'fit', 'transform', and 'fit_transform' methods. This class will redirect the call of this to handle the additional logic required for DataFrames that will not need to be implemented by the child class.
def __getattribute__(self,attr): if attr in super(BaseTransformer,self).__getattribute__('_overrides'): return super(BaseTransformer,self).__getattribute__('_'+attr) return super(BaseTransformer,self).__getattribute__(attr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n raise Exception('derived class should redefine this function')", "def child_overriden(self):\n raise NotImplementedError(\n \"{} does not have implemented `child_overriden`\".format(self)\n )", "def __call__(self):\r\n raise NotImplementedError('override ...
[ "0.5875139", "0.58352757", "0.58183974", "0.580818", "0.5777932", "0.5748379", "0.5687404", "0.56783247", "0.5673622", "0.56652856", "0.56445026", "0.5609732", "0.55811244", "0.5553304", "0.5520016", "0.55106056", "0.5501446", "0.54673254", "0.5454347", "0.54439837", "0.54430...
0.0
-1
Makes a post request to the given endpoint with the provided data from the client.
def make_post_request(client, endpoint, data): return client.post(endpoint, data=data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self, endpoint, params=None, data=None):\n\n return self._call(requests.post, endpoint, params=params, data=data)", "def post(self, endpoint, params=None, data=None):\n params = params or dict()\n data = data or dict()\n return self.request(verb=requests.post, address=self.pr...
[ "0.76917946", "0.75565577", "0.72526884", "0.72151124", "0.7178728", "0.70120376", "0.6983637", "0.6974069", "0.68566394", "0.68350816", "0.679791", "0.67907983", "0.6790379", "0.6745747", "0.6716422", "0.6710829", "0.66509205", "0.6636331", "0.6633512", "0.6619758", "0.65772...
0.92025495
0
Creates a random string
def random_string(length): random_list = [] for i in range(length): random_list.append(random.choice(string.ascii_uppercase + string.digits)) return ''.join(random_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def r...
[ "0.8204216", "0.8064874", "0.8060258", "0.78437895", "0.7699288", "0.76867044", "0.7685242", "0.7667141", "0.7630261", "0.7621643", "0.76169604", "0.75889164", "0.7581788", "0.75459", "0.7545244", "0.7534775", "0.75305027", "0.7518783", "0.7496469", "0.7462007", "0.74562943",...
0.0
-1
Find and return a ".terraformversion" file if one is present.
def version_file(self) -> Optional[Path]: for path in [self.path, self.path.parent]: test_path = path / TF_VERSION_FILENAME if test_path.is_file(): LOGGER.debug("using version file: %s", test_path) return test_path return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self, directory, version_file_name='.version'):\n if self.path_exists(directory) and (version_file_name in os.listdir(directory)):\n f = open(directory + '/' + version_file_name)\n version = f.read()\n f.close()\n return version\n return Non...
[ "0.67319036", "0.6583178", "0.65693635", "0.64801407", "0.6475913", "0.64692795", "0.6441142", "0.633473", "0.6330302", "0.6328526", "0.6227127", "0.62209064", "0.6220467", "0.62152225", "0.6202556", "0.6196654", "0.6191919", "0.61804706", "0.61592025", "0.6157814", "0.615431...
0.71120024
0
Get the defined minimum required version of Terraform.
def get_min_required(self) -> str: version = self.terraform_block.get("required_version") if version: if re.match(r"^!=.+", version): LOGGER.error( "min required Terraform version is a negation (%s) " "- unable to determine required ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_min():\n return VERSION_MIN", "def min_api_version(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"min_api_version\")", "def min_api_version(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"min_api_version\")", "def min_api_version(self) -> pulu...
[ "0.7592078", "0.6727831", "0.6727831", "0.67000395", "0.6673934", "0.6651586", "0.6635504", "0.6635504", "0.6570398", "0.6563299", "0.654208", "0.625186", "0.6146679", "0.6130398", "0.60835415", "0.60531086", "0.60531086", "0.59937984", "0.59844506", "0.5975632", "0.5962323",...
0.8736733
0
Allow or prevent the computation of gradients for decoder blocks
def fine_tune(self): for params in self.encoder.parameters(): params.requires_grad = self.if_fine_tune
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_gradient_fusion():\n pass", "def late_gradient_fusion():\n pass", "def early_gradient_fusion():\n pass", "def _poputil_block_recompute_backward(op, grads):\n return grads", "def dev_network(self):\n freeze_model(self.eval_net)\n for data_set_name, data_set in self.data_to_dev...
[ "0.6387028", "0.6113133", "0.6037294", "0.588107", "0.58578974", "0.57747084", "0.576814", "0.5694518", "0.561002", "0.5607158", "0.56008726", "0.55730104", "0.55313396", "0.5525046", "0.5512736", "0.54739", "0.54404914", "0.5412464", "0.5375855", "0.5374027", "0.53729916", ...
0.57306284
7
Creates the initial hidden and cell state for each layer of the decoder's lstm
def init_hidden_state(self, encoder_out): init_internal_state = [] mean_encoder_out = encoder_out.mean(dim=1) h = self.init_h(mean_encoder_out) c = self.init_c(mean_encoder_out) init_internal_state.append((h, c)) for i in range(1, self.decoder_number_layers): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_states(batch_size, num_lstm_layer, num_hidden):\n init_c = [('l%d_init_c' % l, (batch_size, num_hidden)) for l in range(num_lstm_layer)]\n init_h = [('l%d_init_h' % l, (batch_size, num_hidden)) for l in range(num_lstm_layer)]\n return init_c + init_h", "def get_lstm_init_state(combiner_outputs:...
[ "0.79330057", "0.7323646", "0.72587425", "0.72421336", "0.72159034", "0.72159034", "0.72159034", "0.70154953", "0.7008315", "0.69341445", "0.6934068", "0.6829755", "0.6825306", "0.6800513", "0.6800513", "0.6789778", "0.6777058", "0.6772707", "0.6771452", "0.6765032", "0.67504...
0.7289454
2
set new learning rate
def set_new_lr(step_num, batch_id): # set grad to zero for gradient accumulation if args.accumulate: if batch_id % args.accumulate == 0: net.collect_params().zero_grad() step_num += 1 else: step_num += 1 # learning rate schedule ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)", "def assign_learning_rate(session, lr_update, lr_placeholder, new_lr):\n session.run(lr_update, feed_dict={lr_placeholder: new_lr})", "def _update_learning_rate(self):\r\n\r\n self.n_steps += 1\r\n lr = self.factor * ...
[ "0.81899655", "0.8186776", "0.7890553", "0.77374995", "0.7719085", "0.76482403", "0.76482403", "0.75524837", "0.7516568", "0.7480104", "0.74621284", "0.7443868", "0.74433243", "0.744311", "0.743519", "0.7428284", "0.7428284", "0.7409477", "0.7404238", "0.7380271", "0.73702323...
0.0
-1
This function mutates given control_points and returns the same list.
def act(self, control_points): self.current_parameter = 0 p = self.param # shorthand for creating or reading parameters. for i in range(0, len(control_points), 3): center = control_points[i] prev_handle = control_points[i + 1] next_handle = control_points[i +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copyPoints(points):\n copied = [point.copy() for point in points]\n return copied", "def set_control_points(self, control_points):\r\n for curve_index, points in enumerate(control_points):\r\n self.curves[curve_index].control_points = points", "def applyToPoints(self, points):\n ...
[ "0.64618224", "0.63019234", "0.62510586", "0.62441766", "0.57302487", "0.56248873", "0.55653214", "0.5523265", "0.54409575", "0.5415689", "0.5411803", "0.53513193", "0.52872205", "0.5216645", "0.5189271", "0.51567817", "0.51401174", "0.5134629", "0.5107092", "0.5084214", "0.5...
0.5183061
15
Returns a fixed version of the AP data point for this error or None if this error should be suppressed.
def fix(self) -> Union[tuple, None]: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def papi(self) -> typing.Union[None, str]:\n if self.airfield.data['2.14']['data']:\n for row in self.airfield.data['2.14']['data'][2:]:\n if row[0] == self.designation:\n return row[3].partition('\\n')[0] or None\n return None", "def soleDataPoint(self)...
[ "0.6167753", "0.54195476", "0.52139986", "0.5131659", "0.50841814", "0.507934", "0.50727123", "0.50565684", "0.50497514", "0.49881572", "0.4982593", "0.49672902", "0.494047", "0.49204242", "0.48960406", "0.48955262", "0.4883316", "0.4866334", "0.48160532", "0.48071092", "0.48...
0.0
-1
Returns the original version of this data point.
def unfix(self) -> Union[tuple, None]: if hasattr(self, "pred"): return self.pred["class"], (self.pred["score"], False, self.pred["info"]) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getOriginal(self,):\n\t\treturn self.original;", "def original(self):\n return self._original", "def original(self):\n return self._original", "def copy(self):\n return Point(self.data, name=self.name+\"'\")", "def to_python(self):\r\n return self.original", "def clone(sel...
[ "0.76433486", "0.7354626", "0.7354626", "0.73061746", "0.67512125", "0.6592378", "0.65743464", "0.65743464", "0.65743464", "0.64975107", "0.6459376", "0.6419153", "0.64087516", "0.63501376", "0.6303118", "0.6303118", "0.6227504", "0.6147316", "0.61231947", "0.611136", "0.6102...
0.0
-1
Test that host expression props fail gracefully
def test_invalid_host_expression_prop(self): block = SNMPBase() block._create_data = MagicMock() block.execute_request = MagicMock() myOID = "1.3.6.1.2.1.31.1.1.1.6.2" ip = "0.0.0.0" port = 1611 starting_signal = Signal({ "ip": ip, "port": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_nonexistent_runtime_property(self):\n script_path = self._create_script(\n linux_script='''#! /bin/bash -e\n ctx instance runtime-properties nonexistent\n ''',\n windows_script='''\n ctx instance runtime-properties nonexistent\n ...
[ "0.6067826", "0.60512716", "0.5924807", "0.5880989", "0.573708", "0.5730073", "0.57235485", "0.5694024", "0.56856906", "0.5622357", "0.56221014", "0.56204987", "0.5611164", "0.5609023", "0.5603117", "0.5597464", "0.5571664", "0.55696565", "0.55646634", "0.5554427", "0.5530065...
0.62409085
0
Run a simulation from the initial state given for a fixed number of steps. The returned array includes the initial state.
def run_simulation_with_fixed_int(self, init_x: float, init_y: float, n_steps: int, time_delta: float = 1.0) -> np.array: if n_steps <= 0: raise ValueError(f'n_steps must be a positive integer, but was {n_steps}') return self.run_simulation(init_x, init_y, eval_times=np.arange(0, n_steps + 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sim_steps(self, num_steps, include_init_state=True, rng=np.random):\n\n times = [self.time]\n states = [self.state.copy()]\n\n for _ in range(num_steps):\n\n rates = self.params * self._calc_propensities()\n total_rate = rates.sum()\n\n if total_rate == 0:\...
[ "0.67404836", "0.6414116", "0.6295438", "0.6263309", "0.6066734", "0.6066734", "0.6054842", "0.60531026", "0.5980217", "0.59237224", "0.59151053", "0.5876742", "0.5867276", "0.5846098", "0.58368707", "0.58101326", "0.57950294", "0.5785644", "0.57750326", "0.57696164", "0.5751...
0.64974654
1
Test missing .shx file
def test_missing_shx(self): path = os.path.join(BASE_DIR, "tests", "fixtures", "missing_shx.zip") zip_file = zipfile.ZipFile(path) with self.assertRaises(MissingFiles) as context: get_shapefile(zip_file) the_exception = context.exception self.assertEqual(MISSING_FILE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_file():\n passed = False\n try:\n x = XPIManager('foo.bar')\n except:\n passed = True\n assert passed", "def test_script_exists(self):\n get_files=os.listdir(\"../../taxonomy/src_files\")\n self.assertIn(\"validate_match_batch.py\", get_files)", "def tes...
[ "0.70473933", "0.68444026", "0.67671233", "0.67127603", "0.66949743", "0.6689946", "0.66809124", "0.66654414", "0.65776235", "0.6543652", "0.6543581", "0.6525398", "0.6420084", "0.6413658", "0.6389313", "0.63086426", "0.62918097", "0.62362903", "0.6213797", "0.618119", "0.617...
0.7172244
0
Converts to military (24hour) time
def timeConversion(s): new_s = '' if s[-2:] == 'PM' and s[:2] != '12': new_s = str(int(s[:2]) + 12) + s[2:-2] elif s[-2:] == 'AM' and s[:2] == '12': new_s = '0' + str(int(s[:2]) - 12) + s[2:-2] else: new_s = s[:-2] return new_s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_24hr_12ampm(military_hr): \n\t\n if military_hr == 0:\n hour_ampm_str = \"12am\"\n elif military_hr == 12:\n hour_ampm_str = \"12pm\"\n elif military_hr > 12:\n hour_ampm_str = str(military_hr - 12) + \"pm\"\n else:\n hour_ampm_str = str(military_hr) + \"...
[ "0.74171627", "0.68960637", "0.6859331", "0.6672087", "0.6596903", "0.6552891", "0.64525217", "0.64145744", "0.6337312", "0.62382984", "0.62377155", "0.62156934", "0.62137127", "0.6163646", "0.61625975", "0.6150988", "0.6150089", "0.61185735", "0.6108344", "0.605468", "0.6014...
0.6483817
6
This plots a confusion matrix for an already trained predictor (it will just call predictor.predict(X_test), not predictor.fit(...)) This can be used to check wether the given predictor performs well
def plot_confusion_matrix(name, trained_predictor, X_test, y_test): fig, ax = plt.subplots() fig.tight_layout() cm = confusion_matrix(y_test, trained_predictor.predict(X_test), normalize="all") ConfusionMatrixDisplay(cm, display_labels=["False", "True"]).plot( ax=ax ) plt.title(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confusion_matrix(y_true, y_pred):\n skplt.plot_confusion_matrix(y_true, y_pred, normalize=True)\n plt.show()", "def plot_confusion_matrix(y_pred, y_true, classes_list):\n fig = plt.figure(figsize=(8, 8))\n cm = confusion_matrix(y_pred, y_true)\n plt.imshow(cm, interpolation='nearest', ...
[ "0.7565519", "0.7540713", "0.75214607", "0.74298614", "0.7427613", "0.73591155", "0.73433137", "0.73245466", "0.7302947", "0.72827363", "0.7254476", "0.7239747", "0.7219855", "0.720874", "0.72076845", "0.7196952", "0.7176733", "0.7175466", "0.7163334", "0.7162828", "0.7162089...
0.7979355
0
Creates a classification model.
def create_model(bert_config, is_training, is_eval, is_output, input_ids, input_mask, segment_ids, effective_mask, label, use_one_hot_embeddings, colbert_dim, dotbert_dim, max_q_len, max_p_len, doc_type, loss, kd_source, train_model, eval_model): with tf.variable_scope("Teacher") as scope: if (is_train...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self):\n self.classifier = DecisionTreeClassifier(max_depth=1)", "def create_model(self, C : float =1):\n self.classifier = RandomForestClassifier(max_depth=5)", "def create_model():\n\n # Create a sequential model (a simple NN is created) adding a softmax activation at the en...
[ "0.7451048", "0.716728", "0.70753753", "0.69427526", "0.69337225", "0.69306064", "0.6929345", "0.68631464", "0.68004555", "0.6769279", "0.6737084", "0.66838384", "0.66709864", "0.660953", "0.65912193", "0.6564333", "0.6534873", "0.6526978", "0.6525293", "0.6521778", "0.651739...
0.0
-1
Returns True if tile percent of background pixels are above background_threshold or tile is not of shape expected_shape.
def is_tile_mostly_background(img_filepath, background_pixel_value, background_threshold, expected_shape): img, pixel_above_threshold = _compute_pixelwise_is_background(img_filepath, background_pixel_value) if img.shape != expected_shape: return True, 0. percent_background_pixels = np.sum(pixel_abo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_pixelwise_is_background(jpeg_file, background_pixel_value):\n img = imageio.imread(jpeg_file)\n\n channel_above_threshold = img > background_pixel_value\n pixel_above_threshold = np.prod(channel_above_threshold, axis=-1)\n\n return img, pixel_above_threshold", "def check_lungs(image, per...
[ "0.66431487", "0.59043664", "0.58898723", "0.5856966", "0.57924366", "0.57647645", "0.57396984", "0.5713221", "0.5682661", "0.56154114", "0.55924904", "0.55850697", "0.5566328", "0.55467147", "0.549086", "0.5444107", "0.54391205", "0.5433852", "0.5433661", "0.54200405", "0.53...
0.8183993
0
Return a randomly generated list of goals with length num_goals. All elements of the list must be the same type of goal, but each goal must have a different randomly generated colour from COLOUR_LIST. No two goals can have the same colour.
def generate_goals(num_goals: int) -> List[Goal]: num = random.random() goal_list = [] colours = _get_goal_colours() if num < 0.5: for i in range(num_goals): colour = colours[i] goal = PerimeterGoal(colour) goal_list.append(goal) else: for i in ran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_goals(num_goals: int) -> List[Goal]:\r\n goal_lst = []\r\n colour_lst = []\r\n\r\n num = len(COLOUR_LIST) - 1\r\n rand = random.randint(0, 1)\r\n\r\n if rand == 1:\r\n while len(goal_lst) < num_goals:\r\n new = COLOUR_LIST[random.randint(0, num)]\r\n if not ...
[ "0.9042545", "0.87703604", "0.8560951", "0.7739296", "0.6907885", "0.62121385", "0.6152537", "0.6105629", "0.5944219", "0.580509", "0.5644077", "0.5638114", "0.55760545", "0.5520105", "0.5478518", "0.5462582", "0.5442521", "0.5389885", "0.53858465", "0.5379968", "0.5376745", ...
0.8217716
3
Return a twodimensional list representing as rows and columns of unit cells. Return a list of lists L, where, for 0 <= i, j < 2^{max_depth self.level} L[i] represents column i and L[i][j] represents the unit cell at column i and row j. Each unit cell is represented by a tuple of 3 ints, which is the colour of the block...
def _flatten(block: Block) -> List[List[Tuple[int, int, int]]]: if block.level == block.max_depth: return [[block.colour]] elif not block.children: dim = int(2 ** (block.max_depth - block.level)) return [[block.colour] * dim for _ in range(dim)] else: grid = [] child_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cells_z(self):\n if self.is_depth:\n return list(reversed(self._cells[2]))\n return self._cells[2]", "def cells_list(self):\n xx, yy = np.meshgrid(self.x_spacings, self.y_spacings)\n return np.vstack([yy.ravel(), xx.ravel()]).transpose()", "def cell_list(self):\n ...
[ "0.6126699", "0.6068125", "0.604326", "0.60215193", "0.5918493", "0.5905843", "0.58728737", "0.57507306", "0.5708353", "0.5694894", "0.5665089", "0.5663916", "0.56198037", "0.56185895", "0.5616556", "0.55978286", "0.5591555", "0.55790204", "0.5563565", "0.5550841", "0.5533275...
0.5942324
4
Return the current score for this goal on the given board. The score is always greater than or equal to 0.
def score(self, board: Block) -> int: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getScore(self,board):\n return board.getScore()[self.tile]", "def score(self, board: Block) -> int:\r\n raise NotImplementedError", "def score(self, board: Block) -> int:\r\n raise NotImplementedError", "def score(self, board: Block) -> int:\r\n raise NotImplementedError", "...
[ "0.7853069", "0.7739044", "0.7739044", "0.7739044", "0.74194056", "0.7296544", "0.7255367", "0.7215996", "0.72092766", "0.71322733", "0.70832807", "0.70311314", "0.70094764", "0.7002051", "0.69650555", "0.68869925", "0.6875984", "0.68739367", "0.6851097", "0.6836086", "0.6821...
0.7805225
2
Returns whether the dependency is contained within a single job.
def isInternal(self): if self.data.depend_er_job == self.data.depend_on_job: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_queue(self):\n if self.get_db('jobid') is None:\n log.debug('jobid not found for calculation.')\n return False\n else:\n # get the jobid\n jobid = self.get_db('jobid')\n # see if jobid is in queue\n _, jobids_in_queue, _ = getstatusoutput('qselect',\n ...
[ "0.6906989", "0.6839656", "0.66601545", "0.6360909", "0.6337891", "0.6222235", "0.61848074", "0.61673003", "0.6142863", "0.6091579", "0.60619444", "0.6031266", "0.60294586", "0.60197246", "0.60098815", "0.59935504", "0.5973742", "0.5960723", "0.59422576", "0.5940927", "0.5902...
0.6351953
4
Validates if given file exists.
def existent_file(file_path): if not os.path.exists(file_path): raise argparse.ArgumentTypeError("Input file path does not exist") return file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_file(filename: str):\n if os.path.isfile(filename):\n return True\n else:\n raise FileExistsError", "def is_file_exists(self):\n pass", "def validate_file_exists(filename):\n try:\n file = open(filename, \"r\")\n file.close()\n except IOError:\n p...
[ "0.81250226", "0.801535", "0.8012515", "0.79715765", "0.791677", "0.7829435", "0.78247803", "0.7813382", "0.7812089", "0.7812089", "0.77913696", "0.77477324", "0.7740215", "0.77300465", "0.77202404", "0.7717732", "0.77073765", "0.76988333", "0.76670444", "0.7647037", "0.76454...
0.74938667
31
Validates if given ADB bitrate is correct or not.
def adb_video_limit(given_limit): return given_limit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(video):\n return video.length != -1", "def validate(input):\n regex = re.compile(r'(UL)?\\d{1,' + re.escape(str(barcode_digit_length)) + '}$', flags=re.IGNORECASE)\n if regex.match(input):\n is_valid = True\n else:\n is_valid = False\n return is_valid", "def validateFo...
[ "0.55174804", "0.54642963", "0.5445135", "0.53527755", "0.53027385", "0.52211946", "0.5206416", "0.5174617", "0.51487523", "0.5126271", "0.51182705", "0.51049453", "0.5005415", "0.49875465", "0.4981704", "0.4973337", "0.495033", "0.49458855", "0.49274614", "0.49164766", "0.49...
0.0
-1
Generate a random string with the combination of lowercase and uppercase letters
def randomString(stringLength): symbols="!#$%&*?@" chars_allowed="" final_char_mix="" if("onlylower" in sys.argv): chars_allowed=string.ascii_lowercase else: chars_allowed=string.ascii_letters if("nosymbol" not in sys.argv): final_char_mix= chars_allowed+symbols; e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string(length=1, uppercase=False, lowercase=False):\n characters = digits\n code = str()\n\n if uppercase:\n characters += ascii_uppercase\n if lowercase:\n characters += ascii_lowercase\n\n while len(code) < length:\n character = choice(characters)\n if len(co...
[ "0.79476154", "0.77391785", "0.7680588", "0.7658086", "0.76103413", "0.752879", "0.75105095", "0.74913675", "0.7373961", "0.7372846", "0.73110056", "0.7271517", "0.7265145", "0.7246747", "0.72297484", "0.7197778", "0.7178096", "0.717765", "0.7168494", "0.71666646", "0.7165629...
0.7079744
37
Checks whether a string has numbers or letters.
def check_address_empty(address): return re.search('[a-zA-Z0-9]', address) # If number or letter exists, then at least one address field has been provided
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isAlphaNumeric(string):\n return (True)", "def alphanumeric(s: str) -> bool:\n return len(re.findall(r'[^A-Za-z0-9]', s)) == 0", "def is_letter(string_):\n if string_ not in string.ascii_letters or len(string_) > 1:\n return False\n return True", "def hasNumbers(inputString):\n return...
[ "0.8243477", "0.7757213", "0.75719815", "0.7537497", "0.7535774", "0.75231296", "0.7232919", "0.7226663", "0.71988374", "0.71583915", "0.7117124", "0.7073485", "0.70496655", "0.7028747", "0.69984823", "0.6997262", "0.6978403", "0.6962873", "0.69445205", "0.6938811", "0.693717...
0.0
-1
Creates a parent/child relation in the database.
def create_hierarchy(parent_path, child_path): if parent_path: parent_skill_id = database_controller.get_skill(parent_path).id child_skill_id = database_controller.get_skill(child_path).id new_hierarchy = Hierarchy(parent_skill_id=parent_skill_id, child_skill_id=child_skill_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_parent_child_relation(parent, child, relation_type, volume):\n rr = RecordRelationsParentChild()\n click.echo('Creating relations: {0} - {1}'.format(parent['pid'],\n child['pid']))\n rr.add(\n parent=parent,\n child=child,\n ...
[ "0.727176", "0.6639228", "0.6511371", "0.626259", "0.62460697", "0.6112094", "0.6086549", "0.6059214", "0.5871822", "0.5843188", "0.5779552", "0.5749226", "0.57240736", "0.5638246", "0.56082636", "0.55755395", "0.55712795", "0.5554237", "0.55324274", "0.5529303", "0.5505311",...
0.6088462
6
Gets Users object, given id of the user
def get_user_from_id(user_id): return Users.query.filter_by(id=user_id).first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]", "def get(id):\n return User.query.filter_by(id=id).first()", "def load_user(id):\n return Users.query.get(id)", "def get...
[ "0.8779749", "0.83585083", "0.822289", "0.8173856", "0.81693155", "0.80604845", "0.79971176", "0.79869205", "0.79842687", "0.7925498", "0.7846517", "0.7846517", "0.7846517", "0.7846517", "0.78368735", "0.7819745", "0.77926064", "0.7779953", "0.77797216", "0.77566826", "0.7755...
0.7846145
14
Takes a list of `Users` and converts them to `ProfileModel`s
def get_profile_models(users): profile_models = [] # iterate over the users for user in users: # gets the SkillModels of the user skill_models = database_controller.get_skills(user.username) # creates ProfileModel from username and list of SkillModel ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_profiles(self, params):\n return self.profiles", "def profiles():\n images = get_uploaded_images()\n records = db.session.query(UserProfile).all()\n return render_template('profiles.html', images=images, records =records)", "def list_to(self):\n qs = super(MigrateProfile, self)....
[ "0.5873556", "0.5811019", "0.580981", "0.57973635", "0.5732257", "0.5656988", "0.56169206", "0.56113976", "0.5596969", "0.5583577", "0.5578255", "0.5532246", "0.5505803", "0.54858834", "0.54853094", "0.54630697", "0.54360455", "0.5386984", "0.5321617", "0.52642417", "0.526338...
0.75204486
0
Takes a ProfileModel and a list of skillpaths and checks for the sum of the levels of corresponding skills. Used as a key for ordering search results.
def sum_relevant_skills(profile, skill_paths): rel_sum = 0 # look for every skill in list of skill paths for skill_path in skill_paths: for skill_model in profile.skills: if skill_model.skill_path.lower() == skill_path.lower(): rel_sum += skill_mod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(query):\n has_some = []\n # list of all users\n users = database_controller.get_all_users()\n # has_all starts off with every user, removes those who don't have one of the required skills\n has_all = users.copy()\n # iterate through every user and look up their ...
[ "0.55930096", "0.5148804", "0.5144777", "0.5058127", "0.5057765", "0.49606115", "0.48981452", "0.48834836", "0.48424393", "0.47602153", "0.47531292", "0.4727375", "0.4652321", "0.46334404", "0.46107352", "0.45984805", "0.45913628", "0.4589694", "0.45509657", "0.45504436", "0....
0.7638404
0
Resize image to match the given shape. A bilinear interpolation is used for resizing.
def resize(x, output_shape): if not _available: raise ValueError('cv2 is not installed on your environment, ' 'so nothing will be plotted at this time. ' 'Please install OpenCV.\n\n Under Anaconda ' ' environment, you can install it ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(img, shape, mode='constant', orig_shape=(155, 240, 240)):\n assert len(shape) == 3, \"Can not have more than 3 dimensions\"\n factors = (\n shape[0] / orig_shape[0],\n shape[1] / orig_shape[1],\n shape[2] / orig_shape[2]\n )\n\n # Resize to the given shape\n return zo...
[ "0.7953497", "0.7260338", "0.72600085", "0.7184659", "0.708315", "0.69229156", "0.6893204", "0.68926215", "0.68926215", "0.6874876", "0.6867922", "0.6847304", "0.6828275", "0.6809579", "0.68094295", "0.68004084", "0.6797732", "0.6780467", "0.6760277", "0.67247456", "0.6717196...
0.0
-1
Retrieves the clients list from samba
def _get_samba_clients(self): # TODO preferably use a library, don't assume localhost. logging.debug("inspecting samba...") command = 'sudo smbstatus -p | sed -n 5p | tr -s " " | cut -d" " -f4' output = utils.run_os_command(command) return output.strip().split("\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_list(self):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT * FROM CLIENT\"\"\")\r\n return cursor.fetchall()", "def clientlist(self) -> None:\n from bacommon.servermanager import ClientListCommand\n self._enqueue_server_command(ClientListCommand(...
[ "0.7487732", "0.719857", "0.7137713", "0.69747156", "0.69664335", "0.6604978", "0.6604978", "0.6563487", "0.65014094", "0.64407647", "0.6428513", "0.64033383", "0.6313856", "0.6263324", "0.6246961", "0.62337726", "0.62311494", "0.6202812", "0.6202548", "0.62021095", "0.620181...
0.7655905
0
Split dataset into train and test sets (sublists) based on a test set size.
def train_test_split(X, y, test_size=0.33, random_state=None, shuffle=True): if random_state is not None: random.seed(random_state) if shuffle: myutils.randomize_in_place(X, parallel_list=y) num_instances = len(X) if isinstance(test_size, float): test_size = math.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_dataset(self, test_size=0.20):\n\t\t(self.training_data, self.test_data, self.training_labels, self.test_labels) = train_test_split(self.training_data, self.training_labels, test_size=test_size)", "def split_data(dataset, test_size=0.5):\n shuffled_data = np.random.RandomState(seed=721).permutation(...
[ "0.8606726", "0.8337164", "0.82015276", "0.8159535", "0.7856308", "0.7855692", "0.78139555", "0.77506024", "0.77325463", "0.7729288", "0.767232", "0.7650368", "0.75894517", "0.7572302", "0.75486135", "0.7527101", "0.7507528", "0.75036293", "0.74679023", "0.7461673", "0.743368...
0.7133727
49
Add a rate parameter names source_name + "_rate_multiplier" to the likelihood function.. The values of this parameter will MULTIPLY the expected rate of events for the source. The rates of sources can also vary due to shape parameters.
def add_rate_parameter(self, source_name, log_prior=None): self.rate_parameters[source_name] = log_prior
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_samp_rate(self, *args, **kwargs):\n return _uhd_swig.usrp_source_set_samp_rate(self, *args, **kwargs)", "def set_samp_rate(self, *args, **kwargs):\n return _uhd_swig.usrp_source_sptr_set_samp_rate(self, *args, **kwargs)", "def add_rate_uncertainty(self, source_name, fractional_uncertainty...
[ "0.6405935", "0.59060144", "0.5845224", "0.57820135", "0.5649823", "0.5517799", "0.550522", "0.5408946", "0.5400886", "0.5353125", "0.53267485", "0.53233707", "0.5310702", "0.53073066", "0.5293416", "0.5276952", "0.5274179", "0.52601314", "0.52576244", "0.52510154", "0.521648...
0.7664521
0
Adds a shape parameter to the likelihood function, with Gaussian prior around the default value.
def add_shape_uncertainty(self, setting_name, fractional_uncertainty, anchor_zs=(-2, -1, 0, 1, 2), base_value=None): # Call add_shape_parameter without a prior first, then inject the prior later. # It's a bit of a hack, but there is some validation / default-setting code for base_value we don't want to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GaussianPrior(shape, fit_mean, fit_var, name='GaussianPrior'):\n units = shape[1]\n\n def instantiate(z):\n if fit_mean:\n # (B, M, dz)\n zero_mean = layers.Lambda(lambda t: K.zeros_like(t) + 0.001,\n output_shape=shape,\n ...
[ "0.63119084", "0.5846583", "0.5792739", "0.57768315", "0.5588442", "0.5461596", "0.5376964", "0.53341377", "0.52759147", "0.52588916", "0.52504516", "0.5230208", "0.5208885", "0.5193517", "0.51928234", "0.5179233", "0.5179233", "0.5179233", "0.51752466", "0.51703197", "0.5164...
0.5380459
6
Shows information about the current guild.
async def server(self, ctx): created = ctx.guild.created_at created = created.strftime('%a %b %d %Y at %I:%M %p') created1 = datetime.strptime(created, '%a %b %d %Y at %I:%M %p') created1 = relativedelta(created1, datetime.utcnow()) channels = len(ctx.guild.channels) em...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def server_info(self, ctx):\n guild = ctx.guild\n id = guild.id\n boost_count = guild.premium_subscription_count\n region = str(guild.region)\n channels = len(guild.channels)\n vc = len(guild.voice_channels)\n text_channels = len(guild.text_channels)\n ...
[ "0.72720075", "0.7151705", "0.7101078", "0.70837516", "0.7072103", "0.6987756", "0.6968286", "0.69477713", "0.69180405", "0.6845922", "0.68390226", "0.6799237", "0.67586267", "0.672205", "0.66088957", "0.6591235", "0.65743196", "0.6568158", "0.65651506", "0.6563881", "0.65606...
0.6066025
36
Shows the avatar of the mentioned user.
async def avatar(self, ctx, user: discord.Member = None): if user is None: user = ctx.author avatar = user.avatar_url_as(static_format='png', size=1024) embed = discord.Embed(color=self.bot.embed_color) embed.set_author(name=f"{user}'s avatar", icon_url=avatar) emb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def avatar(self, ctx, *, member: disnake.Member = None):\n if member is None:\n member = ctx.author\n await ctx.send(member.display_avatar.url)", "async def avatar(self, ctx, user: discord.User = None):\n if user is None:\n user = ctx.author\n avatar = user...
[ "0.77440083", "0.7552449", "0.7500849", "0.7481652", "0.7424725", "0.74126095", "0.7402198", "0.73649114", "0.7171719", "0.7034651", "0.68934387", "0.6856163", "0.6789102", "0.67856646", "0.67298824", "0.66623604", "0.65778744", "0.6469675", "0.6442003", "0.64376867", "0.6423...
0.7308232
8
True iff triangle abc is counterclockwise
def is_ccw(a, b, c): p = b - a q = c - a area = p.x * q.y - q.x * p.y # May want to throw an exception if area == 0 return area > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isclockwise(self):\n s = sum((seg[1][0] - seg[0][0]) * (seg[1][1] + seg[0][1])\n for seg in self.segment_tuples)\n return s > 0", "def is_triangle(a, b, c):\n a, b, c = sorted([a, b, c])\n return True if a > abs(b - c) and a < (b + c) else False", "def is_clockwis...
[ "0.7610783", "0.74833363", "0.74156165", "0.7167028", "0.7089694", "0.7089694", "0.6931784", "0.6843787", "0.67656064", "0.6741302", "0.6705305", "0.6668621", "0.65707225", "0.65638405", "0.64989984", "0.6447921", "0.6405516", "0.63942707", "0.6367579", "0.62225384", "0.62088...
0.72346896
3
1. Remove punc 2. Remove stop words 3. Return list of clean text words
def text_process(mess): nopunc= [char for char in mess if char not in string.punctuation] nopunc=''.join(nopunc) return [word for word in nopunc.split() if word.lower() not in stopwords.words('english') and len(word)>2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processText(text):\n\n no_punc = [word for word in text.split() if word.isalpha()] # and word not in stopwords.words('english')]\n #removes non-letter characters and only includes words not included in stopwords\n no_punc = \" \".join(no_punc) \n clean_words = nltk.word_tokenize(no_punc) #splits t...
[ "0.8581471", "0.81725335", "0.8148157", "0.8145557", "0.8123101", "0.7994653", "0.79781365", "0.7969293", "0.79102516", "0.78597337", "0.78296715", "0.7808968", "0.7807197", "0.77931356", "0.7773359", "0.77686226", "0.7747774", "0.77133286", "0.77133286", "0.77133286", "0.771...
0.79306465
8
Opens the tree view of Invoices.
def open_invoices(self): return { 'domain': "[('id', 'in', " + str(self.invoice_ids.ids) + " )]", 'name': 'Invoices', 'view_mode': 'tree,form', 'res_model': 'account.move', 'type': 'ir.actions.act_window', }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_invoice(self, cr, uid, ids, context=None):\n if context is None:\n context = {}\n mod_obj = self.pool.get('ir.model.data')\n for advance_pay in self.browse(cr, uid, ids, context=context):\n form_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supp...
[ "0.711692", "0.6486356", "0.5976821", "0.5902836", "0.579003", "0.57529277", "0.5566393", "0.55498576", "0.5519628", "0.5500557", "0.5479644", "0.54782456", "0.54366016", "0.53994286", "0.53791326", "0.5370473", "0.5346116", "0.5237616", "0.52264035", "0.5200993", "0.5156033"...
0.72879493
0
Computes the dot product of v1 and v2
def dot_product(v1, v2): #print(v1, v2) sum = 0 for i in range(len(v1)): #print(v1[i], v2[i]) sum += v1[i] * v2[i] return sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotProduct(v1, v2):\n n1 = normalize(v1)\n n2 = normalize(v2)\n return n1[0] * n2[0] + n1[1] * n2[1] + n1[2] * n2[2]", "def dot_product(v1, v2):\n return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]", "def dot_product(v1, v2):\n return v1[0] * v2[0] + v1[1] * v2[1]", "def dotProduct(v1, v2):\n ...
[ "0.9146861", "0.89656043", "0.8939553", "0.89197075", "0.8891167", "0.8458794", "0.8448753", "0.84123284", "0.8348313", "0.8326295", "0.82441646", "0.8225435", "0.8112416", "0.8092164", "0.8033246", "0.80259407", "0.80184", "0.79506934", "0.7913882", "0.7907049", "0.78919226"...
0.81787544
12
Logistic / sigmoid function
def logistic(x): try: denom = (1 + math.e ** -x) except OverflowError: return 0.0 return 1.0 / denom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + math.exp(-x))", "def sigmoid(x):\n return 1.0/(1.0+exp(-x))", "def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", "d...
[ "0.8515589", "0.8515589", "0.84908247", "0.8464301", "0.8463506", "0.8446034", "0.84339756", "0.8418244", "0.8416246", "0.8416246", "0.8398559", "0.8398559", "0.8398559", "0.8398559", "0.8398559", "0.8398559", "0.8384881", "0.8383032", "0.8376922", "0.83710796", "0.8370056", ...
0.0
-1
Initializes matrix of weights and biases self.weights a dictionary where each layer j maps to a size ixj matrix
def create_params(self, layer_sizes): weights = [[None]] bias = [] bias.append([1] * layer_sizes[0]) for layer in range(1, len(layer_sizes)): weights.append(numpy.random.rand(layer_sizes[layer-1], layer_sizes[layer])) bias.append([0] * layer_sizes[layer]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_matrix(self):\n\n try:\n # Grab the weight matrix from weight_matrices.py\n tmp_weight_matrix = copy.copy(weight_matrices.__dict__[self._weight_matrix_name])\n except KeyError:\n\n # Treat this name as a file\n data = open(self._weight_matri...
[ "0.74495703", "0.737873", "0.7342981", "0.73123944", "0.72205836", "0.7079782", "0.7074431", "0.7074431", "0.7074431", "0.7064074", "0.7040137", "0.7037429", "0.7027251", "0.701833", "0.7001828", "0.7001634", "0.6970096", "0.6914572", "0.6892995", "0.68780696", "0.68658906", ...
0.0
-1
takes an error matrix and a layer, returns the individual errors of the node in the preceding layer based on the weights.
def node_layer_error(self, errors, layer): weights = self.weights[layer] node_errors = [] for i, input in enumerate(self.input_matrix[layer-1]): node_errors.append(float(log_deriv(input) * dot_product(weights[i], errors))) return node_errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backprop_error(self,t=0, external_error=0):\n\t\taux = external_error\n\t\t# Other layers' contributions\n\t\tif t != 0:\n\t\t\tfor layer in self.next_recurrent:\n\t\t\t\taux += layer.get_error_contribution(self, t=t+1)\n\t\tfor layer in self.next:\n\t\t\taux += layer.get_error_contribution(self, t=t)\n\n\t\ti...
[ "0.63156897", "0.6257517", "0.59837484", "0.59098774", "0.584947", "0.5719502", "0.5716888", "0.5716773", "0.5702195", "0.55608886", "0.548", "0.54583067", "0.54363763", "0.54083955", "0.54007465", "0.5379464", "0.53708035", "0.5368533", "0.5345358", "0.5312313", "0.5310901",...
0.79019064
0
Create the api and authenticator objects.
async def async_setup(self, conf): if conf.get(VERIFICATION_CODE_KEY): return self._access_token_cache_file = conf.get( CONF_ACCESS_TOKEN_CACHE_FILE, f".{conf[CONF_USERNAME]}{DEFAULT_AUGUST_CONFIG_FILE}", ) self._config = conf self._api = Api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.api = Api(consumer_key=credentials[\"consumer_key\"],\n consumer_secret=credentials[\"consumer_secret\"],\n access_token_key=credentials[\"access_token_key\"],\n access_token_secret=credentials[\"access_token_secret...
[ "0.66780365", "0.6645443", "0.6397644", "0.6388884", "0.633235", "0.6326718", "0.624818", "0.6222473", "0.61881906", "0.6158173", "0.6120532", "0.6110127", "0.60853136", "0.60724443", "0.6064991", "0.6060397", "0.6057882", "0.60202724", "0.600326", "0.59973305", "0.59905744",...
0.6010488
18
Check whether an action had an associated faction.
def _get_faction(text): for faction in _FACTIONS: if faction in text: return faction return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_action(self, action):\n\n return hasattr(self, self._action_handler_name(action))", "def is_valid_action(self, action):\n if self.board[action[0]][action[1]] == None:\n return True\n \n return False", "def has(self, ActionClass):\n for action in self.h:\n...
[ "0.6802109", "0.6584824", "0.6345662", "0.6176071", "0.5996063", "0.5974518", "0.59714603", "0.59099567", "0.57944673", "0.5789518", "0.5746428", "0.57446367", "0.5738184", "0.5721567", "0.5682417", "0.5665316", "0.56606245", "0.5640808", "0.56190777", "0.5613474", "0.5590448...
0.5028373
57
Evaluates the Interval to the power of n, based on some rules provided
def __pow__(self, n): # We are given 1 option for odd n if n >= 1 and (n % 2) != 0: return Interval(self.left**n, self.right**n) # and 3 for even n elif n > 0 and (n % 2) == 0: # a >= 0 if self.left >= 0: return Interval(self.left**n, s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power", "def _pow_(self, n):\n assert n > 0\n return generic_power(self, n)", "def power(x, n):\n if n == 0:\n return 1\n result = power(x, math.floor(n / 2))\n if...
[ "0.72425", "0.709204", "0.7003416", "0.6994898", "0.6925305", "0.6813599", "0.68055737", "0.67978084", "0.6785114", "0.6766115", "0.67495096", "0.6682384", "0.66654557", "0.66620886", "0.6640547", "0.6640547", "0.662766", "0.66202223", "0.6599868", "0.6570302", "0.6565152", ...
0.8090334
0
Verifica si un numero previamente premiado ha incrementado su premio. Devuelve True si hay incremento sobre un premio ya informado. False en caso contrario.
def verifica_incremento(numero, premio): # Se comprueba si ya ha sido premiado previamente para no avisar de nuevo, pero antes se mira si se ha incrementado el premio. if numero in premiados.keys(): if premiados[numero] < premio: # Premio mayor que el guardado. print(LITERAL_TOC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_prev(self):\n return self.page > 1", "def has_prev(self):\n return self.page > 1", "def is_incr(self, idx) -> bool:\n return False", "def is_incr(self, idx):\n return self.args[0].is_positive()", "def is_incr(self, idx):\n return False", "def is_incr(self, idx):...
[ "0.6546479", "0.6546479", "0.6348991", "0.6322084", "0.6320673", "0.6320673", "0.6320673", "0.62667453", "0.6232614", "0.6078803", "0.6061329", "0.597883", "0.59470063", "0.5875424", "0.5801918", "0.5653601", "0.5653601", "0.5653601", "0.5555568", "0.5516738", "0.5476474", ...
0.80478257
0
Set the ID in the new document with the updated ID
def setID(id, content): return content.replace("$ID", str(id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetId(self, new_id):\r\n\r\n self.id = new_id", "def update_id(self, field='name'):\n\n if self.verbose:\n click.echo('Updating ID')\n if field not in self.data:\n print_error(f'Missing {field} field in file {self.source_file} - add this field manually')\n ...
[ "0.7223816", "0.68603384", "0.68397456", "0.67639816", "0.6696392", "0.6696392", "0.6696392", "0.6696392", "0.6696392", "0.6687556", "0.6670801", "0.66359824", "0.66359824", "0.66359824", "0.66359824", "0.66359824", "0.66359824", "0.66359824", "0.66359824", "0.66359824", "0.6...
0.0
-1
Convert from Euler angles to pose's orientation (quaternion)
def euler_to_quat(roll, pitch, yaw): pose = Pose() quaternion = tf.transformations.quaternion_from_euler(roll, pitch, yaw) pose.orientation.x = quaternion[0] pose.orientation.y = quaternion[1] pose.orientation.z = quaternion[2] pose.orientation.w = quaternion[3] return pose.orientation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euler_to_quaternion(euler: tuple) -> object:\n\n (yaw, pitch, roll) = (euler[0], euler[1], euler[2])\n qy = np.sin(roll / 2) * np.cos(pitch / 2) * np.cos(yaw / 2) - np.cos(roll / 2) * np.sin(pitch / 2) * np.sin(yaw / 2)\n qx = np.cos(roll / 2) * np.sin(pitch / 2) * np.cos(yaw / 2) + np.sin(roll / 2) *...
[ "0.7716793", "0.7675402", "0.76656246", "0.7630826", "0.73898655", "0.73428357", "0.73076576", "0.72086555", "0.7201879", "0.7146299", "0.71291596", "0.71251535", "0.7056123", "0.70338565", "0.6970747", "0.6889485", "0.6875701", "0.68428713", "0.6842132", "0.6798497", "0.6798...
0.82313824
0
Helper function to assign pose's orientation according to quaterion in list form.
def give_orientation(pose, orr_array): pose.orientation.x = orr_array[0] pose.orientation.y = orr_array[1] pose.orientation.z = orr_array[2] pose.orientation.w = orr_array[3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformat_pose_to_dict(self, now_pose):\n # now_pose è un dict in particolare { pose : [ {position : [{x : value , y:value , z:value} ] } , {orientation : [] } }\n # devo convertire i quaternioni in amgoli di eulero...estrarre i quaternioni da pose_now e convertirli in angoli RPY\n\n lato_c...
[ "0.60361046", "0.5982259", "0.5908801", "0.5787259", "0.5771794", "0.5737287", "0.5693343", "0.5658342", "0.56019497", "0.56019497", "0.5593034", "0.55820554", "0.5557277", "0.55565345", "0.5547485", "0.554395", "0.55262035", "0.548297", "0.54825646", "0.54807514", "0.5442158...
0.66434866
0
Converts the provided string into camel case
def to_camel_case(string: str): return "".join( word.title() if idx > 0 else word for idx, word in enumerate(string.split("_")) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camel(s):\n return s[0].upper() + s[1:]", "def to_camel(string, capitalize):\n\n ret = string.lower()\n words = re.split(\"[\\s_]\", ret)\n words = list(map(lambda x: x.capitalize(), words))\n if not capitalize:\n words[0] = words[0].lower()\n return \"\".join(words)", "def snake_t...
[ "0.8393052", "0.82150733", "0.8171326", "0.8133403", "0.8088697", "0.8019505", "0.8014874", "0.8008397", "0.7981959", "0.7952406", "0.7948592", "0.7920694", "0.7904639", "0.78928894", "0.7876539", "0.775117", "0.772237", "0.7704707", "0.7684524", "0.76456", "0.75734717", "0...
0.80613923
5
Generate ngrams from an iterable l = range(5) list(ngrams(l)) > [(0,), (1,), (2,), (3,), (4,)] list(ngrams(l, 2)) > [(0, 1), (1, 2), (2, 3), (3, 4)] list(ngrams(l, 3)) > [(0, 1, 2), (1, 2, 3), (2, 3, 4)]
def ngrams(iterable, n=1): return zip(*(iterable[i:] for i in range(n)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ngrams(word_list, n):\n yield zip(*[word_list[i:] for i in range(n)])", "def generate_ngrams(iterable, n):\n return zip(*[itertools.islice(it, i, None) for i, it in enumerate(itertools.tee(iterable, n))])", "def n_gram(list, n):\n ngrams = zip(*[list[i:] for i in range(n)])\n return ...
[ "0.8114929", "0.8107826", "0.79146713", "0.7791096", "0.77816623", "0.7760309", "0.7717857", "0.7651586", "0.75992054", "0.75757325", "0.7519746", "0.74806225", "0.7425707", "0.74204004", "0.74161285", "0.7402985", "0.73509467", "0.7329913", "0.7321288", "0.73070914", "0.7284...
0.78738594
3
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(y_true, y_pred, classes, normalize=False, title=None, cmap=plt.cm.Blues): if not title: if normalize: title = 'Normalized confusion matrix' else: title = 'Confusion matrix, without normalization' # Compute confusion matrix cm = confu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81920755", "0.8093736", "0.8028212", "0.8017333", "0.79923165", "0.7989431", "0.79789335", "0.7974398", "0.795948", "0.79555666", "0.7935652", "0.7932704", "0.7932632", "0.7929465", "0.7924336", "0.7922666", "0.79221356", "0.7921299", "0.79209703", "0.7920307", "0.7916008"...
0.0
-1
Get the last broadcasted state from the /mavros/state topic
def current_state(): global current_state while current_state is None: pass return current_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_state_data(self):\n if not self.state_list:\n return None\n if not self.state_list[-1]:\n return None\n return self.state_list[-1]", "def last_state(self):\n return self._simstate", "def _get_state(self):\n # gst's get_state function returns a...
[ "0.6417554", "0.62642854", "0.6139529", "0.6015026", "0.6008578", "0.59739655", "0.5973244", "0.5938572", "0.59256697", "0.58885914", "0.58385104", "0.58385104", "0.5825541", "0.5800791", "0.57872146", "0.57858175", "0.5777898", "0.5752066", "0.5733361", "0.57307214", "0.5702...
0.0
-1
Apply histogram equalization to an input frame, threshold it and return the (binary_image_array) result.
def get_binary_image_array_from_equalized_grayscale(frame): eq_global = cv2.equalizeHist(frame.gray) #_, th = cv2.threshold(eq_global, thresh=240, maxval=255, type=cv2.THRESH_BINARY) _, th = cv2.threshold(eq_global, thresh=240, maxval=255, type=cv2.THRESH_TOZERO) return th
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def histograma(frame):\n #Imagen mejorada por Equalizacion de Histogramas.\n histograma = cv2.equalizeHist(frame)\n return histograma", "def thresholdImage(frame, binarizationThreshold=30):\n return cv2.threshold(frame, binarizationThreshold, 255, cv2.THRESH_BINARY)[1]", "def histogram_equalize(im_...
[ "0.7274848", "0.70589155", "0.6838287", "0.66614676", "0.6572216", "0.65297306", "0.6498808", "0.64899945", "0.6463982", "0.64587957", "0.6425696", "0.6424768", "0.640547", "0.6374837", "0.6334242", "0.6324775", "0.6276884", "0.6257229", "0.62504154", "0.62375546", "0.6179145...
0.79449207
0
Array of species molar masses [kg/kmol].
def molarMasses(self, species = None): mm = _cantera.phase_getarray(self._phase_id,22) return self.selectSpecies(mm, species)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mol_masses(mol):\n return np.array([a.GetMass() for a in mol.GetAtoms()])", "def getMasses(self):\n try:\n return self._massList\n except AttributeError:\n self._massList = [float(x) for x in self._raw_data['MASS']]\n return self._massList", "def list_m...
[ "0.77033025", "0.7010884", "0.6967567", "0.6662244", "0.6612066", "0.652884", "0.6185853", "0.6109096", "0.6049422", "0.6046375", "0.59868944", "0.5983297", "0.5859888", "0.5834788", "0.58251154", "0.58115196", "0.57832134", "0.5771419", "0.57619977", "0.57262677", "0.5725522...
0.7331622
1
Array of species molar masses [kg/kmol].
def molecularWeights(self, species = None): return self.molarMasses(species)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mol_masses(mol):\n return np.array([a.GetMass() for a in mol.GetAtoms()])", "def molarMasses(self, species = None):\n mm = _cantera.phase_getarray(self._phase_id,22)\n return self.selectSpecies(mm, species)", "def getMasses(self):\n try:\n return self._massList\n ...
[ "0.77033025", "0.7331622", "0.7010884", "0.6967567", "0.6662244", "0.6612066", "0.652884", "0.6185853", "0.6109096", "0.6049422", "0.6046375", "0.59868944", "0.5983297", "0.5859888", "0.5834788", "0.58251154", "0.58115196", "0.57832134", "0.5771419", "0.57619977", "0.57262677...
0.5464818
42
Mole fraction of a species, referenced by name or index number. >>> ph.moleFraction(4) >>> ph.moleFraction('CH4')
def moleFraction(self, species): k = self.speciesIndex(species) return _cantera.phase_molefraction(self._phase_id,k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moleFraction(self, s): \n if type(s) == types.StringType:\n kk = self._contents.speciesIndex(s)\n else:\n kk = s\n x = self.moleFractions()\n return x[kk]", "def moleFractions(self, species = None):\n x = _cantera.phase_getarray(self._phase_id,2...
[ "0.80913675", "0.70740086", "0.68286306", "0.6639602", "0.6633551", "0.6337102", "0.5858942", "0.5850405", "0.5636429", "0.55042446", "0.5472932", "0.5384408", "0.5356524", "0.53066105", "0.5292259", "0.5236752", "0.51733166", "0.51559746", "0.5136899", "0.5134771", "0.513313...
0.7754062
1
Species mass fraction array. If optional argument species is supplied, then only the values for the selected species are returned. >>> y1 = ph.massFractions() all species >>> y2 = ph.massFractions(['OH', 'CH3'. 'O2'])
def massFractions(self, species = None): y = _cantera.phase_getarray(self._phase_id,21) return self.selectSpecies(y, species)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def massFractions(self):\n nsp = self._contents.nSpecies()\n y = zeros(nsp,'d')\n for k in range(nsp):\n y[k] = self.massFraction(k)\n return y", "def massFraction(self, species):\n k = self.speciesIndex(species)\n return _cantera.phase_massfraction(self._phas...
[ "0.768643", "0.7121507", "0.700465", "0.6576287", "0.6432377", "0.57874465", "0.56374764", "0.5481158", "0.538975", "0.53418016", "0.5316373", "0.53144085", "0.5270862", "0.52437854", "0.52242243", "0.5200321", "0.5193363", "0.5179203", "0.51119214", "0.5103088", "0.5071522",...
0.8189515
0
Mass fraction of one species, referenced by name or index number. >>> ph.massFraction(4) >>> ph.massFraction('CH4')
def massFraction(self, species): k = self.speciesIndex(species) return _cantera.phase_massfraction(self._phase_id,k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def massFraction(self, s):\n if type(s) == types.StringType:\n kk = self._contents.speciesIndex(s)\n else:\n kk = s\n return _cantera.reactor_massFraction(self.__reactor_id, kk)", "def massFractions(self, species = None):\n y = _cantera.phase_getarray(self._phase...
[ "0.8143933", "0.7273333", "0.6898319", "0.6713574", "0.666651", "0.6622478", "0.63634455", "0.6115404", "0.6112987", "0.6078885", "0.60731626", "0.6020887", "0.6008939", "0.5954976", "0.59517664", "0.5927389", "0.5915098", "0.5908623", "0.5904089", "0.5900988", "0.58879167", ...
0.79167795
1
Given an array f of floatingpoint element properties, return a those values corresponding to elements listed in elements. Returns an array if elements is a sequence, or a scalar if elements is a scalar. >>> f = ph.elementPotentials() >>> lam_o, lam_h = ph.selectElements(f, ['O', 'H']) >>> lam_h = ph.selectElements(f, '...
def selectElements(self, f, elements): if isinstance(elements, types.StringTypes): m = self.elementIndex(elements) return f[m] if elements: fs = [] k = 0 for s in elements: k = self.elementIndex(s) fs.append(f[k]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements(xpath_selection):\n driver = Driver().connect()\n return driver.find_elements_by_xpath(xpath_selection)", "def _pick_elements(self,regexp_ind,array_list):\r\n new_array_list = [] #New list with elements matching regexp_ind\r\n array_indices = [] #Indices that matches the arrays i...
[ "0.52432096", "0.518182", "0.4885145", "0.48468608", "0.48123518", "0.48107567", "0.47828904", "0.47817177", "0.47577536", "0.4753989", "0.47314376", "0.47000527", "0.46615222", "0.46554", "0.46544898", "0.45862788", "0.45752892", "0.45678526", "0.45643702", "0.4563339", "0.4...
0.7426283
0
Computes analytic GP upper confidence bound.
def __call__(self, **kwargs): stddev = self.predictive_distribution.stddev(**kwargs) mean = self.predictive_distribution.mean(**kwargs) return normal_upper_confidence_bound( mean, stddev, exploration=self.exploration)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upper_bound(self) -> float:\n ...", "def upper_confidence(self, X):\n x = np.asarray(X).reshape(1, -1)\n mu, sigma = self.gpr.predict(x, return_std=True)\n\n return mu - self.beta * sigma", "def get_upper_bound(self):\n return self._upper_bound", "def best_upper_bound(self)...
[ "0.6975499", "0.6713523", "0.61821425", "0.6160476", "0.61156183", "0.6087567", "0.6075567", "0.59776247", "0.59265476", "0.5905964", "0.58638215", "0.5863536", "0.58501583", "0.5828992", "0.5805245", "0.5803856", "0.5790083", "0.5782733", "0.57269305", "0.5709188", "0.568294...
0.59057575
10