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
Get a `output_classes`depth kernel from the original 1000depth kernel trained on ImageNet.
def get_fully_compressed_as_CNN(self, name, bottom, uncompressed_kernel_size, output_classes=20): bottom_shape = bottom.get_shape().as_list() fc_weights = self.weights_dict[name][self.weights_idx] # reshape from [4096, 1000] to [1, 1, 4096, 1000] fc_as_cnn_weights = fc_weights.resh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def res_net_50(input_shape, n_classes):\n input_tensor = keras.layers.Input(shape=input_shape)\n\n x = keras.layers.ZeroPadding2D((3, 3))(input_tensor)\n x = keras.layers.Conv2D(64, (7, 7), strides=(2, 2), name='conv1')(x)\n x = keras.layers.BatchNormalization(axis=3, name='bn_conv1')(x)\n x = keras...
[ "0.5965672", "0.5751908", "0.5742828", "0.5687017", "0.56310123", "0.56194115", "0.55910593", "0.5580251", "0.5560072", "0.55526817", "0.55369925", "0.5525033", "0.5519152", "0.55126184", "0.54980725", "0.5485916", "0.54798704", "0.5470755", "0.54332143", "0.5420688", "0.5410...
0.527632
49
pad the input feature map independently of input size.
def _fixed_padding(inputs, kernel_size, mode='CONSTANT'): total_padding = kernel_size - 1 padding_begin = total_padding // 2 padding_end = total_padding - padding_begin return tf.pad(inputs, [[0, 0], [padding_begin, padding_end], [padding_begin, padding_end], [0, 0]], mode)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pad_feature(self):\n # Check no padding for context features\n feature_tensor = self.parser.pad_feature(tf.zeros((10)),\n self.feature_config.get_feature(\"query_text\"))\n assert feature_tensor.shape == (10,)\n\n # Check padding ...
[ "0.66310126", "0.62977844", "0.6225284", "0.62008524", "0.61488193", "0.60981274", "0.6066242", "0.60619754", "0.6040747", "0.6030055", "0.6019648", "0.5996635", "0.59745073", "0.59507495", "0.5950446", "0.59259564", "0.58835685", "0.5880143", "0.5875958", "0.58160895", "0.58...
0.61553085
4
Return the colun having the name specified by the "column" argument
def get(self, column): return self._data[column]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column(self, column):\n if \"(\" in str(column):\n temp_list = column.split(\"(\")\n key = temp_list[1].strip(\"()\")\n func = temp_list[0].lower()\n else:\n key = column\n func = None\n\n if \".\" not in key:\n for i in...
[ "0.7644572", "0.7451816", "0.7428286", "0.7418211", "0.7392375", "0.7372747", "0.72928524", "0.7264056", "0.7232212", "0.7215366", "0.7168452", "0.7141458", "0.7116429", "0.70371276", "0.70183516", "0.701144", "0.70068914", "0.70038295", "0.69624186", "0.69507354", "0.6943096...
0.6299756
78
Return the internal state for backup
def getState(self): print("Saving telemetry") copyfile(self.dump_file_path, "./metrics_backup.csv") return { "dump_file_path": self.dump_file_path, "backup_path": "./metrics_backup.csv" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive_backup(self):\n return self._archive_backup", "def __getstate__ (self):\n dump_stuff = self.__dict__\n #del dump_stuff['hdulist'] # if I keep self.hdulist I have to figure out something to do with this\n return dump_stuff", "def __getstate__(self):\r\n state = {}\...
[ "0.7179254", "0.71040046", "0.68924606", "0.68270725", "0.681489", "0.6782606", "0.6782149", "0.6706496", "0.6695261", "0.6685849", "0.665693", "0.66408503", "0.661918", "0.66151154", "0.66151154", "0.66151154", "0.66151154", "0.66151154", "0.66151154", "0.66151154", "0.66151...
0.0
-1
Log Errors caused by Updates.
def error(update, context): logger.warning('Update "%s" caused error "%s"', update, context.error)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)", "def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)", "def error(self, update, context):\n self.logger.warning('Update \"%s\" caused error \"...
[ "0.7894918", "0.7894918", "0.7824726", "0.77865386", "0.77847004", "0.77847004", "0.77348727", "0.7719687", "0.77089363", "0.7704042", "0.7657734", "0.76541996", "0.7650504", "0.76456845", "0.76366454", "0.7611564", "0.75665796", "0.75659215", "0.7552477", "0.75404334", "0.75...
0.7746143
30
Verifies that a checkout request with a malformed token returns a 400.
def test_file_get_invalid_token(self): tempdir = tempfile.gettempdir() self._test_file_get_invalid_token(Replica.aws, "s3", self.s3_test_bucket, S3Uploader(tempdir, self.s3_test_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_request_parsing_error(error, req, schema, status_code, headers):\n abort(422, errors=error.messages)", "def assertBadRequest(self, response):\n return self.assertStatusCode(response, 400)", "def test_invalid_credit_card_number(self):\n testcase = {\n \"credit_card_number\...
[ "0.6251675", "0.6170594", "0.61188495", "0.60995805", "0.59606844", "0.59480184", "0.59441924", "0.5931591", "0.59137386", "0.5903135", "0.58731806", "0.5867714", "0.5864017", "0.58618975", "0.5852542", "0.5818231", "0.5814187", "0.5805276", "0.5795988", "0.5763655", "0.57630...
0.0
-1
Do not return anything, modify board inplace instead.
def solve(self, board: List[List[str]]) -> None: print("BFS") if len(board) == 0 or len(board[0]) == 0: return M, N = len(board), len(board[0]) #self.printBoard(board) # 1. Find the "O" which can't be flips and set them to "T" for i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def board_copy(board):\n return board.copy()", "def move(board, row, col, char):\n board_copy = copy.deepcopy(board)\n board_copy[row][col] = char\n return board_copy", "def _update_board(board, position, player):\n board = board.copy()\n board[position[0], position[1], player] = 1\n retur...
[ "0.71159256", "0.7085941", "0.6954577", "0.68043697", "0.67718863", "0.6752613", "0.67428917", "0.6735564", "0.6706817", "0.6694613", "0.6693218", "0.6651022", "0.66255426", "0.6608803", "0.6607113", "0.6582967", "0.6532868", "0.6518662", "0.6491719", "0.6445777", "0.64423895...
0.0
-1
Do not return anything, modify board inplace instead.
def solve1(self, board: List[List[str]]) -> None: print("DFS") if len(board) == 0 or len(board[0]) == 0: return M, N = len(board), len(board[0]) #self.printBoard(board) # 1. Find the "O" which can't be flips and set them to "T" for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def board_copy(board):\n return board.copy()", "def move(board, row, col, char):\n board_copy = copy.deepcopy(board)\n board_copy[row][col] = char\n return board_copy", "def _update_board(board, position, player):\n board = board.copy()\n board[position[0], position[1], player] = 1\n retur...
[ "0.71159256", "0.7085941", "0.6954577", "0.68043697", "0.67718863", "0.6752613", "0.67428917", "0.6735564", "0.6706817", "0.6694613", "0.6693218", "0.6651022", "0.66255426", "0.6608803", "0.6607113", "0.6582967", "0.6532868", "0.6518662", "0.6491719", "0.6445777", "0.64423895...
0.0
-1
! Adjust the bounding box points according to the blur applied.
def motion_distortion_aabb(shape, kernel, aabb): # Get number of image rows and cols rows = shape[0] # y-axis in OpenCV cols = shape[1] # x-axis in OpenCV # Get point values x1, y1, x2, y2 = aabb # Find the value to adjust bboxes k_delta = (kernel.shape[0]-1)/4 # Adjust points aabb ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_bounding_box(self):\n self.boundingBox = BBox.from_points(self.points)\n if self._canvas:\n self._canvas.boundingBoxDirty = True", "def updateBoundingBox(self):\n # Just to make sure that no point of gate regions is \n # at the border\n a = self.hp.a\n ...
[ "0.66764235", "0.6673504", "0.64809406", "0.64044124", "0.6320059", "0.6273806", "0.61920863", "0.6128515", "0.6076739", "0.60215735", "0.5985173", "0.59585905", "0.59337384", "0.5901248", "0.5895547", "0.5894155", "0.58795154", "0.5872284", "0.58528996", "0.5846777", "0.5809...
0.0
-1
! Construct a random vector between min and max.
def _random_vector(min, max, prng=DEFAULT_PRNG): min = np.array(min) max = np.array(max) assert min.shape == max.shape assert len(min.shape) == 1 return prng.uniform(min, max)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_vector(dim=2, v_min=-1, v_max=1):\n from random import uniform\n v = vector(*[uniform(v_min, v_max) for _ in range(dim)])\n return v", "def makeRandom(cls, m, min=0, max=1):\n Vector.validate_dimension(m)\n data = [randrange(min, max) for i in range(m)]\n return Vector(m,...
[ "0.8199811", "0.7825094", "0.7639015", "0.747355", "0.74691576", "0.73991203", "0.73489636", "0.7254303", "0.7099014", "0.70928603", "0.7061235", "0.69932705", "0.698526", "0.6978921", "0.6968641", "0.6967309", "0.6944155", "0.66877604", "0.66831326", "0.66553664", "0.6627688...
0.86911744
0
! Construct a random rotation between max and max.
def random_rotation(min, max, prng=DEFAULT_PRNG): return rotation(prng.uniform(min, max))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_rotation():\n return orthogonalization(np.random.rand(9).reshape(3,3))", "def random_angle(min_angle=0, max_angle=None):\n from math import pi\n from random import uniform\n if max_angle is None: max_angle = pi\n return uniform(0, max_angle)", "def random_transform(min_rotation=0,\n ...
[ "0.72112924", "0.6899688", "0.68614835", "0.67195576", "0.67159146", "0.6625804", "0.6622924", "0.65523773", "0.65344465", "0.64992607", "0.6498859", "0.6273998", "0.6269812", "0.6195717", "0.6174846", "0.61146724", "0.6086149", "0.6084111", "0.60816455", "0.6032003", "0.6017...
0.85698164
0
! Construct a random 2D translation between min and max.
def random_translation(min, max, prng=DEFAULT_PRNG): return translation(_random_vector(min, max, prng))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_transform(min_rotation=0,\n max_rotation=0,\n min_translation=(0, 0),\n max_translation=(0, 0),\n min_shear=0,\n max_shear=0,\n min_scaling=(1, 1),\n max_scaling=(1...
[ "0.6922707", "0.67425835", "0.6220859", "0.6220224", "0.6169977", "0.6162585", "0.614068", "0.6137524", "0.6059512", "0.60077846", "0.5958423", "0.5921899", "0.5900005", "0.58426225", "0.57583576", "0.5746889", "0.5746568", "0.57368153", "0.5732774", "0.57087386", "0.5708607"...
0.7768125
0
! Construct a random 2D shear matrix with shear angle between max and max.
def random_shear(min, max, prng=DEFAULT_PRNG): return shear(prng.uniform(min, max))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shear(angle):\n return np.array([\n [1, -np.sin(angle), 0],\n [0, np.cos(angle), 0],\n [0, 0, 1]\n ])", "def shearMatrix(self,hxy=0, hxz=0, hyz=0, hyx=0, hzx=0, hzy=0):\n return np.array([[1,hxy,hxz,0],\n [hyx,1,hyz,0],\n [hzx...
[ "0.6952986", "0.6180413", "0.60472244", "0.5854468", "0.5735001", "0.5558871", "0.5422313", "0.5404145", "0.54004097", "0.5314623", "0.5288991", "0.5248451", "0.52379054", "0.52266157", "0.519783", "0.51929814", "0.51780576", "0.51733243", "0.516704", "0.5165186", "0.5163731"...
0.7412148
0
This function returns a Pyramid WSGI application.
def main(global_config, **settings): settings = expand_vars(settings) with Configurator(settings=settings) as config: config.include('.models') config.include('pyramid_chameleon') config.include('.routes') config.include('.security') my_session_factory = SignedCo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wsgi_app():\n return bottle.default_app()", "def app():\n return create_app()", "def app():\n app = server.app\n return app", "def make_app():\n config = Configurator()\n config.add_renderer('.jinja2', pyramid_jinja2.Jinja2Renderer)\n config.add_route('root_view', '/')\n\n config....
[ "0.7845448", "0.77049613", "0.7673193", "0.7536037", "0.7503258", "0.73890936", "0.7384288", "0.73103803", "0.72841936", "0.7276823", "0.7249291", "0.7245736", "0.7243444", "0.7225791", "0.7212354", "0.7212105", "0.7182324", "0.71565676", "0.71322274", "0.7112378", "0.7096177...
0.0
-1
Return the value of the state (computed in __init__).
def getValue(self, state): return self.values[state]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self):\n return self.__state", "def get_value(self):\n return self.__state", "def value(self, state):\r\n raise NotImplementedError", "def value(self, state):\r\n raise NotImplementedError", "def value(self, state):\n raise NotImplementedError", "def value...
[ "0.84116", "0.84116", "0.832352", "0.832352", "0.83014333", "0.83014333", "0.82503194", "0.8024963", "0.80249274", "0.80220973", "0.79581815", "0.79296756", "0.79296756", "0.79296756", "0.79049283", "0.7832321", "0.7741866", "0.7729666", "0.77095544", "0.767235", "0.7646413",...
0.77333474
28
Checks 'tiles' for a given coordinate
def check_tile(offset, tiles, lng, lat): lat = float(lat) lng = float(lng) x_coordinate = lat + offset[0] y_coordinate = lng + offset[1] x_coordinate = format(x_coordinate, '.3f') y_coordinate = format(y_coordinate, '.3f') print("x:", x_coordinate, " y:", y_coordinate) key = (x_coordi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tileExist(x, y, maxX, maxY):\n # if the x and y values are in the map\n if x >= 0 and y >= 0:\n if x <= maxX and y <= maxY:\n return True\n else:\n return False", "def is_visible_tile(x, y):\n global my_map\n if x >= MAP_WIDTH or x < 0:\n return False\n elif ...
[ "0.781539", "0.72188765", "0.6702141", "0.663864", "0.66204286", "0.6613119", "0.66026396", "0.65697193", "0.655522", "0.6540984", "0.65160656", "0.6462751", "0.64615667", "0.6449239", "0.64429504", "0.6404693", "0.6390268", "0.6387279", "0.6381707", "0.63776165", "0.6376955"...
0.77585256
1
Find the position of the maximum in an image. Helper function returns the position of the maximum value in the image as an [x,y] list in 0based pixel coordinates.
def maxpos_im(self, im): # 2D images don't store maxpos/maxval yet, so we need to grab them # imstat on a 512^2 image is about 0.032 sec # ia.getchunk is about 0.008, about 4x faster. # we're going to assume 2D images fit in memory and always use getchunk # @todo review the use ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_max_index(image: NDArray[Shape[\"*, *\"], Any]) -> Tuple[Int, Int]:\n yy, xx = np.mgrid[0 : image.shape[0], 0 : image.shape[1]]\n ymax: Int = (yy[image == np.amax(image)])[0]\n xmax: Int = (xx[image == np.amax(image)])[0]\n return ymax, xmax", "def maxval_pos(self):\n\n if self._is_co...
[ "0.7913168", "0.730747", "0.6967928", "0.6906565", "0.68558663", "0.66897976", "0.66737115", "0.6644114", "0.659654", "0.65677184", "0.656002", "0.6555945", "0.6485129", "0.64563745", "0.64450985", "0.6439983", "0.64353627", "0.64179605", "0.6407565", "0.6386334", "0.63787466...
0.79727024
0
NOT USED FOR ASSIGNMENT 07 Returns a dict containing information about customers who have rented a product based on the provided product_id.
def show_rentals(product_id): cust_rent_dict = {} try: with MONGO: DATABAE = MONGO.connection.assignment_07 customer_rental = DATABAE.rental.aggregate( [ { "$lookup": { "from": "customer", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_rentals(product_id): # {{{\n cust_rent_dict = {}\n try:\n with MONGO:\n DATABAE = MONGO.connection.assignment_07\n customer_rental = DATABAE.rental.aggregate(\n [\n {\n \"$lookup\": {\n ...
[ "0.76948225", "0.7590074", "0.74997133", "0.7463532", "0.7224741", "0.7214673", "0.71350336", "0.6973967", "0.6598666", "0.5982758", "0.56304216", "0.5540601", "0.5538116", "0.55309355", "0.55088955", "0.5485387", "0.5355412", "0.53442323", "0.53397435", "0.53394693", "0.5280...
0.7677931
1
Return path of file1 when expressed relative to file0. For instance, if file0 is "/path/to/file0" and file1 is "../for/file1" then what is returned is "/path/for/file1".
def lpath(file0, file1): return os.path.abspath(os.path.join(os.path.dirname(file0), file1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rel_path(self, path: str) -> str:\n return os.path.relpath(self.file_path, start=path)", "def relpath(filename):\n\n ret = PurePath(os.fsdecode(filename))\n if ret.is_absolute():\n try:\n return PurePath(ret.relative_to(setting.ROOT))\n except ValueError:\n ra...
[ "0.71473074", "0.7110893", "0.7042014", "0.7019204", "0.700715", "0.6921129", "0.69192296", "0.690509", "0.6903726", "0.6901314", "0.6826979", "0.6791092", "0.6742833", "0.6731712", "0.67124164", "0.67057645", "0.6701723", "0.66946316", "0.669043", "0.6680137", "0.66742295", ...
0.7623768
0
Return True if this tree is empty.
def is_empty(self): return self._root is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self) -> bool:\n return False if self.__root else True", "def is_empty(self):\n if (self.root == None):\n return True\n return False", "def isEmptyTree(self):\n return len(self.root.children) == 0", "def is_empty(self):\r\n if self.root is None:\r\n ...
[ "0.902163", "0.89572513", "0.88964736", "0.8888714", "0.8818615", "0.8818615", "0.8797038", "0.8797038", "0.8686458", "0.8656264", "0.8654461", "0.85397154", "0.8269786", "0.82668954", "0.8220517", "0.8177207", "0.8177207", "0.8177207", "0.81496286", "0.81270003", "0.8116302"...
0.878326
10
Return the string used to separate nodes in the string representation of a path from the tree root to a leaf. Used by the treemap visualiser to generate a string displaying the items from the root of the tree to the currently selected leaf. This should be overridden by each AbstractTree subclass, to customize how these...
def get_separator(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_tree_format_string(self) -> str:\n string = \"\"\n # level spacing - init\n nodes_on_level = 0\n level_limit = 1\n spaces = 10 * int(1 + len(self))\n\n for i in range(len(self)):\n space = spaces // level_limit\n # determine spacing\n\n ...
[ "0.71249604", "0.70769906", "0.705105", "0.695722", "0.6868134", "0.68047357", "0.664196", "0.6569801", "0.6537902", "0.6498097", "0.64784014", "0.6433597", "0.6427382", "0.6401714", "0.6389798", "0.6362462", "0.6347628", "0.6334339", "0.6317601", "0.63088185", "0.62992233", ...
0.0
-1
Creates a new instance of the appropriate class based on discriminator value
def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> SecurityResource: if not parse_node: raise TypeError("parse_node cannot be null.") return SecurityResource()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> RiskDetection:\n if not parse_node:\n raise TypeError(\"parse_node cannot be null.\")\n return RiskDetection()", "def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> ThreatAssessment...
[ "0.68228483", "0.65063024", "0.6385448", "0.6361333", "0.6312115", "0.6290569", "0.6280218", "0.61998093", "0.6171211", "0.6156041", "0.61064214", "0.6104898", "0.60900193", "0.6028755", "0.5989813", "0.5937353", "0.59282756", "0.58812183", "0.58695674", "0.5867912", "0.58622...
0.59666413
15
Returns the count of interfaces asociated to a machine instance
def get_num_ifaces(self): return self.interface_set.all().count()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_interfaces_len(self):\n return len(self.__interfaces)", "def pciptVirtualInterfaces_calculator(self):\r\n \r\n pcipt_vnics_count = 0\r\n for device in self.vm_obj.config.hardware.device:\r\n if \"PCI device\" in device.deviceInfo.label:\r\n pcipt_vnic...
[ "0.7030705", "0.6840989", "0.6754525", "0.6480965", "0.64694136", "0.6378359", "0.62712634", "0.6211079", "0.60848296", "0.6063261", "0.6042459", "0.6042459", "0.6042459", "0.6042459", "0.6042459", "0.6008327", "0.5997392", "0.5996606", "0.59892356", "0.59761167", "0.591708",...
0.7890876
0
Returns the interface named DEFAULT_SVC_IFACE_NAME if exists
def get_service_iface(self): try: svc_iface = self.interface_set.get(name=DEFAULT_SVC_IFACE_NAME) except ObjectDoesNotExist: svc_iface = None return svc_iface
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_interface():\n gws = netifaces.gateways()\n if 'default' not in gws:\n return ''\n\n route = gws['default'].get(netifaces.AF_INET)\n if route:\n return route[1]", "def build_service_interface(self):\n ip = self.resolveip()\n if not ip:\n return N...
[ "0.7371872", "0.6984731", "0.69513786", "0.6554372", "0.64792395", "0.64555955", "0.6327052", "0.6309483", "0.6250077", "0.61795473", "0.6089627", "0.60289264", "0.5983247", "0.5976658", "0.5895224", "0.5893194", "0.5873984", "0.5873301", "0.5842906", "0.5795722", "0.57935417...
0.83254683
0
Returns if this machine should have upsmon or not.
def has_upsmon(self): try: vm = self.virtualmachine except ObjectDoesNotExist: return True if vm.hypervisor == KVM_HYPERVISOR: return True # VMware return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_up():\n with GlobalVars.MSStatus.rw_lock:\n current_ms_status = GlobalVars.MSStatus.ms_is_up\n return current_ms_status", "def calcStatus(self):\n\n # Always return up if no monitors attached to the service\n if len(self.monitors) == 0: return True\n ...
[ "0.6961158", "0.64832497", "0.6415084", "0.6406667", "0.6300941", "0.6300941", "0.6300941", "0.62123317", "0.6180111", "0.6137665", "0.61329263", "0.6121978", "0.60953015", "0.6042147", "0.6017136", "0.600974", "0.6007411", "0.59957814", "0.59914005", "0.59874547", "0.5983099...
0.80114216
0
Returns an Interface with the values of the default service interface for de machine instance. This function assumes that the fqdn name is resoluble.
def build_service_interface(self): ip = self.resolveip() if not ip: return None iface = Interface() iface.machine = self iface.ip = ip iface.hwaddr = '00:00:00:00:00:00' iface.name = DEFAULT_SVC_IFACE_NAME iface.visible = True return i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_iface(self):\n try:\n svc_iface = self.interface_set.get(name=DEFAULT_SVC_IFACE_NAME)\n except ObjectDoesNotExist:\n svc_iface = None\n return svc_iface", "def get_default_interface():\n gws = netifaces.gateways()\n if 'default' not in gws:\n ...
[ "0.69491506", "0.6360718", "0.6281665", "0.6111488", "0.59716946", "0.5931245", "0.5899367", "0.5855426", "0.5818119", "0.57143456", "0.5711706", "0.5678895", "0.5658248", "0.5652248", "0.55899924", "0.5585002", "0.55809075", "0.5574828", "0.5564441", "0.55156064", "0.5507661...
0.76272064
0
Returns `True` if this bell is assigned to Wheatley.
def _bot_assigned_bell(self, bell: Bell) -> bool: return self._tower.is_bell_assigned_to(bell, self._user_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equipped(self):\n return self.is_worn or self.is_wielded", "def has_wbit(self):\n return self.wbit", "def is_won(self):\n pass", "def __bool__(self):\n return self.has_king()", "def won(self) -> bool:\n return all(\n self.ennemy_board.real_board @ (x, y)...
[ "0.66417223", "0.65044624", "0.6388436", "0.635713", "0.6330925", "0.62177074", "0.60617274", "0.60611033", "0.6057354", "0.6042115", "0.59974766", "0.59972924", "0.59939784", "0.5993086", "0.59598255", "0.5936948", "0.5902712", "0.58964306", "0.5871827", "0.584336", "0.58099...
0.62161624
6
Save rawls image into PNG
def to_png(self, outfile, gamma_convert=True): if '/' in outfile: output_path, _ = os.path.split(outfile) if not os.path.exists(output_path): os.makedirs(output_path) if '.png' not in outfile: raise Exception('output filename is not `.png` format')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_png(self, filename):\n png = image_to_png(self.img)\n with open(filename, 'wb') as f:\n f.write(png)", "def save_image(self,filename):\n from PIL import Image\n image = Image.new('RGB',(self.width,self.height))\n image.fromstring(self.rgb_data)\n imag...
[ "0.69271964", "0.68512917", "0.6674759", "0.6655075", "0.66433525", "0.6641504", "0.66362023", "0.66306794", "0.66180396", "0.6582713", "0.6563539", "0.65385526", "0.64727926", "0.6466829", "0.6457747", "0.6435315", "0.64277196", "0.6422942", "0.64116484", "0.6401227", "0.639...
0.0
-1
Save rawls image into EXR
def to_exr(self, outfile, gamma_convert=True): if '/' in outfile: output_path, _ = os.path.split(outfile) if not os.path.exists(output_path): os.makedirs(output_path) if '.exr' not in outfile: raise Exception('output filename is not `.exr` format')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_save(self):\n file_name, extension = return_folder_file_extension(self.img_name)[1:]\n image_name_save = \"%s_D=%s_Rs=%s_size=%s_offset=%i%s\" % (file_name, self.D, self.Rs, self.axe_X, self.offset_X+self.offset_X2, extension)\n\n if self.img2 is not None:\n self.img2.save(i...
[ "0.6555198", "0.64941037", "0.6364548", "0.6355141", "0.6277872", "0.62743247", "0.6162982", "0.6109661", "0.60831565", "0.6082322", "0.60499036", "0.60132056", "0.6009985", "0.6004034", "0.599878", "0.59214437", "0.5894526", "0.5885862", "0.5856888", "0.5841482", "0.58392787...
0.5400282
94
A mock put action that simply raises a known exception.
def mock_put(s, f): raise OSError(1, oserror_message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_store_put_raises_access_error(\n store: Store[CoolModel], mock_filesystem: AsyncMock\n) -> None:\n key = \"cool-key\"\n mock_filesystem.write_json.side_effect = FileWriteError(\"oh no\")\n\n with pytest.raises(ItemAccessError, match=\"oh no\"):\n await store.put(CoolModel(foo=\"he...
[ "0.75494576", "0.73018384", "0.71311", "0.70720524", "0.7051522", "0.69648635", "0.67751974", "0.67683893", "0.67464304", "0.67391455", "0.6726185", "0.6589775", "0.65723914", "0.6561434", "0.65594894", "0.6516533", "0.6510601", "0.6484546", "0.6476117", "0.6469982", "0.64252...
0.78782475
0
Blood vessel segmentation of a 3D image. See function `vessel_segmentation` for details.
def _vessel_segmentation_3d(img_data, threshold, radius=40, comp_size=500): if img_data.dtype!=np.float: img_data = img_data.astype(np.float) img_bin = np.zeros_like(img_data, dtype=np.uint8) for idx in range(img_data.shape[0]): img_bin[idx] = adaptive_thresholding(img_data[idx], threshold...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vessel_segmentation(img, threshold, sigma=None, radius=40, comp_size=500, hole_size=None):\n\n ndim = img.ndim\n\n if sigma is None:\n sigma = [1.]*ndim\n sigma = np.array(sigma)\n\n img_data = img.data\n\n if img_data.dtype!=np.float:\n img_data = img_data.astype(np.float)\n\n ...
[ "0.7212459", "0.64131033", "0.6410668", "0.57727814", "0.57013077", "0.5629389", "0.5581061", "0.5532209", "0.55139685", "0.5455434", "0.5427669", "0.5410387", "0.5407047", "0.52719355", "0.52629995", "0.52628213", "0.51993936", "0.518913", "0.5176784", "0.516502", "0.5155941...
0.7007171
1
Segmentation using adaptive thresholding of a bright object on a dark background. In short terms, for each pixel, if img_data[pixel]avg(img_data[window])>threshold the pixel is marked as belonging to the object, where window is a region centered at the pixel.
def adaptive_thresholding(img_data, threshold, radius): if img_data.dtype!=np.float: img_data = img_data.astype(np.float) img_blurred = ndi.gaussian_filter(img_data, sigma=radius/2.) img_corr = img_data - img_blurred img_bin = img_corr > threshold return img_bin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment(img, img_bg, img0_sigma=5, img0_min_size=300, img0_min_distance=50, img0_thresh_bg=500, img0_min_size_bg=10_000, img0_dilation=5):\n\n # Gauss-smoothening\n img0_smooth = ndi.filters.gaussian_filter(img, img0_sigma)\n\n # Thresholding and removal of small objects\n img0_thresh = filters.thr...
[ "0.67244416", "0.67242247", "0.6677976", "0.6660881", "0.66087323", "0.6568189", "0.6529254", "0.6478069", "0.635919", "0.63372505", "0.6285202", "0.628273", "0.62425154", "0.62413365", "0.6239937", "0.6235164", "0.622737", "0.6214339", "0.6202327", "0.61819947", "0.6160386",...
0.67778236
0
Convert a string hex byte values into a byte string. The Hex Byte values may or may not be space separated.
def HexToByte( hexStr ): # The list comprehension implementation is fractionally slower in this case # # hexStr = ''.join( hexStr.split(" ") ) # return ''.join( ["%c" % chr( int ( hexStr[i:i+2],16 ) ) \ # for i in range(0, len( hexStr ), 2) ] ) bytes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_to_bytestr(hex_string):\n assert type(hex_string) == str\n output=\"\"\n if len(hex_string)%2!=0:\n raise ValueError('read_hex: Odd number of hex characters input.')\n for i in range(0,len(hex_string)-1,2):\n byte_val = hex_to_bits(hex_string[i]) << 4\n byte_val += hex_to_b...
[ "0.7918446", "0.7815149", "0.77758586", "0.7748537", "0.7736363", "0.7700186", "0.7588074", "0.7542549", "0.7526128", "0.7469191", "0.73490953", "0.7246835", "0.7246835", "0.7237001", "0.7162157", "0.7153077", "0.7141396", "0.7050312", "0.7013493", "0.7008043", "0.6989191", ...
0.7716262
5
Convert a byte string to it's hex string representation e.g. for output.
def ByteToHex( byteStr ): # Uses list comprehension which is a fractionally faster implementation than # the alternative, more readable, implementation below # # hex = [] # for aChar in byteStr: # hex.append( "%02X " % ord( aChar ) ) # # return ''.join( hex ).stri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ByteToHex(self, byteStr):\n # Uses list comprehension which is a fractionally faster implementation than\n # the alternative, more readable, implementation below\n # \n # hex = []\n # for aChar in byteStr:\n # hex.append( \"%02X \" % ord( aChar ) )\n ...
[ "0.7998769", "0.7903967", "0.7861436", "0.7851266", "0.7845065", "0.7845065", "0.7835041", "0.7824689", "0.7794315", "0.7753109", "0.7666137", "0.7657189", "0.7646469", "0.7631339", "0.76084864", "0.75081897", "0.74745244", "0.74243003", "0.7384578", "0.7278043", "0.7273151",...
0.7835787
6
Given a list of lists, this function spreads the contents of each list. For example, the call spread_nested_lists([[1, 2], [3, 4]]) would return [1, 2, 3, 4].
def spread_nested_lists(input_list): #The list to be returned new_list = [] #Goes through each inner list and spreads it into the new list for inner_list in input_list: new_list += inner_list #Returns this new list return new_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(list_of_lists):\n return [item for sublist in list_of_lists for item in sublist]", "def flatten(list_of_lists):\n return [item for sublist in list_of_lists for item in sublist]", "def flatten(list_of_lists):\n return [item for sublist in list_of_lists for item in sublist]", "def flatten(...
[ "0.69416535", "0.69416535", "0.69416535", "0.69040096", "0.6883992", "0.6813807", "0.6813807", "0.6801156", "0.66806847", "0.66805", "0.66783506", "0.66680914", "0.66641706", "0.66615987", "0.66384965", "0.6627786", "0.65439665", "0.6506907", "0.65032136", "0.6465027", "0.645...
0.81345624
0
Returns the converstion factor to get from the input z units to meters
def from_z_units_to_meters_con(zUnits): try: con_z_to_m = float(zunits) except: if zUnits == "Meters": con_z_to_m = 1.0 elif zUnits == "Feet": con_z_to_m = 0.3048 else: con_z_to_m = None # The conversion factor will not be used return con_z_to_m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_zunits(self, z):\n return self.zaxis.convert_units(z)", "def fits_z_unit(self):\n return self.z_axis.unit", "def z2f(self, z):\n return self._f21 / (z + 1)", "def cm_to_meters(cm):\n pass", "def dl(self, z):\n # Conversion factor from Mpc to meters (obtained from py...
[ "0.74166894", "0.705862", "0.6873247", "0.68281466", "0.68211496", "0.6701384", "0.66594845", "0.66530067", "0.65378594", "0.6529216", "0.6436539", "0.643646", "0.6365475", "0.6362644", "0.6335134", "0.62962234", "0.6275051", "0.6259286", "0.6239716", "0.6225264", "0.615814",...
0.76184505
0
Inserts new node as the new tail of the list.
def add_to_tail(self, value): # adding to an empty list new_node = ListNode(value) self.length += 1 if self.head is None and self.tail is None: # create a new node self.head = new_node self.tail = new_node else: new_node.prev = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_insert_tail(self, new_node): # add item (key or node) at tail of list, used in mergesort\n n = self._tail\n if type(new_node) is not _Node: # if the thing isn't already a node, make it a node\n self._tail = _Node(new_node)\n else: # make it the tail\n self._ta...
[ "0.8409854", "0.78866845", "0.7709119", "0.74913955", "0.7464448", "0.7395816", "0.73292387", "0.7265867", "0.72077864", "0.7204081", "0.7147901", "0.7134843", "0.71157986", "0.711218", "0.7087885", "0.7068903", "0.70479035", "0.7017397", "0.7004658", "0.6966912", "0.69527435...
0.729724
7
Return the integer represented by the given array of bytes. bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of builtin objects that support the buffer protocol. byteorder The byte order used to rep...
def from_bytes(self, *args, **kwargs): # real signature unknown pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_int(bytes: bytearray) -> int:\n return int.from_bytes(bytes, INT_ENCODING)", "def from_bytes(b):\n return int.from_bytes(b, byteorder='big')", "def to_big_int(byte_array):\n array = byte_array[::-1] # reverse array\n out = 0\n for key, value in enumerate(array):\n decoded = st...
[ "0.6773911", "0.6769167", "0.67429113", "0.64215124", "0.6355507", "0.6320548", "0.61666965", "0.61168575", "0.60585326", "0.5924032", "0.5886399", "0.58583194", "0.5854781", "0.5831309", "0.57986724", "0.57350814", "0.57071257", "0.5686544", "0.5646899", "0.5599029", "0.5593...
0.0
-1
Return an array of bytes representing an integer. length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte ...
def to_bytes(self, *args, **kwargs): # real signature unknown pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_to_bytes(n, minlen=0): # Helper function\n nbits = n.bit_length() + (1 if n < 0 else 0) # +1 for any sign bit.\n nbytes = (nbits+7) // 8 # Number of whole bytes.\n b = bytearray()\n for _ in range(nbytes):\n b.append(n & 0xff)\n n >>= 8\n if minlen and len(b) < minlen: # Ze...
[ "0.6516576", "0.6495123", "0.64881355", "0.6479105", "0.6388292", "0.6372559", "0.6351655", "0.6315405", "0.62898713", "0.6287708", "0.60972244", "0.6042899", "0.5974127", "0.5938866", "0.5873423", "0.5840899", "0.58126915", "0.57902956", "0.5762191", "0.57193804", "0.5702926...
0.0
-1
Create and return a new object. See help(type) for accurate signature.
def __new__(*args, **kwargs): # real signature unknown pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cls, *args, **kwargs):\n return cls(*args, **kwargs)", "def _factory(*args_, **kwargs_):\n return ObsType(*args_, **kwargs_)", "def make_instance(self, cls, args, kw):\n return Object(cls, args, kw)", "def __new__(cls):\n raise TypeError(\"%s may not be instantiated.\" ...
[ "0.70525295", "0.69892246", "0.69411", "0.6937072", "0.692134", "0.68386704", "0.67864245", "0.67692834", "0.67692834", "0.6714244", "0.6670643", "0.66675353", "0.6653578", "0.6652061", "0.66407984", "0.66275185", "0.6615648", "0.6611473", "0.6590555", "0.65855825", "0.655820...
0.0
-1
Gets the value of a setting from the environment.
def get_setting(key, default=None): key = "%s_%s" % (PREFIX, key) return os.environ[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_env_setting(setting):\n\n try:\n value = environ[setting]\n # Try convert values to their python objects\n try:\n return ast.literal_eval(value)\n except (SyntaxError, ValueError):\n return value\n except KeyError:\n error_msg = \"Set the %s en...
[ "0.7964835", "0.76601845", "0.7585074", "0.7585074", "0.7585074", "0.75091016", "0.7336266", "0.7242536", "0.7095984", "0.7017028", "0.69423413", "0.6890601", "0.68848866", "0.6845632", "0.6839255", "0.68022984", "0.67973995", "0.6785612", "0.6774794", "0.6712335", "0.6662612...
0.72462994
7
Configures logging to output to stderr.
def configure_stream_logging(logger): handler = logging.StreamHandler(sys.stderr) formatter = logging.Formatter(LOG_FORMAT, LOG_DATE_FORMAT) handler.setFormatter(formatter) logger.addHandler(handler) logger.setLevel(logging.DEBUG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_logging(self):\n log_level = logging.getLevelName(self._bootstrap_options.for_global_scope().level.upper())\n\n formatter = logging.Formatter('%(levelname)s] %(message)s')\n handler = logging.StreamHandler(sys.stderr)\n handler.setLevel(log_level)\n handler.setFormatter(formatter)\n\n ...
[ "0.7031255", "0.6863974", "0.68634486", "0.66697365", "0.6668084", "0.65935993", "0.6526996", "0.64817977", "0.64635795", "0.64511925", "0.64484584", "0.64282614", "0.6419866", "0.6396294", "0.63805604", "0.6372291", "0.6360615", "0.6335547", "0.6327272", "0.6322457", "0.6279...
0.56920516
77
The providerassigned unique ID for this managed resource.
def id(self) -> str: return pulumi.get(self, "id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provider_id(self) -> str:\n return self._provider_id", "def provider_id(self):\n return self.__provider_id", "def provider_id(self):\n raise NotImplementedError", "def get_id(self):\n return \"{0} {1}\".format(self.get_issuer(), self.get_serial_number())", "def get_resource_...
[ "0.8126292", "0.80488974", "0.7851373", "0.7627896", "0.75990766", "0.7476093", "0.7476093", "0.7476093", "0.7476093", "0.7476093", "0.7445641", "0.7445641", "0.737442", "0.7371964", "0.7371964", "0.7371964", "0.7371964", "0.73697764", "0.73408705", "0.73204225", "0.7317522",...
0.0
-1
The email address of the user who sent an invitation to the user.
def invited_by(self) -> str: return pulumi.get(self, "invited_by")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_email(self, instance):\n return instance.user.email", "def email_address(self) -> str:\n return pulumi.get(self, \"email_address\")", "def email_address(self) -> str:\n return pulumi.get(self, \"email_address\")", "def user_email(self) -> str:\n return pulumi.get(self, \"...
[ "0.8035406", "0.7943051", "0.7943051", "0.7939779", "0.7909343", "0.7831166", "0.78307396", "0.7806431", "0.7776686", "0.7724042", "0.7719401", "0.7615721", "0.7615721", "0.7615721", "0.7615721", "0.7615721", "0.7615721", "0.7615721", "0.7615721", "0.760791", "0.7600805", "...
0.6569499
67
Add sensors for passed config_entry in HA
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigType, async_add_entities: AddEntitiesCallback, ) -> None: homeconnect: HomeConnect = hass.data[DOMAIN]["homeconnect"] entity_manager = EntityManager(async_add_entities) def add_appliance(appliance: Appliance) -> None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_setup_entry(\n hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities\n):\n coordinator = hass.data[DOMAIN][config_entry.entry_id][DATA_COORDINATOR]\n user_id = config_entry.data[CONF_ID]\n\n async_add_entities(\n HuisbaasjeSensor(coordinator, user_id=user_id, **senso...
[ "0.653861", "0.64803", "0.62222236", "0.61975574", "0.61520326", "0.6149333", "0.6130536", "0.61188936", "0.61123896", "0.6080841", "0.6062238", "0.6030867", "0.6000861", "0.59994566", "0.5957601", "0.59349084", "0.59129447", "0.5912325", "0.59084845", "0.5908433", "0.5906324...
0.6047278
11
Get the original unit before manipulations
def internal_unit(self) -> str | None: unit = None t = None if self._appliance.active_program and self._key in self._appliance.active_program.options: t = self._appliance.active_program.options[self._key].type unit = self._appliance.active_program.options[self._key].unit ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUnit(self):\n return self._Unit", "def getUnit(self):\n return self.__unit", "def unit(self):\n return self._unit", "def unit(self):\n return self._unit", "def unit(self):\n return self._unit", "def unit_of_measurement(self):\n return OBSERVATIONS[self.obs...
[ "0.70888245", "0.70669687", "0.692822", "0.692822", "0.692822", "0.68141437", "0.6808089", "0.6599923", "0.6578954", "0.6561583", "0.64718354", "0.6457831", "0.6457831", "0.64482605", "0.6441056", "0.6431579", "0.6431579", "0.6431579", "0.64093584", "0.64042264", "0.63591397"...
0.59900653
85
Convert list of dictionaries to list of lists, with first nested list containing column names.
def _dicts_to_lists(my_list): try: column_names = list(my_list[0].keys()) # Account for tabs without data e.g. no learners have filled out a survey except IndexError: return [[gettext('Apologies, this tab contains no data.')]] results_processed = [] results_processed.append(column_names) for dict_ in my_list:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_list(dict, header):\n row = []\n for field in header:\n if field in dict:\n row.append(str(dict[field]))\n else:\n row.append(None)\n return row", "def list_of_dict_to_list(data, key):\n results = []\n for entry in data:\n results.append(entry...
[ "0.70526046", "0.6656581", "0.65890425", "0.6427638", "0.6409069", "0.63248086", "0.6311676", "0.6271054", "0.6238405", "0.61267316", "0.6109163", "0.6060444", "0.60377383", "0.60356295", "0.6025422", "0.6025422", "0.6002028", "0.60001314", "0.5997876", "0.59855735", "0.59225...
0.8283064
0
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): #declares DF for csv that user chose if (city == 'chicago'): df = pd.read_csv(r'D:\MFE Prep\PDSND\Project2 Files\bikeshare-2\chicago.csv') elif (city == 'new york city'): df = pd.read_csv(r'D:\MFE Prep\PDSND\Project2 Files\bikeshare-2\new_york_city....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_city_data(city, month, day):\n df = pd.read_csv(CITY_DATA[city])\n #extract month, day, hour from start time\n df['month'] = pd.to_datetime(df['Start Time']).dt.month_name()\n df['day'] = pd.to_datetime(df['Start Time']).dt.weekday\n df['hour'] = pd.to_datetime(df['Start Time']).dt.hour\n\n...
[ "0.83183694", "0.8226695", "0.8150808", "0.80794895", "0.80427766", "0.8017983", "0.8001192", "0.79902804", "0.7979157", "0.797769", "0.79721206", "0.7957008", "0.7955993", "0.79484135", "0.7931038", "0.79188", "0.7912735", "0.791154", "0.790504", "0.7902931", "0.79026365", ...
0.7684958
82
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() df['Month'] = pd.to_datetime(df['Start Time']).dt.month df['Day'] = pd.to_datetime(df['Start Time']).dt.day df['Hour'] = pd.to_datetime(df['Start Time']).dt.hour # display the m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\r\n\r\n print('\\nThese are the statistics of the most frequent times of travel:\\n')\r\n start_time = time.time()\r\n\r\n # Display the most common month\r\n common_month = df['month'].mode()[0]\r\n print(\"- That's the most common month based on your selection: \" +\r\n ...
[ "0.7974609", "0.7851373", "0.7800278", "0.77821916", "0.7775073", "0.7762475", "0.77532375", "0.77384645", "0.77262247", "0.7718093", "0.7685153", "0.7683606", "0.76808155", "0.7679881", "0.7650141", "0.7644975", "0.7643931", "0.76428497", "0.7629725", "0.76246285", "0.762423...
0.716519
88
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station most_common_start = df['Start Station'].mode()[0] print('Most Common Start Station: ' + str(most_common_start)) # display most commonly...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\033[1m' + 'Calculating the most popular stations and trip...\\n' + '\\033[0m')\n start_time = time.time()\n\n # display the most commonly used start station\n\n start_stn = df['Start Station'].mode()[0]\n print('Most popular start station is {}.'.format(start_stn)...
[ "0.7809938", "0.76727635", "0.7538624", "0.74982685", "0.7490305", "0.74887866", "0.7436869", "0.7429845", "0.74274427", "0.7425571", "0.74126786", "0.7404592", "0.7382532", "0.7379482", "0.73747545", "0.7365935", "0.73561436", "0.7351966", "0.7324152", "0.7304813", "0.729985...
0.70164114
91
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time total_time = df['Trip Duration'].sum() print('Total Travel Time: ' + str(total_time) + ' Days') # display mean travel time mean_time = round(df['Trip Duration']....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(df):\r\n\r\n print('\\nThese are the statistics related to the trips durations:\\n')\r\n start_time = time.time()\r\n\r\n # Display total travel time\r\n total_travel_time = df['Trip Duration'].sum()\r\n print(\"\\n- The total travel time based on your selection is: \" +\r\n ...
[ "0.8270393", "0.811851", "0.80482864", "0.8047429", "0.7978948", "0.79635143", "0.79598707", "0.7946656", "0.7936787", "0.7930004", "0.79281574", "0.79273146", "0.7924902", "0.792007", "0.7916145", "0.7915809", "0.7913596", "0.79079324", "0.79042363", "0.790269", "0.7892615",...
0.7770714
61
Test if the expressions involved in an ElinaLincons0Array are quasilinear.
def elina_lincons0_array_is_quasilinear(lincons_array): result = None try: elina_lincons0_array_is_quasilinear_c = elina_auxiliary_api.elina_lincons0_array_is_quasilinear elina_lincons0_array_is_quasilinear_c.restype = c_bool elina_lincons0_array_is_quasilinear_c.argtypes = [ElinaLincon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CheckQuad(q):\n try:\n if q.__len__() != 4:\n return False\n for i in range(len(q)):\n if q[i].__len__() != 2:\n return False\n a = float(q[i][0])\n a = float(q[i][1])\n except:\n return False\n\n return Quad(q).isConvex",...
[ "0.65537244", "0.6237412", "0.6182781", "0.5972821", "0.595587", "0.5594725", "0.5507812", "0.54747015", "0.54204774", "0.5313526", "0.5268528", "0.5259035", "0.5208048", "0.51998204", "0.51989377", "0.5157171", "0.51473194", "0.51384926", "0.5109147", "0.50958556", "0.509153...
0.7589022
0
Init With a size 1. data should be a real
def test_init_size1(self): test = Map2D("name",size=1,dt=self.dt) self.assertEqual(0.,test.getData(),"When initiated with a size == 1, the data should be a real")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,data):\n assert all(isinstance(x,(int, float)) for x in data), \"Data can only be numbers.\"\n assert len(data) > 1, \"Data must be at least 2 numbers.\"\n self.data = data\n self.__update()", "def __init__(self, size):\n self.data = []\n for i in range...
[ "0.729099", "0.7269708", "0.72135067", "0.70920086", "0.69091964", "0.682824", "0.6801473", "0.67613584", "0.6757266", "0.66385096", "0.6598656", "0.6598619", "0.6580793", "0.6579081", "0.6547691", "0.65407753", "0.6509031", "0.6505588", "0.64791995", "0.645469", "0.64448947"...
0.0
-1
Returns arguments parsed from commandline.
def get_args(): parser = argparse.ArgumentParser( description="""This script reads an archive of mapping from query to documents and stitches the documents for each query into a new document.""") parser.add_argument("--query2docs", type=argparse.FileType('r'), r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_args_from_command_line():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--country_code\", type=str)\n parser.add_argument(\"--model_folder\", type=str)\n parser.add_argument(\"--scratch_path\", type=str)\n args = parser.parse_args()\n return args", "def _parse_command_lin...
[ "0.7782162", "0.75651205", "0.75544864", "0.75171846", "0.75171846", "0.7460546", "0.742949", "0.73975223", "0.73410237", "0.73267156", "0.7281317", "0.7258362", "0.72357404", "0.72313184", "0.71992165", "0.7195346", "0.71723866", "0.7169486", "0.7153596", "0.71270233", "0.71...
0.0
-1
Get currently logged in user id.
def get_valid_user_from_token(dbsession): authorization = connexion.request.headers.get("Authorization") if not authorization: return None token = authorization.split(" ")[1] logger.debug("Authorization: %s", token) claims = decode_token(token) logger.debug("Claims: %s", claims) u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_id(self):\n return self.authenticate()['user_id']", "def current_user_id(self):\n return api.user.get_current().getId()", "def user_get_current_user_id(self):\n\n response = self.user_get_current_user()\n return response['uri'].split('spotify:user:', 1)[1]", "def get_...
[ "0.8672746", "0.8497251", "0.8374656", "0.83444726", "0.8304354", "0.82108706", "0.8163114", "0.8129577", "0.8045698", "0.80400676", "0.80317277", "0.7981147", "0.7970013", "0.7969204", "0.7969204", "0.7969204", "0.7967948", "0.79544836", "0.79533803", "0.7940094", "0.7866223...
0.0
-1
Check error validation when path is absolute but context has been provided.
def test_rc_load_empty_content_should_fail(*args): with pytest.raises(AssertionError): utils.rc_load_json(Path(), context='')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_abolute_path(self, path):\n if(path.startswith('/')):\n raise StandardError('Absolute path names are not supported by now! Check: %s' %path)", "def validate(path, context):\n path = pathtostr(path)\n if path != '/':\n context.set_code(grpc.StatusCode.NOT_FOUND...
[ "0.74515605", "0.7435427", "0.7408968", "0.7283713", "0.72537106", "0.7134301", "0.68877494", "0.67342186", "0.6693809", "0.66126806", "0.65685385", "0.6505559", "0.6478875", "0.644269", "0.64343333", "0.6384067", "0.6338183", "0.63314486", "0.6328207", "0.6308192", "0.627982...
0.0
-1
Check does rc_load_json output equal json.load output.
def test_rc_load_return_should_provide_json(mock_open, *args): mock_open.__enter__.return_value = mock.Mock() data = utils.rc_load_json(Path()) assert data == {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_json_loads(self):\n loaded = difference_engine.json_loads(self.text_small)\n assert 'test1' in loaded['prod']['bid1']['tests']['fail']\n assert ['mod2', '2'] in loaded['prod']['bid2']['modules']", "def test_load_json(self):\n tlj_std = [{\"id\": 3}]\n tlj_exp = [{\"bet...
[ "0.6888034", "0.6587479", "0.6561401", "0.65570664", "0.6511758", "0.64670223", "0.640442", "0.63665575", "0.6357382", "0.6287444", "0.6258652", "0.61986566", "0.6191293", "0.6114239", "0.61014766", "0.60496604", "0.6022987", "0.6022987", "0.6022987", "0.6022987", "0.6022987"...
0.6263663
10
Gets the name of the tag group
def name(self): if self._is_ignored: return '' return self._tag_group_dict["common.ALLTYPES_NAME"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_name(self):\n return self.name", "def group_tag(self):\n return ''.join(['[{}]'.format(x.name) for x in self.groups])", "def group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"group_name\")", "def group_name(self):\n return self.properties.get(\"Grou...
[ "0.8217201", "0.81963986", "0.7934984", "0.78946406", "0.78128386", "0.7472486", "0.7472486", "0.7466683", "0.7441562", "0.7441562", "0.73986465", "0.734114", "0.72994643", "0.7287616", "0.7115807", "0.7112208", "0.69828206", "0.69391674", "0.6931285", "0.68820614", "0.688206...
0.6461367
70
Returns the stringified JSON representation of the Kepware tag group
def as_json(self): return json.dumps(OrderedDict(self._tag_group_dict))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n return self._tag_group_dict", "def get_groups():\n groups_dict = list(map(lambda group: \n { \"id\": str(group.raw.get(ATTR_ID)), \n \"name\": str(group.raw.get(ATTR_NAME)),\n \"state\": str(group.raw.get(ATTR_DEVICE_STATE)),\n \"level\": s...
[ "0.7290602", "0.63183874", "0.63007253", "0.61903816", "0.6117644", "0.59507424", "0.5934828", "0.58320063", "0.5799554", "0.57893205", "0.5781083", "0.57742405", "0.57441604", "0.5726282", "0.5699964", "0.56980675", "0.5695123", "0.569106", "0.5673376", "0.56646746", "0.5651...
0.8117053
0
If a multiline string has nothing added to it, its str representation must be the empty string.
def testEmpty(self): self.assertEqual('', str(MultilineString()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testEmptyIsFalse(self):\n self.assertFalse(MultilineString())", "def testAppendOneLine(self):\n s = MultilineString()\n s.append('test')\n self.assertEqual('test', str(s))", "def emptyline(self):\r\n pass", "def emptyline(self):\n pass", "def emptyline(self):\n...
[ "0.71476424", "0.6937139", "0.6714046", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6694553", "0.66694164", "0.6664271", "0.6544409", "0.6465254", "0.6447967", "0.64207685", ...
0.8079279
0
If a multiline string has nothing added to it, it must be considered False in a Boolean test.
def testEmptyIsFalse(self): self.assertFalse(MultilineString())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOneLineTrue(self):\n s = MultilineString()\n s.append('test')\n self.assertTrue(s)", "def is_multiline(s):\n return len(s.splitlines()) > 1", "def multiline_test(line: str) -> bool:\n if line.rfind('=') > -1:\n # A '=' character in a rem line is not a line break!\n ...
[ "0.7590837", "0.7553887", "0.74091774", "0.74091774", "0.71564364", "0.7113903", "0.7041658", "0.6812294", "0.6796212", "0.6696406", "0.65631026", "0.6519799", "0.65158635", "0.64909035", "0.6457212", "0.6457212", "0.6456439", "0.6448699", "0.6431669", "0.6368155", "0.630376"...
0.8024152
0
If a multiline string has nothing added to it, its length must be zero.
def testLenZero(self): self.assertEqual(0, len(MultilineString()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOneLineLength(self):\n s = MultilineString()\n s.append('test')\n self.assertEqual(4, len(s))", "def testEmpty(self):\n self.assertEqual('', str(MultilineString()))", "def testLineCountZero(self):\n self.assertEqual(0, MultilineString().lineCount())", "def is_multil...
[ "0.766805", "0.755679", "0.75008553", "0.7296741", "0.7289227", "0.72612417", "0.7243209", "0.7242377", "0.6850717", "0.68381894", "0.6767801", "0.6760852", "0.6759915", "0.6759915", "0.6759915", "0.6759915", "0.6759915", "0.6759915", "0.6759915", "0.6759915", "0.6759915", ...
0.7823915
0
If a multiline string has nothing added to it, its line count must be zero.
def testLineCountZero(self): self.assertEqual(0, MultilineString().lineCount())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOneLineLineCount(self):\n s = MultilineString()\n s.append('test')\n self.assertEqual(1, s.lineCount())", "def test_on_no_newlines(self):\n assert len(lint(self.text_with_no_newline)) == 1", "def testOneLineLength(self):\n s = MultilineString()\n s.append('test...
[ "0.78191394", "0.7562106", "0.72952044", "0.72850966", "0.7268283", "0.7220012", "0.7076227", "0.7064255", "0.70400476", "0.695458", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.693224", "0.692555...
0.81715864
0
If a multiline string has one thing appended to it, it must be considered True in a Boolean test.
def testOneLineTrue(self): s = MultilineString() s.append('test') self.assertTrue(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_multiline(s):\n return len(s.splitlines()) > 1", "def multiline_test(line: str) -> bool:\n if line.rfind('=') > -1:\n # A '=' character in a rem line is not a line break!\n if line.startswith(\"REM\") and not dsr_regex.match(line):\n return False\n return True\n el...
[ "0.7610463", "0.74359065", "0.74359065", "0.7181944", "0.65487707", "0.6511626", "0.6366083", "0.6244524", "0.61964303", "0.6136241", "0.61348015", "0.61177886", "0.6079722", "0.60582435", "0.6055406", "0.6047885", "0.6038949", "0.601646", "0.6011056", "0.6010336", "0.5992693...
0.776395
0
If a multiline string has one thing appended to it, its line count must be one.
def testOneLineLineCount(self): s = MultilineString() s.append('test') self.assertEqual(1, s.lineCount())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOneLineLength(self):\n s = MultilineString()\n s.append('test')\n self.assertEqual(4, len(s))", "def is_multiline(s):\n return len(s.splitlines()) > 1", "def testTwoLinesLineCount(self):\n s = MultilineString()\n s.append('test1')\n s.append('test2')\n ...
[ "0.7707518", "0.75719005", "0.755927", "0.742227", "0.7288511", "0.7209049", "0.7200011", "0.706877", "0.6982607", "0.6868193", "0.6865201", "0.6733123", "0.6730479", "0.6494529", "0.6491882", "0.6483451", "0.64260304", "0.62830293", "0.6276195", "0.6255683", "0.6228776", "...
0.8012268
0
If a multiline string has one thing appended to it, its length must be the length of that string.
def testOneLineLength(self): s = MultilineString() s.append('test') self.assertEqual(4, len(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testTwoLinesLength(self):\n s = MultilineString()\n s.append('123')\n s.append('45678')\n self.assertEqual(9, len(s))", "def testOneLineLineCount(self):\n s = MultilineString()\n s.append('test')\n self.assertEqual(1, s.lineCount())", "def is_multiline(s):\n...
[ "0.82361096", "0.75314504", "0.74356204", "0.7140659", "0.7038898", "0.6926937", "0.6857314", "0.6795092", "0.67562395", "0.67141515", "0.65862507", "0.65614754", "0.64571685", "0.63514113", "0.63394296", "0.6284767", "0.6213855", "0.61053574", "0.60716563", "0.6019442", "0.6...
0.84649074
0
If a multiline string has two things appended to it, its length must be the sum of the two lengths plus one for the newline separator.
def testTwoLinesLength(self): s = MultilineString() s.append('123') s.append('45678') self.assertEqual(9, len(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testOneLineLength(self):\n s = MultilineString()\n s.append('test')\n self.assertEqual(4, len(s))", "def testTwoLinesLineCount(self):\n s = MultilineString()\n s.append('test1')\n s.append('test2')\n self.assertEqual(2, s.lineCount())", "def testOneLineLineC...
[ "0.81647366", "0.7617312", "0.7443835", "0.730083", "0.7287686", "0.71382195", "0.6987489", "0.6972632", "0.6722956", "0.67149466", "0.6553778", "0.65146625", "0.63012135", "0.628322", "0.6265762", "0.62272674", "0.60610545", "0.59692633", "0.58379453", "0.5830868", "0.582564...
0.8403026
0
If a multiline string with a left margin has two things appended to it, its str representation must have the two strings, separated by a newline and each line must start with the margin.
def testAppendTwoLinesWithMargin(self): s = MultilineString(margin='+ ') s.append('test1') s.append('test2') self.assertEqual('+ test1\n+ test2', str(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testIndentOutdentWithMargin(self):\n s = MultilineString(indent='\\t', margin='>>> ')\n s.append('test1')\n s.indent()\n s.append('test2')\n s.outdent()\n s.append('test3')\n self.assertEqual('>>> test1\\n>>> \\ttest2\\n>>> test3', str(s))", "def testDefaultIn...
[ "0.66222453", "0.65455824", "0.6244586", "0.6237283", "0.6225881", "0.6133364", "0.6132242", "0.61260295", "0.6115642", "0.6113785", "0.6063664", "0.6024581", "0.5999329", "0.5994151", "0.5966189", "0.5960782", "0.59401834", "0.59355265", "0.5933682", "0.59291565", "0.5907352...
0.7700371
0
Given a( a pr array), returns coefficients of transformation for each column and normalizes each column at the same time.
def normalize(a, direction, low_end=-1.0, high_end=1.0): p_min, p_max = np.min(a, axis=0), np.max(a, axis=0) slope = (high_end - low_end) / (p_max - p_min) intercept = low_end - p_min * slope for i in xrange(len(a)): a[i] = slope * a[i] + intercept if direction == 'forward': retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalise_m(a):\n # Transform to matrix\n a.shape = (-1, 3)\n # Compute the array 'a' length\n lengths = np.sqrt(a[:, 0] * a[:, 0] + a[:, 1] * a[:, 1] + a[:, 2] * a[:, 2])\n # Normalise all the entries\n # a[:] /= lengths\n a.T[0, :] /= lengths\n a.T[1, :] /= lengths\n a.T[2, :] /= l...
[ "0.71480143", "0.65933067", "0.6350661", "0.59722465", "0.58815974", "0.58073443", "0.5796165", "0.5750867", "0.57428", "0.5715334", "0.5696488", "0.5682979", "0.5667552", "0.56282336", "0.56188756", "0.55685794", "0.5563359", "0.554767", "0.55300945", "0.54985005", "0.548826...
0.0
-1
Make sure the specified CIM is populated if expected, and that its properties are displayed appropriately.
def tbird_verify_cim_bay(bay): is_passing = True # keeps track of any errors encountered slot_content = BuiltIn().get_variable_value("${Enc Object}") s2l = ui_lib.get_s2l() # Consider any sorting: # Verify the row corresponding to that actual Bay Number, not Row #[bay] bay_row = 'xpath=//tabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_margins_initial_value(self):\n self.assertEqual(self.group.getMargined(), False)", "def test_species_missing_inchi(self, capfd):\n root = etree.Element('experiment')\n properties = etree.SubElement(root, 'commonProperties')\n initial_composition = etree.SubElement(properties,...
[ "0.5190495", "0.4961753", "0.4925378", "0.4901043", "0.48875344", "0.48850977", "0.4875686", "0.487027", "0.4864737", "0.48620102", "0.48536834", "0.48487672", "0.48474282", "0.4835204", "0.48141328", "0.48132655", "0.4795161", "0.47921667", "0.47883037", "0.47765377", "0.476...
0.0
-1
Returns True if matrix is 9x9 and only contains numbers between 0 and 9.
def is_valid_matrix(self, matrix): return self.is_9x9(matrix) and self.is_valid_nums(matrix)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_9x9(self, matrix):\n return matrix.ndim == 2 and matrix.shape == (9, 9)", "def is_valid_nums(self, matrix):\n return matrix[(matrix < 0) | (matrix > 9)].sum() == 0", "def is_solved(sudoku_matrix):\n\n for i in range(9):\n for j in range(9):\n if len(sudoku_matrix[i][j]...
[ "0.84386945", "0.8208725", "0.7089837", "0.7026869", "0.70156115", "0.69280803", "0.6794615", "0.678628", "0.67545587", "0.67339087", "0.6651151", "0.66509914", "0.65263706", "0.6521158", "0.64429843", "0.642565", "0.64242995", "0.64195234", "0.63724977", "0.6351999", "0.6349...
0.8097567
2
Returns True if matrix only contains numbers 0 to 9 (0 represents empty square).
def is_valid_nums(self, matrix): return matrix[(matrix < 0) | (matrix > 9)].sum() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_matrix(self, matrix):\n return self.is_9x9(matrix) and self.is_valid_nums(matrix)", "def is_9x9(self, matrix):\n return matrix.ndim == 2 and matrix.shape == (9, 9)", "def check_zeros(board):\n for row in board:\n if 0 in row:\n return False\n\n return True", ...
[ "0.79229194", "0.76323396", "0.725728", "0.69029796", "0.68384504", "0.6834649", "0.6826028", "0.6815098", "0.67748314", "0.66961604", "0.6692842", "0.6530507", "0.65240824", "0.65090966", "0.6402405", "0.6379325", "0.63749576", "0.6349163", "0.6339271", "0.6334505", "0.63138...
0.8243558
0
Returns True if num is a valid entry in position (i, j). According to Sudoku rules, there can be no duplicates along a given row or column, and there must be no duplicates in each 3x3 submatrix.
def is_valid_element(self, num, row, col): # Check if duplicate in row for j in range(self.matrix.shape[1]): if j != col and self.matrix[row, j] == num: return False # Check if duplicate in col for i in range(self.matrix.shape[0]): if i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIfValid(matrix, row, col, num):\n for j in range(BOARD_LENGTH):\n if matrix[row][j] == num and j != col:\n return False\n\n for i in range(BOARD_LENGTH):\n if matrix[i][col] == num and i != row:\n return False\n\n box_row = (row // 3) * 3\n box_col = (col //...
[ "0.761953", "0.7517283", "0.7355286", "0.73266345", "0.7273109", "0.7272601", "0.7141898", "0.71319246", "0.7088139", "0.70402336", "0.6927886", "0.685246", "0.67978144", "0.67839867", "0.6781179", "0.675968", "0.6745492", "0.6740846", "0.6740676", "0.67296493", "0.66968656",...
0.8177209
0
Returns a tuple for the next empty location to check. Traversal order is left to right, then top to bottom.
def next_loc(self, i, j): next_i, next_j = i, j while next_i < 9 and next_j < 9 and self.matrix[next_i, next_j] != 0: next_i = next_i if next_j < 8 else next_i + 1 next_j = next_j + 1 if next_j < 8 else 0 return next_i, next_j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty(self):\n for i in range(9):\n for j in range(9):\n if self.state[i][j] == 0:\n return (i, j) # row, col\n return None", "def BlankTileLocation(state):\n for row in range(len(state)):\n for col in range(len(state)):\n ...
[ "0.64045644", "0.63885665", "0.6263455", "0.58835757", "0.5846831", "0.57976186", "0.57916296", "0.5760187", "0.5700191", "0.56785476", "0.56330776", "0.56302905", "0.56220996", "0.5612827", "0.55958194", "0.5562424", "0.5557024", "0.5526916", "0.550158", "0.5493863", "0.5492...
0.55321866
17
Returns True if every element is valid. Should only be used to check condition of the final filled matrix. Will return False if matrix contains any empty elements.
def is_final_solution(self): if 0 in self.matrix: return False for i in range(self.matrix.shape[0]): for j in range(self.matrix.shape[1]): if not self.is_valid_element(self.matrix[i, j], i, j): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_matrix(self, matrix):\n return self.is_9x9(matrix) and self.is_valid_nums(matrix)", "def is_valid(self):\n for i in range(9):\n if not self._is_valid_row(i):\n return False\n if not self._is_valid_column(i):\n return False\n ...
[ "0.7638425", "0.7565327", "0.7436249", "0.73948944", "0.734303", "0.7277269", "0.72435474", "0.71222323", "0.7087144", "0.6951472", "0.6906656", "0.6869072", "0.6856324", "0.6856303", "0.6845516", "0.6821662", "0.6746719", "0.67289406", "0.672687", "0.6719072", "0.6671052", ...
0.71100765
8
Checks if invalid baseball event exists. This function uses IDs to perform a query to the database that verifies if the invalid Baseball Event exists.
def getBaseballEventIDInvalid(self, eID, aID): cursor = self.conn.cursor() query = """ SELECT id FROM baseball_softball_event WHERE event_id = %s and athlete_id = %s and (is_invalid = true); """ cursor.execute(query, (int(eID...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBaseballEventTeamStatsIDInvalid(self, eID):\r\n cursor = self.conn.cursor()\r\n query = \"\"\"\r\n SELECT id\r\n FROM baseball_softball_event_team_stats\r\n WHERE event_id = %s and (is_invalid = true);\r\n \"\"\"\r\n cursor.exe...
[ "0.66756755", "0.65055466", "0.61406755", "0.6095179", "0.60401505", "0.60197693", "0.58395773", "0.5699694", "0.5644299", "0.5592231", "0.5570605", "0.5541987", "0.5539285", "0.55118215", "0.54419905", "0.5409492", "0.5398987", "0.5386589", "0.537887", "0.5294454", "0.529293...
0.7326809
0
Checks if invalid baseball event team stats exist. This function uses IDs to perform a query to the database that verifies if the invalid Baseball Event exists.
def getBaseballEventTeamStatsIDInvalid(self, eID): cursor = self.conn.cursor() query = """ SELECT id FROM baseball_softball_event_team_stats WHERE event_id = %s and (is_invalid = true); """ cursor.execute(query, (int(eID),)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSoccerEventTeamStatsIDInvalid(self, eID):\r\n cursor = self.conn.cursor()\r\n query = \"\"\"\r\n SELECT id\r\n FROM soccer_event_team_stats\r\n WHERE event_id = %s and (is_invalid = true);\r\n \"\"\"\r\n cursor.execute(query, (...
[ "0.68973595", "0.6723311", "0.6391226", "0.6260419", "0.6041074", "0.60097605", "0.5876539", "0.58373016", "0.58155733", "0.5811245", "0.57377946", "0.5720978", "0.57020646", "0.569319", "0.5638441", "0.5629931", "0.5605907", "0.5598953", "0.55685776", "0.5518972", "0.5469003...
0.7358271
0
Gets the aggregated statistics for a given athlete and season. This function uses and ID and a year number to perform a query to the database that gets the aggregated statistics in the system that match the given ID and season year.
def getAggregatedAthleteStatisticsPerSeason(self, aID, seasonYear): cursor = self.conn.cursor() query = """ with aggregate_query as( SELECT sum(at_bats) as at_bats,sum(runs) as runs, sum(hits) as hits,sum(runs_batted_in) as runs_batted_in, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAggregatedAthleteStatisticsPerSeason(self, aID, seasonYear):\r\n cursor = self.conn.cursor()\r\n query = \"\"\"\r\n with aggregate_query as(\r\n SELECT\r\n sum(goal_attempts) as goal_attempts,sum(assists) as assists, sum(fouls) as fouls,sum(cards) a...
[ "0.83394265", "0.8087077", "0.8028328", "0.77618843", "0.77169776", "0.75868034", "0.75606257", "0.75399023", "0.74617326", "0.6140369", "0.6092121", "0.60251015", "0.58805835", "0.58277917", "0.5819843", "0.56360173", "0.5621238", "0.55814487", "0.5548701", "0.5456125", "0.5...
0.8272398
1
Gets the aggregated statistics for a given athlete and season. This function uses and ID and a year number to perform a query to the database that gets the aggregated statistics in the system that match the given ID and season year.
def getAggregatedAthleteStatisticsCareer(self, aID, seasonYear): cursor = self.conn.cursor() query = """ with aggregate_query as( SELECT sum(at_bats) as at_bats,sum(runs) as runs, sum(hits) as hits,sum(runs_batted_in) as runs_batted_in, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAggregatedAthleteStatisticsPerSeason(self, aID, seasonYear):\r\n cursor = self.conn.cursor()\r\n query = \"\"\"\r\n with aggregate_query as(\r\n SELECT\r\n sum(goal_attempts) as goal_attempts,sum(assists) as assists, sum(fouls) as fouls,sum(cards) a...
[ "0.83387005", "0.82713306", "0.8087087", "0.80279917", "0.7715139", "0.7589005", "0.7560203", "0.7539233", "0.7463678", "0.61424226", "0.6092153", "0.60264355", "0.5883079", "0.58301294", "0.5822721", "0.5638247", "0.5622567", "0.5583384", "0.55523294", "0.5456879", "0.538777...
0.77596146
4
Return True if ``a`` is unit normal.
def is_normal(self, a): return a >= 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_normal(self, a):\n a = _convert_other(a, raiseit=True)\n return a.is_normal(context=self)", "def is_subnormal(self, a):\n a = _convert_other(a, raiseit=True)\n return a.is_subnormal(context=self)", "def isNormalized(self):\n return self.getLength() == 1", "def is_uni...
[ "0.7317686", "0.68002737", "0.6680187", "0.6451541", "0.62836546", "0.6236922", "0.62205815", "0.6192785", "0.6018408", "0.59799707", "0.59213156", "0.5811043", "0.5811043", "0.5764195", "0.57133883", "0.5675402", "0.56119263", "0.5602107", "0.56020045", "0.56020045", "0.5585...
0.786483
0
Transform the withqiter nodes that form the body of a withqfor node to be withqrepeat loops, if possible Assumes that all of the transformations prior to flattening have already been made; does NOT work on general AST.
def visit_With(self, node): # transform any subnodes prior to attempting to # transform this node # new_body = [self.visit(subnode) for subnode in node.body] # TODO: check that what we have is qiter nodes? new_body = make_repeats(new_body) # DESTRUCTIVE ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_qrepeat(iter_cnt, body, subname=''):\n\n repeat_txt = 'with Qrepeat%s(%d):\\n pass' % (subname, iter_cnt)\n repeat_ast = expr2ast(repeat_txt)\n copy_all_loc(repeat_ast, body[0], recurse=True)\n\n repeat_ast.body = body\n\n return repeat_ast", "def and_gen(args):\n ...
[ "0.59913075", "0.5243544", "0.5141996", "0.5002862", "0.49953395", "0.4975387", "0.49730855", "0.4961271", "0.495013", "0.49408558", "0.492991", "0.49238652", "0.49109963", "0.48876682", "0.48516113", "0.48307985", "0.4806262", "0.47916815", "0.47577754", "0.4725842", "0.4696...
0.6336727
0
Sends a 401 response that enables basic auth
def authenticate(): return Response( 'Vous n\'avez pas de droit a acceder ce site.\n' 'Veuillez vous identifier', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return Response(\n 'Forbidden', 401,\n {'WWW-Authenticate': 'Basic realm=\"Login Required\"'})", "def authenticate():\n return Response(\n 'Admin access required, please login' , 401,\n {'WWW-Authenticate': 'Basic realm=\"Login Required\"'})", "def authen...
[ "0.8197392", "0.8035733", "0.80004793", "0.7995748", "0.7896774", "0.78750163", "0.7832148", "0.7824419", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.7810746", "0.77872056", "0.77767545", "0.774767", "0.774767", "0.774767", "0.77113056", ...
0.7756027
17
Gets the name of the application to be deployed (even if it's Poulpe, it can be deployed as ROOT.war).
def get_app_final_name(self): return self.props.get('app_final_name', self.project)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app_name(self):\n if \"app\" in self.properties:\n return self.properties[\"app\"].display_name\n return None", "def get_application_name(): # real signature unknown; restored from __doc__\n return \"\"", "def app_name(self):\n return self._app_name", "def applicati...
[ "0.76508826", "0.75267506", "0.7386023", "0.73388445", "0.73199564", "0.73051673", "0.7244745", "0.71931607", "0.7056203", "0.70519304", "0.6902116", "0.6892799", "0.6873036", "0.681145", "0.6725557", "0.6685635", "0.6684953", "0.66649514", "0.66435325", "0.6637266", "0.65919...
0.7611153
1
checks to see if x is a prime
def if_prime(x, primes): for p in primes: if p**2 > x: return True if x % p == 0: return False print(x) return "error"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(x):\n if x < 2:\n return False\n for i in range(2, x//2):\n if x % i == 0:\n return False\n return True", "def is_prime(x):\n for i in range(2, x):\n if x % i == 0:\n return False\n return True", "def is_prime(x):\n if x == 0 or x == 1:\...
[ "0.88263065", "0.8726216", "0.87056625", "0.86905485", "0.86885786", "0.86570376", "0.8532177", "0.8528742", "0.85182863", "0.83910424", "0.8387917", "0.81026006", "0.80805486", "0.77501637", "0.7727548", "0.7725533", "0.7725533", "0.7718755", "0.76963675", "0.76901424", "0.7...
0.8115827
11
turns direction right 60 degrees uses if statements rather than matrix multiplication to simplify
def right(direction): if direction == [1, 0]: return [1/2, -(3**0.5)/2] if direction == [1/2, -(3**0.5)/2]: return [-1/2, -(3**0.5)/2] if direction == [-1/2, -(3**0.5)/2]: return [-1, 0] if direction == [-1, 0]: return [-1/2, (3**0.5)/2] if direction == [-1/2, (3**0.5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_turn(self):\n self.encR(12)", "def turn(self,new_direction):\n if new_direction[0] + self.direction[0] == 0 and new_direction[0] + self.direction[0] ==0:\n pass\n else:\n self.direction = new_direction", "def turn(self, clockwise, dummy=0):\t\t\t# CHECK\n\n\...
[ "0.6848858", "0.6625772", "0.65041816", "0.64499587", "0.6441863", "0.63920885", "0.63765675", "0.6371257", "0.6355006", "0.6349556", "0.63351834", "0.6311189", "0.62767184", "0.61768526", "0.61768526", "0.61289185", "0.6112631", "0.6059025", "0.60587907", "0.6038257", "0.602...
0.601216
22
turns direction left 60 degrees uses if statements rather than matrix multiplication to simplify
def left(direction): if direction == [1, 0]: return [1/2, (3**0.5)/2] if direction == [1/2, -(3**0.5)/2]: return [1, 0] if direction == [-1/2, -(3**0.5)/2]: return [1/2, -(3**0.5)/2] if direction == [-1, 0]: return [-1/2, -(3**0.5)/2] if direction == [-1/2, (3**0.5)/2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_left_turn(direction):\n if direction == \"W\":\n ret_val = \"S\"\n elif direction == \"S\":\n ret_val = \"E\"\n elif direction == \"E\":\n ret_val = \"N\"\n else: # going north\n ret_val = \"W\"\n\n return ret_val", "def turn...
[ "0.6486662", "0.6483721", "0.6449853", "0.6436889", "0.63778555", "0.6337758", "0.6283656", "0.6278885", "0.6222368", "0.6221971", "0.61949563", "0.61439836", "0.61297715", "0.61297715", "0.6126362", "0.6105987", "0.60998464", "0.6087581", "0.60697347", "0.6069656", "0.605554...
0.5957566
24
Fixture to handle mocking (get|set)_property calls.
def properties(mocker): _mock_get = mocker.patch("houdini_toolbox.pyfilter.operations.zdepth.get_property") _mock_set = mocker.patch("houdini_toolbox.pyfilter.operations.zdepth.set_property") class Properties: """Fake class for accessing and setting properties.""" @property def mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_serve_property(self):\n pass", "def property_mock(request, cls, prop_name, **kwargs):\n _patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)\n request.addfinalizer(_patch.stop)\n return _patch.start()", "def property_mock(request, cls, prop_name, **kwargs):\n _...
[ "0.682555", "0.6594345", "0.6594345", "0.6521666", "0.63312817", "0.63162", "0.62781936", "0.62605566", "0.6232873", "0.6157474", "0.6155763", "0.61453646", "0.61353296", "0.6095487", "0.60863405", "0.60652053", "0.6048009", "0.59799576", "0.596616", "0.59537596", "0.59519374...
0.6613951
1
Bernoulli Thompson Sampling with known mu
def thompson_sampling(T: int, mu, seed=None, prior_SF=None, **_kwargs): K_ = len(mu) S, F, theta = np.zeros((K_,)), np.zeros((K_,)), np.zeros((K_,)) if prior_SF is not None: S, F = prior_SF arms_selected = np.zeros((T,)).astype(int) rewards = np.zeros((T,)) with seeded(seed): ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sampleMuMH(theta, mu0, M0, M, mu=ss.beta.rvs(1, 1), burnin=0.2, nsample=5000, thin=2):\n N,J = np.shape(theta)\n alpha0 = mu0*M0 + np.finfo(np.float).eps\n beta0 = (1-mu0)*M0 + np.finfo(np.float).eps\n \n \n mu_s = np.zeros( (nsample, J) ) \n for ns in xrange(0, nsample):\n mu_p = n...
[ "0.6460429", "0.64083076", "0.63420165", "0.6136191", "0.60942674", "0.5989034", "0.5978687", "0.5964064", "0.5885022", "0.5873397", "0.5866612", "0.5863995", "0.5855663", "0.58550745", "0.58152723", "0.58111763", "0.58068925", "0.57900226", "0.5789864", "0.5747322", "0.57363...
0.5909752
8
Return `True` if permission is granted, `False` otherwise.
def has_object_permission(self, request, view, obj): if request.method in ['GET', 'OPTIONS', 'HEAD']: # Read only permissions return True perms = self.get_required_permissions(request.method, type(obj)) if (request.user and request.user.is_authenticat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_permission(self):\n return True", "def has_permission(self):\n return cualquier_permiso(self.request.user, self.get_permission_required())", "def has_permission(self):\n perms = self.get_permission_required()\n return self.request.user.has_perms(perms)", "def has_perm(self...
[ "0.8081346", "0.79419005", "0.78587437", "0.7683935", "0.7681298", "0.7573053", "0.75090665", "0.7479041", "0.74754316", "0.7443387", "0.7362152", "0.735261", "0.7349514", "0.7329637", "0.7323736", "0.7276617", "0.72595334", "0.7250541", "0.7250541", "0.71880335", "0.7161603"...
0.0
-1
Get the path the current model would generate.
def get_path(self, locs, rads): return ut.test(locs, rads, self.policy, self.params)[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_path(self) -> str:\n return pulumi.get(self, \"model_path\")", "def get_actual_model_path(self) -> str:\n return(self.actual_model_path)", "def get_path(self) -> str:\n return self.__path", "def get_path(self):\n\t\treturn self.path", "def model_path(self):\n name = '{}.{}...
[ "0.79298747", "0.77864033", "0.76482904", "0.75062823", "0.75038403", "0.74984956", "0.74984956", "0.7477103", "0.743195", "0.74111766", "0.73904663", "0.7388164", "0.7388164", "0.73792106", "0.73648983", "0.73063743", "0.73032606", "0.73032606", "0.7300979", "0.7286484", "0....
0.0
-1
Plot the training history.
def plot_history(self): y1 = [perf[0] for perf in self.performances] y2 = [perf[1] for perf in self.performances] plt.plot(y1) plt.plot(y2, label='Baseline') plt.legend() plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_history(H, epochs):\n plt.style.use(\"fivethirtyeight\")\n plt.figure()\n plt.plot(np.arange(0, epochs), H.history[\"loss\"], label=\"train_loss\")\n plt.plot(np.arange(0, epochs), H.history[\"val_loss\"], label=\"val_loss\")\n plt.plot(np.arange(0, epochs), H.history[\"accuracy\"], label=\...
[ "0.8200992", "0.8176185", "0.8134098", "0.8075329", "0.7930956", "0.77452356", "0.7737362", "0.7661693", "0.7608853", "0.7608766", "0.7580712", "0.7542242", "0.7532328", "0.75223947", "0.7521701", "0.7515105", "0.7512225", "0.75009835", "0.74985105", "0.74921346", "0.7473398"...
0.7579513
11
Renders the home page.
def home(): return render_template( 'index.html', title='Home Page', year=datetime.now().year, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\treturn render_template('home.html')", "def home():\n return render_template(\n 'home.html',\n title='Home Page',\n )", "def home():\r\n return render_template('home.html')", "def home():\r\n return render_template(\"home.html\")", "def home():\n\n return render_t...
[ "0.8605755", "0.8495015", "0.8452865", "0.84418297", "0.83532524", "0.83532524", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", ...
0.8061255
50
Renders the login page.
def login(): if 'logged_in' in session and session['logged_in']: return redirect(url_for('site.dashboard')) form = LoginForm(request.form) if request.method == 'POST': username = request.form['username'] password = request.form['password'] if username == 'jaqen' and password ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_page():\n\n return render_template(\"login_form.html\")", "def show_loginpage():\n\n return render_template(\"login_form.html\")", "def show_login_page():\n\n return render_template(\"login.html\")", "def login():\n\n return render_template(\"login.html\")", "def login():\n\n retur...
[ "0.8358303", "0.82976633", "0.82828414", "0.82412744", "0.8239806", "0.8237236", "0.8198511", "0.81950843", "0.81950843", "0.80125976", "0.79771775", "0.79739624", "0.7773802", "0.75894284", "0.7555354", "0.75532466", "0.7526734", "0.75126666", "0.75020015", "0.74935883", "0....
0.67282933
73
Renders the dashboard page.
def dashboard(): if 'logged_in' not in session or not session['logged_in']: return redirect(url_for('site.home')) response = requests.get("http://127.0.0.1:5000/books") books = json.loads(response.text) return render_template( 'dashboard.html', title='Dashboard', year=dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard():\n return render_template('dashboard.html', title=\"Dashboard\")", "def dashboard():\n return render_template('home/dashboard.html', title=\"Dashboard\")", "def dashboard():\n return render_template('home/dashboard.html', title=\"Dashboard\")", "def dashboard():\n return render_te...
[ "0.83014834", "0.82225573", "0.82225573", "0.82225573", "0.8102937", "0.77032244", "0.7610232", "0.75640774", "0.7492825", "0.74563956", "0.74384975", "0.74347705", "0.7413493", "0.7374931", "0.73496467", "0.7307833", "0.7268651", "0.7219054", "0.70892745", "0.70770955", "0.6...
0.6463537
30
Convert integer to formatted currency string.
def get_num_with_curr_sign(value): return "${:,}".format(int(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_string(self) -> str:\n return babel.numbers.format_currency(self, CURRENCY_FORMAT,\n locale=LOCALE)", "def convert(val):\n dollars = int(val)\n cents = int((val - dollars) * 100)\n return str(dollars) + \" dollars and \" + str(cents) + \" ...
[ "0.69932616", "0.68802476", "0.67461926", "0.67204356", "0.65336317", "0.6524572", "0.64908427", "0.64761287", "0.64316714", "0.64121187", "0.63525015", "0.6329068", "0.6222204", "0.62172514", "0.61443126", "0.611041", "0.6071909", "0.60443974", "0.60314846", "0.6013413", "0....
0.58160996
37
Convert yyyymmdd to mmddyyyy.
def ymd_to_mdy(value): if value is None: return "None" else: value = datetime.strptime(value, '%Y-%m-%d').date() return value.strftime("%m-%d-%Y")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_yyyymmdd(timestamp):\r\n s = str(timestamp)\r\n r = s[0:4] + s[5:7] + s[8:10]\r\n return r", "def convert_date(date):\n return datetime.datetime.strptime(str(date), '%Y-%m-%d').strftime('%m%y')", "def change_format(date):\n return (date % 10 ** 4).astype(str) + '-' + (date % ...
[ "0.7563101", "0.7231895", "0.7201727", "0.7025946", "0.70113474", "0.68986744", "0.6852594", "0.68066746", "0.67895013", "0.67895013", "0.67189246", "0.66813904", "0.6617057", "0.65119785", "0.648255", "0.6447974", "0.64251125", "0.64241683", "0.63981986", "0.63948333", "0.63...
0.6442044
16
Convert yyyymmdd to mm/dd/yyyy.
def ymd_to_mdy_slashes(value): if value is None: return "None" else: value = datetime.strptime(value, '%Y-%m-%d').date() value = value.strftime("%m/%d/%Y") return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dob_reformat(self):\n if self.dob and self.dob.count('/') == 2:\n dob = self.dob.split('/')\n for i in range(0, 2):\n if dob[i] in ('0', '00'):\n dob[i] = '01'\n self.dob = u\"%(day)s-%(month)s-%(year)s\" \\\n % {'y...
[ "0.70502734", "0.6999365", "0.6935961", "0.6922329", "0.6893476", "0.6890385", "0.682999", "0.67216784", "0.6712568", "0.67010087", "0.66818106", "0.6663674", "0.6663674", "0.66573685", "0.6634103", "0.6632582", "0.66264534", "0.6617095", "0.66063476", "0.65428376", "0.652387...
0.6237351
29
Convert yyyymmdd to Day, Month Date, Year.
def ymd_to_full_date(value, no_day=False): if value is None: return "None" # 12/31/2016. Why? # if isinstance(value, unicode): # TODO: Why? Remove. if value[2] == "/": # TODO: Hack. Improve. readable_date = str(value) readable_date = datetime.strptime( readable_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertDateinFormat(date) :\n\t\n\t#Dictionary of months abbreviation name with their respective numbers i.e. months_dict[Jan]=1, months_dict[Feb]=2 \n\tmonths_dict = {abbr: num for num,abbr in enumerate(calendar.month_abbr)}\n\t\n\t#Separating Days, Months and Years and storing it in a list date_list.\n\tda...
[ "0.74666893", "0.7084985", "0.69736356", "0.69583654", "0.68845916", "0.6796268", "0.6744777", "0.66371775", "0.66291", "0.66108185", "0.6568163", "0.64852154", "0.6454714", "0.6432776", "0.6432776", "0.63418466", "0.63308746", "0.6279841", "0.62564063", "0.623126", "0.622680...
0.61166906
29
Convert month to abbreviated AP style. Ex. January => Jan. May ==> May.
def convert_month_to_ap_style(month): if re.match(r"[jJ][aA]", month): month = "Jan." if re.match(r"[fF]", month): month = "Feb." if re.match(r"[mM][aA][rR]", month): month = "March" if re.match(r"[aA][pP]", month): month = "April" if re.match(r"[mM][aA][yY]", mon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_month(month):\n if valid_month(month) is True:\n if month == 1:\n return \"January\"\n elif month == 2:\n return \"February\"\n elif month == 3:\n return \"March\"\n elif month == 4:\n return \"April\"\n elif month == 5...
[ "0.68477064", "0.67259985", "0.66356015", "0.6587862", "0.6415397", "0.6361484", "0.63483596", "0.6305741", "0.62913734", "0.6168272", "0.6104495", "0.60875785", "0.59320277", "0.5901019", "0.58678496", "0.5860831", "0.5780912", "0.5774729", "0.5770796", "0.5769801", "0.57586...
0.8585635
0
Convert 0/1 to No/Yes.
def binary_to_english(bit): bit = int(bit) conversion_dict = { 0: "No", 1: "Yes"} english = conversion_dict[bit] return english
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yesno(val):\n if val:\n return 'yes'\n else:\n return 'no'", "def yesno(x):\n return \"Yes\" if x else \"No\"", "def to_boolean_know(data: bool):\n return 'Yes' if data else 'No'", "def yesno2bool(value):\n if not isinstance(value, basestring):\n raise Instrume...
[ "0.69545346", "0.6908754", "0.687389", "0.64638793", "0.6444902", "0.6265096", "0.61847943", "0.60974795", "0.6094261", "0.60692704", "0.60271215", "0.59857625", "0.59569085", "0.5882857", "0.58038753", "0.5787794", "0.57848823", "0.575301", "0.5709564", "0.56874305", "0.5676...
0.5552821
36